Class CustomMenuItemBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.controls.CustomMenuItemBuilder

public class CustomMenuItemBuilder extends Object
The CustomMenuItemBuilder class constructs instances of the CustomMenuItem 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 CustomMenuItem constructor and returns an instance of the CustomMenuItemBuilder.

You can use method chaining to call the builder methods for configuring the CustomMenuItem. Finally, invoke the build method to generate an instance of the CustomMenuItem 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 Details

    • create

      public static CustomMenuItemBuilder create()
      Returns an instance of the CustomMenuItemBuilder.
      Returns:
      an instance of the CustomMenuItemBuilder.
    • create

      public static CustomMenuItemBuilder create(Node node)
      Accepts the constructor arguments of CustomMenuItem(Node) and returns an instance of CustomMenuItemBuilder.
      Returns:
      an instance of the CustomMenuItemBuilder.
    • create

      public static CustomMenuItemBuilder create(Node node, boolean hideOnClick)
      Accepts the constructor arguments of CustomMenuItem(Node, boolean) and returns an instance of CustomMenuItemBuilder.
      Returns:
      an instance of the CustomMenuItemBuilder.
    • build

      public CustomMenuItem build()
      Builds and returns an instance of the CustomMenuItem 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 CustomMenuItem class
    • apply

      Applies a function to the CustomMenuItem instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • accelerator

      public CustomMenuItemBuilder accelerator(KeyCombination value)
      A builder method that invokes the setAccelerator method on the instance being constructed.
      Returns:
      builder instance
    • content

      public CustomMenuItemBuilder content(Node value)
      A builder method that invokes the setContent method on the instance being constructed.
      Returns:
      builder instance
    • disable

      public CustomMenuItemBuilder disable(boolean value)
      A builder method that invokes the setDisable method on the instance being constructed.
      Returns:
      builder instance
    • graphic

      public CustomMenuItemBuilder graphic(Node value)
      A builder method that invokes the setGraphic method on the instance being constructed.
      Returns:
      builder instance
    • hideOnClick

      public CustomMenuItemBuilder hideOnClick(boolean value)
      A builder method that invokes the setHideOnClick method on the instance being constructed.
      Returns:
      builder instance
    • id

      public CustomMenuItemBuilder id(String value)
      A builder method that invokes the setId method on the instance being constructed.
      Returns:
      builder instance
    • mnemonicParsing

      public CustomMenuItemBuilder mnemonicParsing(boolean value)
      A builder method that invokes the setMnemonicParsing method on the instance being constructed.
      Returns:
      builder instance
    • onAction

      A builder method that invokes the setOnAction method on the instance being constructed.
      Returns:
      builder instance
    • onMenuValidation

      public CustomMenuItemBuilder onMenuValidation(EventHandler<Event> value)
      A builder method that invokes the setOnMenuValidation method on the instance being constructed.
      Returns:
      builder instance
    • style

      public CustomMenuItemBuilder style(String value)
      A builder method that invokes the setStyle method on the instance being constructed.
      Returns:
      builder instance
    • text

      public CustomMenuItemBuilder text(String value)
      A builder method that invokes the setText method on the instance being constructed.
      Returns:
      builder instance
    • userData

      public CustomMenuItemBuilder userData(Object value)
      A builder method that invokes the setUserData method on the instance being constructed.
      Returns:
      builder instance
    • visible

      public CustomMenuItemBuilder visible(boolean value)
      A builder method that invokes the setVisible method on the instance being constructed.
      Returns:
      builder instance
    • addStyleClass

      public final CustomMenuItemBuilder addStyleClass(String... elements)
      Calls the addAll method on the ObservableList returned by the CustomMenuItem#getStyleClass() method.
      Returns:
      builder instance
    • addStyleClass

      public final CustomMenuItemBuilder addStyleClass(Collection<? extends String> col)
      Calls the addAll method on the ObservableList returned by the CustomMenuItem#getStyleClass() method.
      Returns:
      builder instance
    • acceleratorPropertyApply

      public CustomMenuItemBuilder acceleratorPropertyApply(Consumer<ObjectProperty<KeyCombination>> op)
      Applies a function to the acceleratorProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.acceleratorProperty().bind(anotherProperty))
      
      // Use shorthand form
      .acceleratorPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • contentPropertyApply

      public CustomMenuItemBuilder contentPropertyApply(Consumer<ObjectProperty<Node>> op)
      Applies a function to the contentProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.contentProperty().bind(anotherProperty))
      
      // Use shorthand form
      .contentPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • disablePropertyApply

      public CustomMenuItemBuilder disablePropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the disableProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.disableProperty().bind(anotherProperty))
      
      // Use shorthand form
      .disablePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • graphicPropertyApply

      public CustomMenuItemBuilder graphicPropertyApply(Consumer<ObjectProperty<Node>> op)
      Applies a function to the graphicProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.graphicProperty().bind(anotherProperty))
      
      // Use shorthand form
      .graphicPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • hideOnClickPropertyApply

      public CustomMenuItemBuilder hideOnClickPropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the hideOnClickProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.hideOnClickProperty().bind(anotherProperty))
      
      // Use shorthand form
      .hideOnClickPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • idPropertyApply

      public CustomMenuItemBuilder idPropertyApply(Consumer<StringProperty> op)
      Applies a function to the idProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.idProperty().bind(anotherProperty))
      
      // Use shorthand form
      .idPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • mnemonicParsingPropertyApply

      public CustomMenuItemBuilder mnemonicParsingPropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the mnemonicParsingProperty of the instance being constructed. This serves as a shorthand form of the apply 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 the onActionProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onActionProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onActionPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • onMenuValidationPropertyApply

      public CustomMenuItemBuilder onMenuValidationPropertyApply(Consumer<ObjectProperty<EventHandler<Event>>> op)
      Applies a function to the onMenuValidationProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onMenuValidationProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onMenuValidationPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • parentMenuPropertyApply

      public CustomMenuItemBuilder parentMenuPropertyApply(Consumer<ReadOnlyObjectProperty<Menu>> op)
      Applies a function to the parentMenuProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.parentMenuProperty().bind(anotherProperty))
      
      // Use shorthand form
      .parentMenuPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • parentPopupPropertyApply

      public CustomMenuItemBuilder parentPopupPropertyApply(Consumer<ReadOnlyObjectProperty<ContextMenu>> op)
      Applies a function to the parentPopupProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.parentPopupProperty().bind(anotherProperty))
      
      // Use shorthand form
      .parentPopupPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • stylePropertyApply

      public CustomMenuItemBuilder stylePropertyApply(Consumer<StringProperty> op)
      Applies a function to the styleProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.styleProperty().bind(anotherProperty))
      
      // Use shorthand form
      .stylePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • textPropertyApply

      public CustomMenuItemBuilder textPropertyApply(Consumer<StringProperty> op)
      Applies a function to the textProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.textProperty().bind(anotherProperty))
      
      // Use shorthand form
      .textPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • visiblePropertyApply

      public CustomMenuItemBuilder visiblePropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the visibleProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.visibleProperty().bind(anotherProperty))
      
      // Use shorthand form
      .visiblePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance