- java.lang.Object
-
- org.controlsfx.control.action.ActionUtils
-
public class ActionUtils extends Object
Convenience class for users of theActionAPI. 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
Collectionofactions. In these cases, it is likely they are designed to work withaction groups. For examples on how to work with these methods, refer to theActionGroupclass documentation.- See Also:
Action,ActionGroup
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classActionUtils.ActionTextBehaviorAction text behavior.
-
Field Summary
Fields Modifier and Type Field Description static ActionACTION_SEPARATORAction representation of the generic separator.static ActionACTION_SPAN
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
ACTION_SEPARATOR
public static Action 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
public static Action ACTION_SPAN
-
-
Method Detail
-
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
public static javafx.scene.control.Button createButton(Action action)
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
public static javafx.scene.control.ButtonBase configureButton(Action action, javafx.scene.control.ButtonBase button)
Takes the providedActionand 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 suppliedButtonBasewas bound to anActionvia one of the methods of this class.- Parameters:
button- aButtonBasethat was bound to anAction
-
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
public static javafx.scene.control.MenuButton createMenuButton(Action action)
Takes the providedActionand returns aMenuButtoninstance with all relevant properties bound to the properties of the Action.
-
createHyperlink
public static javafx.scene.control.Hyperlink createHyperlink(Action action)
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
public static javafx.scene.control.ToggleButton createToggleButton(Action action)
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:
actions- TheCollectionofActionthat theSegmentedButtonshould bind to.textBehavior- DefinesActionUtils.ActionTextBehavior- Returns:
- A
SegmentedButtonthat is bound to the state of the providedActions
-
createSegmentedButton
public static SegmentedButton createSegmentedButton(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.- 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
public static SegmentedButton createSegmentedButton(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.- Returns:
- A
SegmentedButtonthat is bound to the state of the providedActions
-
createCheckBox
public static javafx.scene.control.CheckBox createCheckBox(Action action)
Takes the providedActionand returns aCheckBoxinstance with all relevant properties bound to the properties of the Action.
-
createRadioButton
public static javafx.scene.control.RadioButton createRadioButton(Action action)
Takes the providedActionand returns aRadioButtoninstance with all relevant properties bound to the properties of the Action.
-
createMenuItem
public static javafx.scene.control.MenuItem createMenuItem(Action action)
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
public static void unconfigureMenuItem(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.- Parameters:
menuItem- aMenuItemthat was bound to anAction
-
createMenu
public static javafx.scene.control.Menu createMenu(Action action)
Takes the providedActionand returns aMenuinstance with all relevant properties bound to the properties of the Action.
-
createCheckMenuItem
public static javafx.scene.control.CheckMenuItem createCheckMenuItem(Action action)
Takes the providedActionand returns aCheckMenuIteminstance with all relevant properties bound to the properties of the Action.
-
createRadioMenuItem
public static javafx.scene.control.RadioMenuItem createRadioMenuItem(Action action)
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
public static javafx.scene.control.MenuBar createMenuBar(Collection<? extends Action> actions)
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
public static javafx.scene.control.ButtonBar createButtonBar(Collection<? extends Action> actions)
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
-
-