Class DockingActionProxy
- java.lang.Object
-
- docking.DockingActionProxy
-
- All Implemented Interfaces:
DockingActionIf,MultiActionDockingActionIf,ToggleDockingActionIf,HelpDescriptor,java.beans.PropertyChangeListener,java.util.EventListener
public class DockingActionProxy extends java.lang.Object implements ToggleDockingActionIf, MultiActionDockingActionIf, java.beans.PropertyChangeListener
-
-
Field Summary
-
Fields inherited from interface docking.action.DockingActionIf
DESCRIPTION_PROPERTY, ENABLEMENT_PROPERTY, GLOBALCONTEXT_PROPERTY, KEYBINDING_DATA_PROPERTY, MENUBAR_DATA_PROPERTY, POPUP_MENU_DATA_PROPERTY, TOOLBAR_DATA_PROPERTY
-
Fields inherited from interface docking.action.ToggleDockingActionIf
SELECTED_STATE_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description DockingActionProxy(DockingActionIf dockingAction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(ActionContext context)method to actually perform the action logic for this action.voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a listener to be notified if any property changesjavax.swing.JButtoncreateButton()Returns a JButton that is suitable for this action.javax.swing.JMenuItemcreateMenuItem(boolean isPopup)Returns a JMenuItem that is suitable for this action.voiddispose()Called when the action's owner is removed from the toolprotected voidfirePropertyChanged(java.beans.PropertyChangeEvent event)DockingActionIfgetAction()java.util.List<DockingActionIf>getActionList(ActionContext context)KeyBindingDatagetDefaultKeyBindingData()Returns the defaultKeyBindingDatato be used to assign this action to a key binding.java.lang.StringgetDescription()Returns a short description of this action.java.lang.StringgetFullName()Returns the full name (the action name combined with the owner name)java.lang.StringgetHelpInfo()Returns a descriptive String about the help object that this descriptor represents.java.lang.ObjectgetHelpObject()Returns the object for which help locations are defined.java.lang.StringgetInceptionInformation()Returns a string that includes source file and line number information of where this action was createdjavax.swing.KeyStrokegetKeyBinding()Convenience method for getting the keybinding for this action.KeyBindingDatagetKeyBindingData()Returns theKeyBindingDatato be used to assign this action to a key binding.KeyBindingTypegetKeyBindingType()Returns this actions level of support for key binding accelerator keysMenuDatagetMenuBarData()Returns theMenuDatato be used to put this action in the menu bar.java.lang.StringgetName()Returns the name of the actionjava.lang.StringgetOwner()Returns the owner of this actionMenuDatagetPopupMenuData()Returns theMenuDatato be used to put this action in a popup menu.DockingActionIfgetProxyAction()ToolBarDatagetToolBarData()Returns theToolBarDatato be used to put this action in a toolbar.booleanisAddToPopup(ActionContext context)method is used to determine if this action should be displayed on the current popup.booleanisEnabled()Returns true if the action is enabled.booleanisEnabledForContext(ActionContext context)Method used to determine if this action should be enabled for the given context.booleanisSelected()Returns true if the toggle state for this action is current selected.booleanisValidContext(ActionContext context)Method that actions implement to indicate if this action is valid (knows how to work with, is appropriate for) for the given context.voidpropertyChange(java.beans.PropertyChangeEvent evt)voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a listener to be notified of property changes.voidsetEnabled(boolean newValue)Enables or disables the actionvoidsetKeyBindingData(KeyBindingData keyBindingData)Sets theKeyBindingDataon an action to either assign a keybinding or remove it (keyBindingData = null).voidsetSelected(boolean newValue)Sets the toggle state for this action.voidsetSupportsDefaultToolContext(boolean newValue)Sets whether or not this action should be activated using the default tool context if the current focused provider's context is not valid for this action.voidsetUnvalidatedKeyBindingData(KeyBindingData newKeyBindingData)Users creating actions should not call this method, but should instead callDockingActionIf.setKeyBindingData(KeyBindingData).booleanshouldAddToWindow(boolean isMainWindow, java.util.Set<java.lang.Class<?>> contextTypes)Determines whether this action should be added to a window (either the main window or a secondary detached window).booleansupportsDefaultToolContext()Returns true if this action can be activated using the default tool context if the focused context is invalid for this action.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface docking.action.DockingActionIf
getOwnerDescription
-
-
-
-
Constructor Detail
-
DockingActionProxy
public DockingActionProxy(DockingActionIf dockingAction)
-
-
Method Detail
-
getAction
public DockingActionIf getAction()
-
actionPerformed
public void actionPerformed(ActionContext context)
Description copied from interface:DockingActionIfmethod to actually perform the action logic for this action.- Specified by:
actionPerformedin interfaceDockingActionIf- Parameters:
context- theActionContextobject that provides information about where and how this action was invoked.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:DockingActionIfAdds a listener to be notified if any property changes- Specified by:
addPropertyChangeListenerin interfaceDockingActionIf- Parameters:
listener- The property change listener that will be notified of property change events.- See Also:
Action.addPropertyChangeListener(java.beans.PropertyChangeListener)
-
getDescription
public java.lang.String getDescription()
Description copied from interface:DockingActionIfReturns a short description of this action. Generally used for a tooltip- Specified by:
getDescriptionin interfaceDockingActionIf- Returns:
- the description
-
getFullName
public java.lang.String getFullName()
Description copied from interface:DockingActionIfReturns the full name (the action name combined with the owner name)- Specified by:
getFullNamein interfaceDockingActionIf- Returns:
- the full name
-
getInceptionInformation
public java.lang.String getInceptionInformation()
Description copied from interface:DockingActionIfReturns a string that includes source file and line number information of where this action was created- Specified by:
getInceptionInformationin interfaceDockingActionIf- Returns:
- the inception information
-
getKeyBindingData
public KeyBindingData getKeyBindingData()
Description copied from interface:DockingActionIfReturns theKeyBindingDatato be used to assign this action to a key binding. The KeyBindingData will be null if the action is not set to have a keyBinding.- Specified by:
getKeyBindingDatain interfaceDockingActionIf- Returns:
- the
KeyBindingDatafor the action or null if the action does not have a keyBinding.
-
getDefaultKeyBindingData
public KeyBindingData getDefaultKeyBindingData()
Description copied from interface:DockingActionIfReturns the defaultKeyBindingDatato be used to assign this action to a key binding. The KeyBindingData will be null if the action is not set to have a keyBinding. The value of this method is that which is set from a call toDockingActionIf.setKeyBindingData(KeyBindingData).- Specified by:
getDefaultKeyBindingDatain interfaceDockingActionIf- Returns:
- the
KeyBindingDatafor the action or null if the action does not have a keyBinding.
-
getMenuBarData
public MenuData getMenuBarData()
Description copied from interface:DockingActionIfReturns theMenuDatato be used to put this action in the menu bar. The MenuData will be null if the action in not set to be in the menu bar.- Specified by:
getMenuBarDatain interfaceDockingActionIf- Returns:
- the
MenuDatafor the menu bar or null if the action is not in the menu bar.
-
getName
public java.lang.String getName()
Description copied from interface:DockingActionIfReturns the name of the action- Specified by:
getNamein interfaceDockingActionIf- Returns:
- the name
-
getOwner
public java.lang.String getOwner()
Description copied from interface:DockingActionIfReturns the owner of this action- Specified by:
getOwnerin interfaceDockingActionIf- Returns:
- the owner
-
getPopupMenuData
public MenuData getPopupMenuData()
Description copied from interface:DockingActionIfReturns theMenuDatato be used to put this action in a popup menu. The MenuData will be null if the action in not set to be in a popup menu.- Specified by:
getPopupMenuDatain interfaceDockingActionIf- Returns:
- the
MenuDatafor a popup menu or null if the action is not to be in a popup menu.
-
getToolBarData
public ToolBarData getToolBarData()
Description copied from interface:DockingActionIfReturns theToolBarDatato be used to put this action in a toolbar. The ToolBarData will be null if the action in not set to be in a toolbar.- Specified by:
getToolBarDatain interfaceDockingActionIf- Returns:
- the
ToolBarDatafor the popup menu or null if the action is not in a popup menu.
-
isEnabled
public boolean isEnabled()
Description copied from interface:DockingActionIfReturns true if the action is enabled.- Specified by:
isEnabledin interfaceDockingActionIf- Returns:
- true if the action is enabled, false otherwise
-
isAddToPopup
public boolean isAddToPopup(ActionContext context)
Description copied from interface:DockingActionIfmethod is used to determine if this action should be displayed on the current popup. This method will only be called if the action has popupPopupMenuDataset.Generally, actions don't need to override this method as the default implementation will defer to the
DockingActionIf.isEnabledForContext(ActionContext), which will have the effect of adding the action to the popup only if it is enabled for a given context. By overriding this method, you can change this behavior so that the action will be added to the popup, even if it is disabled for the context, by having this method return true even if theDockingActionIf.isEnabledForContext(ActionContext)method will return false, resulting in the action appearing in the popup menu, but begin disabled.- Specified by:
isAddToPopupin interfaceDockingActionIf- Parameters:
context- theActionContextfrom the active provider.- Returns:
- true if this action is appropriate for the given context.
-
isValidContext
public boolean isValidContext(ActionContext context)
Description copied from interface:DockingActionIfMethod that actions implement to indicate if this action is valid (knows how to work with, is appropriate for) for the given context. This method is used to determine if the action should be enabled based on the either the local context or the global context. The action is first asked if it is valid for the local context and if not, then it is asked if it is valid for the global context. If a context is valid, then it will then be asked if it is enabled for that context.- Specified by:
isValidContextin interfaceDockingActionIf- Parameters:
context- theActionContextfrom the active provider.- Returns:
- true if this action is appropriate for the given context.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:DockingActionIfRemoves a listener to be notified of property changes.- Specified by:
removePropertyChangeListenerin interfaceDockingActionIf- Parameters:
listener- The property change listener that will be notified of property change events.- See Also:
DockingActionIf.addPropertyChangeListener(PropertyChangeListener),Action.addPropertyChangeListener(java.beans.PropertyChangeListener)
-
setEnabled
public void setEnabled(boolean newValue)
Description copied from interface:DockingActionIfEnables or disables the action- Specified by:
setEnabledin interfaceDockingActionIf- Parameters:
newValue- true to enable the action, false to disable it
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
firePropertyChanged
protected void firePropertyChanged(java.beans.PropertyChangeEvent event)
-
getProxyAction
public DockingActionIf getProxyAction()
-
isSelected
public boolean isSelected()
Description copied from interface:ToggleDockingActionIfReturns true if the toggle state for this action is current selected.- Specified by:
isSelectedin interfaceToggleDockingActionIf- Returns:
- true if the toggle state for this action is current selected.
-
setSelected
public void setSelected(boolean newValue)
Description copied from interface:ToggleDockingActionIfSets the toggle state for this action.- Specified by:
setSelectedin interfaceToggleDockingActionIf- Parameters:
newValue- the new toggle state.
-
getActionList
public java.util.List<DockingActionIf> getActionList(ActionContext context)
- Specified by:
getActionListin interfaceMultiActionDockingActionIf
-
createButton
public javax.swing.JButton createButton()
Description copied from interface:DockingActionIfReturns a JButton that is suitable for this action. For example, It creates a ToggleButton if the action is aToggleDockingActionIf.- Specified by:
createButtonin interfaceDockingActionIf- Returns:
- a JButton to be used in a toolbar or null if the action does not have ToolBarData set.
-
createMenuItem
public javax.swing.JMenuItem createMenuItem(boolean isPopup)
Description copied from interface:DockingActionIfReturns a JMenuItem that is suitable for this action. For example, if the action is aToggleDockingActionIf, then a JCheckBoxMenuItem will be created.- Specified by:
createMenuItemin interfaceDockingActionIf- Parameters:
isPopup- true if the action should use its Popup MenuData, else it uses the MenuBar MenuData.- Returns:
- a JMenuItem for placement in either the menu bar or a popup menu.
-
shouldAddToWindow
public boolean shouldAddToWindow(boolean isMainWindow, java.util.Set<java.lang.Class<?>> contextTypes)Description copied from interface:DockingActionIfDetermines whether this action should be added to a window (either the main window or a secondary detached window). By default, this method will return true for the main window and false otherwise.- Specified by:
shouldAddToWindowin interfaceDockingActionIf- Parameters:
isMainWindow- true if the window in question is the main windowcontextTypes- a list of contextTypes (Classes) based on the providers that are currently in the window.- Returns:
- true if this action should be added to the window, false otherwise.
-
isEnabledForContext
public boolean isEnabledForContext(ActionContext context)
Description copied from interface:DockingActionIfMethod used to determine if this action should be enabled for the given context.This is the method implementors override to control when the action may be used.
This method will be called by the DockingWindowManager for actions on the global menuBar and toolBar and for actions that have a keyBinding.
This method will be called whenever one of the following events occur:
- when the user invokes the action via its keyBinding,
- the user changes focus from one component provider to another,
- the user moves a component to another position in the window or into another window,
- a component provider reports a change in it's context,
- any plugin or software component reports a general change in context (calls the tool.contextChanged(ComponentProvider) with a null parameter).
- Specified by:
isEnabledForContextin interfaceDockingActionIf- Parameters:
context- the currentActionContextfor the window.- Returns:
- true if the action should be enabled for the context or false otherwise.
-
getKeyBinding
public javax.swing.KeyStroke getKeyBinding()
Description copied from interface:DockingActionIfConvenience method for getting the keybinding for this action.- Specified by:
getKeyBindingin interfaceDockingActionIf- Returns:
- the
KeyStroketo be used as a keybinding for this action or null if there is no
-
getKeyBindingType
public KeyBindingType getKeyBindingType()
Description copied from interface:DockingActionIfReturns this actions level of support for key binding accelerator keysActions support key bindings by default. Some reserved actions do not support key bindings, while others wish to share the same key bindings with multiple, equivalent actions (this allows the user to set one binding that works in many different contexts).
- Specified by:
getKeyBindingTypein interfaceDockingActionIf- Returns:
- the key binding support
-
setKeyBindingData
public void setKeyBindingData(KeyBindingData keyBindingData)
Description copied from interface:DockingActionIfSets theKeyBindingDataon an action to either assign a keybinding or remove it (keyBindingData = null).- Specified by:
setKeyBindingDatain interfaceDockingActionIf- Parameters:
keyBindingData- if non-null, assigns a keybinding to the action. Otherwise, removes any keybinding from the action.
-
setUnvalidatedKeyBindingData
public void setUnvalidatedKeyBindingData(KeyBindingData newKeyBindingData)
Description copied from interface:DockingActionIfUsers creating actions should not call this method, but should instead callDockingActionIf.setKeyBindingData(KeyBindingData).Call this method when you wish to bypass the validation of
DockingActionIf.setKeyBindingData(KeyBindingData)so that keybindings are set exactly as they are given (such as when set by the user and not by the programmer).- Specified by:
setUnvalidatedKeyBindingDatain interfaceDockingActionIf- Parameters:
newKeyBindingData- the KeyBindingData to be used to assign this action to a keybinding
-
dispose
public void dispose()
Description copied from interface:DockingActionIfCalled when the action's owner is removed from the tool- Specified by:
disposein interfaceDockingActionIf
-
getHelpInfo
public java.lang.String getHelpInfo()
Description copied from interface:HelpDescriptorReturns a descriptive String about the help object that this descriptor represents.- Specified by:
getHelpInfoin interfaceHelpDescriptor
-
getHelpObject
public java.lang.Object getHelpObject()
Description copied from interface:HelpDescriptorReturns the object for which help locations are defined. This may be the implementor of this interface or some other delegate object.- Specified by:
getHelpObjectin interfaceHelpDescriptor
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setSupportsDefaultToolContext
public void setSupportsDefaultToolContext(boolean newValue)
Description copied from interface:DockingActionIfSets whether or not this action should be activated using the default tool context if the current focused provider's context is not valid for this action. Typically, this should be set on actions that are mostly independent of which component has focus such as those on the tool's main toolbar.- Specified by:
setSupportsDefaultToolContextin interfaceDockingActionIf- Parameters:
newValue- if true, the action will be activated using the default tool context if the local context is not valid for this action. If false, the action will only ever be activated using the focused context.
-
supportsDefaultToolContext
public boolean supportsDefaultToolContext()
Description copied from interface:DockingActionIfReturns true if this action can be activated using the default tool context if the focused context is invalid for this action. SeeDockingActionIf.setSupportsDefaultToolContext(boolean)- Specified by:
supportsDefaultToolContextin interfaceDockingActionIf- Returns:
- true if this action can be activated using the default tool context if the local context is invalid for this action.
-
-