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 enum
Action text behavior. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.scene.control.ButtonBase
configureButton
(Action action, javafx.scene.control.ButtonBase button) Takes the providedAction
and binds the relevant properties to the suppliedButton
.static javafx.scene.control.ButtonBase
configureButton
(Action action, javafx.scene.control.ButtonBase button, ActionUtils.ActionTextBehavior textBehavior) Takes the providedAction
and binds the relevant properties to the suppliedButton
.static javafx.scene.control.MenuItem
configureMenuItem
(Action action, javafx.scene.control.MenuItem menuItem) static javafx.scene.control.Button
createButton
(Action action) Takes the providedAction
and returns aButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.Button
createButton
(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedAction
and returns aButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ButtonBar
createButtonBar
(Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aButtonBar
populated with appropriatenodes
bound to the providedactions
.static javafx.scene.control.CheckBox
createCheckBox
(Action action) Takes the providedAction
and returns aCheckBox
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.CheckMenuItem
createCheckMenuItem
(Action action) Takes the providedAction
and returns aCheckMenuItem
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ContextMenu
createContextMenu
(Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aContextMenu
populated with appropriatenodes
bound to the providedactions
.static javafx.scene.control.Hyperlink
createHyperlink
(Action action) Takes the providedAction
and returns aHyperlink
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.Menu
createMenu
(Action action) Takes the providedAction
and returns aMenu
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenuBar
createMenuBar
(Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aMenuBar
populated with appropriatenodes
bound to the providedactions
.static javafx.scene.control.MenuButton
createMenuButton
(Action action) Takes the providedAction
and returns aMenuButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenuButton
createMenuButton
(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedAction
and returns aMenuButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.MenuItem
createMenuItem
(Action action) Takes the providedAction
and returns aMenuItem
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.RadioButton
createRadioButton
(Action action) Takes the providedAction
and returns aRadioButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.RadioMenuItem
createRadioMenuItem
(Action action) Takes the providedAction
and returns aRadioMenuItem
instance with all relevant properties bound to the properties of the Action.static SegmentedButton
createSegmentedButton
(Collection<? extends Action> actions) Takes the providedCollection
ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.static SegmentedButton
createSegmentedButton
(Action... actions) Takes the provided varargs array ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.static SegmentedButton
createSegmentedButton
(ActionUtils.ActionTextBehavior textBehavior, Collection<? extends Action> actions) Takes the providedCollection
ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.static SegmentedButton
createSegmentedButton
(ActionUtils.ActionTextBehavior textBehavior, Action... actions) Takes the provided varargs array ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.static javafx.scene.control.ToggleButton
createToggleButton
(Action action) Takes the providedAction
and returns aToggleButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ToggleButton
createToggleButton
(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedAction
and returns aToggleButton
instance with all relevant properties bound to the properties of the Action.static javafx.scene.control.ToolBar
createToolBar
(Collection<? extends Action> actions, ActionUtils.ActionTextBehavior textBehavior) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aToolBar
populated with appropriatenodes
bound to the providedactions
.static void
unconfigureButton
(javafx.scene.control.ButtonBase button) Removes all bindings and listeners which were added when the suppliedButtonBase
was bound to anAction
via one of the methods of this class.static void
unconfigureMenuItem
(javafx.scene.control.MenuItem menuItem) Removes all bindings and listeners which were added when the suppliedMenuItem
was bound to anAction
via one of the methods of this class.static javafx.scene.control.ButtonBar
updateButtonBar
(javafx.scene.control.ButtonBar buttonBar, Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and updates aButtonBar
populated with appropriatenodes
bound to the providedactions
.static javafx.scene.control.ContextMenu
updateContextMenu
(javafx.scene.control.ContextMenu menu, Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and updates aContextMenu
populated with appropriatenodes
bound to the providedactions
.static javafx.scene.control.MenuBar
updateMenuBar
(javafx.scene.control.MenuBar menuBar, Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and updates aMenuBar
populated with appropriatenodes
bound to the providedactions
.static javafx.scene.control.ToolBar
updateToolBar
(javafx.scene.control.ToolBar toolbar, Collection<? extends Action> actions, ActionUtils.ActionTextBehavior textBehavior) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns providedToolBar
populated with appropriatenodes
bound 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. SeeActionGroup
for example of action tree creation -
ACTION_SPAN
-
-
Method Details
-
createButton
public static javafx.scene.control.Button createButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedAction
and returns aButton
instance with all relevant properties bound to the properties of the Action.- Parameters:
action
- TheAction
that theButton
should bind to.textBehavior
- DefinesActionUtils.ActionTextBehavior
- Returns:
- A
Button
that is bound to the state of the providedAction
-
createButton
Takes the providedAction
and returns aButton
instance 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 providedAction
and binds the relevant properties to the suppliedButton
. This allows for the use of Actions within custom Button subclasses.- Parameters:
action
- TheAction
that theButton
should bind to.button
- TheButtonBase
that theAction
should be bound to.textBehavior
- DefinesActionUtils.ActionTextBehavior
- Returns:
- The
ButtonBase
that was bound to theAction
.
-
configureButton
public static javafx.scene.control.ButtonBase configureButton(Action action, javafx.scene.control.ButtonBase button) Takes the providedAction
and binds the relevant properties to the suppliedButton
. This allows for the use of Actions within custom Button subclasses. -
unconfigureButton
public static void unconfigureButton(javafx.scene.control.ButtonBase button) Removes all bindings and listeners which were added when the suppliedButtonBase
was bound to anAction
via one of the methods of this class.- Parameters:
button
- aButtonBase
that was bound to anAction
-
createMenuButton
public static javafx.scene.control.MenuButton createMenuButton(Action action, ActionUtils.ActionTextBehavior textBehavior) Takes the providedAction
and returns aMenuButton
instance with all relevant properties bound to the properties of the Action.- Parameters:
action
- TheAction
that theMenuButton
should bind to.textBehavior
- DefinesActionUtils.ActionTextBehavior
- Returns:
- A
MenuButton
that is bound to the state of the providedAction
-
createMenuButton
Takes the providedAction
and returns aMenuButton
instance with all relevant properties bound to the properties of the Action. -
createHyperlink
Takes the providedAction
and returns aHyperlink
instance 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 providedAction
and returns aToggleButton
instance with all relevant properties bound to the properties of the Action.- Parameters:
action
- TheAction
that theToggleButton
should bind to.textBehavior
- DefinesActionUtils.ActionTextBehavior
- Returns:
- A
ToggleButton
that is bound to the state of the providedAction
-
createToggleButton
Takes the providedAction
and returns aToggleButton
instance 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 providedCollection
ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.- Parameters:
textBehavior
- DefinesActionUtils.ActionTextBehavior
actions
- TheCollection
ofAction
that theSegmentedButton
should bind to.- Returns:
- A
SegmentedButton
that is bound to the state of the providedAction
s
-
createSegmentedButton
Takes the providedCollection
ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.- Parameters:
actions
- TheCollection
ofAction
that theSegmentedButton
should bind to.- Returns:
- A
SegmentedButton
that is bound to the state of the providedAction
s
-
createSegmentedButton
public static SegmentedButton createSegmentedButton(ActionUtils.ActionTextBehavior textBehavior, Action... actions) Takes the provided varargs array ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.- Parameters:
textBehavior
- DefinesActionUtils.ActionTextBehavior
actions
- A varargs array ofAction
that theSegmentedButton
should bind to.- Returns:
- A
SegmentedButton
that is bound to the state of the providedAction
s
-
createSegmentedButton
Takes the provided varargs array ofAction
and returns aSegmentedButton
instance with all relevant properties bound to the properties of the actions.- Parameters:
actions
- A varargs array ofAction
that theSegmentedButton
should bind to.- Returns:
- A
SegmentedButton
that is bound to the state of the providedAction
s
-
createCheckBox
Takes the providedAction
and returns aCheckBox
instance with all relevant properties bound to the properties of the Action. -
createRadioButton
Takes the providedAction
and returns aRadioButton
instance with all relevant properties bound to the properties of the Action. -
createMenuItem
Takes the providedAction
and returns aMenuItem
instance 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
public static void unconfigureMenuItem(javafx.scene.control.MenuItem menuItem) Removes all bindings and listeners which were added when the suppliedMenuItem
was bound to anAction
via one of the methods of this class.- Parameters:
menuItem
- aMenuItem
that was bound to anAction
-
createMenu
Takes the providedAction
and returns aMenu
instance with all relevant properties bound to the properties of the Action. -
createCheckMenuItem
Takes the providedAction
and returns aCheckMenuItem
instance with all relevant properties bound to the properties of the Action. -
createRadioMenuItem
Takes the providedAction
and returns aRadioMenuItem
instance 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 providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aToolBar
populated with appropriatenodes
bound to the providedactions
.- Parameters:
actions
- Theactions
to place on theToolBar
.textBehavior
- definesActionUtils.ActionTextBehavior
- Returns:
- A
ToolBar
that containsnodes
which 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 providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns providedToolBar
populated with appropriatenodes
bound to the providedactions
. Previous toolbar content is removed- Parameters:
toolbar
- Thetoolbar
to updateactions
- Theactions
to place on theToolBar
.textBehavior
- definesActionUtils.ActionTextBehavior
- Returns:
- A
ToolBar
that containsnodes
which are bound to the state of the providedAction
-
createMenuBar
Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aMenuBar
populated with appropriatenodes
bound to the providedactions
. -
updateMenuBar
public static javafx.scene.control.MenuBar updateMenuBar(javafx.scene.control.MenuBar menuBar, Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and updates aMenuBar
populated with appropriatenodes
bound to the providedactions
. Previous MenuBar content is removed. -
createButtonBar
Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aButtonBar
populated with appropriatenodes
bound to the providedactions
. -
updateButtonBar
public static javafx.scene.control.ButtonBar updateButtonBar(javafx.scene.control.ButtonBar buttonBar, Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and updates aButtonBar
populated with appropriatenodes
bound to the providedactions
. Previous content of button bar is removed -
createContextMenu
public static javafx.scene.control.ContextMenu createContextMenu(Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and returns aContextMenu
populated with appropriatenodes
bound to the providedactions
. -
updateContextMenu
public static javafx.scene.control.ContextMenu updateContextMenu(javafx.scene.control.ContextMenu menu, Collection<? extends Action> actions) Takes the providedCollection
ofAction
(or subclasses, such asActionGroup
) instances and updates aContextMenu
populated with appropriatenodes
bound to the providedactions
. Previous content of context menu is removed
-