Module MaterialFX

Class MFXGenericDialog

All Implemented Interfaces:
Styleable, EventTarget
Direct Known Subclasses:
MFXFilterDialog

public class MFXGenericDialog extends AbstractMFXDialog
Basic implementation of a modern generic dialog.

It is composed of three main parts:

- the header: which is an HBox containing an icon(optional) and a Label to show the headerTextProperty(). It also contains three buttons to minimize, close and set always on top. All three of them can be hidden. By default they don't do anything, they have been added since this dialog in indented to be used in conjunction with MFXStageDialog, see MFXGenericDialogBuilder.toStageDialogBuilder() for an example on how those buttons are used

- the content: which is just a Label to show the contentTextProperty(), the content can be easily changed in many ways: you can set the property contentProperty(), you can override buildContent() or you can override buildScrollableContent(boolean). By default the dialog uses the content built by buildContent(). The other method, buildScrollableContent(boolean), by default is just wrapping the buildContent() result in a MFXScrollPane

- the footer/actions: which is a HBox or VBox (depending on the actionsOrientationProperty()), which contains a list of arbitrary nodes specified by the user through: addActions(Node...) or addActions(Map.Entry[]), you can also clear them with clearActions(). Note that despite being generic Nodes, it is intended to be used with buttons and the like

This dialog also offers a property to indicate whether the dialog is set to be always on top or not, alwaysOnTopProperty(), also has a new related PseudoClass: ":always-on-top".
  • Property Details

  • Field Details

    • headerLabel

      protected Label headerLabel
    • alwaysOnTopIcon

      protected MFXIconWrapper alwaysOnTopIcon
    • minimizeIcon

      protected MFXIconWrapper minimizeIcon
    • closeIcon

      protected MFXIconWrapper closeIcon
    • actions

      protected Pane actions
    • ALWAYS_ON_TOP_PSEUDO_CLASS

      protected static final PseudoClass ALWAYS_ON_TOP_PSEUDO_CLASS
  • Constructor Details

    • MFXGenericDialog

      public MFXGenericDialog()
    • MFXGenericDialog

      public MFXGenericDialog(String headerText, String contentText)
  • Method Details

    • buildHeader

      protected void buildHeader()
      Builds the default header.
    • buildContent

      protected void buildContent()
      Builds the default dialog's content.
    • buildScrollableContent

      protected void buildScrollableContent(boolean smoothScrolling)
      Builds the same nodes as buildContent() but wrapped in a MFXScrollPane.
      Parameters:
      smoothScrolling - to specify whether to use smooth scrolling on the MFXScrollPane
    • buildActionsPane

      protected void buildActionsPane()
      Builds the actions pane according to the actionsOrientationProperty().

      Note that actions are preserved when changing the Orientation.
    • addActions

      public void addActions(Node... actions)
      Adds the specified nodes to the actions pane.
    • addActions

      @SafeVarargs public final void addActions(Map.Entry<Node,EventHandler<MouseEvent>>... actions)
      Each entry has a Node that will trigger the given action on MouseEvent.MOUSE_CLICKED.

      For each entry, adds the given EventHandler to the given Node, than adds it to the actions pane.

    • clearActions

      public void clearActions()
      Removes all the nodes from the actions pane.
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • getHeaderIcon

      public Node getHeaderIcon()
      Gets the value of the property headerIcon.
      Property description:
      Specifies the header's label icon
    • headerIconProperty

      public ObjectProperty<Node> headerIconProperty()
      Specifies the header's label icon
      See Also:
    • setHeaderIcon

      public void setHeaderIcon(Node headerIcon)
      Sets the value of the property headerIcon.
      Property description:
      Specifies the header's label icon
    • getHeaderText

      public String getHeaderText()
      Gets the value of the property headerText.
      Property description:
      Specifies the header's label text.
    • headerTextProperty

      public StringProperty headerTextProperty()
      Specifies the header's label text.
      See Also:
    • setHeaderText

      public void setHeaderText(String headerText)
      Sets the value of the property headerText.
      Property description:
      Specifies the header's label text.
    • getContent

      public Node getContent()
      Gets the value of the property content.
      Property description:
      Specifies the dialog's content.
    • contentProperty

      public ObjectProperty<Node> contentProperty()
      Specifies the dialog's content.
      See Also:
    • setContent

      public void setContent(Node content)
      Sets the value of the property content.
      Property description:
      Specifies the dialog's content.
    • getContentText

      public String getContentText()
      Gets the value of the property contentText.
      Property description:
      Specifies the dialog's content text.
    • contentTextProperty

      public StringProperty contentTextProperty()
      Specifies the dialog's content text.
      See Also:
    • setContentText

      public void setContentText(String contentText)
      Sets the value of the property contentText.
      Property description:
      Specifies the dialog's content text.
    • isShowClose

      public boolean isShowClose()
      Gets the value of the property showClose.
      Property description:
      Specifies whether to show the close button in the header.
    • showCloseProperty

      public BooleanProperty showCloseProperty()
      Specifies whether to show the close button in the header.
      See Also:
    • setShowClose

      public void setShowClose(boolean showClose)
      Sets the value of the property showClose.
      Property description:
      Specifies whether to show the close button in the header.
    • isShowMinimize

      public boolean isShowMinimize()
      Gets the value of the property showMinimize.
      Property description:
      Specifies whether to show the minimize button in the header.
    • showMinimizeProperty

      public BooleanProperty showMinimizeProperty()
      Specifies whether to show the minimize button in the header.
      See Also:
    • setShowMinimize

      public void setShowMinimize(boolean showMinimize)
      Sets the value of the property showMinimize.
      Property description:
      Specifies whether to show the minimize button in the header.
    • isShowAlwaysOnTop

      public boolean isShowAlwaysOnTop()
      Gets the value of the property showAlwaysOnTop.
      Property description:
      Specifies whether to show the always on top button in the header.
    • showAlwaysOnTopProperty

      public BooleanProperty showAlwaysOnTopProperty()
      Specifies whether to show the always on top button in the header.
      See Also:
    • setShowAlwaysOnTop

      public void setShowAlwaysOnTop(boolean showAlwaysOnTop)
      Sets the value of the property showAlwaysOnTop.
      Property description:
      Specifies whether to show the always on top button in the header.
    • getActionsOrientation

      public Orientation getActionsOrientation()
      Gets the value of the property actionsOrientation.
      Property description:
      Specifies the Orientation of the actions pane.
    • actionsOrientationProperty

      public ObjectProperty<Orientation> actionsOrientationProperty()
      Specifies the Orientation of the actions pane.
      See Also:
    • setActionsOrientation

      public void setActionsOrientation(Orientation actionsOrientation)
      Sets the value of the property actionsOrientation.
      Property description:
      Specifies the Orientation of the actions pane.
    • getOnClose

      public EventHandler<MouseEvent> getOnClose()
      Gets the value of the property onClose.
      Property description:
      Specifies the action to perform when the close button is pressed.
    • onCloseProperty

      public EventHandlerProperty<MouseEvent> onCloseProperty()
      Specifies the action to perform when the close button is pressed.
      See Also:
    • setOnClose

      public void setOnClose(EventHandler<MouseEvent> onClose)
      Sets the value of the property onClose.
      Property description:
      Specifies the action to perform when the close button is pressed.
    • getOnMinimize

      public EventHandler<MouseEvent> getOnMinimize()
      Gets the value of the property onMinimize.
      Property description:
      Specifies the action to perform when the minimize button is pressed.
    • onMinimizeProperty

      public EventHandlerProperty<MouseEvent> onMinimizeProperty()
      Specifies the action to perform when the minimize button is pressed.
      See Also:
    • setOnMinimize

      public void setOnMinimize(EventHandler<MouseEvent> onMinimize)
      Sets the value of the property onMinimize.
      Property description:
      Specifies the action to perform when the minimize button is pressed.
    • getOnAlwaysOnTop

      public EventHandler<MouseEvent> getOnAlwaysOnTop()
      Gets the value of the property onAlwaysOnTop.
      Property description:
      Specifies the action to perform when the always on top button is pressed.
    • onAlwaysOnTopProperty

      public EventHandlerProperty<MouseEvent> onAlwaysOnTopProperty()
      Specifies the action to perform when the always on top button is pressed.
      See Also:
    • setOnAlwaysOnTop

      public void setOnAlwaysOnTop(EventHandler<MouseEvent> onAlwaysOnTop)
      Sets the value of the property onAlwaysOnTop.
      Property description:
      Specifies the action to perform when the always on top button is pressed.
    • isAlwaysOnTop

      public boolean isAlwaysOnTop()
      Gets the value of the property alwaysOnTop.
      Property description:
      Specifies whether the dialog should be always on top. (see class documentation for further details)
    • alwaysOnTopProperty

      public BooleanProperty alwaysOnTopProperty()
      Specifies whether the dialog should be always on top. (see class documentation for further details)
      See Also:
    • setAlwaysOnTop

      public void setAlwaysOnTop(boolean alwaysOnTop)
      Sets the value of the property alwaysOnTop.
      Property description:
      Specifies whether the dialog should be always on top. (see class documentation for further details)