org.openbp.jaspira.plugins.propertybrowser
Class PropertyBrowserPlugin

java.lang.Object
  extended by org.openbp.jaspira.plugin.AbstractPlugin
      extended by org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
          extended by org.openbp.jaspira.plugins.propertybrowser.PropertyBrowserPlugin
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.HierarchyListener, java.util.EventListener, VisiblePlugin, Plugin, ObjectChangeListener, PropertyBrowserListener, SaveStrategy

public class PropertyBrowserPlugin
extends AbstractVisiblePlugin
implements ObjectChangeListener, SaveStrategy, PropertyBrowserListener, java.awt.event.FocusListener

Property browser plugin. The oe plugin can be used to display arbitrary objects.
There can be multiple oe plugin instances in an application. However, there should be only one oe plugin instance per view. The outside world communicates with the plugin using the property browser events (see the event module). When the oe is instructed to display an object (using the plugin.propertybrowser.setobject event), it will provide information on this object in a custom plugin state object (PropertyBrowserPluginState). If the oe is currently visible, the object will be displayed and the state (newState member) will be cleared. If not, this will happen when the oe is being activated.
This construct has been introduced to prevent the oe from consuming system performance when it is not even visible. The property browser provides to edit properties of any object.

Author:
Andreas Putz

Nested Class Summary
 class PropertyBrowserPlugin.Events
          Event module.
 class PropertyBrowserPlugin.InteractionEvents
          Interaction module.
 class PropertyBrowserPlugin.SaveEvents
          Event module that manages the save operation.
 
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
 
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.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
PropertyBrowserPlugin()
          Constructor.
 
Method Summary
protected  boolean canPageChange(JaspiraPage oldPage, JaspiraPage newPage)
          This method is called before a page change takes place.
 boolean executeSave(PropertyBrowser editor)
          Executes the save procedure for the current item of the specified property browser.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 java.lang.Object getCurrentObject()
          Gets the current object.
 java.lang.String getDescription()
          Gets the description.
protected  java.util.Collection getExternalActions()
          Returns a collection of the external actions of this plugin.
 MultiIcon getIcon()
          Gets the icon.
 PluginState getPluginState()
          Returns the state of this plugin.
 java.lang.String getResourceCollectionContainerName()
          Gets the name of the resource component the default resource of the plugin belongs to.
 java.lang.String getSubTitle()
          Returns the sub title of this plugin.
 java.lang.String getTitle()
          Gets the title.
 int getToolbarType()
          Gets the type of the plugin toolbar.
 void handlePropertyBrowserEvent(PropertyBrowserEvent e)
          Handles an edit event.
 boolean hasCloseButton()
          Returns true if the plugin should have a close button in its title bar.
protected  void initializeComponents()
          This template method is called after internal Components (i\.e\. title bar etc\.)
 void initializePlugin()
          Initializes the plugin.
 void objectChanged(java.lang.Object original, java.lang.Object modified)
          Is performed if the object was changed.
 void setPluginState(PluginState state)
          Rebuilds the state of the plugin using the given state object.
 
Methods inherited from class org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
addPluginFocusListener, applicationReady, canCopy, canCut, canDelete, canDrag, canPaste, copy, createToolbar, cut, delete, firePluginFocusGained, firePluginFocusLost, focusPlugin, getContentPane, getPage, getPluginComponent, getPluginFocusComponent, getPluginFromComponentHierarchy, getPluginHolder, getPluginPanel, getSizeBehavior, getSubClients, hierarchyChanged, initializeResources, installPlugin, installPluginContent, isPluginFocused, isPluginVisible, paste, pluginHidden, pluginShown, postPluginContainerUpdate, removePluginFocusListener, setPluginHolder, showPlugin, 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, getEventActionNames, getEventModules, getExternalEventModuleClasses, getExternalOptionModuleClasses, getIcon, getLevel, getName, getOptionModules, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getUniqueId, getVendor, getVersion, handleEvent, handleKeySequence, inheritEvent, initializeFromPluginProfile, installFirstPlugin, matchesPeerGroup, matchesPeerGroups, passDown, pluginInstalled, pluginUninstalled, preClose, receiveEvent, removeFromPeerGroup, removePlugin, removeStackedEvent, requestClose, setDescription, setIcon, setName, setParentPlugin, setResourceCollection, setTitle, toString, 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.plugin.Plugin
addPlugin, addToPeerGroup, canClose, containsStackedEvent, fireEvent, fireEvent, fireEvent, getAction, getChildPlugins, getClassName, getCondition, getDescendantPlugins, getEventActionNames, getLevel, getName, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getUniqueId, getVendor, getVersion, handleEvent, inheritEvent, installFirstPlugin, matchesPeerGroup, matchesPeerGroups, receiveEvent, removeFromPeerGroup, removePlugin, requestClose, setParentPlugin, uninstallLastPlugin
 

Constructor Detail

PropertyBrowserPlugin

public PropertyBrowserPlugin()
Constructor.

Method Detail

getResourceCollectionContainerName

public java.lang.String getResourceCollectionContainerName()
Description copied from class: AbstractPlugin
Gets the name of the resource component the default resource of the plugin belongs to.

Specified by:
getResourceCollectionContainerName in class AbstractPlugin
Returns:
The container name

initializePlugin

public void initializePlugin()
Description copied from class: AbstractPlugin
Initializes the plugin. Should only be called by the plugin manager.

Specified by:
initializePlugin in interface Plugin
Overrides:
initializePlugin in class AbstractPlugin

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

getExternalActions

protected java.util.Collection getExternalActions()
Description copied from class: AbstractPlugin
Returns a collection of the external actions of this plugin. Override this method to customize the plugin.

Overrides:
getExternalActions in class AbstractPlugin
Returns:
A collection of JaspiraAction objects or null

hasCloseButton

public boolean hasCloseButton()
Description copied from class: AbstractVisiblePlugin
Returns true if the plugin should have a close button in its title bar. Override this method to customize the plugin.

Specified by:
hasCloseButton in interface VisiblePlugin
Overrides:
hasCloseButton in class AbstractVisiblePlugin

getToolbarType

public int getToolbarType()
Description copied from class: AbstractVisiblePlugin
Gets the type of the plugin toolbar. This will determine how the toolbar of the plugin will be constructed.

Specified by:
getToolbarType in interface VisiblePlugin
Overrides:
getToolbarType in class AbstractVisiblePlugin
Returns:
VisiblePlugin.TOOLBAR_NONE/VisiblePlugin.TOOLBAR_EVENTS/VisiblePlugin.TOOLBAR_DYNAMIC
Default: TOOLBAR_EVENTS
See Also:
AbstractVisiblePlugin.getToolbarType()

getSubTitle

public java.lang.String getSubTitle()
Returns the sub title of this plugin. In the title bar, we also display the object type and name. The sub title should stay constant.

Specified by:
getSubTitle in interface Plugin
Overrides:
getSubTitle in class AbstractPlugin

canPageChange

protected boolean canPageChange(JaspiraPage oldPage,
                                JaspiraPage newPage)
This method is called before a page change takes place. It allows the plugin to veto the change by returning false. Override this to check for veto conditions.

Overrides:
canPageChange in class AbstractVisiblePlugin
Parameters:
oldPage - Current page
newPage - Page that should be made the new current page
Returns:
true If the plugin accepts the page change
false Otherwise

getPluginState

public PluginState getPluginState()
Description copied from class: AbstractPlugin
Returns the state of this plugin.

Specified by:
getPluginState in interface Plugin
Overrides:
getPluginState in class AbstractPlugin

setPluginState

public void setPluginState(PluginState state)
Description copied from class: AbstractPlugin
Rebuilds the state of the plugin using the given state object.

Specified by:
setPluginState in interface Plugin
Overrides:
setPluginState in class AbstractPlugin

getCurrentObject

public java.lang.Object getCurrentObject()
Gets the current object.

Returns:
Either the object that has been set in the new state object, but has not been applied or the current object of the editor.
Note that always the original object will be returned, regardless if it has been modified or not.

executeSave

public boolean executeSave(PropertyBrowser editor)
Executes the save procedure for the current item of the specified property browser.

Specified by:
executeSave in interface SaveStrategy
Parameters:
editor - The property browser
Returns:
true If object was saved successfully.
false There were errors during the save operations or the user choosed to cancel the save operation. The implementor of the strategy should issue an error message if appropriate.

objectChanged

public void objectChanged(java.lang.Object original,
                          java.lang.Object modified)
Is performed if the object was changed.

Specified by:
objectChanged in interface ObjectChangeListener
Parameters:
original - The object without any changes
modified - The modified object

handlePropertyBrowserEvent

public void handlePropertyBrowserEvent(PropertyBrowserEvent e)
Description copied from interface: PropertyBrowserListener
Handles an edit event.

Specified by:
handlePropertyBrowserEvent in interface PropertyBrowserListener
Parameters:
e - Event

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

getTitle

public java.lang.String getTitle()
Description copied from class: AbstractPlugin
Gets the title.

Specified by:
getTitle in interface Plugin
Overrides:
getTitle in class AbstractPlugin

getDescription

public java.lang.String getDescription()
Description copied from class: AbstractPlugin
Gets the description.

Specified by:
getDescription in interface Plugin
Overrides:
getDescription in class AbstractPlugin

getIcon

public MultiIcon getIcon()
Description copied from class: AbstractPlugin
Gets the icon.

Specified by:
getIcon in interface Plugin
Overrides:
getIcon in class AbstractPlugin


Copyright © 2011. All Rights Reserved.