org.openbp.cockpit.plugins.itembrowser
Class ItemBrowserPlugin

java.lang.Object
  extended by org.openbp.jaspira.plugin.AbstractPlugin
      extended by org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
          extended by org.openbp.cockpit.plugins.itembrowser.ItemBrowserPlugin
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.HierarchyListener, java.util.EventListener, EventObserver, ItemTreeListener, DragOrigin, VisiblePlugin, Plugin
Direct Known Subclasses:
NodeEditorItemBrowserPlugin

public class ItemBrowserPlugin
extends AbstractVisiblePlugin
implements EventObserver, DragOrigin, ItemTreeListener, java.awt.event.FocusListener

The item browser displays the models of the system and their items in a tree structure. It supports dragging an item (e. g. onto the workspace).
The items can be filtered by the installed item filters (currently item type and item text filter). The filter components (used to adjust the filters) are shown in a panel above the tree and can be turned on and off using the item filter buttons in the plugin's toolbar.

Author:
Jens Ferchland

Nested Class Summary
 class ItemBrowserPlugin.InteractionEvents
          Interaction module.
 class ItemBrowserPlugin.ItemBrowserOptions
          Option module containing all core Modeler options.
 
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
static int GUESS_MODEL
          Flag for getSelectedModel: Guess model from selected item
static int USE_CURRENT_MODEL
          Flag for getSelectedModel: Use model of current process if none selected in the item browser
 
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
ItemBrowserPlugin()
           
 
Method Summary
 void applicationReady()
          Called after the application has been initialized AND the plugin initialization is finished.
 boolean canCopy()
          Checks if the plugin can copy the selected data to the clipboard.
 boolean canCut()
          Checks if the plugin can cut the selected data to the clipboard.
 boolean canDrag()
          Checks if the plugin can be dragged.
 boolean canPaste(java.awt.datatransfer.Transferable transferable)
          Checks if the plugin can paste the data of the given transferable object.
 java.awt.datatransfer.Transferable copy()
          Copies the selected data from the plugin to the clipboard.
 JaspiraToolbar createToolbar()
          Creates the toolbar of this plugin.
 java.awt.datatransfer.Transferable cut()
          Cuts the selected data from the plugin to the clipboard.
 void dropAccepted(java.awt.datatransfer.Transferable t)
          Called when the drag has been accepted by a InteractionClient, but before it is actually imported.
 void dropCanceled(java.awt.datatransfer.Transferable t)
          Called when the drag action has been aborted, either by dropping upon a non- qualifying target or because the target reported an unsuccessful drop.
 void dropPerformed(java.awt.datatransfer.Transferable t)
          Called when the drop has been performed and the object has been inserted.
protected  void firePropertyBrowserEvent(Item item)
          Creates an property browser event which will send to the property browser later.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 MultiIcon getDragImage()
          Gets the image for the construction of the drag cursor.
protected  java.lang.Class[] getExternalEventModuleClasses()
          Returns the list of external event module classes.
 java.awt.Component getPluginFocusComponent()
          Returns the focus component of this plugin, i\.e\. the component that is to initially receive the focus.
 java.lang.String getResourceCollectionContainerName()
          Gets the name of the resource component the default resource of the plugin belongs to.
 Item getSelectedItem()
          Gets the selected item.
 Model getSelectedModel(int flag)
          Gets the selected model.
 java.lang.String[] getSupportedItemTypes()
          Gets the item types supported by this browser (null for the standard item types).
 java.awt.datatransfer.Transferable getTranferableAt(java.awt.Point p)
          Returns the Transferable for a drag Operation starting at .
 void handleItemTreeEvent(ItemTreeEvent e)
          Called when an item tree event has happened.
 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 observeEvent(ObserverEvent event)
           
 void paste(java.awt.datatransfer.Transferable content)
          Pastes the given data into the plugin.
 void performAlternativeSelection()
          Selects the element that should be selected if the currently selected element is deleted.
protected  void pluginUninstalled()
          Called before the plugin is uninstalled.
protected  void rebuildTree()
          Rebuilds the model/item tree.
 void setSelectedObject(java.lang.Object object)
          Sets the currently selected object.
 void setSupportedItemTypes(java.lang.String[] supportedItemTypes)
          Sets the item types supported by this browser (null for the standard item types).
 
Methods inherited from class org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
addPluginFocusListener, canDelete, canPageChange, delete, firePluginFocusGained, firePluginFocusLost, focusPlugin, getContentPane, getPage, getPluginComponent, getPluginFromComponentHierarchy, getPluginHolder, getPluginPanel, getSizeBehavior, getSubClients, getToolbarType, hierarchyChanged, initializeResources, installPlugin, installPluginContent, isPluginFocused, isPluginVisible, 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, getDescription, getEventActionNames, getEventModules, getExternalActions, getExternalOptionModuleClasses, getIcon, getIcon, getLevel, getName, getOptionModules, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getPluginState, 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, 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, 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

GUESS_MODEL

public static final int GUESS_MODEL
Flag for getSelectedModel: Guess model from selected item

See Also:
Constant Field Values

USE_CURRENT_MODEL

public static final int USE_CURRENT_MODEL
Flag for getSelectedModel: Use model of current process if none selected in the item browser

See Also:
Constant Field Values
Constructor Detail

ItemBrowserPlugin

public ItemBrowserPlugin()
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

getExternalEventModuleClasses

protected java.lang.Class[] getExternalEventModuleClasses()
Description copied from class: AbstractPlugin
Returns the list of external event module classes. Override this method to customize the plugin.

Overrides:
getExternalEventModuleClasses in class AbstractPlugin
Returns:
An array of classes or null (the default) if the plugin doesn't declare external event modules. The returned classes need to subclass ExternalEventModule
See Also:
AbstractPlugin.getExternalEventModuleClasses()

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
See Also:
AbstractVisiblePlugin.hasCloseButton()

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
See Also:
AbstractVisiblePlugin.initializeComponents()

pluginUninstalled

protected void pluginUninstalled()
Called before the plugin is uninstalled.

Overrides:
pluginUninstalled in class AbstractPlugin

getPluginFocusComponent

public java.awt.Component getPluginFocusComponent()
Description copied from class: AbstractVisiblePlugin
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.
See Also:
AbstractVisiblePlugin.getPluginFocusComponent()

createToolbar

public JaspiraToolbar createToolbar()
Description copied from class: AbstractVisiblePlugin
Creates the toolbar of this plugin. The toolbar will be constructed according to the return value of the method. If you want to construct your own custom toolbar, override this method.

Specified by:
createToolbar in interface VisiblePlugin
Overrides:
createToolbar in class AbstractVisiblePlugin
Returns:
The toolbar or null if the plugin does not have a toolbar
See Also:
AbstractVisiblePlugin.createToolbar()

applicationReady

public void applicationReady()
Called after the application has been initialized AND the plugin initialization is finished.

Overrides:
applicationReady in class AbstractVisiblePlugin

getSelectedModel

public Model getSelectedModel(int flag)
Gets the selected model.

Returns:
The selected model or the model of the selected item or null

getSelectedItem

public Item getSelectedItem()
Gets the selected item.

Returns:
The selected item or the item of the selected item or null

setSelectedObject

public void setSelectedObject(java.lang.Object object)
Sets the currently selected object.

Parameters:
object - Object to select (item or model) or null

getSupportedItemTypes

public java.lang.String[] getSupportedItemTypes()
Gets the item types supported by this browser (null for the standard item types).


setSupportedItemTypes

public void setSupportedItemTypes(java.lang.String[] supportedItemTypes)
Sets the item types supported by this browser (null for the standard item types). Call this method before the plugin is installed (best use the constructor of derived classes).


rebuildTree

protected void rebuildTree()
Rebuilds the model/item tree.


performAlternativeSelection

public void performAlternativeSelection()
Selects the element that should be selected if the currently selected element is deleted. Searches downwards in the current level first, then upwards and then tries the parent level


canCopy

public boolean canCopy()
Description copied from interface: VisiblePlugin
Checks if the plugin can copy the selected data to the clipboard.

Specified by:
canCopy in interface VisiblePlugin
Overrides:
canCopy in class AbstractVisiblePlugin
Returns:
true if the plugin can provide clipboard data.

canCut

public boolean canCut()
Description copied from interface: VisiblePlugin
Checks if the plugin can cut the selected data to the clipboard.

Specified by:
canCut in interface VisiblePlugin
Overrides:
canCut in class AbstractVisiblePlugin
Returns:
true if the plugin can provide clipboard data that can be deleted.

canPaste

public boolean canPaste(java.awt.datatransfer.Transferable transferable)
Description copied from interface: VisiblePlugin
Checks if the plugin can paste the data of the given transferable object.

Specified by:
canPaste in interface VisiblePlugin
Overrides:
canPaste in class AbstractVisiblePlugin
Returns:
true if the plugin accepts the given transferable.

copy

public java.awt.datatransfer.Transferable copy()
Description copied from interface: VisiblePlugin
Copies the selected data from the plugin to the clipboard.

Specified by:
copy in interface VisiblePlugin
Overrides:
copy in class AbstractVisiblePlugin
Returns:
The copied data

cut

public java.awt.datatransfer.Transferable cut()
Description copied from interface: VisiblePlugin
Cuts the selected data from the plugin to the clipboard.

Specified by:
cut in interface VisiblePlugin
Overrides:
cut in class AbstractVisiblePlugin
Returns:
The copied data

paste

public void paste(java.awt.datatransfer.Transferable content)
Description copied from interface: VisiblePlugin
Pastes the given data into the plugin.

Specified by:
paste in interface VisiblePlugin
Overrides:
paste in class AbstractVisiblePlugin
Parameters:
content - Content to paste

canDrag

public boolean canDrag()
Description copied from interface: VisiblePlugin
Checks if the plugin can be dragged.

Specified by:
canDrag in interface DragOrigin
Specified by:
canDrag in interface VisiblePlugin
Overrides:
canDrag in class AbstractVisiblePlugin
See Also:
DragOrigin.canDrag()

dropAccepted

public void dropAccepted(java.awt.datatransfer.Transferable t)
Description copied from interface: DragOrigin
Called when the drag has been accepted by a InteractionClient, but before it is actually imported.

Specified by:
dropAccepted in interface DragOrigin
Parameters:
t - Dragged transferable
See Also:
DragOrigin.dropAccepted(Transferable)

dropCanceled

public void dropCanceled(java.awt.datatransfer.Transferable t)
Description copied from interface: DragOrigin
Called when the drag action has been aborted, either by dropping upon a non- qualifying target or because the target reported an unsuccessful drop.

Specified by:
dropCanceled in interface DragOrigin
Parameters:
t - Dragged transferable
See Also:
DragOrigin.dropCanceled(Transferable)

dropPerformed

public void dropPerformed(java.awt.datatransfer.Transferable t)
Description copied from interface: DragOrigin
Called when the drop has been performed and the object has been inserted.

Specified by:
dropPerformed in interface DragOrigin
Parameters:
t - Dragged transferable
See Also:
DragOrigin.dropPerformed(Transferable)

getTranferableAt

public java.awt.datatransfer.Transferable getTranferableAt(java.awt.Point p)
Description copied from interface: DragOrigin
Returns the Transferable for a drag Operation starting at .

Specified by:
getTranferableAt in interface DragOrigin
Parameters:
p - The location at which the drag started in component local coordinates
Returns:
The Transferable to drag
See Also:
DragOrigin.getTranferableAt(Point)

getDragImage

public MultiIcon getDragImage()
Description copied from interface: DragOrigin
Gets the image for the construction of the drag cursor.

Specified by:
getDragImage in interface DragOrigin
Returns:
The image or null if no special drag image is to be constructed
See Also:
DragOrigin.getDragImage()

focusGained

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

focusLost

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

handleItemTreeEvent

public void handleItemTreeEvent(ItemTreeEvent e)
Called when an item tree event has happened.

Specified by:
handleItemTreeEvent in interface ItemTreeListener
Parameters:
e - Item tree event holding the event information

firePropertyBrowserEvent

protected void firePropertyBrowserEvent(Item item)
Creates an property browser event which will send to the property browser later.

Parameters:
item - An item or a model

observeEvent

public void observeEvent(ObserverEvent event)
Specified by:
observeEvent in interface EventObserver


Copyright © 2011. All Rights Reserved.