Class MasterDetailPane

  • All Implemented Interfaces:
    Styleable, EventTarget, Skinnable

    public class MasterDetailPane
    extends 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);
     
    • Constructor Detail

      • MasterDetailPane

        public MasterDetailPane​(Side side,
                                Node masterNode,
                                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​(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​(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

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

        public final 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​(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)
      • 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
      • getMasterNode

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

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

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

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

        public final 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.
        See Also:
        isAnimated(), setAnimated(boolean)
      • 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)
      • 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)