java.lang.Object
org.controlsfx.control.action.ActionUtils
Convenience class for users of the
Action API. Primarily this class
is used to conveniently create UI controls from a given Action (this is
necessary for now as there is no built-in support for Action in JavaFX
UI controls at present).
Some of the methods in this class take a Collection of
actions. In these cases, it is likely they are designed to
work with action groups. For examples on how to work with
these methods, refer to the ActionGroup class documentation.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAction text behavior. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ButtonBaseconfigureButton(Action action, ButtonBase button) static ButtonBaseconfigureButton(Action action, ButtonBase button, ActionUtils.ActionTextBehavior textBehavior) static MenuItemconfigureMenuItem(Action action, MenuItem menuItem) static ButtoncreateButton(Action action) static ButtoncreateButton(Action action, ActionUtils.ActionTextBehavior textBehavior) static ButtonBarcreateButtonBar(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aButtonBarpopulated with appropriatenodesbound to the providedactions.static CheckBoxcreateCheckBox(Action action) static CheckMenuItemcreateCheckMenuItem(Action action) Takes the providedActionand returns aCheckMenuIteminstance with all relevant properties bound to the properties of the Action.static ContextMenucreateContextMenu(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aContextMenupopulated with appropriatenodesbound to the providedactions.static HyperlinkcreateHyperlink(Action action) static MenucreateMenu(Action action) static MenuBarcreateMenuBar(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aMenuBarpopulated with appropriatenodesbound to the providedactions.static MenuButtoncreateMenuButton(Action action) Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.static MenuButtoncreateMenuButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.static MenuItemcreateMenuItem(Action action) static RadioButtoncreateRadioButton(Action action) Takes the providedActionand returns aRadioButtoninstance with all relevant properties bound to the properties of the Action.static RadioMenuItemcreateRadioMenuItem(Action action) Takes the providedActionand returns aRadioMenuIteminstance with all relevant properties bound to the properties of the Action.static SegmentedButtoncreateSegmentedButton(Collection<? extends Action> actions) Takes the providedCollectionofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.static SegmentedButtoncreateSegmentedButton(Action... actions) Takes the provided varargs array ofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.static SegmentedButtoncreateSegmentedButton(ActionUtils.ActionTextBehavior textBehavior, Collection<? extends Action> actions) Takes the providedCollectionofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.static SegmentedButtoncreateSegmentedButton(ActionUtils.ActionTextBehavior textBehavior, Action... actions) Takes the provided varargs array ofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.static ToggleButtoncreateToggleButton(Action action) Takes the providedActionand returns aToggleButtoninstance with all relevant properties bound to the properties of the Action.static ToggleButtoncreateToggleButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aToggleButtoninstance with all relevant properties bound to the properties of the Action.static ToolBarcreateToolBar(Collection<? extends Action> actions, ActionUtils.ActionTextBehavior textBehavior) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aToolBarpopulated with appropriatenodesbound to the providedactions.static voidunconfigureButton(ButtonBase button) Removes all bindings and listeners which were added when the suppliedButtonBasewas bound to anActionvia one of the methods of this class.static voidunconfigureMenuItem(MenuItem menuItem) static ButtonBarupdateButtonBar(ButtonBar buttonBar, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aButtonBarpopulated with appropriatenodesbound to the providedactions.static ContextMenuupdateContextMenu(ContextMenu menu, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aContextMenupopulated with appropriatenodesbound to the providedactions.static MenuBarupdateMenuBar(MenuBar menuBar, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aMenuBarpopulated with appropriatenodesbound to the providedactions.static ToolBarupdateToolBar(ToolBar toolbar, Collection<? extends Action> actions, ActionUtils.ActionTextBehavior textBehavior) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns providedToolBarpopulated with appropriatenodesbound to the providedactions.
-
Field Details
-
ACTION_SEPARATOR
Action representation of the generic separator. Adding this action anywhere in the action tree serves as indication that separator has be created in its place. SeeActionGroupfor example of action tree creation -
ACTION_SPAN
-
-
Method Details
-
createButton
Takes the providedActionand returns aButtoninstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theButtonshould bind to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- A
Buttonthat is bound to the state of the providedAction
-
createButton
-
configureButton
public static ButtonBase configureButton(Action action, ButtonBase button, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand binds the relevant properties to the suppliedButton. This allows for the use of Actions within custom Button subclasses.- Parameters:
action- TheActionthat theButtonshould bind to.button- TheButtonBasethat theActionshould be bound to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- The
ButtonBasethat was bound to theAction.
-
configureButton
Takes the providedActionand binds the relevant properties to the suppliedButton. This allows for the use of Actions within custom Button subclasses.- Parameters:
action- TheActionthat theButtonshould bind to.button- TheButtonBasethat theActionshould be bound to.- Returns:
- The
ButtonBasethat was bound to theAction.
-
unconfigureButton
Removes all bindings and listeners which were added when the suppliedButtonBasewas bound to anActionvia one of the methods of this class.- Parameters:
button- aButtonBasethat was bound to anAction
-
createMenuButton
public static MenuButton createMenuButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theMenuButtonshould bind to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- A
MenuButtonthat is bound to the state of the providedAction
-
createMenuButton
Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theMenuButtonshould bind to.- Returns:
- A
MenuButtonthat is bound to the state of the providedAction
-
createHyperlink
-
createToggleButton
public static ToggleButton createToggleButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aToggleButtoninstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theToggleButtonshould bind to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- A
ToggleButtonthat is bound to the state of the providedAction
-
createToggleButton
Takes the providedActionand returns aToggleButtoninstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theToggleButtonshould bind to.- Returns:
- A
ToggleButtonthat is bound to the state of the providedAction
-
createSegmentedButton
public static SegmentedButton createSegmentedButton(ActionUtils.ActionTextBehavior textBehavior, Collection<? extends Action> actions) Takes the providedCollectionofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.- Parameters:
actions- TheCollectionofActionthat theSegmentedButtonshould bind to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- A
SegmentedButtonthat is bound to the state of the providedActions
-
createSegmentedButton
Takes the providedCollectionofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.- Parameters:
actions- TheCollectionofActionthat theSegmentedButtonshould bind to.- Returns:
- A
SegmentedButtonthat is bound to the state of the providedActions
-
createSegmentedButton
public static SegmentedButton createSegmentedButton(ActionUtils.ActionTextBehavior textBehavior, Action... actions) Takes the provided varargs array ofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.- Parameters:
actions- A varargs array ofActionthat theSegmentedButtonshould bind to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- A
SegmentedButtonthat is bound to the state of the providedActions
-
createSegmentedButton
Takes the provided varargs array ofActionand returns aSegmentedButtoninstance with all relevant properties bound to the properties of the actions.- Parameters:
actions- A varargs array ofActionthat theSegmentedButtonshould bind to.- Returns:
- A
SegmentedButtonthat is bound to the state of the providedActions
-
createCheckBox
-
createRadioButton
Takes the providedActionand returns aRadioButtoninstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theRadioButtonshould bind to.- Returns:
- A
RadioButtonthat is bound to the state of the providedAction
-
createMenuItem
-
configureMenuItem
-
unconfigureMenuItem
-
createMenu
-
createCheckMenuItem
Takes the providedActionand returns aCheckMenuIteminstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theCheckMenuItemshould bind to.- Returns:
- A
CheckMenuItemthat is bound to the state of the providedAction
-
createRadioMenuItem
Takes the providedActionand returns aRadioMenuIteminstance with all relevant properties bound to the properties of the Action.- Parameters:
action- TheActionthat theRadioMenuItemshould bind to.- Returns:
- A
RadioMenuItemthat is bound to the state of the providedAction
-
createToolBar
public static ToolBar createToolBar(Collection<? extends Action> actions, ActionUtils.ActionTextBehavior textBehavior) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aToolBarpopulated with appropriatenodesbound to the providedactions. -
updateToolBar
public static ToolBar updateToolBar(ToolBar toolbar, Collection<? extends Action> actions, ActionUtils.ActionTextBehavior textBehavior) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns providedToolBarpopulated with appropriatenodesbound to the providedactions. Previous toolbar content is removed -
createMenuBar
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aMenuBarpopulated with appropriatenodesbound to the providedactions. -
updateMenuBar
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aMenuBarpopulated with appropriatenodesbound to the providedactions. Previous MenuBar content is removed. -
createButtonBar
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aButtonBarpopulated with appropriatenodesbound to the providedactions. -
updateButtonBar
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aButtonBarpopulated with appropriatenodesbound to the providedactions. Previous content of button bar is removed -
createContextMenu
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aContextMenupopulated with appropriatenodesbound to the providedactions.- Parameters:
actions- Theactionsto place on theContextMenu.- Returns:
- A
ContextMenuthat containsnodeswhich are bound to the state of the providedAction
-
updateContextMenu
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aContextMenupopulated with appropriatenodesbound to the providedactions. Previous content of context menu is removed- Parameters:
menu- Themenuto updateactions- Theactionsto place on theContextMenu.- Returns:
- A
ContextMenuthat containsnodeswhich are bound to the state of the providedAction
-