Class WebEngineBuilder
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 Summary
Modifier and TypeMethodDescriptionApplies a function to the WebEngine instance being constructed.build()
Builds and returns an instance of theWebEngine
class.confirmHandler
(Callback<String, Boolean> handler) A builder method that invokes thesetConfirmHandler
method on the instance being constructed.Applies a function to theconfirmHandlerProperty
of the instance being constructed.static WebEngineBuilder
create()
Returns an instance of theWebEngineBuilder
.static WebEngineBuilder
Accepts the constructor arguments ofWebEngine(String)
and returns an instance ofWebEngineBuilder
.createPopupHandler
(Callback<PopupFeatures, WebEngine> handler) A builder method that invokes thesetCreatePopupHandler
method on the instance being constructed.Applies a function to thecreatePopupHandlerProperty
of the instance being constructed.Applies a function to thedocumentProperty
of the instance being constructed.javaScriptEnabled
(boolean value) A builder method that invokes thesetJavaScriptEnabled
method on the instance being constructed.Applies a function to thejavaScriptEnabledProperty
of the instance being constructed.Applies a function to thelocationProperty
of the instance being constructed.onAlert
(EventHandler<WebEvent<String>> handler) A builder method that invokes thesetOnAlert
method on the instance being constructed.Applies a function to theonAlertProperty
of the instance being constructed.onError
(EventHandler<WebErrorEvent> handler) A builder method that invokes thesetOnError
method on the instance being constructed.Applies a function to theonErrorProperty
of the instance being constructed.onResized
(EventHandler<WebEvent<Rectangle2D>> handler) A builder method that invokes thesetOnResized
method on the instance being constructed.Applies a function to theonResizedProperty
of the instance being constructed.onStatusChanged
(EventHandler<WebEvent<String>> handler) A builder method that invokes thesetOnStatusChanged
method on the instance being constructed.Applies a function to theonStatusChangedProperty
of the instance being constructed.onVisibilityChanged
(EventHandler<WebEvent<Boolean>> handler) A builder method that invokes thesetOnVisibilityChanged
method on the instance being constructed.Applies a function to theonVisibilityChangedProperty
of the instance being constructed.promptHandler
(Callback<PromptData, String> handler) A builder method that invokes thesetPromptHandler
method on the instance being constructed.Applies a function to thepromptHandlerProperty
of the instance being constructed.Applies a function to thetitleProperty
of the instance being constructed.A builder method that invokes thesetUserAgent
method on the instance being constructed.Applies a function to theuserAgentProperty
of the instance being constructed.userDataDirectory
(File value) A builder method that invokes thesetUserDataDirectory
method on the instance being constructed.Applies a function to theuserDataDirectoryProperty
of the instance being constructed.userStyleSheetLocation
(String value) A builder method that invokes thesetUserStyleSheetLocation
method on the instance being constructed.Applies a function to theuserStyleSheetLocationProperty
of the instance being constructed.
-
Method Details
-
create
Returns an instance of theWebEngineBuilder
.- Returns:
- an instance of the
WebEngineBuilder
.
-
create
Accepts the constructor arguments ofWebEngine(String)
and returns an instance ofWebEngineBuilder
.- Returns:
- an instance of the
WebEngineBuilder
.
-
build
Builds and returns an instance of theWebEngine
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
Applies a function to the WebEngine instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
confirmHandler
A builder method that invokes thesetConfirmHandler
method on the instance being constructed.- Returns:
- builder instance
-
createPopupHandler
A builder method that invokes thesetCreatePopupHandler
method on the instance being constructed.- Returns:
- builder instance
-
javaScriptEnabled
A builder method that invokes thesetJavaScriptEnabled
method on the instance being constructed.- Returns:
- builder instance
-
onAlert
A builder method that invokes thesetOnAlert
method on the instance being constructed.- Returns:
- builder instance
-
onError
A builder method that invokes thesetOnError
method on the instance being constructed.- Returns:
- builder instance
-
onResized
A builder method that invokes thesetOnResized
method on the instance being constructed.- Returns:
- builder instance
-
onStatusChanged
A builder method that invokes thesetOnStatusChanged
method on the instance being constructed.- Returns:
- builder instance
-
onVisibilityChanged
A builder method that invokes thesetOnVisibilityChanged
method on the instance being constructed.- Returns:
- builder instance
-
promptHandler
A builder method that invokes thesetPromptHandler
method on the instance being constructed.- Returns:
- builder instance
-
userAgent
A builder method that invokes thesetUserAgent
method on the instance being constructed.- Returns:
- builder instance
-
userDataDirectory
A builder method that invokes thesetUserDataDirectory
method on the instance being constructed.- Returns:
- builder instance
-
userStyleSheetLocation
A builder method that invokes thesetUserStyleSheetLocation
method on the instance being constructed.- Returns:
- builder instance
-
confirmHandlerPropertyApply
public WebEngineBuilder confirmHandlerPropertyApply(Consumer<ObjectProperty<Callback<String, Boolean>>> op) Applies a function to theconfirmHandlerProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 thecreatePopupHandlerProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.createPopupHandlerProperty().bind(anotherProperty)) // Use shorthand form .createPopupHandlerPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
documentPropertyApply
Applies a function to thedocumentProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.documentProperty().bind(anotherProperty)) // Use shorthand form .documentPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
javaScriptEnabledPropertyApply
Applies a function to thejavaScriptEnabledProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.javaScriptEnabledProperty().bind(anotherProperty)) // Use shorthand form .javaScriptEnabledPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
locationPropertyApply
Applies a function to thelocationProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 theonAlertProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 theonErrorProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 theonResizedProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 theonStatusChangedProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 theonVisibilityChangedProperty
of the instance being constructed. This serves as a shorthand form of theapply
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 thepromptHandlerProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.promptHandlerProperty().bind(anotherProperty)) // Use shorthand form .promptHandlerPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
titlePropertyApply
Applies a function to thetitleProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.titleProperty().bind(anotherProperty)) // Use shorthand form .titlePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
userAgentPropertyApply
Applies a function to theuserAgentProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.userAgentProperty().bind(anotherProperty)) // Use shorthand form .userAgentPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
userDataDirectoryPropertyApply
Applies a function to theuserDataDirectoryProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.userDataDirectoryProperty().bind(anotherProperty)) // Use shorthand form .userDataDirectoryPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
userStyleSheetLocationPropertyApply
Applies a function to theuserStyleSheetLocationProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.userStyleSheetLocationProperty().bind(anotherProperty)) // Use shorthand form .userStyleSheetLocationPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-