Class MenuItemBuilder
java.lang.Object
io.github.sosuisen.jfxbuilder.controls.MenuItemBuilder
The
MenuItemBuilder class constructs instances of the MenuItem class
and offers a fluent interface for creating and configuring it.
This class includes a static create method that accepts the same arguments as the original MenuItem constructor
and returns an instance of the MenuItemBuilder.
You can use method chaining to call the builder methods for configuring the MenuItem.
Finally, invoke the build method to generate an instance of the MenuItem class.
Note that intermediate builder methods are not evaluated until the build method
is called, meaning they are evaluated lazily.
- Author:
- Hidekazu Kubota <hidekazu.kubota@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionaccelerator(KeyCombination value) A builder method that invokes thesetAcceleratormethod on the instance being constructed.Applies a function to theacceleratorPropertyof the instance being constructed.final MenuItemBuilderaddStyleClass(String... elements) Calls theaddAllmethod on the ObservableList returned by theMenuItem#getStyleClass()method.final MenuItemBuilderaddStyleClass(Collection<? extends String> col) Calls theaddAllmethod on the ObservableList returned by theMenuItem#getStyleClass()method.Applies a function to the MenuItem instance being constructed.build()Builds and returns an instance of theMenuItemclass.static MenuItemBuildercreate()Returns an instance of theMenuItemBuilder.static MenuItemBuilderAccepts the constructor arguments ofMenuItem(String)and returns an instance ofMenuItemBuilder.static MenuItemBuilderAccepts the constructor arguments ofMenuItem(String, Node)and returns an instance ofMenuItemBuilder.disable(boolean value) A builder method that invokes thesetDisablemethod on the instance being constructed.Applies a function to thedisablePropertyof the instance being constructed.A builder method that invokes thesetGraphicmethod on the instance being constructed.Applies a function to thegraphicPropertyof the instance being constructed.A builder method that invokes thesetIdmethod on the instance being constructed.Applies a function to theidPropertyof the instance being constructed.mnemonicParsing(boolean value) A builder method that invokes thesetMnemonicParsingmethod on the instance being constructed.Applies a function to themnemonicParsingPropertyof the instance being constructed.onAction(EventHandler<ActionEvent> value) A builder method that invokes thesetOnActionmethod on the instance being constructed.Applies a function to theonActionPropertyof the instance being constructed.onMenuValidation(EventHandler<Event> value) A builder method that invokes thesetOnMenuValidationmethod on the instance being constructed.Applies a function to theonMenuValidationPropertyof the instance being constructed.Applies a function to theparentMenuPropertyof the instance being constructed.Applies a function to theparentPopupPropertyof the instance being constructed.A builder method that invokes thesetStylemethod on the instance being constructed.Applies a function to thestylePropertyof the instance being constructed.A builder method that invokes thesetTextmethod on the instance being constructed.Applies a function to thetextPropertyof the instance being constructed.A builder method that invokes thesetUserDatamethod on the instance being constructed.visible(boolean value) A builder method that invokes thesetVisiblemethod on the instance being constructed.Applies a function to thevisiblePropertyof the instance being constructed.
-
Method Details
-
create
Returns an instance of theMenuItemBuilder.- Returns:
- an instance of the
MenuItemBuilder.
-
create
Accepts the constructor arguments ofMenuItem(String)and returns an instance ofMenuItemBuilder.- Returns:
- an instance of the
MenuItemBuilder.
-
create
Accepts the constructor arguments ofMenuItem(String, Node)and returns an instance ofMenuItemBuilder.- Returns:
- an instance of the
MenuItemBuilder.
-
build
-
apply
Applies a function to the MenuItem instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
accelerator
A builder method that invokes thesetAcceleratormethod on the instance being constructed.- Returns:
- builder instance
-
disable
A builder method that invokes thesetDisablemethod on the instance being constructed.- Returns:
- builder instance
-
graphic
A builder method that invokes thesetGraphicmethod on the instance being constructed.- Returns:
- builder instance
-
id
A builder method that invokes thesetIdmethod on the instance being constructed.- Returns:
- builder instance
-
mnemonicParsing
A builder method that invokes thesetMnemonicParsingmethod on the instance being constructed.- Returns:
- builder instance
-
onAction
A builder method that invokes thesetOnActionmethod on the instance being constructed.- Returns:
- builder instance
-
onMenuValidation
A builder method that invokes thesetOnMenuValidationmethod on the instance being constructed.- Returns:
- builder instance
-
style
A builder method that invokes thesetStylemethod on the instance being constructed.- Returns:
- builder instance
-
text
A builder method that invokes thesetTextmethod on the instance being constructed.- Returns:
- builder instance
-
userData
A builder method that invokes thesetUserDatamethod on the instance being constructed.- Returns:
- builder instance
-
visible
A builder method that invokes thesetVisiblemethod on the instance being constructed.- Returns:
- builder instance
-
addStyleClass
Calls theaddAllmethod on the ObservableList returned by theMenuItem#getStyleClass()method.- Returns:
- builder instance
-
addStyleClass
Calls theaddAllmethod on the ObservableList returned by theMenuItem#getStyleClass()method.- Returns:
- builder instance
-
acceleratorPropertyApply
Applies a function to theacceleratorPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.acceleratorProperty().bind(anotherProperty)) // Use shorthand form .acceleratorPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
disablePropertyApply
Applies a function to thedisablePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.disableProperty().bind(anotherProperty)) // Use shorthand form .disablePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
graphicPropertyApply
Applies a function to thegraphicPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.graphicProperty().bind(anotherProperty)) // Use shorthand form .graphicPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
idPropertyApply
Applies a function to theidPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.idProperty().bind(anotherProperty)) // Use shorthand form .idPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
mnemonicParsingPropertyApply
Applies a function to themnemonicParsingPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.mnemonicParsingProperty().bind(anotherProperty)) // Use shorthand form .mnemonicParsingPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
onActionPropertyApply
public MenuItemBuilder onActionPropertyApply(Consumer<ObjectProperty<EventHandler<ActionEvent>>> op) Applies a function to theonActionPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.onActionProperty().bind(anotherProperty)) // Use shorthand form .onActionPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
onMenuValidationPropertyApply
public MenuItemBuilder onMenuValidationPropertyApply(Consumer<ObjectProperty<EventHandler<Event>>> op) Applies a function to theonMenuValidationPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.onMenuValidationProperty().bind(anotherProperty)) // Use shorthand form .onMenuValidationPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
parentMenuPropertyApply
Applies a function to theparentMenuPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.parentMenuProperty().bind(anotherProperty)) // Use shorthand form .parentMenuPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
parentPopupPropertyApply
Applies a function to theparentPopupPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.parentPopupProperty().bind(anotherProperty)) // Use shorthand form .parentPopupPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
stylePropertyApply
Applies a function to thestylePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.styleProperty().bind(anotherProperty)) // Use shorthand form .stylePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
textPropertyApply
Applies a function to thetextPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.textProperty().bind(anotherProperty)) // Use shorthand form .textPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
visiblePropertyApply
Applies a function to thevisiblePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.visibleProperty().bind(anotherProperty)) // Use shorthand form .visiblePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-