org.openbp.cockpit.plugins.toolbox
Class ToolBoxPlugin

java.lang.Object
  extended by org.openbp.jaspira.plugin.AbstractPlugin
      extended by org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin
          extended by org.openbp.cockpit.plugins.toolbox.ToolBoxPlugin
All Implemented Interfaces:
java.awt.event.HierarchyListener, java.util.EventListener, BreakoutProvider, InteractionClient, VisiblePlugin, Plugin
Direct Known Subclasses:
SocketToolBoxPlugin, StandardToolBoxPlugin, UserToolBoxPlugin

public abstract class ToolBoxPlugin
extends AbstractVisiblePlugin
implements InteractionClient, BreakoutProvider

A generic Plugin that shows ToolBoxItems which can used for Drag and Drop. By default the items can be draged into the box. You can use the box as clipboard.

Author:
Jens Ferchland

Nested Class Summary
 class ToolBoxPlugin.Events
          Event module.
 class ToolBoxPlugin.ToolBoxLayoutManager
           
 
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
ToolBoxPlugin()
           
 
Method Summary
protected  boolean acceptDrop()
          If this method returns true all item flavor drops will be accepted.
protected  boolean acceptFlyWheelKey(int key)
          Determines if the given key is accepted by the toolbox as break out mode key.
protected  void addStandardToolBoxItems()
          Adds the standard content of the toolbox.
protected  void addToolBoxItem(ModelObject mo, java.lang.String tooltipResourceName)
          Adds a process object to the toolbox.
 void addToolBoxItem(ToolBoxItem item)
          Adds a toolbox item to the toolbox.
protected  boolean canTitleChange()
          Determines if the title of the toolbox can be changed by the user.
 void clearToolbox()
          Clears the toolbox.
 BreakoutBoxEntry[] createBreakOutEntries(java.util.List importers)
          Creates a set of break out entries for the given data flavors.
 void dragActionTriggered(java.lang.Object regionId, java.awt.Point p)
          Called to signal additional actions, such as hovering for a certain time over the region.
 void dragEnded(java.awt.datatransfer.Transferable transferable)
          called when a dragging has ended.
 void dragStarted(java.awt.datatransfer.Transferable transferable)
          Called when a dragging has been started.
 java.util.List getAllDropRegions(java.util.List flavors, java.awt.datatransfer.Transferable data, java.awt.event.MouseEvent mouseEvent)
          Returns a list of all regions of this client AND possible sub clients.
 java.util.List getAllImportersAt(java.awt.Point p)
          Returns all importers which will be accepted at the given point by this client or one of its sub clients.
 java.util.List getDropRegions(java.util.List flavors, java.awt.datatransfer.Transferable data, java.awt.event.MouseEvent mouseEvent)
          Returns a list of drop regions of this client that are compatible with the provided data flavors.
 java.util.List getImportersAt(java.awt.Point p)
          Returns all importers which will be accepted at the given point by this client.
 java.lang.String getResourceCollectionContainerName()
          Gets the name of the resource component the default resource of the plugin belongs to.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getToolBoxTitle()
          Returns the title of the ToolBox.
 boolean importData(java.lang.Object regionId, java.awt.datatransfer.Transferable data, java.awt.Point p)
          Imports the given transferable into the given region.
protected  void initializeComponents()
          This template method is called after internal Components (i\.e\. title bar etc\.)
 void refreshContent()
          Redisplays content.
 void removeToolBoxItem(ToolBoxItem item)
          Removes a tool box item from the toolbox.
 void setToolBoxTitle(java.lang.String title)
          Sets the title of the ToolBox.
 void updateSkinIcons()
          Updates the icons of the toolbox items if they have been retrieved from the icon model in the case of skin changes.
 
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, getPluginFocusComponent, getPluginFromComponentHierarchy, getPluginHolder, getPluginPanel, getSizeBehavior, getSubClients, getToolbarType, hasCloseButton, 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, getDescription, getEventActionNames, getEventModules, getExternalActions, getExternalEventModuleClasses, getExternalOptionModuleClasses, getIcon, getIcon, getLevel, getName, getOptionModules, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getPluginState, getSubTitle, getUniqueId, getVendor, getVersion, handleEvent, handleKeySequence, inheritEvent, initializeFromPluginProfile, initializePlugin, installFirstPlugin, matchesPeerGroup, matchesPeerGroups, passDown, pluginInstalled, pluginUninstalled, 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.gui.interaction.InteractionClient
getSubClients
 
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, getUniqueId, getVendor, getVersion, handleEvent, inheritEvent, initializePlugin, installFirstPlugin, matchesPeerGroup, matchesPeerGroups, receiveEvent, removeFromPeerGroup, removePlugin, requestClose, setParentPlugin, setPluginState, uninstallLastPlugin
 

Constructor Detail

ToolBoxPlugin

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

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

addStandardToolBoxItems

protected void addStandardToolBoxItems()
Adds the standard content of the toolbox. By default, the toolbox has no content.


addToolBoxItem

protected void addToolBoxItem(ModelObject mo,
                              java.lang.String tooltipResourceName)
Adds a process object to the toolbox.

Parameters:
mo - Object to add
tooltipResourceName - Tooltip resource name

addToolBoxItem

public void addToolBoxItem(ToolBoxItem item)
Adds a toolbox item to the toolbox.

Parameters:
item - Item to add

removeToolBoxItem

public void removeToolBoxItem(ToolBoxItem item)
Removes a tool box item from the toolbox.

Parameters:
item - Item to remove; must have been added using addToolBoxItem(ToolBoxItem)

clearToolbox

public void clearToolbox()
Clears the toolbox.


refreshContent

public void refreshContent()
Redisplays content.


updateSkinIcons

public void updateSkinIcons()
Updates the icons of the toolbox items if they have been retrieved from the icon model in the case of skin changes.


setToolBoxTitle

public void setToolBoxTitle(java.lang.String title)
Sets the title of the ToolBox.


getToolBoxTitle

public java.lang.String getToolBoxTitle()
Returns the title of the ToolBox.


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
See Also:
AbstractPlugin.getTitle()

canTitleChange

protected boolean canTitleChange()
Determines if the title of the toolbox can be changed by the user.


acceptDrop

protected boolean acceptDrop()
If this method returns true all item flavor drops will be accepted. If you don't want to accept drop events override this method!
The default implementation returns true


dragActionTriggered

public void dragActionTriggered(java.lang.Object regionId,
                                java.awt.Point p)
Description copied from interface: InteractionClient
Called to signal additional actions, such as hovering for a certain time over the region.

Specified by:
dragActionTriggered in interface InteractionClient
Parameters:
regionId - Id of the region to import into (see BasicDropRegion.getId)
p - Current mouse position in screen coordinates
See Also:
InteractionClient.dragActionTriggered(Object, Point)

dragEnded

public void dragEnded(java.awt.datatransfer.Transferable transferable)
Description copied from interface: InteractionClient
called when a dragging has ended.

Specified by:
dragEnded in interface InteractionClient
Parameters:
transferable - Transferable that has been dragged
See Also:
InteractionClient.dragEnded(Transferable)

dragStarted

public void dragStarted(java.awt.datatransfer.Transferable transferable)
Description copied from interface: InteractionClient
Called when a dragging has been started.

Specified by:
dragStarted in interface InteractionClient
Parameters:
transferable - Transferable to be dragged
See Also:
InteractionClient.dragStarted(Transferable)

getAllDropRegions

public java.util.List getAllDropRegions(java.util.List flavors,
                                        java.awt.datatransfer.Transferable data,
                                        java.awt.event.MouseEvent mouseEvent)
Description copied from interface: InteractionClient
Returns a list of all regions of this client AND possible sub clients.

Specified by:
getAllDropRegions in interface InteractionClient
Parameters:
flavors - List of data flavors to check
data - Transferable to import
mouseEvent - Mouse event that initiated the drag action
Returns:
A list of DragAwareRegion object or null if the drop client or one of its sub clients cannot satisfy at least one of the supplied data flavors
See Also:
InteractionClient.getAllDropRegions(List, Transferable, MouseEvent)

getDropRegions

public java.util.List getDropRegions(java.util.List flavors,
                                     java.awt.datatransfer.Transferable data,
                                     java.awt.event.MouseEvent mouseEvent)
Description copied from interface: InteractionClient
Returns a list of drop regions of this client that are compatible with the provided data flavors.

Specified by:
getDropRegions in interface InteractionClient
Parameters:
flavors - List of data flavors to check
data - Transferable to be imported
mouseEvent - Mouse event that initiated the drag action
Returns:
A list of DragAwareRegion object or null if the drop client cannot satisfy at least one of the supplied data flavors.
The list will contain only regions that belong directly to this drop client.
See Also:
InteractionClient.getDropRegions(List, Transferable, MouseEvent)

getImportersAt

public java.util.List getImportersAt(java.awt.Point p)
Description copied from interface: InteractionClient
Returns all importers which will be accepted at the given point by this client.

Specified by:
getImportersAt in interface InteractionClient
Parameters:
p - Current mouse position in screen coordinates
Returns:
A list of Importer objects or null
See Also:
InteractionClient.getImportersAt(Point)

getAllImportersAt

public java.util.List getAllImportersAt(java.awt.Point p)
Description copied from interface: InteractionClient
Returns all importers which will be accepted at the given point by this client or one of its sub clients.

Specified by:
getAllImportersAt in interface InteractionClient
Parameters:
p - Current mouse position in screen coordinates
Returns:
A list of Importer objects or null
See Also:
InteractionClient.getAllImportersAt(Point)

importData

public boolean importData(java.lang.Object regionId,
                          java.awt.datatransfer.Transferable data,
                          java.awt.Point p)
Description copied from interface: InteractionClient
Imports the given transferable into the given region.

Specified by:
importData in interface InteractionClient
Parameters:
regionId - Id of the region to import into (see BasicDropRegion.getId)
data - Transferable to import
p - Drop point in glass coordinates
Returns:
true The data was successfully imported.
false An error occured while importing the data.
See Also:
InteractionClient.importData(Object, Transferable, Point)

acceptFlyWheelKey

protected boolean acceptFlyWheelKey(int key)
Determines if the given key is accepted by the toolbox as break out mode key.

Parameters:
key - Key to check
Returns:
true: The key will initiate the break out mode for this toolbox.
false: The toolbox does not respond on this key.

createBreakOutEntries

public BreakoutBoxEntry[] createBreakOutEntries(java.util.List importers)
Description copied from interface: BreakoutProvider
Creates a set of break out entries for the given data flavors.

Specified by:
createBreakOutEntries in interface BreakoutProvider
Parameters:
importers - Flavors supported by the break out box (contains DataFlavor objects)
Returns:
The list of entries
See Also:
BreakoutProvider.createBreakOutEntries(List)


Copyright © 2011. All Rights Reserved.