Class AbstractDockingTool
- java.lang.Object
-
- docking.AbstractDockingTool
-
- All Implemented Interfaces:
DockingTool
- Direct Known Subclasses:
PluginTool
public abstract class AbstractDockingTool extends java.lang.Object implements DockingTool
A partial implementation ofDockingTool
that serves as a place to share common functionality
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
configChangedFlag
protected java.util.Map<java.lang.String,ToolOptions>
optionsMap
protected ToolActions
toolActions
protected DockingWindowManager
winMgr
-
Constructor Summary
Constructors Constructor Description AbstractDockingTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(DockingActionIf action)
Adds the action to the tool.void
addComponentProvider(ComponentProvider provider, boolean show)
Adds the ComponentProvider to the tool, optionally making it visible.void
addContextListener(DockingContextListener listener)
Adds the given context listener to this toolvoid
addLocalAction(ComponentProvider provider, DockingActionIf action)
Adds the action to the given provider as a local action.void
addPopupActionProvider(PopupActionProvider provider)
Adds the given popup action provider to this tool.void
clearStatusInfo()
Clear the status informationvoid
contextChanged(ComponentProvider provider)
Signals to the tool that the provider's context has changed.ComponentProvider
getActiveComponentProvider()
Returns the active component provider, that which has focusjava.util.Set<DockingActionIf>
getAllActions()
Return a set of all actions in the tool.ComponentProvider
getComponentProvider(java.lang.String name)
Gets the ComponentProvider with the given name.java.util.Set<DockingActionIf>
getDockingActionsByOwnerName(java.lang.String owner)
Returns all actions for the given ownerActionContext
getGlobalContext()
Returns this tool's notion of the current action context, which is based upon the activeComponentProvider
.java.awt.Window
getProviderWindow(ComponentProvider provider)
Returns the parent window for the given providerToolActions
getToolActions()
Returns the class that manages actions for the tool.javax.swing.JFrame
getToolFrame()
DockingWindowManager
getWindowManager()
Returns the DockingWindowManger for this tool.boolean
hasConfigChanged()
Return true if the tool's configuration has changedboolean
isActive(ComponentProvider provider)
Returns true if the ComponentProvider is the currently active provider.boolean
isVisible()
Returns true if tool is visibleboolean
isVisible(ComponentProvider provider)
Returns true if the given ComponentProvider is currently visible.void
removeAction(DockingActionIf action)
Removes the given action from the tool.void
removeComponentProvider(ComponentProvider provider)
Removes the given ComponentProvider from the tool.void
removeContextListener(DockingContextListener listener)
Removes the given context listener to this toolvoid
removeLocalAction(ComponentProvider provider, DockingActionIf action)
Removes the action from the providervoid
removePopupActionProvider(PopupActionProvider provider)
Removes the given popup action providervoid
setConfigChanged(boolean changed)
Toggles the "change" state of the tool...void
setMenuGroup(java.lang.String[] menuPath, java.lang.String group)
Set the menu group associated with a cascaded submenu.void
setMenuGroup(java.lang.String[] menuPath, java.lang.String group, java.lang.String menuSubGroup)
Set the menu group associated with a cascaded submenu.void
setStatusInfo(java.lang.String text)
Set the status informationvoid
setStatusInfo(java.lang.String text, boolean beep)
Set the status informationvoid
setVisible(boolean visibility)
Sets the tool visible or invisible.void
showComponentProvider(ComponentProvider provider, boolean visible)
Shows or hides the component provider in the toolvoid
showDialog(DialogComponentProvider dialogComponent)
Shows the dialog using the tool's root frame as a parent.void
toFront()
Brings this tool to the front.void
toFront(ComponentProvider provider)
Makes the given ComponentProvider move to the front if it is tabbed with other components.void
updateTitle(ComponentProvider provider)
Indicates to the tool that the given componentProvider's title has changed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface docking.DockingTool
close, getIcon, getName, getOptions
-
-
-
-
Field Detail
-
winMgr
protected DockingWindowManager winMgr
-
toolActions
protected ToolActions toolActions
-
optionsMap
protected java.util.Map<java.lang.String,ToolOptions> optionsMap
-
configChangedFlag
protected boolean configChangedFlag
-
-
Method Detail
-
isVisible
public boolean isVisible()
Description copied from interface:DockingTool
Returns true if tool is visible- Specified by:
isVisible
in interfaceDockingTool
- Returns:
- true if tool is visible
-
setVisible
public void setVisible(boolean visibility)
Description copied from interface:DockingTool
Sets the tool visible or invisible. This method is used by the Project to make it's tools visible or invisible depending on whether this tool is in is the active workspace.- Specified by:
setVisible
in interfaceDockingTool
- Parameters:
visibility
- true specifies that the tool should be visible
-
toFront
public void toFront()
Description copied from interface:DockingTool
Brings this tool to the front. Places this tool at the top of the stacking order and shows it in front of any other tools.- Specified by:
toFront
in interfaceDockingTool
-
addComponentProvider
public void addComponentProvider(ComponentProvider provider, boolean show)
Description copied from interface:DockingTool
Adds the ComponentProvider to the tool, optionally making it visible.- Specified by:
addComponentProvider
in interfaceDockingTool
- Parameters:
provider
- the provider to add to the toolshow
- if true, the component is made visible.
-
removeComponentProvider
public void removeComponentProvider(ComponentProvider provider)
Description copied from interface:DockingTool
Removes the given ComponentProvider from the tool. When a provider has been removed from the tool it is considered disposed and should not be reused.- Specified by:
removeComponentProvider
in interfaceDockingTool
- Parameters:
provider
- the provider to remove from the tool
-
getComponentProvider
public ComponentProvider getComponentProvider(java.lang.String name)
Description copied from interface:DockingTool
Gets the ComponentProvider with the given name.- Specified by:
getComponentProvider
in interfaceDockingTool
- Parameters:
name
- the name of the provider to get- Returns:
- the provider
-
setStatusInfo
public void setStatusInfo(java.lang.String text)
Description copied from interface:DockingTool
Set the status information- Specified by:
setStatusInfo
in interfaceDockingTool
- Parameters:
text
- non-html string to be displayed in the Status display area
-
setStatusInfo
public void setStatusInfo(java.lang.String text, boolean beep)
Description copied from interface:DockingTool
Set the status information- Specified by:
setStatusInfo
in interfaceDockingTool
- Parameters:
text
- string to be displayed in the Status display areabeep
- whether to be or not
-
clearStatusInfo
public void clearStatusInfo()
Description copied from interface:DockingTool
Clear the status information- Specified by:
clearStatusInfo
in interfaceDockingTool
-
addAction
public void addAction(DockingActionIf action)
Description copied from interface:DockingTool
Adds the action to the tool.- Specified by:
addAction
in interfaceDockingTool
- Parameters:
action
- the action to be added.
-
removeAction
public void removeAction(DockingActionIf action)
Description copied from interface:DockingTool
Removes the given action from the tool. When an action is removed from the tool it will be disposed and should not be reused.- Specified by:
removeAction
in interfaceDockingTool
- Parameters:
action
- the action to be removed.
-
addLocalAction
public void addLocalAction(ComponentProvider provider, DockingActionIf action)
Description copied from interface:DockingTool
Adds the action to the given provider as a local action.- Specified by:
addLocalAction
in interfaceDockingTool
- Parameters:
provider
- the provider to add the action to.action
- the DockingAction to add to the componentProvider.
-
removeLocalAction
public void removeLocalAction(ComponentProvider provider, DockingActionIf action)
Description copied from interface:DockingTool
Removes the action from the provider- Specified by:
removeLocalAction
in interfaceDockingTool
- Parameters:
provider
- the component provider from which to remove the action.action
- the action to remove.
-
getAllActions
public java.util.Set<DockingActionIf> getAllActions()
Description copied from interface:DockingTool
Return a set of all actions in the tool.Note: the result may contain conceptually duplicate actions, which is when multiple actions exist that share the same full name (the full name is the action name with the owner name, such as "My Action (MyPlugin)".
- Specified by:
getAllActions
in interfaceDockingTool
- Returns:
- set of all actions
-
addPopupActionProvider
public void addPopupActionProvider(PopupActionProvider provider)
Description copied from interface:DockingTool
Adds the given popup action provider to this tool. This provider will be called each time the popup menu is about to be shown.- Specified by:
addPopupActionProvider
in interfaceDockingTool
- Parameters:
provider
- the provider
-
removePopupActionProvider
public void removePopupActionProvider(PopupActionProvider provider)
Description copied from interface:DockingTool
Removes the given popup action provider- Specified by:
removePopupActionProvider
in interfaceDockingTool
- Parameters:
provider
- the provider
-
getDockingActionsByOwnerName
public java.util.Set<DockingActionIf> getDockingActionsByOwnerName(java.lang.String owner)
Description copied from interface:DockingTool
Returns all actions for the given ownerNote: the result may contain conceptually duplicate actions, which is when multiple actions exist that share the same full name (the full name is the action name with the owner name, such as "My Action (MyPlugin)".
- Specified by:
getDockingActionsByOwnerName
in interfaceDockingTool
- Parameters:
owner
- the action owner's name- Returns:
- the actions
-
getActiveComponentProvider
public ComponentProvider getActiveComponentProvider()
Description copied from interface:DockingTool
Returns the active component provider, that which has focus- Specified by:
getActiveComponentProvider
in interfaceDockingTool
- Returns:
- the active provider
-
showComponentProvider
public void showComponentProvider(ComponentProvider provider, boolean visible)
Description copied from interface:DockingTool
Shows or hides the component provider in the tool- Specified by:
showComponentProvider
in interfaceDockingTool
- Parameters:
provider
- the provider to either show or hide.visible
- true to show the provider, false to hide it.
-
showDialog
public void showDialog(DialogComponentProvider dialogComponent)
Description copied from interface:DockingTool
Shows the dialog using the tool's root frame as a parent. Also, remembers any size and location adjustments made by the user for the next time the dialog is shown.- Specified by:
showDialog
in interfaceDockingTool
- Parameters:
dialogComponent
- the DialogComponentProvider object to be shown in a dialog.
-
getToolFrame
public javax.swing.JFrame getToolFrame()
-
getProviderWindow
public java.awt.Window getProviderWindow(ComponentProvider provider)
Description copied from interface:DockingTool
Returns the parent window for the given provider- Specified by:
getProviderWindow
in interfaceDockingTool
- Parameters:
provider
- the provider- Returns:
- the window
-
toFront
public void toFront(ComponentProvider provider)
Description copied from interface:DockingTool
Makes the given ComponentProvider move to the front if it is tabbed with other components.- Specified by:
toFront
in interfaceDockingTool
- Parameters:
provider
- the provider to move to the top of its stacking order.
-
isVisible
public boolean isVisible(ComponentProvider provider)
Description copied from interface:DockingTool
Returns true if the given ComponentProvider is currently visible.- Specified by:
isVisible
in interfaceDockingTool
- Parameters:
provider
- the provider to check for visibility.- Returns:
- true if the given ComponentProvider is currently visible.
-
isActive
public boolean isActive(ComponentProvider provider)
Description copied from interface:DockingTool
Returns true if the ComponentProvider is the currently active provider. The active provider is the provider that has keyboard focus and provides the current action context.- Specified by:
isActive
in interfaceDockingTool
- Parameters:
provider
- the provider to check for active.- Returns:
- true if the ComponentProvider is the currently active provider.
-
updateTitle
public void updateTitle(ComponentProvider provider)
Description copied from interface:DockingTool
Indicates to the tool that the given componentProvider's title has changed.- Specified by:
updateTitle
in interfaceDockingTool
- Parameters:
provider
- the componentProvider whose title has changed.
-
setMenuGroup
public void setMenuGroup(java.lang.String[] menuPath, java.lang.String group)
Set the menu group associated with a cascaded submenu. This allows a cascading menu item to be grouped with a specific set of actions. The default group for a cascaded submenu is the name of the submenu.- Parameters:
menuPath
- menu name path where the last element corresponds to the specified group name.group
- group name- See Also:
setMenuGroup(String[], String, String)
-
setMenuGroup
public void setMenuGroup(java.lang.String[] menuPath, java.lang.String group, java.lang.String menuSubGroup)
Description copied from interface:DockingTool
Set the menu group associated with a cascaded submenu. This allows a cascading menu item to be grouped with a specific set of actions.The default group for a cascaded submenu is the name of the submenu.
- Specified by:
setMenuGroup
in interfaceDockingTool
- Parameters:
menuPath
- menu name path where the last element corresponds to the specified group name.group
- group namemenuSubGroup
- the name used to sort the cascaded menu within other menu items at its level
-
contextChanged
public void contextChanged(ComponentProvider provider)
Description copied from interface:DockingTool
Signals to the tool that the provider's context has changed. This lets toolbar and menu actions update enablement based on current context.Pass
null
to signal that the entire tool's context has changed- Specified by:
contextChanged
in interfaceDockingTool
- Parameters:
provider
- the provider whose context changed; null to signal the tool's context
-
getGlobalContext
public ActionContext getGlobalContext()
Description copied from interface:DockingTool
Returns this tool's notion of the current action context, which is based upon the activeComponentProvider
. If there is not active provider, then a generic context will be returned.- Specified by:
getGlobalContext
in interfaceDockingTool
- Returns:
- the context
-
addContextListener
public void addContextListener(DockingContextListener listener)
Description copied from interface:DockingTool
Adds the given context listener to this tool- Specified by:
addContextListener
in interfaceDockingTool
- Parameters:
listener
- the listener to add
-
removeContextListener
public void removeContextListener(DockingContextListener listener)
Description copied from interface:DockingTool
Removes the given context listener to this tool- Specified by:
removeContextListener
in interfaceDockingTool
- Parameters:
listener
- the listener to add
-
getWindowManager
public DockingWindowManager getWindowManager()
Description copied from interface:DockingTool
Returns the DockingWindowManger for this tool.- Specified by:
getWindowManager
in interfaceDockingTool
- Returns:
- the DockingWindowManger for this tool.
-
setConfigChanged
public void setConfigChanged(boolean changed)
Description copied from interface:DockingTool
Toggles the "change" state of the tool...- Specified by:
setConfigChanged
in interfaceDockingTool
- Parameters:
changed
- true indicates that the tool config has changed.
-
hasConfigChanged
public boolean hasConfigChanged()
Description copied from interface:DockingTool
Return true if the tool's configuration has changed- Specified by:
hasConfigChanged
in interfaceDockingTool
- Returns:
- true if the tool's configuration has changed
-
getToolActions
public ToolActions getToolActions()
Description copied from interface:DockingTool
Returns the class that manages actions for the tool.Most clients will not need to use this methods. Instead, actions should be added to the tool via
DockingTool.addAction(DockingActionIf)
andDockingTool.addLocalAction(ComponentProvider, DockingActionIf)
.- Specified by:
getToolActions
in interfaceDockingTool
- Returns:
- the action manager
-
-