Class Dockable

java.lang.Object
com.dlsc.gemsfx.docking.Dockable

public class Dockable extends Object
Represents a dockable component with an ID, a mutable display title and optional graphic, and a content node.
  • Property Summary

    Properties
    Type
    Property
    Description
    final javafx.beans.property.BooleanProperty
    Whether this dockable can be closed through normal close requests.
    final javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.Node>
    The optional graphic displayed in this dockable's tab, or null for no graphic.
    final javafx.beans.property.ObjectProperty<BooleanSupplier>
    The optional callback invoked on a normal close request after close permissions are checked.
    final javafx.beans.property.ObjectProperty<Runnable>
    The optional callback invoked when help is requested for this dockable.
    final javafx.beans.property.ObjectProperty<DockingSize>
    The preferred size when this dockable opens or moves into a new side split, including drops.
    final javafx.beans.property.BooleanProperty
    Whether the user can edit the title by double-clicking the default DockingTab.
    final javafx.beans.property.ReadOnlyStringProperty
    The display title property.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The optional toolbar displayed to the left of the menu, help and close buttons in the default DockingTab.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dockable(String id, String title, javafx.scene.Node content)
    Constructs a Dockable without a graphic.
    Dockable(String id, String title, javafx.scene.Node graphic, javafx.scene.Node content)
    Constructs a Dockable with an optional graphic.
  • Method Summary

    Modifier and Type
    Method
    Description
    final javafx.beans.property.BooleanProperty
    Whether this dockable can be closed through normal close requests.
    protected void
    Releases resources after this dockable is removed from its docking context.
    javafx.scene.Node
    Returns the content node of this Dockable.
    Returns the pane currently hosting this dockable, even when its content is not selected.
    final javafx.scene.Node
    Gets the value of the graphic property.
    Returns the unique identifier of this Dockable.
    final javafx.collections.ObservableList<javafx.scene.control.MenuItem>
    Returns the live list of actions displayed in the default DockingTab's More dropdown.
    Gets the value of the onCloseRequest property.
    final Runnable
    Gets the value of the onHelp property.
    Gets the value of the preferredDockingSize property.
    javafx.scene.Scene
    Returns the scene containing the hosting pane.
    javafx.stage.Stage
    Returns the stage containing the hosting pane.
    final String
    Gets the value of the title property.
    final javafx.scene.Node
    Gets the value of the toolbar property.
    final javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.Node>
    The optional graphic displayed in this dockable's tab, or null for no graphic.
    final boolean
    Gets the value of the closeable property.
    final boolean
    Gets the value of the titleEditable property.
    final javafx.beans.property.ObjectProperty<BooleanSupplier>
    The optional callback invoked on a normal close request after close permissions are checked.
    final javafx.beans.property.ObjectProperty<Runnable>
    The optional callback invoked when help is requested for this dockable.
    final javafx.beans.property.ObjectProperty<DockingSize>
    The preferred size when this dockable opens or moves into a new side split, including drops.
    final void
    setCloseable(boolean closeable)
    Sets the value of the closeable property.
    final void
    setGraphic(javafx.scene.Node graphic)
    Sets the value of the graphic property.
    final void
    Sets the value of the onCloseRequest property.
    final void
    Sets the value of the onHelp property.
    final void
    Sets the value of the preferredDockingSize property.
    final void
    Sets the value of the title property.
    final void
    setTitleEditable(boolean titleEditable)
    Sets the value of the titleEditable property.
    final void
    setToolbar(javafx.scene.Node toolbar)
    Sets the value of the toolbar property.
    final javafx.beans.property.BooleanProperty
    Whether the user can edit the title by double-clicking the default DockingTab.
    final javafx.beans.property.ReadOnlyStringProperty
    The display title property.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The optional toolbar displayed to the left of the menu, help and close buttons in the default DockingTab.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

    • title

      public final javafx.beans.property.ReadOnlyStringProperty titleProperty
      The display title property. The property is read-only; use setTitle(String) to change the title.
      See Also:
    • titleEditable

      public final javafx.beans.property.BooleanProperty titleEditableProperty
      Whether the user can edit the title by double-clicking the default DockingTab. Defaults to true. Setting this to false cancels an active title edit; programmatic changes through setTitle(String) remain allowed.
      See Also:
    • closeable

      public final javafx.beans.property.BooleanProperty closeableProperty
      Whether this dockable can be closed through normal close requests. Defaults to true. The default tab hides its close button when this property is false. Layout restore and teardown of an already hidden window can still remove the dockable.
      See Also:
    • preferredDockingSize

      public final javafx.beans.property.ObjectProperty<DockingSize> preferredDockingSizeProperty
      The preferred size when this dockable opens or moves into a new side split, including drops. Left/right docking uses width; top/bottom docking uses height. Weights are relative to the entire destination pane. Requests are constrained by available space and the content's minimum sizes. A null value keeps the default equal split. Center/tab insertion and layout restore ignore this preference; changing it does not resize an already docked group. Pixel sizes are applied once the pane is measured, not maintained during later resizes. The resulting divider positions, rather than this preference, are saved in the layout. Moving a whole tab group uses its selected tab's preference. For external drags, the size becomes known only when the drop factory creates the dockable; the preceding preview uses the default size.
      See Also:
    • onCloseRequest

      public final javafx.beans.property.ObjectProperty<BooleanSupplier> onCloseRequestProperty
      The optional callback invoked on a normal close request after close permissions are checked. Return false to veto the request or true to allow it. A null callback allows the request. The callback runs on the JavaFX application thread and is not invoked by permission queries, layout restore, or teardown of an already hidden window.
      See Also:
    • graphic

      public final javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.Node> graphicProperty
      The optional graphic displayed in this dockable's tab, or null for no graphic. The property is read-only; use setGraphic(Node) to replace or remove the graphic.
      See Also:
    • toolbar

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> toolbarProperty
      The optional toolbar displayed to the left of the menu, help and close buttons in the default DockingTab. Defaults to null. Changes replace or remove the displayed toolbar immediately. The toolbar shares the action buttons' hover fade.
      See Also:
    • onHelp

      public final javafx.beans.property.ObjectProperty<Runnable> onHelpProperty
      The optional callback invoked when help is requested for this dockable. Defaults to null, hiding the help button in the default DockingTab. Changes update the button's availability immediately; the callback runs on the JavaFX application thread when the user activates the button.
      See Also:
  • Constructor Details

    • Dockable

      public Dockable(String id, String title, javafx.scene.Node content)
      Constructs a Dockable without a graphic.
      Parameters:
      id - the unique identifier, must not be null or blank
      title - the display title, must not be null or blank
      content - the content node, must not be null
      Throws:
      IllegalArgumentException - if id or title is null/blank, or content is null
    • Dockable

      public Dockable(String id, String title, javafx.scene.Node graphic, javafx.scene.Node content)
      Constructs a Dockable with an optional graphic.
      Parameters:
      id - the unique identifier, must not be null or blank
      title - the display title, must not be null or blank
      graphic - the optional icon/graphic, may be null
      content - the content node, must not be null
      Throws:
      IllegalArgumentException - if id or title is null/blank, or content is null
  • Method Details

    • getId

      public String getId()
      Returns the unique identifier of this Dockable.
      Returns:
      the id
    • getDockingPane

      public DockingPane getDockingPane()
      Returns the pane currently hosting this dockable, even when its content is not selected.
      Returns:
      the hosting pane, or null if this dockable is not open
    • getScene

      public javafx.scene.Scene getScene()
      Returns the scene containing the hosting pane.
      Returns:
      the hosting scene, or null if there is no hosting pane or scene
    • getStage

      public javafx.stage.Stage getStage()
      Returns the stage containing the hosting pane.
      Returns:
      the hosting stage, or null if there is no scene or its window is not a stage
    • titleProperty

      public final javafx.beans.property.ReadOnlyStringProperty titleProperty()
      The display title property. The property is read-only; use setTitle(String) to change the title.
      Returns:
      the title property
      See Also:
    • getTitle

      public final String getTitle()
      Gets the value of the title property.
      Property description:
      The display title property. The property is read-only; use setTitle(String) to change the title.
      Returns:
      the value of the title property
      See Also:
    • setTitle

      public final void setTitle(String title)
      Sets the value of the title property.
      Property description:
      The display title property. The property is read-only; use setTitle(String) to change the title.
      Parameters:
      title - the value for the title property
      See Also:
    • titleEditableProperty

      public final javafx.beans.property.BooleanProperty titleEditableProperty()
      Whether the user can edit the title by double-clicking the default DockingTab. Defaults to true. Setting this to false cancels an active title edit; programmatic changes through setTitle(String) remain allowed.
      Returns:
      the title editing permission property
      See Also:
    • isTitleEditable

      public final boolean isTitleEditable()
      Gets the value of the titleEditable property.
      Property description:
      Whether the user can edit the title by double-clicking the default DockingTab. Defaults to true. Setting this to false cancels an active title edit; programmatic changes through setTitle(String) remain allowed.
      Returns:
      the value of the titleEditable property
      See Also:
    • setTitleEditable

      public final void setTitleEditable(boolean titleEditable)
      Sets the value of the titleEditable property.
      Property description:
      Whether the user can edit the title by double-clicking the default DockingTab. Defaults to true. Setting this to false cancels an active title edit; programmatic changes through setTitle(String) remain allowed.
      Parameters:
      titleEditable - the value for the titleEditable property
      See Also:
    • closeableProperty

      public final javafx.beans.property.BooleanProperty closeableProperty()
      Whether this dockable can be closed through normal close requests. Defaults to true. The default tab hides its close button when this property is false. Layout restore and teardown of an already hidden window can still remove the dockable.
      Returns:
      the close permission property
      See Also:
    • isCloseable

      public final boolean isCloseable()
      Gets the value of the closeable property.
      Property description:
      Whether this dockable can be closed through normal close requests. Defaults to true. The default tab hides its close button when this property is false. Layout restore and teardown of an already hidden window can still remove the dockable.
      Returns:
      the value of the closeable property
      See Also:
    • setCloseable

      public final void setCloseable(boolean closeable)
      Sets the value of the closeable property.
      Property description:
      Whether this dockable can be closed through normal close requests. Defaults to true. The default tab hides its close button when this property is false. Layout restore and teardown of an already hidden window can still remove the dockable.
      Parameters:
      closeable - the value for the closeable property
      See Also:
    • preferredDockingSizeProperty

      public final javafx.beans.property.ObjectProperty<DockingSize> preferredDockingSizeProperty()
      The preferred size when this dockable opens or moves into a new side split, including drops. Left/right docking uses width; top/bottom docking uses height. Weights are relative to the entire destination pane. Requests are constrained by available space and the content's minimum sizes. A null value keeps the default equal split. Center/tab insertion and layout restore ignore this preference; changing it does not resize an already docked group. Pixel sizes are applied once the pane is measured, not maintained during later resizes. The resulting divider positions, rather than this preference, are saved in the layout. Moving a whole tab group uses its selected tab's preference. For external drags, the size becomes known only when the drop factory creates the dockable; the preceding preview uses the default size.
      Returns:
      the preferred docking size property
      See Also:
    • getPreferredDockingSize

      public final DockingSize getPreferredDockingSize()
      Gets the value of the preferredDockingSize property.
      Property description:
      The preferred size when this dockable opens or moves into a new side split, including drops. Left/right docking uses width; top/bottom docking uses height. Weights are relative to the entire destination pane. Requests are constrained by available space and the content's minimum sizes. A null value keeps the default equal split. Center/tab insertion and layout restore ignore this preference; changing it does not resize an already docked group. Pixel sizes are applied once the pane is measured, not maintained during later resizes. The resulting divider positions, rather than this preference, are saved in the layout. Moving a whole tab group uses its selected tab's preference. For external drags, the size becomes known only when the drop factory creates the dockable; the preceding preview uses the default size.
      Returns:
      the value of the preferredDockingSize property
      See Also:
    • setPreferredDockingSize

      public final void setPreferredDockingSize(DockingSize size)
      Sets the value of the preferredDockingSize property.
      Property description:
      The preferred size when this dockable opens or moves into a new side split, including drops. Left/right docking uses width; top/bottom docking uses height. Weights are relative to the entire destination pane. Requests are constrained by available space and the content's minimum sizes. A null value keeps the default equal split. Center/tab insertion and layout restore ignore this preference; changing it does not resize an already docked group. Pixel sizes are applied once the pane is measured, not maintained during later resizes. The resulting divider positions, rather than this preference, are saved in the layout. Moving a whole tab group uses its selected tab's preference. For external drags, the size becomes known only when the drop factory creates the dockable; the preceding preview uses the default size.
      Parameters:
      size - the value for the preferredDockingSize property
      See Also:
    • onCloseRequestProperty

      public final javafx.beans.property.ObjectProperty<BooleanSupplier> onCloseRequestProperty()
      The optional callback invoked on a normal close request after close permissions are checked. Return false to veto the request or true to allow it. A null callback allows the request. The callback runs on the JavaFX application thread and is not invoked by permission queries, layout restore, or teardown of an already hidden window.
      Returns:
      the close request callback property
      See Also:
    • getOnCloseRequest

      public final BooleanSupplier getOnCloseRequest()
      Gets the value of the onCloseRequest property.
      Property description:
      The optional callback invoked on a normal close request after close permissions are checked. Return false to veto the request or true to allow it. A null callback allows the request. The callback runs on the JavaFX application thread and is not invoked by permission queries, layout restore, or teardown of an already hidden window.
      Returns:
      the value of the onCloseRequest property
      See Also:
    • setOnCloseRequest

      public final void setOnCloseRequest(BooleanSupplier onCloseRequest)
      Sets the value of the onCloseRequest property.
      Property description:
      The optional callback invoked on a normal close request after close permissions are checked. Return false to veto the request or true to allow it. A null callback allows the request. The callback runs on the JavaFX application thread and is not invoked by permission queries, layout restore, or teardown of an already hidden window.
      Parameters:
      onCloseRequest - the value for the onCloseRequest property
      See Also:
    • graphicProperty

      public final javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.Node> graphicProperty()
      The optional graphic displayed in this dockable's tab, or null for no graphic. The property is read-only; use setGraphic(Node) to replace or remove the graphic.
      Returns:
      the graphic property
      See Also:
    • getGraphic

      public final javafx.scene.Node getGraphic()
      Gets the value of the graphic property.
      Property description:
      The optional graphic displayed in this dockable's tab, or null for no graphic. The property is read-only; use setGraphic(Node) to replace or remove the graphic.
      Returns:
      the value of the graphic property
      See Also:
    • setGraphic

      public final void setGraphic(javafx.scene.Node graphic)
      Sets the value of the graphic property.
      Property description:
      The optional graphic displayed in this dockable's tab, or null for no graphic. The property is read-only; use setGraphic(Node) to replace or remove the graphic.
      Parameters:
      graphic - the value for the graphic property
      See Also:
    • toolbarProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> toolbarProperty()
      The optional toolbar displayed to the left of the menu, help and close buttons in the default DockingTab. Defaults to null. Changes replace or remove the displayed toolbar immediately. The toolbar shares the action buttons' hover fade.
      Returns:
      the toolbar property
      See Also:
    • getToolbar

      public final javafx.scene.Node getToolbar()
      Gets the value of the toolbar property.
      Property description:
      The optional toolbar displayed to the left of the menu, help and close buttons in the default DockingTab. Defaults to null. Changes replace or remove the displayed toolbar immediately. The toolbar shares the action buttons' hover fade.
      Returns:
      the value of the toolbar property
      See Also:
    • setToolbar

      public final void setToolbar(javafx.scene.Node toolbar)
      Sets the value of the toolbar property.
      Property description:
      The optional toolbar displayed to the left of the menu, help and close buttons in the default DockingTab. Defaults to null. Changes replace or remove the displayed toolbar immediately. The toolbar shares the action buttons' hover fade.
      Parameters:
      toolbar - the value for the toolbar property
      See Also:
    • getMenuItems

      public final javafx.collections.ObservableList<javafx.scene.control.MenuItem> getMenuItems()
      Returns the live list of actions displayed in the default DockingTab's More dropdown. The list is initially empty, hiding the menu button without reserving layout space. Adding, removing or reordering items updates the dropdown immediately. Each menu item should belong to only one dockable.
      Returns:
      the modifiable menu item list
    • onHelpProperty

      public final javafx.beans.property.ObjectProperty<Runnable> onHelpProperty()
      The optional callback invoked when help is requested for this dockable. Defaults to null, hiding the help button in the default DockingTab. Changes update the button's availability immediately; the callback runs on the JavaFX application thread when the user activates the button.
      Returns:
      the help callback property
      See Also:
    • getOnHelp

      public final Runnable getOnHelp()
      Gets the value of the onHelp property.
      Property description:
      The optional callback invoked when help is requested for this dockable. Defaults to null, hiding the help button in the default DockingTab. Changes update the button's availability immediately; the callback runs on the JavaFX application thread when the user activates the button.
      Returns:
      the value of the onHelp property
      See Also:
    • setOnHelp

      public final void setOnHelp(Runnable onHelp)
      Sets the value of the onHelp property.
      Property description:
      The optional callback invoked when help is requested for this dockable. Defaults to null, hiding the help button in the default DockingTab. Changes update the button's availability immediately; the callback runs on the JavaFX application thread when the user activates the button.
      Parameters:
      onHelp - the value for the onHelp property
      See Also:
    • getContent

      public javafx.scene.Node getContent()
      Returns the content node of this Dockable.
      Returns:
      the content
    • dispose

      protected void dispose()
      Releases resources after this dockable is removed from its docking context. Subclasses may override this method; it is not called when the dockable merely moves between panes. If the same instance is reopened, it can be disposed again when subsequently removed.