org.openbp.jaspira.gui.plugin
Class JaspiraPage

java.lang.Object
  extended by org.openbp.jaspira.plugin.AbstractPlugin
      extended by org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
          extended by org.openbp.jaspira.gui.plugin.JaspiraPage
All Implemented Interfaces:
java.awt.event.HierarchyListener, java.util.EventListener, PluginContainer, VisiblePlugin, Plugin
Direct Known Subclasses:
ModelerPage, NodeItemEditorPage

public abstract class JaspiraPage
extends AbstractVisiblePlugin
implements PluginContainer

A page in a application. A page will be displayed in a JaspiraPageContainer which may contain one or more pages.

Author:
Jens Ferchland

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
AbstractVisiblePlugin.StandardVisiblePluginEvents
 
Nested classes/interfaces inherited from class org.openbp.jaspira.plugin.AbstractPlugin
AbstractPlugin.StandardPluginEvents
 
Field Summary
protected  java.lang.ref.WeakReference focusedPluginRef
          Used to store the plugin that had the focus last (for setFocusedPlugin(org.openbp.jaspira.gui.plugin.VisiblePlugin)/restoreFocus()).
 
Fields inherited from class org.openbp.jaspira.plugin.AbstractPlugin
PROPERTY_CONDITION, PROPERTY_DESCRIPTION, PROPERTY_ICON, PROPERTY_NAME, PROPERTY_SEQUENCE, PROPERTY_TITLE, PROPERTY_VENDOR, PROPERTY_VERSION
 
Fields inherited from interface org.openbp.jaspira.gui.plugin.PluginContainer
CENTER, EAST, NORTH, REGION_CENTER, REGION_EAST, REGION_NORTH, REGION_SOUTH, REGION_WEST, SOUTH, WEST
 
Fields inherited from interface org.openbp.jaspira.gui.plugin.VisiblePlugin
GER, GEU, SIZE_VARIABLE_BOTH, SIZE_VARIABLE_HEIGHT, SIZE_VARIABLE_NONE, SIZE_VARIABLE_WIDTH, TOOLBAR_DYNAMIC, TOOLBAR_EVENTS, TOOLBAR_NONE
 
Fields inherited from interface org.openbp.jaspira.plugin.Plugin
ID_DELIMETER, LEVEL_APPLICATION, LEVEL_FRAME, LEVEL_PAGE, LEVEL_PLUGIN
 
Constructor Summary
JaspiraPage()
          Creates a new Jaspira page.
 
Method Summary
 void addPlugin(VisiblePlugin p)
          Adds a plugin to the container.
 void advanceFocus(boolean forward, boolean visibleOnly)
          Advances the focus of this page.
 VisiblePlugin getActivePlugin()
          Returns the currently active plugin inside this container.
 PluginContainer getParentContainer()
          A page has no plugin container, so this returns null.
 PluginDivider getPluginDivider()
          Returns the divider of the page.
 java.awt.Component getPluginFocusComponent()
          Returns the focus component of this plugin, i\.e\. the component that is to initially receive the focus.
 java.util.List getPlugins()
          Returns all plugins hosted by this container and its sub containers.
 java.util.List getVisiblePlugins()
          Returns all plugins that are currently visible, i\.e\. shown in their tabbed containers.
 java.awt.Window getWindow()
          Returns the JaspiraPageContainer of this page or null.
protected  void initializeComponents()
          This template method is called after internal Components (i\.e\. title bar etc\.)
 void layoutDefaultContent()
          This method will be called to generate the default layout of a Jaspira page.
protected  void pluginUninstalled()
          This template method is called before the plugin is uninstalled.
 void removePlugin(VisiblePlugin p)
          Removes a plugin from this container.
 void restoreFocus()
          Restores the focus of this page.
 void setFocusedPlugin(VisiblePlugin plugin)
          Stores the given plugin as last focused component of this page.
 void setPluginDivider(PluginDivider divider)
          Set the divider of the page.
protected  void setupKeyBindings()
          Sets up the key bindings of the page.
 void showPlugin(boolean changePage)
          Brings the plugin to the front, but does not request the focus.
 void sliceContainer(PluginContainer toInsert, PluginContainer currentContainer, java.lang.String constraint)
          Slices the component at the given edge, i\.e\. replaces the entry with a new PluginDivider consisting of the old component and the new container.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
addPluginFocusListener, applicationReady, canCopy, canCut, canDelete, canDrag, canPageChange, canPaste, copy, createToolbar, cut, delete, firePluginFocusGained, firePluginFocusLost, focusPlugin, getContentPane, getPage, getPluginComponent, getPluginFromComponentHierarchy, getPluginHolder, getPluginPanel, getSizeBehavior, getSubClients, getToolbarType, hasCloseButton, hierarchyChanged, initializeResources, installPlugin, installPluginContent, isPluginFocused, isPluginVisible, paste, pluginHidden, pluginShown, postPluginContainerUpdate, removePluginFocusListener, setPluginHolder, stackEvent, uninstallPlugin, updatePluginContainer
 
Methods inherited from class org.openbp.jaspira.plugin.AbstractPlugin
addActionKeySequence, addPlugin, addToPeerGroup, canClose, closeCanceled, containsStackedEvent, fireEvent, fireEvent, fireEvent, getAction, getChildPlugins, getClassName, getCondition, getDescendantPlugins, getDescription, getEventActionNames, getEventModules, getExternalActions, getExternalEventModuleClasses, getExternalOptionModuleClasses, getIcon, getIcon, getLevel, getName, getOptionModules, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getPluginState, getResourceCollectionContainerName, getSubTitle, getTitle, getUniqueId, getVendor, getVersion, handleEvent, handleKeySequence, inheritEvent, initializeFromPluginProfile, initializePlugin, installFirstPlugin, matchesPeerGroup, matchesPeerGroups, passDown, pluginInstalled, preClose, receiveEvent, removeFromPeerGroup, removePlugin, removeStackedEvent, requestClose, setDescription, setIcon, setName, setParentPlugin, setPluginState, setResourceCollection, setTitle, uninstallLastPlugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openbp.jaspira.gui.plugin.PluginContainer
getPage
 
Methods inherited from interface org.openbp.jaspira.plugin.Plugin
addPlugin, addToPeerGroup, canClose, containsStackedEvent, fireEvent, fireEvent, fireEvent, getAction, getChildPlugins, getClassName, getCondition, getDescendantPlugins, getDescription, getEventActionNames, getIcon, getLevel, getName, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getPluginState, getSubTitle, getTitle, getUniqueId, getVendor, getVersion, handleEvent, inheritEvent, initializePlugin, installFirstPlugin, matchesPeerGroup, matchesPeerGroups, receiveEvent, removeFromPeerGroup, removePlugin, requestClose, setParentPlugin, setPluginState, uninstallLastPlugin
 

Field Detail

focusedPluginRef

protected java.lang.ref.WeakReference focusedPluginRef
Used to store the plugin that had the focus last (for setFocusedPlugin(org.openbp.jaspira.gui.plugin.VisiblePlugin)/restoreFocus()). This is a temporary variable only, so we use weak references here in order to prevent memory leaks.

Constructor Detail

JaspiraPage

public JaspiraPage()
Creates a new Jaspira page.

Method Detail

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class AbstractPlugin
Returns:
tile (uniqueId) [child plugins, ...]

initializeComponents

protected void initializeComponents()
Description copied from class: AbstractVisiblePlugin
This template method is called after internal Components (i\.e\. title bar etc\.) have been initialized. It shoud be used to initialize plugin specific components.

Specified by:
initializeComponents in class AbstractVisiblePlugin

pluginUninstalled

protected void pluginUninstalled()
Description copied from class: AbstractPlugin
This template method is called before the plugin is uninstalled.

Overrides:
pluginUninstalled in class AbstractPlugin

layoutDefaultContent

public void layoutDefaultContent()
This method will be called to generate the default layout of a Jaspira page. The normal JaspiraPage has no default layout so this method does nothing. If you create a new page which has to look special override this method and set your layout here. This method will be called automatically - you needn't to call it of your own.


setPluginDivider

public void setPluginDivider(PluginDivider divider)
Set the divider of the page.

Parameters:
divider - Divider to set

getPluginDivider

public PluginDivider getPluginDivider()
Returns the divider of the page.


getWindow

public java.awt.Window getWindow()
Returns the JaspiraPageContainer of this page or null.


addPlugin

public void addPlugin(VisiblePlugin p)
Description copied from interface: PluginContainer
Adds a plugin to the container.

Specified by:
addPlugin in interface PluginContainer
Parameters:
p - Plugin to add

removePlugin

public void removePlugin(VisiblePlugin p)
Description copied from interface: PluginContainer
Removes a plugin from this container.

Specified by:
removePlugin in interface PluginContainer
Parameters:
p - Plugin to remove

getPlugins

public java.util.List getPlugins()
Description copied from interface: PluginContainer
Returns all plugins hosted by this container and its sub containers.

Specified by:
getPlugins in interface PluginContainer
Returns:
A list of VisiblePlugin objects or null

getVisiblePlugins

public java.util.List getVisiblePlugins()
Description copied from interface: PluginContainer
Returns all plugins that are currently visible, i\.e\. shown in their tabbed containers. This assumes that the container itself is visible.

Specified by:
getVisiblePlugins in interface PluginContainer
Returns:
A list of VisiblePlugin objects or null

getActivePlugin

public VisiblePlugin getActivePlugin()
Description copied from interface: PluginContainer
Returns the currently active plugin inside this container.

Specified by:
getActivePlugin in interface PluginContainer
Returns:
The plugin or null if the container does not contain a plugin

getParentContainer

public PluginContainer getParentContainer()
A page has no plugin container, so this returns null.

Specified by:
getParentContainer in interface PluginContainer
Returns:
The parent container or null

showPlugin

public void showPlugin(boolean changePage)
Description copied from class: AbstractVisiblePlugin
Brings the plugin to the front, but does not request the focus.

Specified by:
showPlugin in interface VisiblePlugin
Overrides:
showPlugin in class AbstractVisiblePlugin
Parameters:
changePage - true Shows the JaspiraPage this holder belongs to if it not the active page.
false Do not flip pages.

sliceContainer

public void sliceContainer(PluginContainer toInsert,
                           PluginContainer currentContainer,
                           java.lang.String constraint)
Description copied from interface: PluginContainer
Slices the component at the given edge, i\.e\. replaces the entry with a new PluginDivider consisting of the old component and the new container.

Specified by:
sliceContainer in interface PluginContainer
Parameters:
toInsert - Containert to insert
currentContainer - Currrent container that shall be replaced
constraint - The constraint determines where to place the new container:
PluginContainer.CENTER/PluginContainer.NORTH/PluginContainer.SOUTH/PluginContainer.EAST/PluginContainer.WEST

getPluginFocusComponent

public java.awt.Component getPluginFocusComponent()
Returns the focus component of this plugin, i\.e\. the component that is to initially receive the focus.

Specified by:
getPluginFocusComponent in interface VisiblePlugin
Overrides:
getPluginFocusComponent in class AbstractVisiblePlugin
Returns:
The return value defaults to the first component below the content pane of the plugin. If this component is a scroll pane, the method returns the view component of the pane. If there is no focusable component, the method returns null.

setFocusedPlugin

public void setFocusedPlugin(VisiblePlugin plugin)
Stores the given plugin as last focused component of this page.

Parameters:
plugin - The focused plugin

restoreFocus

public void restoreFocus()
Restores the focus of this page. Sets the focus to the plugin that had the focus so far or simply tries to determine the component that follows the page component in the focus order.


advanceFocus

public void advanceFocus(boolean forward,
                         boolean visibleOnly)
Advances the focus of this page.

Parameters:
forward - true Moves the focus to the next plugin.
false Moves the focus to the previous plugin.
visibleOnly - true Considers currently visible plugins only.
false Considers also plugins that are currently hidden (i. e. non-active tabs in tabbed plugin containers)

setupKeyBindings

protected void setupKeyBindings()
Sets up the key bindings of the page. Maps CTRL+TAB/SHIFT+CTRL+TAB to cycle the plugins of this page.



Copyright © 2011. All Rights Reserved.