Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class DialogPane

extends StackPane
Class Inheritance
Imports
com.dlsc.gemsfx.util.FocusUtil, .ResizingBehaviour, javafx.animation.Animation, .Interpolator, .KeyFrame, .KeyValue, .RotateTransition, .Timeline, javafx.application.Platform, javafx.beans.InvalidationListener, .Observable, .WeakInvalidationListener, javafx.beans.binding.Bindings, javafx.beans.property.BooleanProperty, .BooleanPropertyBase, .DoubleProperty, .DoublePropertyBase, .ListProperty, .ObjectProperty, .ReadOnlyBooleanProperty, .ReadOnlyBooleanWrapper, .SimpleBooleanProperty, .SimpleDoubleProperty, .SimpleListProperty, .SimpleObjectProperty, .SimpleStringProperty, .StringProperty, javafx.beans.value.ChangeListener, .WeakChangeListener, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, javafx.event.EventHandler, .WeakEventHandler, javafx.geometry.Insets, .Orientation, .Pos, javafx.scene.Node, .Parent, .Scene, javafx.scene.control.Button, .ButtonBar, .ButtonType, .Label, .ListView, .ProgressIndicator, .TextField, .TextInputControl, javafx.scene.control.skin.ButtonBarSkin, javafx.scene.image.ImageView, javafx.scene.input.KeyCode, .KeyCombination, .KeyEvent, javafx.scene.layout.Pane, .Priority, .Region, .StackPane, .VBox, javafx.scene.shape.Arc, .Circle, .Rectangle, .StrokeLineCap, javafx.stage.Window, javafx.util.Callback, .Duration, .StringConverter, net.synedra.validatorfx.Validator, org.apache.commons.lang3.StringUtils, org.kordamp.ikonli.javafx.FontIcon, org.kordamp.ikonli.materialdesign.MaterialDesign, java.io.PrintWriter, .StringWriter, java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Objects, .Optional, java.util.function.BiConsumer, .Consumer, .Supplier, java.util.prefs.Preferences

A pane that allows applications to display a lightweight dialog right inside the application window instead of a separate window. The dialogs are animated and fly-in from top to center and fly-out from center to top.

The dialog pane should be added to the application in such a way that it covers the entire area of the window. If the application is using a StackPane as its root container then the dialog pane can simply be added as the last child of the StackPane.

Example

To show an information dialog one can simply call:

   dialogPane.showInformation("My Title", "My message");

If an application wants to act upon the button that was pressed after showing a confirmation dialog then the following can be written:

    dialogPane.showConfirmation("Confirm", "Really delete?").onClose(buttonType -> { ... });

The pane supports factories for creating the header and the footer. This allows application developers to completely replace those elements of the dialogs. Default factories are already registered and will be used if not replaced.
See Also
setHeaderFactory(Callback), </p>

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private class
public static class
DialogPane.DefaultResizeHandler

The default resize handler is used to persist the dialog's width and height after the user performed a resize operation on the dialog.

public static class
DialogPane.Dialog<
the type of value that the dialog can return
T
>

Represents a dialog that can be displayed to the user.

public static class
DialogPane.DialogButtonBar

The default footer / button bar implementation for dialogs managed by the DialogPane.

public static class
DialogPane.DialogHeader

The default header implementation for dialogs managed by the DialogPane.

public static enum
DialogPane.Type

The various dialog types supported by DialogPane.

Field Summary

Modifier and TypeField and Description
private final BooleanProperty
private final ObjectProperty<Duration>
private final ObjectProperty<StringConverter<ButtonType>>
private final ObservableList<DialogPane.ContentPane>
private final ListProperty<DialogPane.Dialog<?>>
private final Map<DialogPane.ContentPane, DoubleProperty>
private final EventHandler<KeyEvent>
private final BooleanProperty
private final ObjectProperty<Callback<DialogPane.Dialog<?>, Node>>
private final GlassPane
private final ObjectProperty<Callback<DialogPane.Dialog<?>, Node>>
private final ObjectProperty<Supplier<Label>>
private final DoubleProperty
private static final String
private final StringProperty
private final ReadOnlyBooleanWrapper
private final WeakEventHandler<KeyEvent>

Constructor Summary

AccessConstructor and Description
public
DialogPane()

Constructs a new dialog pane.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty

Returns:

true if the dialog will be animated when appearing / disappearing
animateDialogsProperty
()

Determines if the dialogs will be animated when they appear.

public final ObjectProperty<Duration>

Returns:

the animation duration
animationDurationProperty
()

Stores the duration used to animate the fly-in / fly-out of the dialogs.

public final ObjectProperty<StringConverter<ButtonType>>

Returns:

a string converter
converterProperty
()

A string converter can be applied to easily manipulate the default text representation of the various button types.

public final ListProperty<DialogPane.Dialog<?>>

Returns:

the list of dialogs
dialogsProperty
()

Stores the list of currently active dialogs.

private DialogPane.Dialog<ButtonType>
doShowDialog(DialogPane.Type type, String title, String message)

private DialogPane.Dialog<ButtonType>
doShowDialog(DialogPane.Type type, String title, String message, List<ButtonType> buttons)

private void
public final BooleanProperty

Returns:

true if fade-in / fade-out will be used for showing / hiding dialogs
fadeInOutProperty
()

Controls whether the glass pane and the dialogs will animate their opacity during showing or hiding dialogs.

public final ObjectProperty<Callback<DialogPane.Dialog<?>, Node>>

Returns:

the header factory
footerFactoryProperty
()

A callback used as a factory for creating the footer for each dialog.

public final Duration
public final StringConverter<ButtonType>
public final ObservableList<DialogPane.Dialog<?>>

Returns:

the list of dialogs currently showing
getDialogs
()

The list of currently active / showing dialogs.

public final Callback<DialogPane.Dialog<?>, Node>
public final GlassPane

Returns:

the glass pane object
getGlassPane
()

Retrieves the glass pane associated with this dialog pane.

public final Callback<DialogPane.Dialog<?>, Node>
public final Supplier<Label>
public final double
public final String
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final ObjectProperty<Callback<DialogPane.Dialog<?>, Node>>

Returns:

the header factory
headerFactoryProperty
()

A callback used as a factory for creating the header for each dialog.

public void
hideAllDialogs()

Hides all currently active dialogs.

public void
hideDialog(DialogPane.Dialog<?>
the dialog to hide
dialog
)

Hides the given dialog.

public final boolean
public final boolean
public final boolean
public final ObjectProperty<Supplier<Label>>

Returns:

the label supplier / callback / factory
labelSupplierProperty
()

A supplier used for creating the label instances that will be used by the standard dialogs.

protected void
layoutChildren()

Overrides javafx.scene.layout.StackPane.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

public final DoubleProperty

Returns:

the padding around a maximized dialog
maximizedPaddingProperty
()

Defines the padding around a maximized dialog in the dialog pane.

public final StringProperty
public final void
setAnimateDialogs(boolean animate)

public final void
setAnimationDuration(Duration animationDuration)

public final void
public final void
public final void
setFadeInOut(boolean animate)

public final void
public final void
public final void
public final void
setMaximizedPadding(double maximizedPadding)

public final void
setSendButtonText(String sendButtonText)

public final DialogPane.Dialog<Void>

Returns:

the created dialog
showBusyIndicator
()

Creates and shows a dialog that shows a busy indicator / busy animation.

public final DialogPane.Dialog<ButtonType>

Returns:

the dialog
showConfirmation
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
)

Creates and shows a confirmation dialog.

public final DialogPane.Dialog<ButtonType>

Returns:

the dialog
showConfirmation
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
,
List<ButtonType>
the buttons to show in the footer
buttonTypes
)

Creates and shows a confirmation dialog.

public void
showDialog(DialogPane.Dialog<?>
the dialog to show
dialog
)

Makes the given dialog visible in the pane.

public final DialogPane.Dialog<Void>

Returns:

the dialog
showError
(String
the title for the dialog
title
,
String
the main error message
message
)

Creates and shows an error message dialog.

public final DialogPane.Dialog<Void>

Returns:

the dialog
showError
(String
the title for the dialog
title
,
String
the main error message
message
,
Throwable
an exception that will be used to provide more details
exception
)

Creates and shows an error message dialog.

public final DialogPane.Dialog<Void>

Returns:

the dialog
showError
(String
the title for the dialog
title
,
Exception
an exception that will be used to provide the main message additional details
exception
)

Creates and shows an error message dialog.

public final DialogPane.Dialog<Void>

Returns:

the dialog
showError
(String
the title for the dialog
title
,
String
the main error message
message
,
String
additional details
details
)

Creates and shows an error message dialog.

public final DialogPane.Dialog<Void>

Returns:

the dialog
showError
(String
the title for the dialog
title
,
String
the main error message
message
,
String
additional details
details
,
Runnable
an optional action to send out / forward the error message
onSend
)

Creates and shows an error message dialog.

public final DialogPane.Dialog<ButtonType>

Returns:

the dialog
showInformation
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
)

Creates and shows an information dialog.

public final DialogPane.Dialog<ButtonType>

Returns:

the dialog
showInformation
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
,
List<ButtonType>
the list of buttons to create in the footer / button bar
buttons
)

Creates and shows an information dialog.

public final ReadOnlyBooleanProperty

Returns:

true if at least one dialog is currently showing
showingDialogProperty
()

A read-only property used to signal that the pane is currently showing a dialog or not.

public final <
the type of the value provided by the dialog
T
>
DialogPane.Dialog<T>

Returns:

the dialog
showNode
(DialogPane.Type
the type of dialog (info, warning, error, ....)
type
,
String
the text shown in the title section / header of the dialog
title
,
Node
the node to show
node
)

Shows an arbitrary node in a dialog.

public final <
the type of the value provided by the dialog
T
>
DialogPane.Dialog<T>

Returns:

the dialog
showNode
(DialogPane.Type
the type of dialog (info, warning, error, ....)
type
,
String
the text shown in the title section / header of the dialog
title
,
Node
the node to show
node
,
boolean
if true the dialog will use the maximum size available
maximize
)

Shows an arbitrary node in a dialog.

public final <
the type of the value provided by the dialog
T
>
DialogPane.Dialog<T>

Returns:

the dialog
showNode
(DialogPane.Type
the type of dialog (info, warning, error, ....)
type
,
String
the text shown in the title section / header of the dialog
title
,
Node
the node to show
node
,
List<ButtonType>
a list of buttons to create inside the footer / button bar
buttons
)

Shows an arbitrary node in a dialog.

public final <
the type of the value provided by the dialog
T
>
DialogPane.Dialog<T>

Returns:

the dialog
showNode
(DialogPane.Type
the type of dialog (info, warning, error, ....)
type
,
String
the text shown in the title section / header of the dialog
title
,
Node
the node to show
node
,
boolean
if true the dialog will use the maximum size available
maximize
,
List<ButtonType>
a list of buttons to create inside the footer / button bar
buttons
)

Shows an arbitrary node in a dialog.

public final <
the type of the value provided by the dialog
T
>
DialogPane.Dialog<T>

Returns:

the dialog
showNode
(DialogPane.Type
the type of dialog (info, warning, error, ....)
type
,
String
the text shown in the title section / header of the dialog
title
,
Node
the node to show
node
,
boolean
if true the dialog will use the maximum size available
maximize
,
List<ButtonType>
a list of buttons to create inside the footer / button bar
buttons
,
boolean
if true all buttons in the footer / button bar will have the same width
sameWidthButtons
)

Shows an arbitrary node in a dialog.

public final <
the type of the value provided by the dialog
T
>
DialogPane.Dialog<T>

Returns:

the dialog
showNode
(DialogPane.Type
the type of dialog (info, warning, error, ....)
type
,
String
the text shown in the title section / header of the dialog
title
,
Node
the node to show
node
,
boolean
if true the dialog will use the maximum size available
maximize
,
List<ButtonType>
a list of buttons to create inside the footer / button bar
buttons
,
boolean
if true all buttons in the footer / button bar will have the same width
sameWidthButtons
,
BooleanProperty
a validity property that will be bound to the validity property of the dialog
validProperty
)

Shows an arbitrary node in a dialog.

public final DialogPane.Dialog<String>

Returns:

the dialog
showTextInput
(String
the text shown in the header of the dialog
title
,
String
the initial text to show
text
)

Creates and shows a text input dialog.

public final DialogPane.Dialog<String>

Returns:

the dialog
showTextInput
(String
the text shown in the header of the dialog
title
,
String
the initial text to show
text
,
boolean
if true the dialog will show a text area, otherwise a text field
multiline
)

Creates and shows a text input dialog.

public final DialogPane.Dialog<String>

Returns:

the dialog
showTextInput
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
,
String
the initial text to show
text
,
boolean
if true the dialog will show a text area, otherwise a text field
multiline
)

Creates and shows a text input dialog.

public final DialogPane.Dialog<String>

Returns:

the dialog
showTextInput
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
,
String
the prompt text for the text input control
prompt
,
String
the initial text to show
text
,
boolean
if true the dialog will show a text area, otherwise a text field
multiline
)

Creates and shows a text input dialog.

public final DialogPane.Dialog<String>

Returns:

the dialog
showTextInput
(String
the text shown in the header of the dialog
title
,
String
the main message, usually a question
message
,
String
the prompt text for the text input control
prompt
,
String
the initial text to show
text
,
boolean
if true the dialog will show a text area, otherwise a text field
multiline
,
List<ButtonType> buttonTypes)

Creates and shows a text input dialog.

public final DialogPane.Dialog<ButtonType>

Returns:

the dialog
showWarning
(String
the text shown in the header of the dialog
title
,
String
the warning message
message
)

Creates and shows a warning dialog.

public final DialogPane.Dialog<ButtonType>

Returns:

the dialog
showWarning
(String
the text shown in the header of the dialog
title
,
String
the warning message
message
,
List<ButtonType> buttonTypes)

Creates and shows a warning dialog.

private void
slideInOut(double visibility, DoubleProperty visibilityProperty, Supplier<Node> nodeSupplier)

Inherited from javafx.scene.layout.StackPane:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthgetAlignmentgetAlignmentgetClassCssMetaDatagetContentBiasgetCssMetaDatagetMarginrequestLayoutsetAlignmentsetAlignmentsetMargin