java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
org.controlsfx.control.MasterDetailPane
- All Implemented Interfaces:
Styleable,EventTarget,Skinnable
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:
Code Sample
MasterDetailPane pane = new MasterDetailPane();
pane.setMasterNode(new TableView());
pane.setDetailNode(new PropertySheet());
pane.setDetailSide(Side.RIGHT);
pane.setShowDetailNode(true);
-
Property Summary
PropertiesTypePropertyDescriptionfinal BooleanPropertyThe property used to store the "animated" flag.final ObjectProperty<Node>The property used to store the detail node.final ObjectProperty<Side>The property used to store the side where the detail node will be shown.final DoublePropertyStores the location of the divider.final DoublePropertyReturns a property that is used to let the master detail pane know how big the divider handles are.final ObjectProperty<Node>The property used to store the master node.final BooleanPropertyThe property used to store the visibility of the detail node.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties 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_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new pane with two placeholder nodes.MasterDetailPane(Side pos) Constructs a new pane with two placeholder nodes.MasterDetailPane(Side pos, boolean showDetail) Constructs a new pane with two placeholder nodes.MasterDetailPane(Side side, Node masterNode, Node detailNode, boolean showDetail) Constructs a new pane. -
Method Summary
Modifier and TypeMethodDescriptionfinal BooleanPropertyThe property used to store the "animated" flag.protected Skin<?>final ObjectProperty<Node>The property used to store the detail node.final ObjectProperty<Side>The property used to store the side where the detail node will be shown.final DoublePropertyStores the location of the divider.final DoublePropertyReturns a property that is used to let the master detail pane know how big the divider handles are.final NodeReturns the value of the detail node property.final SideReturns the value of the detail side property.final doubleReturns the value of the divider position property.final doubleReturns the value ofdividerSizeHintProperty().final NodeReturns the value of the master node property.protected final StringgetUserAgentStylesheet(Class<?> clazz, String fileName) A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once.final booleanReturns the value of the "animated" property.final booleanReturns the value of the "show detail node" property.final ObjectProperty<Node>The property used to store the master node.final voidResets the divider position to a value that ensures that the detail node will be fully visible at its preferred width or height.final voidsetAnimated(boolean animated) Sets the value of the "animated" property.final voidsetDetailNode(Node node) Sets the value of the detail node property.final voidsetDetailSide(Side side) Sets the value of the detail side property.final voidsetDividerPosition(double position) Sets the value of the divider position property.final voidsetDividerSizeHint(double size) Sets the value ofdividerSizeHintProperty().final voidsetMasterNode(Node node) Sets the value of the master node property.final voidsetShowDetailNode(boolean show) Sets the value of the "show detail node" property.final BooleanPropertyThe 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, tooltipPropertyMethods 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, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods 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, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
dividerSizeHint
Returns a property that is used to let the master detail pane know how big the divider handles are. This value is needed by theresetDividerPosition()method in order to properly calculate the divider location that is needed to fully show the detail node. -
detailSide
The property used to store the side where the detail node will be shown.- See Also:
-
showDetailNode
The property used to store the visibility of the detail node.- See Also:
-
masterNode
The property used to store the master node.- See Also:
-
detailNode
The property used to store the detail node.- See Also:
-
animated
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:
-
dividerPosition
Stores the location of the divider.
-
-
Constructor Details
-
MasterDetailPane
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
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
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
- Overrides:
createDefaultSkinin classControl
-
getUserAgentStylesheet
- Overrides:
getUserAgentStylesheetin classRegion
-
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
Returns a property that is used to let the master detail pane know how big the divider handles are. This value is needed by theresetDividerPosition()method in order to properly calculate the divider location that is needed to fully show the detail node. -
setDividerSizeHint
public final void setDividerSizeHint(double size) Sets the value ofdividerSizeHintProperty().- Parameters:
size- the expected divider size (width or height depending on detail's side)
-
getDividerSizeHint
public final double getDividerSizeHint()Returns the value ofdividerSizeHintProperty().- Returns:
- the expected divider size (width or height depending on detail's side)
-
detailSideProperty
The property used to store the side where the detail node will be shown.- See Also:
-
getDetailSide
Returns the value of the detail side property.- Returns:
- the side where the detail node will be shown (left, right, top, bottom)
-
setDetailSide
Sets the value of the detail side property.- Parameters:
side- the side where the detail node will be shown (left, right, top, bottom)
-
showDetailNodeProperty
The property used to store the visibility of 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
The property used to store the master node.- See Also:
-
getMasterNode
Returns the value of the master node property.- Returns:
- the master node
-
setMasterNode
Sets the value of the master node property.- Parameters:
node- the new master node
-
detailNodeProperty
The property used to store the detail node.- See Also:
-
getDetailNode
Returns the value of the detail node property.- Returns:
- the detail node
-
setDetailNode
Sets the value of the detail node property.- Parameters:
node- the new master node
-
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
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
Stores the location of the divider. -
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
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 lookupfileName- the name of the user agent stylesheet- Returns:
- the external form of the user agent stylesheet (the path)
-