Class MultiStateDockingAction<T>
- Type Parameters:
T- the type of the user data
- All Implemented Interfaces:
DockingActionIf,HelpDescriptor
- Direct Known Subclasses:
NonToolbarMultiStateAction
The button of this action has a drop-down icon that allows users to change the state of the
button. As the user changes the state of this action,
actionStateChanged(ActionState, EventTrigger) will be called. Clients may also use the
button of this action to respond to button presses by overriding
actionPerformed(ActionContext).
This action is intended primarily for use as toolbar actions. Alternatively, some clients use
this action to add a button to custom widgets. In the custom use case, clients should use
NonToolbarMultiStateAction.
- See Also:
-
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionContext context) This method is called when the user clicks the button when this action is used as part of the defaultDockingActionframework.abstract voidactionStateChanged(ActionState<T> newActionState, EventTrigger trigger) This method will be called as the user changes the selected button statevoidaddActionState(ActionState<T> actionState) Add the suppliedActionState.protected voiddoSetCurrentActionState(ActionState<T> actionState, EventTrigger trigger) List<ActionState<T>> protected List<DockingActionIf> protected List<ActionState<T>> Extension point: Get the states to display when the button is clickedprotected booleanisStateEnabled(ActionState<T> state) Check if the given state can be selectedvoidsetActionStates(List<ActionState<T>> newStates) voidsetCurrentActionState(ActionState<T> actionState) voidvoidsetCurrentActionStateWithTrigger(ActionState<T> actionState, EventTrigger trigger) voidsetDefaultIcon(Icon icon) Sets the icon to use if the active action state does not supply an icon.voidvoidsetMenuBarData(MenuData newMenuData) Sets theMenuDatato be used to put this action on the tool's menu barvoidsetPopupMenuData(MenuData newMenuData) Sets theMenuDatato be used to put this action in the tool's popup menuvoidsetSubGroup(String subGroup) voidsetUseCheckboxForIcons(boolean useCheckboxForIcons) Overrides the default icons for actions shown in popup menu of the multi-state action.protected voidprotected voidsuperSetMenuBarData(MenuData newMenuData) Methods inherited from class docking.action.DockingAction
addPropertyChangeListener, addToWindowWhen, createButton, createMenuItem, dispose, doCreateMenuItem, enabledWhen, firePropertyChanged, getContextClass, getDefaultKeyBindingData, getDescription, getFullName, getHelpInfo, getHelpLocation, getHelpObject, getInceptionFromTheFirstClassThatIsNotUsOrABuilder, getInceptionInformation, getKeyBinding, getKeyBindingData, getKeyBindingType, getMenuBarData, getName, getOwner, getPopupMenuData, getPreferredKeyBindingType, getToolBarData, isAddToPopup, isEnabled, isEnabledForContext, isValidContext, markHelpUnnecessary, popupWhen, removePropertyChangeListener, setAddToAllWindows, setContextClass, setDefaultKeyBindingData, setDescription, setEnabled, setHelpLocation, setKeyBindingData, setToolBarData, setUnvalidatedKeyBindingData, shouldAddToWindow, supportsDefaultContext, toString, validContextWhenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface docking.action.DockingActionIf
createMenuComponent, getOwnerDescription
-
Constructor Details
-
MultiStateDockingAction
Constructor- Parameters:
name- the action nameowner- the owner
-
-
Method Details
-
actionPerformed
This method is called when the user clicks the button when this action is used as part of the defaultDockingActionframework.This is the callback to be overridden when the child wishes to respond to user button presses that are on the button and not the drop-down. The default behavior is to show the popup menu when the button is clicked.
- Specified by:
actionPerformedin interfaceDockingActionIf- Specified by:
actionPerformedin classDockingAction- Parameters:
context- theActionContextobject that provides information about where and how this action was invoked.
-
setUseCheckboxForIcons
public void setUseCheckboxForIcons(boolean useCheckboxForIcons) Overrides the default icons for actions shown in popup menu of the multi-state action.By default, the popup menu items will use the icons as provided by the
ActionState. By passing true to this method, icons will not be used in the popup menu. Instead, a checkbox icon will be used to show the active action state.- Parameters:
useCheckboxForIcons- true to use a checkbox
-
setDefaultIcon
Sets the icon to use if the active action state does not supply an icon.This is useful if you wish for your action states to not use icon, but desire the action itself to have an icon.
- Parameters:
icon- the icon
-
getStates
Extension point: Get the states to display when the button is clickedThis is called when the button is clicked, immediately before the menu is displayed. It is generally recommended to ensure the current state is included in this list. The states will be displayed in the order of the returned list.
- Returns:
- the list of possible states
-
getStateActions
-
setGroup
-
setSubGroup
-
setActionStates
-
getCurrentUserData
-
getCurrentState
-
getAllActionStates
-
setCurrentActionStateByUserData
-
doCreateButton
- Overrides:
doCreateButtonin classDockingAction
-
setMenuBarData
Description copied from class:DockingActionSets theMenuDatato be used to put this action on the tool's menu bar- Overrides:
setMenuBarDatain classDockingAction- Parameters:
newMenuData- the MenuData to be used to put this action on the tool's menu bar
-
superSetMenuBarData
-
setPopupMenuData
Description copied from class:DockingActionSets theMenuDatato be used to put this action in the tool's popup menu- Overrides:
setPopupMenuDatain classDockingAction- Parameters:
newMenuData- the MenuData to be used to put this action on the tool's popup menu
-
getToolTipText
-
showPopup
protected void showPopup()