Class MenuBuilder
MenuBuilder
class constructs instances of the Menu
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 Menu
constructor
and returns an instance of the MenuBuilder
.
You can use method chaining to call the builder methods for configuring the Menu
.
Finally, invoke the build
method to generate an instance of the Menu
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 thesetAccelerator
method on the instance being constructed.Applies a function to theacceleratorProperty
of the instance being constructed.final MenuBuilder
addItems
(Collection<? extends MenuItem> col) Calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.final MenuBuilder
Calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.final MenuBuilder
addStyleClass
(String... elements) Calls theaddAll
method on the ObservableList returned by theMenu#getStyleClass()
method.final MenuBuilder
addStyleClass
(Collection<? extends String> col) Calls theaddAll
method on the ObservableList returned by theMenu#getStyleClass()
method.Applies a function to the Menu instance being constructed.build()
Builds and returns an instance of theMenu
class.static MenuBuilder
create()
Returns an instance of theMenuBuilder
.static MenuBuilder
Accepts the constructor arguments ofMenu(String)
and returns an instance ofMenuBuilder
.static MenuBuilder
Accepts the constructor arguments ofMenu(String, Node)
and returns an instance ofMenuBuilder
.static MenuBuilder
Accepts the constructor arguments ofMenu(String, Node, MenuItem...)
and returns an instance ofMenuBuilder
.disable
(boolean value) A builder method that invokes thesetDisable
method on the instance being constructed.Applies a function to thedisableProperty
of the instance being constructed.A builder method that invokes thesetGraphic
method on the instance being constructed.Applies a function to thegraphicProperty
of the instance being constructed.A builder method that invokes thesetId
method on the instance being constructed.Applies a function to theidProperty
of the instance being constructed.mnemonicParsing
(boolean value) A builder method that invokes thesetMnemonicParsing
method on the instance being constructed.Applies a function to themnemonicParsingProperty
of the instance being constructed.onAction
(EventHandler<ActionEvent> value) A builder method that invokes thesetOnAction
method on the instance being constructed.Applies a function to theonActionProperty
of the instance being constructed.onHidden
(EventHandler<Event> value) A builder method that invokes thesetOnHidden
method on the instance being constructed.Applies a function to theonHiddenProperty
of the instance being constructed.onHiding
(EventHandler<Event> value) A builder method that invokes thesetOnHiding
method on the instance being constructed.Applies a function to theonHidingProperty
of the instance being constructed.onMenuValidation
(EventHandler<Event> value) A builder method that invokes thesetOnMenuValidation
method on the instance being constructed.Applies a function to theonMenuValidationProperty
of the instance being constructed.onShowing
(EventHandler<Event> value) A builder method that invokes thesetOnShowing
method on the instance being constructed.Applies a function to theonShowingProperty
of the instance being constructed.onShown
(EventHandler<Event> value) A builder method that invokes thesetOnShown
method on the instance being constructed.Applies a function to theonShownProperty
of the instance being constructed.Applies a function to theparentMenuProperty
of the instance being constructed.Applies a function to theparentPopupProperty
of the instance being constructed.Applies a function to theshowingProperty
of the instance being constructed.A builder method that invokes thesetStyle
method on the instance being constructed.Applies a function to thestyleProperty
of the instance being constructed.A builder method that invokes thesetText
method on the instance being constructed.Applies a function to thetextProperty
of the instance being constructed.A builder method that invokes thesetUserData
method on the instance being constructed.visible
(boolean value) A builder method that invokes thesetVisible
method on the instance being constructed.Applies a function to thevisibleProperty
of the instance being constructed.static MenuBuilder
withItems
(Collection<? extends MenuItem> col) Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.static MenuBuilder
Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.
-
Method Details
-
create
Returns an instance of theMenuBuilder
.- Returns:
- an instance of the
MenuBuilder
.
-
create
Accepts the constructor arguments ofMenu(String)
and returns an instance ofMenuBuilder
.- Returns:
- an instance of the
MenuBuilder
.
-
create
Accepts the constructor arguments ofMenu(String, Node)
and returns an instance ofMenuBuilder
.- Returns:
- an instance of the
MenuBuilder
.
-
create
Accepts the constructor arguments ofMenu(String, Node, MenuItem...)
and returns an instance ofMenuBuilder
.- Returns:
- an instance of the
MenuBuilder
.
-
build
Builds and returns an instance of theMenu
class.Intermediate builder methods are not evaluated until the
build
method is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
Menu
class
-
apply
Applies a function to the Menu instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
accelerator
A builder method that invokes thesetAccelerator
method on the instance being constructed.- Returns:
- builder instance
-
disable
A builder method that invokes thesetDisable
method on the instance being constructed.- Returns:
- builder instance
-
graphic
A builder method that invokes thesetGraphic
method on the instance being constructed.- Returns:
- builder instance
-
id
A builder method that invokes thesetId
method on the instance being constructed.- Returns:
- builder instance
-
mnemonicParsing
A builder method that invokes thesetMnemonicParsing
method on the instance being constructed.- Returns:
- builder instance
-
onAction
A builder method that invokes thesetOnAction
method on the instance being constructed.- Returns:
- builder instance
-
onHidden
A builder method that invokes thesetOnHidden
method on the instance being constructed.- Returns:
- builder instance
-
onHiding
A builder method that invokes thesetOnHiding
method on the instance being constructed.- Returns:
- builder instance
-
onMenuValidation
A builder method that invokes thesetOnMenuValidation
method on the instance being constructed.- Returns:
- builder instance
-
onShowing
A builder method that invokes thesetOnShowing
method on the instance being constructed.- Returns:
- builder instance
-
onShown
A builder method that invokes thesetOnShown
method on the instance being constructed.- Returns:
- builder instance
-
style
A builder method that invokes thesetStyle
method on the instance being constructed.- Returns:
- builder instance
-
text
A builder method that invokes thesetText
method on the instance being constructed.- Returns:
- builder instance
-
userData
A builder method that invokes thesetUserData
method on the instance being constructed.- Returns:
- builder instance
-
visible
A builder method that invokes thesetVisible
method on the instance being constructed.- Returns:
- builder instance
-
addItems
Calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.- Returns:
- builder instance
-
addItems
Calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.- Returns:
- builder instance
-
withItems
Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.- Returns:
- builder instance
-
withItems
Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theMenu#getItems()
method.- Returns:
- builder instance
-
addStyleClass
Calls theaddAll
method on the ObservableList returned by theMenu#getStyleClass()
method.- Returns:
- builder instance
-
addStyleClass
Calls theaddAll
method on the ObservableList returned by theMenu#getStyleClass()
method.- Returns:
- builder instance
-
acceleratorPropertyApply
Applies a function to theacceleratorProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 thedisableProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 thegraphicProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 theidProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 themnemonicParsingProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.mnemonicParsingProperty().bind(anotherProperty)) // Use shorthand form .mnemonicParsingPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onActionPropertyApply
Applies a function to theonActionProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onActionProperty().bind(anotherProperty)) // Use shorthand form .onActionPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onHiddenPropertyApply
Applies a function to theonHiddenProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onHiddenProperty().bind(anotherProperty)) // Use shorthand form .onHiddenPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onHidingPropertyApply
Applies a function to theonHidingProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onHidingProperty().bind(anotherProperty)) // Use shorthand form .onHidingPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onMenuValidationPropertyApply
Applies a function to theonMenuValidationProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onMenuValidationProperty().bind(anotherProperty)) // Use shorthand form .onMenuValidationPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onShowingPropertyApply
Applies a function to theonShowingProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onShowingProperty().bind(anotherProperty)) // Use shorthand form .onShowingPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onShownPropertyApply
Applies a function to theonShownProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onShownProperty().bind(anotherProperty)) // Use shorthand form .onShownPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
parentMenuPropertyApply
Applies a function to theparentMenuProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 theparentPopupProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.parentPopupProperty().bind(anotherProperty)) // Use shorthand form .parentPopupPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
showingPropertyApply
Applies a function to theshowingProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.showingProperty().bind(anotherProperty)) // Use shorthand form .showingPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
stylePropertyApply
Applies a function to thestyleProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 thetextProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.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 thevisibleProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.visibleProperty().bind(anotherProperty)) // Use shorthand form .visiblePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-