- java.lang.Object
-
- javafx.stage.Window
-
- javafx.stage.PopupWindow
-
- javafx.scene.control.PopupControl
-
- org.controlsfx.control.PopOver
-
- All Implemented Interfaces:
Styleable
,EventTarget
,Skinnable
public class PopOver extends PopupControl
The PopOver control provides detailed information about an owning node in a popup window. The popup window has a very lightweight appearance (no default window decorations) and an arrow pointing at the owner. Due to the nature of popup windows the PopOver will move around with the parent window when the user drags it.
The PopOver can be detached from the owning node by dragging it away from the owner. It stops displaying an arrow and starts displaying a title and a close icon.
The following image shows a popover with an accordion content node. PopOver controls are automatically resizing themselves when the content node changes its size.
For styling apply stylesheets to the root pane of the PopOver.Example:
PopOver popOver = new PopOver(); popOver.getRoot().getStylesheets().add(...);
-
-
Property Summary
Properties Type Property Description BooleanProperty
animated
Stores the "animated" flag.DoubleProperty
arrowIndent
Controls the distance between the arrow and the corners of the pop over.ObjectProperty<PopOver.ArrowLocation>
arrowLocation
Stores the preferred arrow location.DoubleProperty
arrowSize
Controls the size of the arrow.BooleanProperty
closeButtonEnabled
Determines whether or not the header's close button should be available.ObjectProperty<Node>
contentNode
Returns the content shown by the pop over.DoubleProperty
cornerRadius
Returns the corner radius property for the pop over.BooleanProperty
detachable
Determines if the pop over is detachable at all.BooleanProperty
detached
Determines whether the pop over is detached from the owning node or not.ObjectProperty<Duration>
fadeInDuration
Stores the fade-in duration.ObjectProperty<Duration>
fadeOutDuration
Stores the fade-out duration.BooleanProperty
headerAlwaysVisible
Determines whether or not thePopOver
header should remain visible, even while attached.StringProperty
title
Stores the title to display in the PopOver's header.-
Properties inherited from class javafx.scene.control.PopupControl
id, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth, skin, style
-
Properties inherited from class javafx.stage.PopupWindow
anchorLocation, anchorX, anchorY, autoFix, autoHide, consumeAutoHidingEvents, hideOnEscape, onAutoHide, ownerNode, ownerWindow
-
Properties inherited from class javafx.stage.Window
eventDispatcher, focused, forceIntegerRenderScale, height, onCloseRequest, onHidden, onHiding, onShowing, onShown, opacity, outputScaleX, outputScaleY, renderScaleX, renderScaleY, scene, showing, width, x, y
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PopOver.ArrowLocation
All possible arrow locations.-
Nested classes/interfaces inherited from class javafx.scene.control.PopupControl
PopupControl.CSSBridge
-
Nested classes/interfaces inherited from class javafx.stage.PopupWindow
PopupWindow.AnchorLocation
-
-
Field Summary
-
Fields inherited from class javafx.scene.control.PopupControl
bridge, USE_COMPUTED_SIZE, USE_PREF_SIZE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanProperty
animatedProperty()
Stores the "animated" flag.DoubleProperty
arrowIndentProperty()
Controls the distance between the arrow and the corners of the pop over.ObjectProperty<PopOver.ArrowLocation>
arrowLocationProperty()
Stores the preferred arrow location.DoubleProperty
arrowSizeProperty()
Controls the size of the arrow.BooleanProperty
closeButtonEnabledProperty()
Determines whether or not the header's close button should be available.ObjectProperty<Node>
contentNodeProperty()
Returns the content shown by the pop over.DoubleProperty
cornerRadiusProperty()
Returns the corner radius property for the pop over.protected Skin<?>
createDefaultSkin()
void
detach()
Detaches the pop over from the owning node.BooleanProperty
detachableProperty()
Determines if the pop over is detachable at all.BooleanProperty
detachedProperty()
Determines whether the pop over is detached from the owning node or not.ObjectProperty<Duration>
fadeInDurationProperty()
Stores the fade-in duration.ObjectProperty<Duration>
fadeOutDurationProperty()
Stores the fade-out duration.double
getArrowIndent()
Returns the value of the arrow indent property.PopOver.ArrowLocation
getArrowLocation()
Returns the value of the arrow location property.double
getArrowSize()
Returns the value of the arrow size property.Node
getContentNode()
Returns the value of the content propertydouble
getCornerRadius()
Returns the value of the corner radius property.Duration
getFadeInDuration()
Returns the value of the fade-in duration property.Duration
getFadeOutDuration()
Returns the value of the fade-out duration property.StackPane
getRoot()
The root pane stores the content node of the popover.String
getTitle()
Returns the value of the title property.BooleanProperty
headerAlwaysVisibleProperty()
Determines whether or not thePopOver
header should remain visible, even while attached.void
hide()
Hides the pop over by quickly changing its opacity to 0.void
hide(Duration fadeOutDuration)
Hides the pop over by quickly changing its opacity to 0.boolean
isAnimated()
Returns the value of the "animated" property.boolean
isCloseButtonEnabled()
Returns the value of the closeButtonEnabled property.boolean
isDetachable()
Returns the value of the detachable property.boolean
isDetached()
Returns the value of the detached property.boolean
isHeaderAlwaysVisible()
Returns the value of the detachable property.void
setAnimated(boolean animated)
Sets the value of the "animated" property.void
setArrowIndent(double size)
Sets the value of the arrow indent property.void
setArrowLocation(PopOver.ArrowLocation location)
Sets the value of the arrow location property.void
setArrowSize(double size)
Sets the value of the arrow size property.void
setCloseButtonEnabled(boolean enabled)
Sets the value of the closeButtonEnabled property.void
setContentNode(Node content)
Sets the value of the content property.void
setCornerRadius(double radius)
Sets the value of the corner radius property.void
setDetachable(boolean detachable)
Sets the value of the detachable property.void
setDetached(boolean detached)
Sets the value of the detached property.void
setFadeInDuration(Duration duration)
Sets the value of the fade-in duration property.void
setFadeOutDuration(Duration duration)
Sets the value of the fade-out duration property.void
setHeaderAlwaysVisible(boolean visible)
Sets the value of the headerAlwaysVisible property.void
setTitle(String title)
Sets the value of the title property.void
show(Node owner)
Shows the pop over in a position relative to the edges of the given owner node.void
show(Node owner, double offset)
Shows the pop over in a position relative to the edges of the given owner node.void
show(Node owner, double x, double y)
Makes the pop over visible at the give location and associates it with the given owner node.void
show(Node owner, double x, double y, Duration fadeInDuration)
Makes the pop over visible at the give location and associates it with the given owner node.void
show(Window owner)
void
show(Window ownerWindow, double anchorX, double anchorY)
StringProperty
titleProperty()
Stores the title to display in the PopOver's header.-
Methods inherited from class javafx.scene.control.PopupControl
getClassCssMetaData, getCssMetaData, getId, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getPseudoClassStates, getSkin, getStyle, getStyleableNode, getStyleableParent, getStyleClass, getTypeSelector, idProperty, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, pseudoClassStateChanged, setId, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setPrefHeight, setPrefSize, setPrefWidth, setSkin, setStyle, skinProperty, styleProperty
-
Methods inherited from class javafx.stage.PopupWindow
anchorLocationProperty, anchorXProperty, anchorYProperty, autoFixProperty, autoHideProperty, consumeAutoHidingEventsProperty, getAnchorLocation, getAnchorX, getAnchorY, getConsumeAutoHidingEvents, getOnAutoHide, getOwnerNode, getOwnerWindow, hideOnEscapeProperty, isAutoFix, isAutoHide, isHideOnEscape, onAutoHideProperty, ownerNodeProperty, ownerWindowProperty, setAnchorLocation, setAnchorX, setAnchorY, setAutoFix, setAutoHide, setConsumeAutoHidingEvents, setHideOnEscape, setOnAutoHide, setScene
-
Methods inherited from class javafx.stage.Window
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, forceIntegerRenderScaleProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getOutputScaleX, getOutputScaleY, getProperties, getRenderScaleX, getRenderScaleY, getScene, getUserData, getWidth, getWindows, getX, getY, hasProperties, heightProperty, isFocused, isForceIntegerRenderScale, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, outputScaleXProperty, outputScaleYProperty, removeEventFilter, removeEventHandler, renderScaleXProperty, renderScaleYProperty, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setForceIntegerRenderScale, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setRenderScaleX, setRenderScaleY, setUserData, setWidth, setX, setY, show, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
-
-
-
-
Property Detail
-
contentNode
public final ObjectProperty<Node> contentNodeProperty
Returns the content shown by the pop over.- See Also:
getContentNode()
,setContentNode(Node)
-
headerAlwaysVisible
public final BooleanProperty headerAlwaysVisibleProperty
Determines whether or not thePopOver
header should remain visible, even while attached.
-
closeButtonEnabled
public final BooleanProperty closeButtonEnabledProperty
Determines whether or not the header's close button should be available.
-
detachable
public final BooleanProperty detachableProperty
Determines if the pop over is detachable at all.- See Also:
isDetachable()
,setDetachable(boolean)
-
detached
public final BooleanProperty detachedProperty
Determines whether the pop over is detached from the owning node or not. A detached pop over no longer shows an arrow pointing at the owner and features its own title bar.- See Also:
isDetached()
,setDetached(boolean)
-
arrowSize
public final DoubleProperty arrowSizeProperty
Controls the size of the arrow. Default value is 12.- See Also:
getArrowSize()
,setArrowSize(double)
-
arrowIndent
public final DoubleProperty arrowIndentProperty
Controls the distance between the arrow and the corners of the pop over. The default value is 12.- See Also:
getArrowIndent()
,setArrowIndent(double)
-
cornerRadius
public final DoubleProperty cornerRadiusProperty
Returns the corner radius property for the pop over.- See Also:
getCornerRadius()
,setCornerRadius(double)
-
title
public final StringProperty titleProperty
Stores the title to display in the PopOver's header.- See Also:
getTitle()
,setTitle(String)
-
arrowLocation
public final ObjectProperty<PopOver.ArrowLocation> arrowLocationProperty
Stores the preferred arrow location. This might not be the actual location of the arrow if auto fix is enabled.
-
fadeInDuration
public final ObjectProperty<Duration> fadeInDurationProperty
Stores the fade-in duration. This should be set before calling PopOver.show(..).- See Also:
getFadeInDuration()
,setFadeInDuration(Duration)
-
fadeOutDuration
public final ObjectProperty<Duration> fadeOutDurationProperty
Stores the fade-out duration.- See Also:
getFadeOutDuration()
,setFadeOutDuration(Duration)
-
animated
public final BooleanProperty animatedProperty
Stores the "animated" flag. If true then the PopOver will be shown / hidden with a short fade in / out animation.- See Also:
isAnimated()
,setAnimated(boolean)
-
-
Constructor Detail
-
PopOver
public PopOver()
Creates a pop over with a label as the content node.
-
PopOver
public PopOver(Node content)
Creates a pop over with the given node as the content node.- Parameters:
content
- The content shown by the pop over
-
-
Method Detail
-
createDefaultSkin
protected Skin<?> createDefaultSkin()
- Overrides:
createDefaultSkin
in classPopupControl
-
getRoot
public final StackPane getRoot()
The root pane stores the content node of the popover. It is accessible via this method in order to support proper styling.Example:
PopOver popOver = new PopOver(); popOver.getRoot().getStylesheets().add(...);
- Returns:
- the root pane
-
contentNodeProperty
public final ObjectProperty<Node> contentNodeProperty()
Returns the content shown by the pop over.- See Also:
getContentNode()
,setContentNode(Node)
-
getContentNode
public final Node getContentNode()
Returns the value of the content property- Returns:
- the content node
- See Also:
contentNodeProperty()
-
setContentNode
public final void setContentNode(Node content)
Sets the value of the content property.- Parameters:
content
- the new content node value- See Also:
contentNodeProperty()
-
show
public final void show(Node owner)
Shows the pop over in a position relative to the edges of the given owner node. The position is dependent on the arrow location. If the arrow is pointing to the right then the pop over will be placed to the left of the given owner. If the arrow points up then the pop over will be placed below the given owner node. The arrow will slightly overlap with the owner node.- Parameters:
owner
- the owner of the pop over
-
show
public final void show(Node owner, double offset)
Shows the pop over in a position relative to the edges of the given owner node. The position is dependent on the arrow location. If the arrow is pointing to the right then the pop over will be placed to the left of the given owner. If the arrow points up then the pop over will be placed below the given owner node.- Parameters:
owner
- the owner of the pop overoffset
- if negative specifies the distance to the owner node or when positive specifies the number of pixels that the arrow will overlap with the owner node (positive values are recommended)
-
show
public final void show(Window owner)
- Overrides:
show
in classPopupWindow
-
show
public final void show(Window ownerWindow, double anchorX, double anchorY)
- Overrides:
show
in classPopupWindow
-
show
public final void show(Node owner, double x, double y)
Makes the pop over visible at the give location and associates it with the given owner node. The x and y coordinate will be the target location of the arrow of the pop over and not the location of the window.- Overrides:
show
in classPopupWindow
- Parameters:
owner
- the owning nodex
- the x coordinate for the pop over arrow tipy
- the y coordinate for the pop over arrow tip
-
show
public final void show(Node owner, double x, double y, Duration fadeInDuration)
Makes the pop over visible at the give location and associates it with the given owner node. The x and y coordinate will be the target location of the arrow of the pop over and not the location of the window.- Parameters:
owner
- the owning nodex
- the x coordinate for the pop over arrow tipy
- the y coordinate for the pop over arrow tipfadeInDuration
- the time it takes for the pop over to be fully visible. This duration takes precedence over the fade-in property without setting.
-
hide
public final void hide()
Hides the pop over by quickly changing its opacity to 0.- Overrides:
hide
in classPopupWindow
- See Also:
hide(Duration)
-
hide
public final void hide(Duration fadeOutDuration)
Hides the pop over by quickly changing its opacity to 0.- Parameters:
fadeOutDuration
- the duration of the fade transition that is being used to change the opacity of the pop over- Since:
- 1.0
-
detach
public final void detach()
Detaches the pop over from the owning node. The pop over will no longer display an arrow pointing at the owner node.
-
headerAlwaysVisibleProperty
public final BooleanProperty headerAlwaysVisibleProperty()
Determines whether or not thePopOver
header should remain visible, even while attached.
-
setHeaderAlwaysVisible
public final void setHeaderAlwaysVisible(boolean visible)
Sets the value of the headerAlwaysVisible property.- Parameters:
visible
- if true, then the header is visible even while attached- See Also:
headerAlwaysVisibleProperty()
-
isHeaderAlwaysVisible
public final boolean isHeaderAlwaysVisible()
Returns the value of the detachable property.- Returns:
- true if the header is visible even while attached
- See Also:
headerAlwaysVisibleProperty()
-
closeButtonEnabledProperty
public final BooleanProperty closeButtonEnabledProperty()
Determines whether or not the header's close button should be available.
-
setCloseButtonEnabled
public final void setCloseButtonEnabled(boolean enabled)
Sets the value of the closeButtonEnabled property.- Parameters:
enabled
- if false, the pop over will not be closeable by the header's close button- See Also:
closeButtonEnabledProperty()
-
isCloseButtonEnabled
public final boolean isCloseButtonEnabled()
Returns the value of the closeButtonEnabled property.- Returns:
- true if the header's close button is enabled
- See Also:
closeButtonEnabledProperty()
-
detachableProperty
public final BooleanProperty detachableProperty()
Determines if the pop over is detachable at all.- See Also:
isDetachable()
,setDetachable(boolean)
-
setDetachable
public final void setDetachable(boolean detachable)
Sets the value of the detachable property.- Parameters:
detachable
- if true then the user can detach / tear off the pop over- See Also:
detachableProperty()
-
isDetachable
public final boolean isDetachable()
Returns the value of the detachable property.- Returns:
- true if the user is allowed to detach / tear off the pop over
- See Also:
detachableProperty()
-
detachedProperty
public final BooleanProperty detachedProperty()
Determines whether the pop over is detached from the owning node or not. A detached pop over no longer shows an arrow pointing at the owner and features its own title bar.- See Also:
isDetached()
,setDetached(boolean)
-
setDetached
public final void setDetached(boolean detached)
Sets the value of the detached property.- Parameters:
detached
- if true the pop over will change its apperance to "detached" mode- See Also:
detachedProperty()
-
isDetached
public final boolean isDetached()
Returns the value of the detached property.- Returns:
- true if the pop over is currently detached.
- See Also:
detachedProperty()
-
arrowSizeProperty
public final DoubleProperty arrowSizeProperty()
Controls the size of the arrow. Default value is 12.- See Also:
getArrowSize()
,setArrowSize(double)
-
getArrowSize
public final double getArrowSize()
Returns the value of the arrow size property.- Returns:
- the arrow size property value
- See Also:
arrowSizeProperty()
-
setArrowSize
public final void setArrowSize(double size)
Sets the value of the arrow size property.- Parameters:
size
- the new value of the arrow size property- See Also:
arrowSizeProperty()
-
arrowIndentProperty
public final DoubleProperty arrowIndentProperty()
Controls the distance between the arrow and the corners of the pop over. The default value is 12.- See Also:
getArrowIndent()
,setArrowIndent(double)
-
getArrowIndent
public final double getArrowIndent()
Returns the value of the arrow indent property.- Returns:
- the arrow indent value
- See Also:
arrowIndentProperty()
-
setArrowIndent
public final void setArrowIndent(double size)
Sets the value of the arrow indent property.- Parameters:
size
- the arrow indent value- See Also:
arrowIndentProperty()
-
cornerRadiusProperty
public final DoubleProperty cornerRadiusProperty()
Returns the corner radius property for the pop over.- See Also:
getCornerRadius()
,setCornerRadius(double)
-
getCornerRadius
public final double getCornerRadius()
Returns the value of the corner radius property.- Returns:
- the corner radius
- See Also:
cornerRadiusProperty()
-
setCornerRadius
public final void setCornerRadius(double radius)
Sets the value of the corner radius property.- Parameters:
radius
- the corner radius- See Also:
cornerRadiusProperty()
-
titleProperty
public final StringProperty titleProperty()
Stores the title to display in the PopOver's header.- See Also:
getTitle()
,setTitle(String)
-
getTitle
public final String getTitle()
Returns the value of the title property.- Returns:
- the detached title
- See Also:
titleProperty()
-
setTitle
public final void setTitle(String title)
Sets the value of the title property.- Parameters:
title
- the title to use when detached- See Also:
titleProperty()
-
arrowLocationProperty
public final ObjectProperty<PopOver.ArrowLocation> arrowLocationProperty()
Stores the preferred arrow location. This might not be the actual location of the arrow if auto fix is enabled.
-
setArrowLocation
public final void setArrowLocation(PopOver.ArrowLocation location)
Sets the value of the arrow location property.- Parameters:
location
- the requested location- See Also:
arrowLocationProperty()
-
getArrowLocation
public final PopOver.ArrowLocation getArrowLocation()
Returns the value of the arrow location property.- Returns:
- the preferred arrow location
- See Also:
arrowLocationProperty()
-
fadeInDurationProperty
public final ObjectProperty<Duration> fadeInDurationProperty()
Stores the fade-in duration. This should be set before calling PopOver.show(..).- See Also:
getFadeInDuration()
,setFadeInDuration(Duration)
-
fadeOutDurationProperty
public final ObjectProperty<Duration> fadeOutDurationProperty()
Stores the fade-out duration.- See Also:
getFadeOutDuration()
,setFadeOutDuration(Duration)
-
getFadeInDuration
public final Duration getFadeInDuration()
Returns the value of the fade-in duration property.- Returns:
- the fade-in duration
- See Also:
fadeInDurationProperty()
-
setFadeInDuration
public final void setFadeInDuration(Duration duration)
Sets the value of the fade-in duration property. This should be set before calling PopOver.show(..).- Parameters:
duration
- the requested fade-in duration- See Also:
fadeInDurationProperty()
-
getFadeOutDuration
public final Duration getFadeOutDuration()
Returns the value of the fade-out duration property.- Returns:
- the fade-out duration
- See Also:
fadeOutDurationProperty()
-
setFadeOutDuration
public final void setFadeOutDuration(Duration duration)
Sets the value of the fade-out duration property.- Parameters:
duration
- the requested fade-out duration- See Also:
fadeOutDurationProperty()
-
animatedProperty
public final BooleanProperty animatedProperty()
Stores the "animated" flag. If true then the PopOver will be shown / hidden with a short fade in / out animation.- See Also:
isAnimated()
,setAnimated(boolean)
-
isAnimated
public final boolean isAnimated()
Returns the value of the "animated" property.- Returns:
- true if the PopOver will be shown and hidden with a short fade animation
- See Also:
animatedProperty()
-
setAnimated
public final void setAnimated(boolean animated)
Sets the value of the "animated" property.- Parameters:
animated
- if true the PopOver will be shown and hidden with a short fade animation- See Also:
animatedProperty()
-
-