Class WebEngineBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.web.WebEngineBuilder

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

You can use method chaining to call the builder methods for configuring the WebEngine. Finally, invoke the build method to generate an instance of the WebEngine 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 WebEngineBuilder create()
      Returns an instance of the WebEngineBuilder.
      Returns:
      an instance of the WebEngineBuilder.
    • create

      public static WebEngineBuilder create(String url)
      Accepts the constructor arguments of WebEngine(String) and returns an instance of WebEngineBuilder.
      Returns:
      an instance of the WebEngineBuilder.
    • build

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

      public WebEngineBuilder apply(Consumer<WebEngine> func)
      Applies a function to the WebEngine instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • confirmHandler

      public WebEngineBuilder confirmHandler(Callback<String,Boolean> handler)
      A builder method that invokes the setConfirmHandler method on the instance being constructed.
      Returns:
      builder instance
    • createPopupHandler

      public WebEngineBuilder createPopupHandler(Callback<PopupFeatures,WebEngine> handler)
      A builder method that invokes the setCreatePopupHandler method on the instance being constructed.
      Returns:
      builder instance
    • javaScriptEnabled

      public WebEngineBuilder javaScriptEnabled(boolean value)
      A builder method that invokes the setJavaScriptEnabled method on the instance being constructed.
      Returns:
      builder instance
    • onAlert

      public WebEngineBuilder onAlert(EventHandler<WebEvent<String>> handler)
      A builder method that invokes the setOnAlert method on the instance being constructed.
      Returns:
      builder instance
    • onError

      public WebEngineBuilder onError(EventHandler<WebErrorEvent> handler)
      A builder method that invokes the setOnError method on the instance being constructed.
      Returns:
      builder instance
    • onResized

      public WebEngineBuilder onResized(EventHandler<WebEvent<Rectangle2D>> handler)
      A builder method that invokes the setOnResized method on the instance being constructed.
      Returns:
      builder instance
    • onStatusChanged

      public WebEngineBuilder onStatusChanged(EventHandler<WebEvent<String>> handler)
      A builder method that invokes the setOnStatusChanged method on the instance being constructed.
      Returns:
      builder instance
    • onVisibilityChanged

      public WebEngineBuilder onVisibilityChanged(EventHandler<WebEvent<Boolean>> handler)
      A builder method that invokes the setOnVisibilityChanged method on the instance being constructed.
      Returns:
      builder instance
    • promptHandler

      public WebEngineBuilder promptHandler(Callback<PromptData,String> handler)
      A builder method that invokes the setPromptHandler method on the instance being constructed.
      Returns:
      builder instance
    • userAgent

      public WebEngineBuilder userAgent(String value)
      A builder method that invokes the setUserAgent method on the instance being constructed.
      Returns:
      builder instance
    • userDataDirectory

      public WebEngineBuilder userDataDirectory(File value)
      A builder method that invokes the setUserDataDirectory method on the instance being constructed.
      Returns:
      builder instance
    • userStyleSheetLocation

      public WebEngineBuilder userStyleSheetLocation(String value)
      A builder method that invokes the setUserStyleSheetLocation method on the instance being constructed.
      Returns:
      builder instance
    • confirmHandlerPropertyApply

      public WebEngineBuilder confirmHandlerPropertyApply(Consumer<ObjectProperty<Callback<String,Boolean>>> op)
      Applies a function to the confirmHandlerProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.confirmHandlerProperty().bind(anotherProperty))
      
      // Use shorthand form
      .confirmHandlerPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • createPopupHandlerPropertyApply

      public WebEngineBuilder createPopupHandlerPropertyApply(Consumer<ObjectProperty<Callback<PopupFeatures,WebEngine>>> op)
      Applies a function to the createPopupHandlerProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.createPopupHandlerProperty().bind(anotherProperty))
      
      // Use shorthand form
      .createPopupHandlerPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • documentPropertyApply

      public WebEngineBuilder documentPropertyApply(Consumer<ReadOnlyObjectProperty<Document>> op)
      Applies a function to the documentProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.documentProperty().bind(anotherProperty))
      
      // Use shorthand form
      .documentPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • javaScriptEnabledPropertyApply

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

      Example:

      // Use apply
      .apply(obj -> obj.javaScriptEnabledProperty().bind(anotherProperty))
      
      // Use shorthand form
      .javaScriptEnabledPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • locationPropertyApply

      public WebEngineBuilder locationPropertyApply(Consumer<ReadOnlyStringProperty> op)
      Applies a function to the locationProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.locationProperty().bind(anotherProperty))
      
      // Use shorthand form
      .locationPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • onAlertPropertyApply

      public WebEngineBuilder onAlertPropertyApply(Consumer<ObjectProperty<EventHandler<WebEvent<String>>>> op)
      Applies a function to the onAlertProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onAlertProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onAlertPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • onErrorPropertyApply

      public WebEngineBuilder onErrorPropertyApply(Consumer<ObjectProperty<EventHandler<WebErrorEvent>>> op)
      Applies a function to the onErrorProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onErrorProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onErrorPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • onResizedPropertyApply

      public WebEngineBuilder onResizedPropertyApply(Consumer<ObjectProperty<EventHandler<WebEvent<Rectangle2D>>>> op)
      Applies a function to the onResizedProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onResizedProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onResizedPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • onStatusChangedPropertyApply

      public WebEngineBuilder onStatusChangedPropertyApply(Consumer<ObjectProperty<EventHandler<WebEvent<String>>>> op)
      Applies a function to the onStatusChangedProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onStatusChangedProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onStatusChangedPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • onVisibilityChangedPropertyApply

      public WebEngineBuilder onVisibilityChangedPropertyApply(Consumer<ObjectProperty<EventHandler<WebEvent<Boolean>>>> op)
      Applies a function to the onVisibilityChangedProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.onVisibilityChangedProperty().bind(anotherProperty))
      
      // Use shorthand form
      .onVisibilityChangedPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • promptHandlerPropertyApply

      public WebEngineBuilder promptHandlerPropertyApply(Consumer<ObjectProperty<Callback<PromptData,String>>> op)
      Applies a function to the promptHandlerProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.promptHandlerProperty().bind(anotherProperty))
      
      // Use shorthand form
      .promptHandlerPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • titlePropertyApply

      public WebEngineBuilder titlePropertyApply(Consumer<ReadOnlyStringProperty> op)
      Applies a function to the titleProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.titleProperty().bind(anotherProperty))
      
      // Use shorthand form
      .titlePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • userAgentPropertyApply

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

      Example:

      // Use apply
      .apply(obj -> obj.userAgentProperty().bind(anotherProperty))
      
      // Use shorthand form
      .userAgentPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • userDataDirectoryPropertyApply

      public WebEngineBuilder userDataDirectoryPropertyApply(Consumer<ObjectProperty<File>> op)
      Applies a function to the userDataDirectoryProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.userDataDirectoryProperty().bind(anotherProperty))
      
      // Use shorthand form
      .userDataDirectoryPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • userStyleSheetLocationPropertyApply

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

      Example:

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