Class ActionUtils
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 javafx.scene.control.ButtonBaseconfigureButton(Action action, javafx.scene.control.ButtonBase button) Takes the providedActionand binds the relevant properties to the suppliedButton.static javafx.scene.control.ButtonBaseconfigureButton(Action action, javafx.scene.control.ButtonBase button, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand binds the relevant properties to the suppliedButton.static javafx.scene.control.MenuItemconfigureMenuItem(Action action, javafx.scene.control.MenuItem menuItem) static javafx.scene.control.ButtoncreateButton(Action action) Takes the providedActionand returns aButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ButtoncreateButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ButtonBarcreateButtonBar(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aButtonBarpopulated with appropriatenodesbound to the providedactions.static javafx.scene.control.CheckBoxcreateCheckBox(Action action) Takes the providedActionand returns aCheckBoxinstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.CheckMenuItemcreateCheckMenuItem(Action action) Takes the providedActionand returns aCheckMenuIteminstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ContextMenucreateContextMenu(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aContextMenupopulated with appropriatenodesbound to the providedactions.static javafx.scene.control.HyperlinkcreateHyperlink(Action action) Takes the providedActionand returns aHyperlinkinstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenucreateMenu(Action action) Takes the providedActionand returns aMenuinstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenuBarcreateMenuBar(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aMenuBarpopulated with appropriatenodesbound to the providedactions.static javafx.scene.control.MenuButtoncreateMenuButton(Action action) Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenuButtoncreateMenuButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenuItemcreateMenuItem(Action action) Takes the providedActionand returns aMenuIteminstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.RadioButtoncreateRadioButton(Action action) Takes the providedActionand returns aRadioButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.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 javafx.scene.control.ToggleButtoncreateToggleButton(Action action) Takes the providedActionand returns aToggleButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ToggleButtoncreateToggleButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedActionand returns aToggleButtoninstance with all relevant properties bound to the properties of the Action.static javafx.scene.control.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(javafx.scene.control.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(javafx.scene.control.MenuItem menuItem) Removes all bindings and listeners which were added when the suppliedMenuItemwas bound to anActionvia one of the methods of this class.static javafx.scene.control.ButtonBarupdateButtonBar(javafx.scene.control.ButtonBar buttonBar, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aButtonBarpopulated with appropriatenodesbound to the providedactions.static javafx.scene.control.ContextMenuupdateContextMenu(javafx.scene.control.ContextMenu menu, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aContextMenupopulated with appropriatenodesbound to the providedactions.static javafx.scene.control.MenuBarupdateMenuBar(javafx.scene.control.MenuBar menuBar, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aMenuBarpopulated with appropriatenodesbound to the providedactions.static javafx.scene.control.ToolBarupdateToolBar(javafx.scene.control.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
public static javafx.scene.control.Button createButton(Action action, ActionUtils.ActionTextBehavior textBehavior) 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
Takes the providedActionand returns aButtoninstance with all relevant properties bound to the properties of the Action. -
configureButton
public static javafx.scene.control.ButtonBase configureButton(Action action, javafx.scene.control.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
-
unconfigureButton
-
createMenuButton
public static javafx.scene.control.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. -
createHyperlink
Takes the providedActionand returns aHyperlinkinstance with all relevant properties bound to the properties of the Action. -
createToggleButton
public static javafx.scene.control.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. -
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:
textBehavior- DefinesActionUtils.ActionTextBehavioractions- TheCollectionofActionthat theSegmentedButtonshould bind to.- 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:
textBehavior- DefinesActionUtils.ActionTextBehavioractions- A varargs array ofActionthat theSegmentedButtonshould bind to.- 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
Takes the providedActionand returns aCheckBoxinstance with all relevant properties bound to the properties of the Action. -
createRadioButton
Takes the providedActionand returns aRadioButtoninstance with all relevant properties bound to the properties of the Action. -
createMenuItem
Takes the providedActionand returns aMenuIteminstance with all relevant properties bound to the properties of the Action. -
configureMenuItem
public static javafx.scene.control.MenuItem configureMenuItem(Action action, javafx.scene.control.MenuItem menuItem) -
unconfigureMenuItem
-
createMenu
Takes the providedActionand returns aMenuinstance with all relevant properties bound to the properties of the Action. -
createCheckMenuItem
Takes the providedActionand returns aCheckMenuIteminstance with all relevant properties bound to the properties of the Action. -
createRadioMenuItem
Takes the providedActionand returns aRadioMenuIteminstance with all relevant properties bound to the properties of the Action. -
createToolBar
public static javafx.scene.control.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.- Parameters:
actions- Theactionsto place on theToolBar.textBehavior- definesActionUtils.ActionTextBehavior- Returns:
- A
ToolBarthat containsnodeswhich are bound to the state of the providedAction
-
updateToolBar
public static javafx.scene.control.ToolBar updateToolBar(javafx.scene.control.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- Parameters:
toolbar- Thetoolbarto updateactions- Theactionsto place on theToolBar.textBehavior- definesActionUtils.ActionTextBehavior- Returns:
- A
ToolBarthat containsnodeswhich are bound to the state of the providedAction
-
createMenuBar
Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aMenuBarpopulated with appropriatenodesbound to the providedactions. -
updateMenuBar
public static javafx.scene.control.MenuBar updateMenuBar(javafx.scene.control.MenuBar menuBar, Collection<? extends Action> actions) 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
public static javafx.scene.control.ButtonBar updateButtonBar(javafx.scene.control.ButtonBar buttonBar, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aButtonBarpopulated with appropriatenodesbound to the providedactions. Previous content of button bar is removed -
createContextMenu
public static javafx.scene.control.ContextMenu createContextMenu(Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and returns aContextMenupopulated with appropriatenodesbound to the providedactions. -
updateContextMenu
public static javafx.scene.control.ContextMenu updateContextMenu(javafx.scene.control.ContextMenu menu, Collection<? extends Action> actions) Takes the providedCollectionofAction(or subclasses, such asActionGroup) instances and updates aContextMenupopulated with appropriatenodesbound to the providedactions. Previous content of context menu is removed
-