Results 1 to 7 of 7

Thread: How to open the same View multiple times

  1. #1
    Join Date
    Apr 2009
    Posts
    25

    Default How to open the same View multiple times

    Hi
    I have in my richclient-application-context.xml
    Code:
    <property name="applicationPageFactory" >
    <bean class="org.springframework.richclient.application.mdi.DesktopApplicationPageFactory" scope="prototype"/>
        </property>
    I would like to be able to open the same View multiple times
    Example
    Code:
    <bean id="reportView" class="org.springframework.richclient.application.docking.vldocking.VLDockingViewDescriptor">
        	<property name="viewClass" value="com.ReportView" />
        </bean>
    Thanks for your help

  2. #2
    Join Date
    Oct 2008
    Posts
    136

    Default

    I am just learning myself, but this is a good tutorial that might get you to where you want to go:

    http://java.dzone.com/news/spring-rcp-tutorial

    I think in the plugin/samples/tutorial, there is a step where you wind up with multiple instances of the same 'view', or at least come close to that.

    Terminology is kind of confusing though as I innately always think of the same 'view' as a view instance, so the same 'view' would be the same instance - if that makes sense.

  3. #3
    Join Date
    Apr 2009
    Posts
    25

    Default multiple instance of the same view

    The link is fine but does not fit the pb I have
    I want to be able to open multiple instances of a view.
    REgards

  4. #4

    Default

    Try creating a VLDockingViewDescriptor programatically.

  5. #5
    Join Date
    Apr 2009
    Posts
    25

    Default not using vldocking, using frame method

    I do not want to use Docking
    I'm using Frame method
    Regards

  6. #6
    Join Date
    Jan 2008
    Location
    Toulouse, France
    Posts
    23

    Default

    Hi,
    There is always only one instance of a view. If you want to have multiple instance of the same PageComponent, have a look at the Editor concept. That might fit your needs.
    Regards

  7. #7
    Join Date
    Apr 2009
    Posts
    25

    Default

    I found a solution
    I rewrite the code bellow
    Code:
    package org.springframework.richclient.application.support;
    
    import java.util.Set;
    
    import javax.swing.JComponent;
    
    import org.springframework.context.event.ApplicationEventMulticaster;
    import org.springframework.richclient.application.ApplicationWindow;
    import org.springframework.richclient.application.PageComponent;
    import org.springframework.richclient.application.PageComponentDescriptor;
    import org.springframework.richclient.application.PageComponentListener;
    import org.springframework.richclient.application.PageComponentPane;
    import org.springframework.richclient.application.PageDescriptor;
    import org.springframework.richclient.application.ViewDescriptor;
    
    public class MultiplePageApplicationPage extends AbstractApplicationPage {
    	
    	private AbstractApplicationPage applicationPage;
    	
    	
    
    	public MultiplePageApplicationPage(AbstractApplicationPage applicationPage) {
    		super();
    		this.applicationPage = applicationPage;
    	}
    
    	public void addPageComponentListener(PageComponentListener pagecomponentlistener) {
    		this.applicationPage.addPageComponentListener(pagecomponentlistener);
    		
    	}
    
    	public boolean close() {
    		return this.applicationPage.close();
    	}
    
    	public boolean close(PageComponent pagecomponent) {
    		return this.applicationPage.close(pagecomponent);
    	}
    
    	public boolean closeAllEditors() {
    		// TODO Auto-generated method stub
    		return this.applicationPage.closeAllEditors();
    	}
    
    	public PageComponent getActiveComponent() {
    		// TODO Auto-generated method stub
    		return this.applicationPage.getActiveComponent();
    	}
    
    	public String getId() {
    		return this.applicationPage.getId();
    	}
    
    	public ApplicationWindow getWindow() {
    		
    		return this.applicationPage.getWindow();
    	}
    
    	public void openEditor(Object obj) {
    		this.applicationPage.openEditor(obj);
    		
    	}
    
    	public void removePageComponentListener(PageComponentListener pagecomponentlistener) {
    		this.applicationPage.removePageComponentListener(pagecomponentlistener);
    		
    	}
    
    	public void setActiveComponent(PageComponent pagecomponent) {
    		this.applicationPage.setActiveComponent(pagecomponent);
    		
    	}
    
    	public void showView(String s) {
    		this.applicationPage.showView(s);
    		
    	}
    
    	public void showView(ViewDescriptor viewDescriptor) {
    		PageComponent component = this.applicationPage.findPageComponent(viewDescriptor.getId());
    		component = this.applicationPage.createPageComponent(viewDescriptor);
    		this.applicationPage.addPageComponent(component);
    		this.applicationPage.setActiveComponent(component);
    	}
    
    	protected void addPageComponent(PageComponent pageComponent) {
    		this.applicationPage.addPageComponent(pageComponent);
    	}
    
    	protected PageComponent createPageComponent(PageComponentDescriptor descriptor) {
    		return this.applicationPage.createPageComponent(descriptor);
    		
    	}
    
    	protected PageComponentPane createPageComponentPane(PageComponent pageComponent) {
    		// TODO Auto-generated method stub
    		return this.applicationPage.createPageComponentPane(pageComponent);
    	}
    
    	protected void doAddPageComponent(PageComponent pagecomponent) {
    		this.applicationPage.doAddPageComponent(pagecomponent);
    		
    	}
    
    	protected void doRemovePageComponent(PageComponent pagecomponent) {
    		this.applicationPage.doRemovePageComponent(pagecomponent);
    		
    	}
    
    	protected PageComponent findPageComponent(String viewDescriptorId) {
    		// TODO Auto-generated method stub
    		return this.applicationPage.findPageComponent(viewDescriptorId);
    	}
    
    	protected void fireClosed(PageComponent component) {
    		// TODO Auto-generated method stub
    		this.applicationPage.fireClosed(component);
    	}
    
    	protected void fireFocusGained(PageComponent component) {
    		// TODO Auto-generated method stub
    		this.applicationPage.fireFocusGained(component);
    	}
    
    	protected void fireFocusLost(PageComponent component) {
    		// TODO Auto-generated method stub
    		this.applicationPage.fireFocusLost(component);
    	}
    
    	protected void fireOpened(PageComponent component) {
    		// TODO Auto-generated method stub
    		this.applicationPage.fireOpened(component);
    	}
    
    	public ApplicationEventMulticaster getApplicationEventMulticaster() {
    		// TODO Auto-generated method stub
    		return this.applicationPage.getApplicationEventMulticaster();
    	}
    
    	public Set getPageComponents() {
    		// TODO Auto-generated method stub
    		return this.applicationPage.getPageComponents();
    	}
    
    	protected PageDescriptor getPageDescriptor() {
    		// TODO Auto-generated method stub
    		return this.applicationPage.getPageDescriptor();
    	}
    
    	protected ViewDescriptor getViewDescriptor(String viewDescriptorId) {
    		// TODO Auto-generated method stub
    		return this.applicationPage.getViewDescriptor(viewDescriptorId);
    	}
    
    	protected boolean giveFocusTo(PageComponent pagecomponent) {
    		// TODO Auto-generated method stub
    		return false;
    	}
    
    	protected void setActiveComponent() {
    		// TODO Auto-generated method stub
    		this.applicationPage.setActiveComponent();
    	}
    
    	protected void updatePageComponentProperties(PageComponent pagecomponent) {
    		// TODO Auto-generated method stub
    		this.applicationPage.updatePageComponentProperties(pagecomponent);
    	}
    
    	protected JComponent createControl() {
    		return this.applicationPage.getControl();
    	}
    
    }
    Then I use
    Code:
    MultiplePageApplicationPage newPage = new MultiplePageApplicationPage((AbstractApplicationPage)getApplicationWindow().getPage());
        	newPage.showView(defaultViewDesc);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •