Class 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);
     
    • 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
      MasterDetailPane()
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javafx.beans.property.BooleanProperty animatedProperty()
      The property used to store the "animated" flag.
      protected javafx.scene.control.Skin<?> createDefaultSkin()
      javafx.beans.property.ObjectProperty<javafx.scene.Node> detailNodeProperty()
      The property used to store the detail node.
      javafx.beans.property.ObjectProperty<javafx.geometry.Side> detailSideProperty()
      The property used to store the side where the detail node will be shown.
      javafx.beans.property.DoubleProperty dividerPositionProperty()
      Stores the location of the divider.
      javafx.beans.property.DoubleProperty dividerSizeHintProperty()
      Returns a property that is used to let the master detail pane know how big the divider handles are.
      javafx.scene.Node getDetailNode()
      Returns the value of the detail node property.
      javafx.geometry.Side getDetailSide()
      Returns the value of the detail side property.
      double getDividerPosition()
      Returns the value of the divider position property.
      double getDividerSizeHint()
      Returns the value of dividerSizeHintProperty().
      javafx.scene.Node getMasterNode()
      Returns the value of the master node property.
      String getUserAgentStylesheet()
      protected String getUserAgentStylesheet​(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once.
      boolean isAnimated()
      Returns the value of the "animated" property.
      boolean isShowDetailNode()
      Returns the value of the "show detail node" property.
      javafx.beans.property.ObjectProperty<javafx.scene.Node> masterNodeProperty()
      The property used to store the master node.
      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.
      void setAnimated​(boolean animated)
      Sets the value of the "animated" property.
      void setDetailNode​(javafx.scene.Node node)
      Sets the value of the detail node property.
      void setDetailSide​(javafx.geometry.Side side)
      Sets the value of the detail side property.
      void setDividerPosition​(double position)
      Sets the value of the divider position property.
      void setDividerSizeHint​(double size)
      Sets the value of dividerSizeHintProperty().
      void setMasterNode​(javafx.scene.Node node)
      Sets the value of the master node property.
      void setShowDetailNode​(boolean show)
      Sets the value of the "show detail node" property.
      javafx.beans.property.BooleanProperty showDetailNodeProperty()
      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 interface javafx.css.Styleable

        getStyleableNode
    • Constructor Detail

      • 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 Detail

      • 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
      • 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
      • 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)
      • 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
      • 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
      • 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
      • 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
      • 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)