Class MasterDetailPane

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
org.controlsfx.control.MasterDetailPane
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable

public class MasterDetailPane extends javafx.scene.control.Control
A master / detail pane is used to display two nodes with a strong relationship to each other. Most of the time the user works with the information displayed in the master node but every once in a while additional information is required and can be made visible via the detail node. By default the detail appears with a short slide-in animation and disappears with a slide-out. This control allows the detail node to be positioned in four different locations (top, bottom, left, or right).

Screenshot

To better describe what a master / detail pane is, please refer to the picture below:
Screenshot of MasterDetailPane

Code Sample

 
 MasterDetailPane pane = new MasterDetailPane();
 pane.setMasterNode(new TableView());
 pane.setDetailNode(new PropertySheet());
 pane.setDetailSide(Side.RIGHT);
 pane.setShowDetailNode(true);
 
  • Property Summary

    Properties
    Type
    Property
    Description
    final javafx.beans.property.BooleanProperty
    The property used to store the "animated" flag.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The property used to store the detail node.
    final javafx.beans.property.ObjectProperty<javafx.geometry.Side>
    The property used to store the side where the detail node will be shown.
    final javafx.beans.property.DoubleProperty
    Stores the location of the divider.
    final javafx.beans.property.DoubleProperty
    Returns a property that is used to let the master detail pane know how big the divider handles are.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The property used to store the master node.
    final javafx.beans.property.BooleanProperty
    The property used to store the visibility of the detail node.

    Properties inherited from class javafx.scene.control.Control

    contextMenu, skin, tooltip

    Properties inherited from class javafx.scene.layout.Region

    background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

    Properties inherited from class javafx.scene.Parent

    needsLayout

    Properties inherited from class javafx.scene.Node

    accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
  • Field Summary

    Fields inherited from class javafx.scene.layout.Region

    USE_COMPUTED_SIZE, USE_PREF_SIZE

    Fields inherited from class javafx.scene.Node

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new pane with two placeholder nodes.
    MasterDetailPane(javafx.geometry.Side pos)
    Constructs a new pane with two placeholder nodes.
    MasterDetailPane(javafx.geometry.Side pos, boolean showDetail)
    Constructs a new pane with two placeholder nodes.
    MasterDetailPane(javafx.geometry.Side side, javafx.scene.Node masterNode, javafx.scene.Node detailNode, boolean showDetail)
    Constructs a new pane.
  • Method Summary

    Modifier and Type
    Method
    Description
    final javafx.beans.property.BooleanProperty
    The property used to store the "animated" flag.
    protected javafx.scene.control.Skin<?>
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The property used to store the detail node.
    final javafx.beans.property.ObjectProperty<javafx.geometry.Side>
    The property used to store the side where the detail node will be shown.
    final javafx.beans.property.DoubleProperty
    Stores the location of the divider.
    final javafx.beans.property.DoubleProperty
    Returns a property that is used to let the master detail pane know how big the divider handles are.
    final javafx.scene.Node
    Returns the value of the detail node property.
    final javafx.geometry.Side
    Returns the value of the detail side property.
    final double
    Returns the value of the divider position property.
    final double
    Returns the value of dividerSizeHintProperty().
    final javafx.scene.Node
    Returns the value of the master node property.
    protected final String
    getUserAgentStylesheet(Class<?> clazz, String fileName)
    A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once.
    final boolean
    Returns the value of the "animated" property.
    final boolean
    Returns the value of the "show detail node" property.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The property used to store the master node.
    final void
    Resets the divider position to a value that ensures that the detail node will be fully visible at its preferred width or height.
    final void
    setAnimated(boolean animated)
    Sets the value of the "animated" property.
    final void
    setDetailNode(javafx.scene.Node node)
    Sets the value of the detail node property.
    final void
    setDetailSide(javafx.geometry.Side side)
    Sets the value of the detail side property.
    final void
    setDividerPosition(double position)
    Sets the value of the divider position property.
    final void
    setDividerSizeHint(double size)
    Sets the value of dividerSizeHintProperty().
    final void
    setMasterNode(javafx.scene.Node node)
    Sets the value of the master node property.
    final void
    setShowDetailNode(boolean show)
    Sets the value of the "show detail node" property.
    final javafx.beans.property.BooleanProperty
    The property used to store the visibility of the detail node.

    Methods inherited from class javafx.scene.control.Control

    computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty

    Methods inherited from class javafx.scene.layout.Region

    backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

    Methods inherited from class javafx.scene.Parent

    getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds

    Methods inherited from class javafx.scene.Node

    accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Property Details

  • Constructor Details

    • MasterDetailPane

      public MasterDetailPane(javafx.geometry.Side side, javafx.scene.Node masterNode, javafx.scene.Node detailNode, boolean showDetail)
      Constructs a new pane.
      Parameters:
      side - the position where the detail will be shown (top, bottom, left, right)
      masterNode - the master node (always visible)
      detailNode - the detail node (slides in and out)
      showDetail - the initial state of the detail node (shown or hidden)
    • MasterDetailPane

      public MasterDetailPane(javafx.geometry.Side pos, boolean showDetail)
      Constructs a new pane with two placeholder nodes.
      Parameters:
      pos - the position where the details will be shown (top, bottom, left, right)
      showDetail - the initial state of the detail node (shown or hidden)
    • MasterDetailPane

      public MasterDetailPane(javafx.geometry.Side pos)
      Constructs a new pane with two placeholder nodes. The detail node will be shown.
      Parameters:
      pos - the position where the details will be shown (top, bottom, left, right)
    • MasterDetailPane

      public MasterDetailPane()
      Constructs a new pane with two placeholder nodes. The detail node will be shown and to the right of the master node.
  • Method Details

    • createDefaultSkin

      protected javafx.scene.control.Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class javafx.scene.control.Control
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class javafx.scene.layout.Region
    • resetDividerPosition

      public final void resetDividerPosition()
      Resets the divider position to a value that ensures that the detail node will be fully visible at its preferred width or height.
    • dividerSizeHintProperty

      public final javafx.beans.property.DoubleProperty dividerSizeHintProperty()
      Returns a property that is used to let the master detail pane know how big the divider handles are. This value is needed by the resetDividerPosition() method in order to properly calculate the divider location that is needed to fully show the detail node.
      Returns:
      the divider size hint property
      See Also:
    • setDividerSizeHint

      public final void setDividerSizeHint(double size)
      Sets the value of dividerSizeHintProperty().
      Parameters:
      size - the expected divider size (width or height depending on detail's side)
    • getDividerSizeHint

      public final double getDividerSizeHint()
      Returns the value of dividerSizeHintProperty().
      Returns:
      the expected divider size (width or height depending on detail's side)
    • detailSideProperty

      public final javafx.beans.property.ObjectProperty<javafx.geometry.Side> detailSideProperty()
      The property used to store the side where the detail node will be shown.
      Returns:
      the details side property
      See Also:
    • getDetailSide

      public final javafx.geometry.Side getDetailSide()
      Returns the value of the detail side property.
      Returns:
      the side where the detail node will be shown (left, right, top, bottom)
    • setDetailSide

      public final void setDetailSide(javafx.geometry.Side side)
      Sets the value of the detail side property.
      Parameters:
      side - the side where the detail node will be shown (left, right, top, bottom)
    • showDetailNodeProperty

      public final javafx.beans.property.BooleanProperty showDetailNodeProperty()
      The property used to store the visibility of the detail node.
      Returns:
      true if the pane is currently expanded (shows the detail node)
      See Also:
    • isShowDetailNode

      public final boolean isShowDetailNode()
      Returns the value of the "show detail node" property.
      Returns:
      true if the pane is currently expanded (shows the detail node)
    • setShowDetailNode

      public final void setShowDetailNode(boolean show)
      Sets the value of the "show detail node" property.
      Parameters:
      show - if true the pane will show the detail node
    • masterNodeProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> masterNodeProperty()
      The property used to store the master node.
      Returns:
      the master node property
      See Also:
    • getMasterNode

      public final javafx.scene.Node getMasterNode()
      Returns the value of the master node property.
      Returns:
      the master node
    • setMasterNode

      public final void setMasterNode(javafx.scene.Node node)
      Sets the value of the master node property.
      Parameters:
      node - the new master node
    • detailNodeProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> detailNodeProperty()
      The property used to store the detail node.
      Returns:
      the detail node property
      See Also:
    • getDetailNode

      public final javafx.scene.Node getDetailNode()
      Returns the value of the detail node property.
      Returns:
      the detail node
    • setDetailNode

      public final void setDetailNode(javafx.scene.Node node)
      Sets the value of the detail node property.
      Parameters:
      node - the new master node
    • animatedProperty

      public final javafx.beans.property.BooleanProperty animatedProperty()
      The property used to store the "animated" flag. If true then the detail node will be shown / hidden with a short slide in / out animation.
      Returns:
      the "animated" property
      See Also:
    • isAnimated

      public final boolean isAnimated()
      Returns the value of the "animated" property.
      Returns:
      true if the detail node will be shown with a short animation (slide in)
    • setAnimated

      public final void setAnimated(boolean animated)
      Sets the value of the "animated" property.
      Parameters:
      animated - if true the detail node will be shown with a short animation (slide in)
    • dividerPositionProperty

      public final javafx.beans.property.DoubleProperty dividerPositionProperty()
      Stores the location of the divider.
      Returns:
      the divider location
      See Also:
    • getDividerPosition

      public final double getDividerPosition()
      Returns the value of the divider position property.
      Returns:
      the position of the divider
    • setDividerPosition

      public final void setDividerPosition(double position)
      Sets the value of the divider position property.
      Parameters:
      position - the new divider position.
    • getUserAgentStylesheet

      protected final String getUserAgentStylesheet(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once. Caches the external form of the resource.
      Parameters:
      clazz - the class used for the resource lookup
      fileName - the name of the user agent stylesheet
      Returns:
      the external form of the user agent stylesheet (the path)