- 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
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: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 BooleanProperty
animated
The property used to store the "animated" flag.ObjectProperty<Node>
detailNode
The property used to store the detail node.ObjectProperty<Side>
detailSide
The property used to store the side where the detail node will be shown.DoubleProperty
dividerPosition
Stores the location of the divider.DoubleProperty
dividerSizeHint
Returns a property that is used to let the master detail pane know how big the divider handles are.ObjectProperty<Node>
masterNode
The property used to store the master node.BooleanProperty
showDetailNode
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 MasterDetailPane()
Constructs 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanProperty
animatedProperty()
The property used to store the "animated" flag.protected Skin<?>
createDefaultSkin()
ObjectProperty<Node>
detailNodeProperty()
The property used to store the detail node.ObjectProperty<Side>
detailSideProperty()
The property used to store the side where the detail node will be shown.DoubleProperty
dividerPositionProperty()
Stores the location of the divider.DoubleProperty
dividerSizeHintProperty()
Returns a property that is used to let the master detail pane know how big the divider handles are.Node
getDetailNode()
Returns the value of the detail node property.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 ofdividerSizeHintProperty()
.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.ObjectProperty<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(Node node)
Sets the value of the detail node property.void
setDetailSide(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 ofdividerSizeHintProperty()
.void
setMasterNode(Node node)
Sets the value of the master node property.void
setShowDetailNode(boolean show)
Sets the value of the "show detail node" 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
-
-
-
Property Detail
-
dividerSizeHint
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 theresetDividerPosition()
method in order to properly calculate the divider location that is needed to fully show the detail node.- See Also:
getDividerSizeHint()
,setDividerSizeHint(double)
-
detailSide
public final ObjectProperty<Side> detailSideProperty
The property used to store the side where the detail node will be shown.- See Also:
getDetailSide()
,setDetailSide(Side)
-
showDetailNode
public final BooleanProperty showDetailNodeProperty
The property used to store the visibility of the detail node.- See Also:
isShowDetailNode()
,setShowDetailNode(boolean)
-
masterNode
public final ObjectProperty<Node> masterNodeProperty
The property used to store the master node.- See Also:
getMasterNode()
,setMasterNode(Node)
-
detailNode
public final ObjectProperty<Node> detailNodeProperty
The property used to store the detail node.- See Also:
getDetailNode()
,setDetailNode(Node)
-
animated
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)
-
dividerPosition
public final DoubleProperty dividerPositionProperty
Stores the location of the divider.- See Also:
getDividerPosition()
,setDividerPosition(double)
-
-
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
-
createDefaultSkin
protected Skin<?> createDefaultSkin()
- Overrides:
createDefaultSkin
in classControl
-
getUserAgentStylesheet
public String getUserAgentStylesheet()
- Overrides:
getUserAgentStylesheet
in 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
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 theresetDividerPosition()
method in order to properly calculate the divider location that is needed to fully show the detail node.- See Also:
getDividerSizeHint()
,setDividerSizeHint(double)
-
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
public final ObjectProperty<Side> detailSideProperty()
The property used to store the side where the detail node will be shown.- See Also:
getDetailSide()
,setDetailSide(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)
-
showDetailNodeProperty
public final BooleanProperty showDetailNodeProperty()
The property used to store the visibility of the detail node.- See Also:
isShowDetailNode()
,setShowDetailNode(boolean)
-
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 ObjectProperty<Node> masterNodeProperty()
The property used to store the master node.- See Also:
getMasterNode()
,setMasterNode(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
-
detailNodeProperty
public final ObjectProperty<Node> detailNodeProperty()
The property used to store the detail node.- See Also:
getDetailNode()
,setDetailNode(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)
-
dividerPositionProperty
public final DoubleProperty dividerPositionProperty()
Stores the location of the divider.- See Also:
getDividerPosition()
,setDividerPosition(double)
-
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 lookupfileName
- the name of the user agent stylesheet- Returns:
- the external form of the user agent stylesheet (the path)
-
-