org.springframework.richclient.application.support
Class AbstractApplicationPage

Show UML class diagram
java.lang.Object
  extended by org.springframework.richclient.application.support.ApplicationServicesAccessor
      extended by org.springframework.richclient.factory.AbstractControlFactory
          extended by org.springframework.richclient.application.support.AbstractApplicationPage
All Implemented Interfaces:
ApplicationPage, ControlFactory
Direct Known Subclasses:
DefaultApplicationPage, DesktopApplicationPage, FlexDockApplicationPage, TabbedApplicationPage, VLDockingApplicationPage

public abstract class AbstractApplicationPage
extends AbstractControlFactory
implements ApplicationPage

Abstract "convenience" implementation of ApplicationPage.

Author:
Peter De Bruycker

Field Summary
 
Fields inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor
logger
 
Constructor Summary
AbstractApplicationPage()
           
AbstractApplicationPage(ApplicationWindow window, PageDescriptor pageDescriptor)
           
 
Method Summary
protected  void addPageComponent(PageComponent pageComponent)
          Adds the pageComponent to the components list while registering listeners and firing appropriate events.
 void addPageComponentListener(PageComponentListener listener)
           
 boolean close()
          Closes this ApplicationPage.
 boolean close(PageComponent pageComponent)
          Closes the given PageComponent.
 boolean closeAllEditors()
           
protected  PageComponent createPageComponent(PageComponentDescriptor descriptor)
          Creates a PageComponent for the given PageComponentDescriptor.
protected  PageComponentPane createPageComponentPane(PageComponent pageComponent)
           
protected abstract  void doAddPageComponent(PageComponent pageComponent)
          This method must add the given PageComponent in the ui.
protected abstract  void doRemovePageComponent(PageComponent pageComponent)
          This method must remove the given PageComponent from the ui.
protected  PageComponent findPageComponent(String viewDescriptorId)
           
protected  void fireClosed(PageComponent component)
           
protected  void fireFocusGained(PageComponent component)
           
protected  void fireFocusLost(PageComponent component)
           
protected  void fireOpened(PageComponent component)
           
 PageComponent getActiveComponent()
          Returns the active PageComponent, or null if none.
 ApplicationEventMulticaster getApplicationEventMulticaster()
           
 String getId()
           
 PageComponentPaneFactory getPageComponentPaneFactory()
           
 List<PageComponent> getPageComponents()
          Returns the list of PageComponents on this ApplicationPage.
protected  PageDescriptor getPageDescriptor()
           
<T extends View>
T
getView(String id)
          Returns the View with the given id.
protected  ViewDescriptor getViewDescriptor(String viewDescriptorId)
           
 ViewDescriptorRegistry getViewDescriptorRegistry()
           
 ApplicationWindow getWindow()
           
protected abstract  boolean giveFocusTo(PageComponent pageComponent)
          This method must transfer the focus to the given PageComponent.
 void openEditor(Object editorInput)
           
 void removePageComponentListener(PageComponentListener listener)
           
protected  void setActiveComponent()
          Sets the first PageComponent as the active one.
 void setActiveComponent(PageComponent pageComponent)
          Activates the given PageComponent.
 void setApplicationWindow(ApplicationWindow window)
           
 void setDescriptor(PageDescriptor descriptor)
           
 void setPageComponentPaneFactory(PageComponentPaneFactory pageComponentPaneFactory)
           
 void setViewDescriptorRegistry(ViewDescriptorRegistry viewDescriptorRegistry)
           
 View showView(String id)
          Shows the View with the given id.
 View showView(String id, Object input)
          Shows the View with the given id, and passes the input to the View, by calling View.setInput(Object).
protected  void updatePageComponentProperties(PageComponent pageComponent)
          Called when the PageComponent changes any of its properties (display name, caption, icon, ...).
 
Methods inherited from class org.springframework.richclient.factory.AbstractControlFactory
createControl, createControlIfNecessary, getControl, isControlCreated, isSingleton, setSingleton
 
Methods inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor
getActiveWindow, getApplication, getApplicationContext, getApplicationName, getApplicationServices, getCommandConfigurer, getComponentFactory, getConversionService, getIconSource, getImageSource, getMessage, getMessage, getMessage, getMessage, getMessages, getMessageSource, getObjectConfigurer, getService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.richclient.factory.ControlFactory
getControl
 

Constructor Detail

AbstractApplicationPage

public AbstractApplicationPage()

AbstractApplicationPage

public AbstractApplicationPage(ApplicationWindow window,
                               PageDescriptor pageDescriptor)
Method Detail

updatePageComponentProperties

protected void updatePageComponentProperties(PageComponent pageComponent)
Called when the PageComponent changes any of its properties (display name, caption, icon, ...).

This method should be overridden when these changes must be reflected in the ui.

Parameters:
pageComponent - the PageComponent that has changed

findPageComponent

protected PageComponent findPageComponent(String viewDescriptorId)

getView

public <T extends View> T getView(String id)
Description copied from interface: ApplicationPage
Returns the View with the given id. Returns null if no View with the given id is shown.

This method is "generified" to avoid extra casts when calling this method:

 ApplicationPage page = ...; // get a reference to the ApplicationPage
 InitialView initialView = page.getView("initialView");
 

Specified by:
getView in interface ApplicationPage
Parameters:
id - the id, cannot be null
Returns:
the View, or null

addPageComponentListener

public void addPageComponentListener(PageComponentListener listener)
Specified by:
addPageComponentListener in interface ApplicationPage

removePageComponentListener

public void removePageComponentListener(PageComponentListener listener)
Specified by:
removePageComponentListener in interface ApplicationPage

fireOpened

protected void fireOpened(PageComponent component)

fireFocusGained

protected void fireFocusGained(PageComponent component)

setActiveComponent

protected void setActiveComponent()
Sets the first PageComponent as the active one.


getViewDescriptor

protected ViewDescriptor getViewDescriptor(String viewDescriptorId)

getActiveComponent

public PageComponent getActiveComponent()
Returns the active PageComponent, or null if none.

Specified by:
getActiveComponent in interface ApplicationPage
Returns:
the active PageComponent

setActiveComponent

public void setActiveComponent(PageComponent pageComponent)
Activates the given PageComponent. Does nothing if it is already the active one.

Does nothing if this ApplicationPage doesn't contain the given PageComponent.

Specified by:
setActiveComponent in interface ApplicationPage
Parameters:
pageComponent - the PageComponent

fireFocusLost

protected void fireFocusLost(PageComponent component)

doAddPageComponent

protected abstract void doAddPageComponent(PageComponent pageComponent)
This method must add the given PageComponent in the ui.

Implementors may choose to add the PageComponent's control directly, or add the PageComponentPane's control.

Parameters:
pageComponent - the PageComponent to add

doRemovePageComponent

protected abstract void doRemovePageComponent(PageComponent pageComponent)
This method must remove the given PageComponent from the ui.

Parameters:
pageComponent - the PageComponent to remove

giveFocusTo

protected abstract boolean giveFocusTo(PageComponent pageComponent)
This method must transfer the focus to the given PageComponent. This could involve making an internal frame visible, selecting a tab in a tabbed pane, ...

Parameters:
pageComponent - the PageComponent
Returns:
true if the operation was successful, false otherwise

createPageComponentPane

protected PageComponentPane createPageComponentPane(PageComponent pageComponent)

fireClosed

protected void fireClosed(PageComponent component)

getId

public String getId()
Specified by:
getId in interface ApplicationPage

getWindow

public ApplicationWindow getWindow()
Specified by:
getWindow in interface ApplicationPage

close

public boolean close(PageComponent pageComponent)
Closes the given PageComponent. This method disposes the PageComponent, triggers all necessary events ("focus lost" and "closed"), and will activate another PageComponent (if there is one).

Returns false if this ApplicationPage doesn't contain the given PageComponent.

Specified by:
close in interface ApplicationPage
Parameters:
pageComponent - the PageComponent
Returns:
boolean true if pageComponent was successfully closed.

close

public boolean close()
Closes this ApplicationPage. This method calls close(PageComponent) for each open PageComponent.

Specified by:
close in interface ApplicationPage
Returns:
true if the operation was successful, false otherwise.

showView

public View showView(String id)
Description copied from interface: ApplicationPage
Shows the View with the given id.

If the View is already opened, the view will be reused.

NOTE: this is NOT the same as calling this.showView(id, null).

Specified by:
showView in interface ApplicationPage
Parameters:
id - the view id, cannot be empty
Returns:
the View that is shown

showView

public View showView(String id,
                     Object input)
Description copied from interface: ApplicationPage
Shows the View with the given id, and passes the input to the View, by calling View.setInput(Object).

If the View is already opened, the view will be reused.

Specified by:
showView in interface ApplicationPage
Parameters:
id - the view id, cannot be empty
input - the input, can be null
Returns:
the View that is shown

openEditor

public void openEditor(Object editorInput)
Specified by:
openEditor in interface ApplicationPage

closeAllEditors

public boolean closeAllEditors()
Specified by:
closeAllEditors in interface ApplicationPage

addPageComponent

protected void addPageComponent(PageComponent pageComponent)
Adds the pageComponent to the components list while registering listeners and firing appropriate events. (not yet setting the component as the active one)

Parameters:
pageComponent - the pageComponent to add.

createPageComponent

protected PageComponent createPageComponent(PageComponentDescriptor descriptor)
Creates a PageComponent for the given PageComponentDescriptor.

Parameters:
descriptor - the descriptor
Returns:
the created PageComponent

getPageComponents

public List<PageComponent> getPageComponents()
Description copied from interface: ApplicationPage
Returns the list of PageComponents on this ApplicationPage.

Specified by:
getPageComponents in interface ApplicationPage
Returns:
the page components

setApplicationWindow

public final void setApplicationWindow(ApplicationWindow window)

setDescriptor

public final void setDescriptor(PageDescriptor descriptor)

getPageDescriptor

protected PageDescriptor getPageDescriptor()

getApplicationEventMulticaster

public ApplicationEventMulticaster getApplicationEventMulticaster()

setViewDescriptorRegistry

public void setViewDescriptorRegistry(ViewDescriptorRegistry viewDescriptorRegistry)

getViewDescriptorRegistry

public ViewDescriptorRegistry getViewDescriptorRegistry()

setPageComponentPaneFactory

public void setPageComponentPaneFactory(PageComponentPaneFactory pageComponentPaneFactory)

getPageComponentPaneFactory

public PageComponentPaneFactory getPageComponentPaneFactory()


Copyright © 2004-2009 The Spring Framework. All Rights Reserved.