Top Description Inners Fields Constructors Methods
org.controlsfx.control

public Class MasterDetailPane

extends ControlsFXControl
Class Inheritance
Imports
impl.org.controlsfx.skin.MasterDetailPaneSkin, java.util.Objects, javafx.beans.property.BooleanProperty, .DoubleProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleDoubleProperty, .SimpleObjectProperty, javafx.geometry.Pos, .Side, javafx.scene.Node, javafx.scene.control.Label, .Skin

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final BooleanProperty
private final ObjectProperty<Node>
private final ObjectProperty<Side>
private DoubleProperty
private final DoubleProperty
private final ObjectProperty<Node>
private final BooleanProperty

Constructor Summary

AccessConstructor and Description
public
MasterDetailPane(Side
the position where the detail will be shown (top, bottom, left, right)
side
,
Node
the master node (always visible)
masterNode
,
Node
the detail node (slides in and out)
detailNode
,
boolean
the initial state of the detail node (shown or hidden)
showDetail
)

Constructs a new pane.

public
MasterDetailPane(Side
the position where the details will be shown (top, bottom, left, right)
pos
,
boolean
the initial state of the detail node (shown or hidden)
showDetail
)

Constructs a new pane with two placeholder nodes.

public
MasterDetailPane(Side
the position where the details will be shown (top, bottom, left, right)
pos
)

Constructs a new pane with two placeholder nodes.

public
MasterDetailPane()

Constructs a new pane with two placeholder nodes.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty

Returns:

the "animated" property
animatedProperty
()

The property used to store the "animated" flag.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ObjectProperty<Node>

Returns:

the detail node property
detailNodeProperty
()

The property used to store the detail node.

public final ObjectProperty<Side>

Returns:

the details side property
detailSideProperty
()

The property used to store the side where the detail node will be shown.

public final DoubleProperty

Returns:

the divider location
dividerPositionProperty
()

Stores the location of the divider.

public final DoubleProperty

Returns:

the divider size hint property
dividerSizeHintProperty
()

Returns a property that is used to let the master detail pane know how big the divider handles are.

public final Node

Returns:

the detail node
getDetailNode
()

Returns the value of the detail node property.

public final Side

Returns:

the side where the detail node will be shown (left, right, top, bottom)
getDetailSide
()

Returns the value of the detail side property.

public final double

Returns:

the position of the divider
getDividerPosition
()

Returns the value of the divider position property.

public final double

Returns:

the expected divider size (width or height depending on detail's side)
getDividerSizeHint
()

Returns the value of dividerSizeHintProperty().

public final Node

Returns:

the master node
getMasterNode
()

Returns the value of the master node property.

public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final boolean

Returns:

true if the detail node will be shown with a short animation (slide in)
isAnimated
()

Returns the value of the "animated" property.

public final boolean

Returns:

true if the pane is currently expanded (shows the detail node)
isShowDetailNode
()

Returns the value of the "show detail node" property.

public final ObjectProperty<Node>

Returns:

the master node property
masterNodeProperty
()

The property used to store the master node.

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.

public final void
setAnimated(boolean
if true the detail node will be shown with a short animation (slide in)
animated
)

Sets the value of the "animated" property.

public final void
setDetailNode(Node
the new master node
node
)

Sets the value of the detail node property.

public final void
setDetailSide(Side
the side where the detail node will be shown (left, right, top, bottom)
side
)

Sets the value of the detail side property.

public final void
setDividerPosition(double
the new divider position.
position
)

Sets the value of the divider position property.

public final void
setDividerSizeHint(double
the expected divider size (width or height depending on detail's side)
size
)

Sets the value of dividerSizeHintProperty().

public final void
setMasterNode(Node
the new master node
node
)

Sets the value of the master node property.

public final void
setShowDetailNode(boolean
if true the pane will show the detail node
show
)

Sets the value of the "show detail node" property.

public final BooleanProperty

Returns:

true if the pane is currently expanded (shows the detail node)
showDetailNodeProperty
()

The property used to store the visibility of the detail node.

Inherited from org.controlsfx.control.ControlsFXControl:
getUserAgentStylesheet

Field Detail

animatedback to summary
private final BooleanProperty animated
detailNodeback to summary
private final ObjectProperty<Node> detailNode
detailSideback to summary
private final ObjectProperty<Side> detailSide
dividerPositionback to summary
private DoubleProperty dividerPosition
dividerSizeHintback to summary
private final DoubleProperty dividerSizeHint
masterNodeback to summary
private final ObjectProperty<Node> masterNode
showDetailNodeback to summary
private final BooleanProperty showDetailNode

Constructor Detail

MasterDetailPaneback to summary
public MasterDetailPane(Side side, Node masterNode, Node detailNode, boolean showDetail)

Constructs a new pane.

Parameters
side:Side

the position where the detail will be shown (top, bottom, left, right)

masterNode:Node

the master node (always visible)

detailNode:Node

the detail node (slides in and out)

showDetail:boolean

the initial state of the detail node (shown or hidden)

MasterDetailPaneback to summary
public MasterDetailPane(Side pos, boolean showDetail)

Constructs a new pane with two placeholder nodes.

Parameters
pos:Side

the position where the details will be shown (top, bottom, left, right)

showDetail:boolean

the initial state of the detail node (shown or hidden)

MasterDetailPaneback to summary
public MasterDetailPane(Side pos)

Constructs a new pane with two placeholder nodes. The detail node will be shown.

Parameters
pos:Side

the position where the details will be shown (top, bottom, left, right)

MasterDetailPaneback to summary
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

animatedPropertyback to summary
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.

Returns:BooleanProperty

the "animated" property

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
detailNodePropertyback to summary
public final ObjectProperty<Node> detailNodeProperty()

The property used to store the detail node.

Returns:ObjectProperty<Node>

the detail node property

detailSidePropertyback to summary
public final ObjectProperty<Side> detailSideProperty()

The property used to store the side where the detail node will be shown.

Returns:ObjectProperty<Side>

the details side property

dividerPositionPropertyback to summary
public final DoubleProperty dividerPositionProperty()

Stores the location of the divider.

Returns:DoubleProperty

the divider location

dividerSizeHintPropertyback to summary
public final 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:DoubleProperty

the divider size hint property

getDetailNodeback to summary
public final Node getDetailNode()

Returns the value of the detail node property.

Returns:Node

the detail node

getDetailSideback to summary
public final Side getDetailSide()

Returns the value of the detail side property.

Returns:Side

the side where the detail node will be shown (left, right, top, bottom)

getDividerPositionback to summary
public final double getDividerPosition()

Returns the value of the divider position property.

Returns:double

the position of the divider

getDividerSizeHintback to summary
public final double getDividerSizeHint()

Returns the value of dividerSizeHintProperty().

Returns:double

the expected divider size (width or height depending on detail's side)

getMasterNodeback to summary
public final Node getMasterNode()

Returns the value of the master node property.

Returns:Node

the master node

getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
isAnimatedback to summary
public final boolean isAnimated()

Returns the value of the "animated" property.

Returns:boolean

true if the detail node will be shown with a short animation (slide in)

isShowDetailNodeback to summary
public final boolean isShowDetailNode()

Returns the value of the "show detail node" property.

Returns:boolean

true if the pane is currently expanded (shows the detail node)

masterNodePropertyback to summary
public final ObjectProperty<Node> masterNodeProperty()

The property used to store the master node.

Returns:ObjectProperty<Node>

the master node property

resetDividerPositionback to summary
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.

setAnimatedback to summary
public final void setAnimated(boolean animated)

Sets the value of the "animated" property.

Parameters
animated:boolean

if true the detail node will be shown with a short animation (slide in)

setDetailNodeback to summary
public final void setDetailNode(Node node)

Sets the value of the detail node property.

Parameters
node:Node

the new master node

setDetailSideback to summary
public final void setDetailSide(Side side)

Sets the value of the detail side property.

Parameters
side:Side

the side where the detail node will be shown (left, right, top, bottom)

setDividerPositionback to summary
public final void setDividerPosition(double position)

Sets the value of the divider position property.

Parameters
position:double

the new divider position.

setDividerSizeHintback to summary
public final void setDividerSizeHint(double size)

Sets the value of dividerSizeHintProperty().

Parameters
size:double

the expected divider size (width or height depending on detail's side)

setMasterNodeback to summary
public final void setMasterNode(Node node)

Sets the value of the master node property.

Parameters
node:Node

the new master node

setShowDetailNodeback to summary
public final void setShowDetailNode(boolean show)

Sets the value of the "show detail node" property.

Parameters
show:boolean

if true the pane will show the detail node

showDetailNodePropertyback to summary
public final BooleanProperty showDetailNodeProperty()

The property used to store the visibility of the detail node.

Returns:BooleanProperty

true if the pane is currently expanded (shows the detail node)

org.controlsfx.control back to summary

private final Class MasterDetailPane.Placeholder

extends Label
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
Placeholder(boolean master)

Method Summary

Inherited from javafx.scene.control.Label:
createDefaultSkingetInitialFocusTraversablegetLabelForlabelForPropertysetLabelFor

Constructor Detail

Placeholderback to summary
public Placeholder(boolean master)