Class PopOver

java.lang.Object
javafx.stage.Window
javafx.stage.PopupWindow
javafx.scene.control.PopupControl
com.dlsc.gemsfx.PopOver
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable
Direct Known Subclasses:
PopOver.CalendarPopOver

public class PopOver extends javafx.scene.control.PopupControl
A control that is intended to provide detailed information about an owning node in a popup window. The popup window has a 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.

Example

var textFlow = new TextFlow(new Text("Some content"));
textFlow.setPrefWidth(300);

var popover = new Popover(textFlow);
var ownerLink = new Hyperlink("Show popover");
ownerLink.setOnAction(e -> popover.show(ownerLink));
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Locations where the arrow of the popover can be placed.
    static class 
    A specialized popover to let the user select a date or a date range.

    Nested classes/interfaces inherited from class javafx.scene.control.PopupControl

    javafx.scene.control.PopupControl.CSSBridge

    Nested classes/interfaces inherited from class javafx.stage.PopupWindow

    javafx.stage.PopupWindow.AnchorLocation
  • Property Summary

    Properties
    Type
    Property
    Description
    final javafx.beans.property.BooleanProperty
    Stores the "animated" flag.
    final javafx.beans.property.DoubleProperty
    Controls the distance between the arrow and the corners of the popover.
    final javafx.beans.property.ObjectProperty<PopOver.ArrowLocation>
    Stores the preferred arrow location.
    final javafx.beans.property.DoubleProperty
    Controls the size of the arrow.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Returns the content shown by the popover.
    final javafx.beans.property.DoubleProperty
    Returns the corner radius property for the popover.
    final javafx.beans.property.BooleanProperty
    Determines if the popover is detachable at all.
    final javafx.beans.property.BooleanProperty
    Determines whether the popover is detached from the owning node or not.
    final javafx.beans.property.ObjectProperty<javafx.util.Duration>
    Stores the fade-in duration.
    final javafx.beans.property.ObjectProperty<javafx.util.Duration>
    Stores the fade-out duration.

    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
  • Field Summary

    Fields inherited from class javafx.scene.control.PopupControl

    bridge, USE_COMPUTED_SIZE, USE_PREF_SIZE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a popover with a label as the content node.
    PopOver(javafx.scene.Node content)
    Creates a popover with the given node as the content node.
  • Method Summary

    Modifier and Type
    Method
    Description
    final javafx.beans.property.BooleanProperty
    Stores the "animated" flag.
    final javafx.beans.property.DoubleProperty
    Controls the distance between the arrow and the corners of the popover.
    final javafx.beans.property.ObjectProperty<PopOver.ArrowLocation>
    Stores the preferred arrow location.
    final javafx.beans.property.DoubleProperty
    Controls the size of the arrow.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Returns the content shown by the popover.
    final javafx.beans.property.DoubleProperty
    Returns the corner radius property for the popover.
    protected javafx.scene.control.Skin<?>
     
    final void
    Detaches the popover from the owning node.
    final javafx.beans.property.BooleanProperty
    Determines if the popover is detachable at all.
    final javafx.beans.property.BooleanProperty
    Determines whether the popover is detached from the owning node or not.
    final javafx.beans.property.ObjectProperty<javafx.util.Duration>
    Stores the fade-in duration.
    final javafx.beans.property.ObjectProperty<javafx.util.Duration>
    Stores the fade-out duration.
    final double
    Returns the value of the arrow indent property.
    Returns the value of the arrow location property.
    final double
    Returns the value of the arrow size property.
    final javafx.scene.Node
    Returns the value of the content property
    final double
    Returns the value of the corner radius property.
    final javafx.util.Duration
    Returns the value of the fade-in duration property.
    final javafx.util.Duration
    Returns the value of the fade-out duration property.
    final javafx.scene.layout.StackPane
    The root pane stores the content node of the popover.
    final void
    Hides the popover by quickly changing its opacity to 0.
    final void
    hide(javafx.util.Duration fadeOutDuration)
    Hides the popover by quickly changing its opacity to 0.
    final boolean
    Returns the value of the "animated" property.
    final boolean
    Returns the value of the detachable property.
    final boolean
    Returns the value of the detached property.
    final void
    setAnimated(boolean animated)
    Sets the value of the "animated" property.
    final void
    setArrowIndent(double size)
    Sets the value of the arrow indent property.
    final void
    Sets the value of the arrow location property.
    final void
    setArrowSize(double size)
    Sets the value of the arrow size property.
    final void
    setContentNode(javafx.scene.Node content)
    Sets the value of the content property.
    final void
    setCornerRadius(double radius)
    Sets the value of the corner radius property.
    final void
    setDetachable(boolean detachable)
    Sets the value of the detachable property.
    final void
    setDetached(boolean detached)
    Sets the value of the detached property.
    final void
    setFadeInDuration(javafx.util.Duration duration)
    Sets the value of the fade-in duration property.
    final void
    setFadeOutDuration(javafx.util.Duration duration)
    Sets the value of the fade-out duration property.
    final void
    show(javafx.scene.Node owner)
    Shows the popover in a position relative to the edges of the given owner node.
    final void
    show(javafx.scene.Node owner, double offset)
    Shows the popover in a position relative to the edges of the given owner node.
    final void
    show(javafx.scene.Node owner, double x, double y)
    Makes the popover visible at the give location and associates it with the given owner node.
    final void
    show(javafx.scene.Node owner, double x, double y, javafx.util.Duration fadeInDuration)
    Makes the popover visible at the give location and associates it with the given owner node.

    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, show, show

    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

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Constructor Details

    • PopOver

      public PopOver()
      Creates a popover with a label as the content node.
    • PopOver

      public PopOver(javafx.scene.Node content)
      Creates a popover with the given node as the content node.
      Parameters:
      content - The content shown by the popover
  • Method Details

    • createDefaultSkin

      protected javafx.scene.control.Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class javafx.scene.control.PopupControl
    • getRoot

      public final javafx.scene.layout.StackPane getRoot()
      The root pane stores the content node of the popover. It is accessible via this method to support proper styling.

      Example:

      Popover popOver = new Popover();
      popOver.getRoot().getStylesheets().add(...);
      
      Returns:
      the root pane
    • contentNodeProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> contentNodeProperty()
      Returns the content shown by the popover.
      Returns:
      the content node property
      See Also:
    • getContentNode

      public final javafx.scene.Node getContentNode()
      Returns the value of the content property
      Returns:
      the content node
      See Also:
    • setContentNode

      public final void setContentNode(javafx.scene.Node content)
      Sets the value of the content property.
      Parameters:
      content - the new content node value
      See Also:
    • show

      public final void show(javafx.scene.Node owner)
      Shows the popover 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 popover will be placed to the left of the given owner. If the arrow points up, then the popover will be placed below the given owner node. The arrow will slightly overlap with the owner node.
      Parameters:
      owner - the owner of the popover
    • show

      public final void show(javafx.scene.Node owner, double offset)
      Shows the popover 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 popover will be placed to the left of the given owner. If the arrow points up, then the popover will be placed below the given owner node.
      Parameters:
      owner - the owner of the popover
      offset - 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(javafx.scene.Node owner, double x, double y)
      Makes the popover 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 popover and not the location of the window.
      Overrides:
      show in class javafx.stage.PopupWindow
      Parameters:
      owner - the owning node
      x - the x coordinate for the popover arrow tip
      y - the y coordinate for the popover arrow tip
    • show

      public final void show(javafx.scene.Node owner, double x, double y, javafx.util.Duration fadeInDuration)
      Makes the popover 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 popover and not the location of the window.
      Parameters:
      owner - the owning node
      x - the x coordinate for the popover arrow tip
      y - the y coordinate for the popover arrow tip
      fadeInDuration - the time it takes for the popover to be fully visible. This duration takes precedence over the fade-in property without setting.
    • hide

      public final void hide()
      Hides the popover by quickly changing its opacity to 0.
      Overrides:
      hide in class javafx.stage.PopupWindow
      See Also:
    • hide

      public final void hide(javafx.util.Duration fadeOutDuration)
      Hides the popover 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 popover
      Since:
      1.0
    • detach

      public final void detach()
      Detaches the popover from the owning node. The popover will no longer display an arrow pointing at the owner node.
    • detachableProperty

      public final javafx.beans.property.BooleanProperty detachableProperty()
      Determines if the popover is detachable at all.
      Returns:
      the detachable property
      See Also:
    • 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 popover
      See Also:
    • isDetachable

      public final boolean isDetachable()
      Returns the value of the detachable property.
      Returns:
      true if the user is allowed to detach / tear off the popover
      See Also:
    • detachedProperty

      public final javafx.beans.property.BooleanProperty detachedProperty()
      Determines whether the popover is detached from the owning node or not. A detached popover no longer shows an arrow pointing at the owner and features its own title bar.
      Returns:
      the detached property
      See Also:
    • setDetached

      public final void setDetached(boolean detached)
      Sets the value of the detached property.
      Parameters:
      detached - if true, the popover will change its appearance to "detached" mode
      See Also:
    • isDetached

      public final boolean isDetached()
      Returns the value of the detached property.
      Returns:
      true if the popover is currently detached.
      See Also:
    • arrowSizeProperty

      public final javafx.beans.property.DoubleProperty arrowSizeProperty()
      Controls the size of the arrow. The default value is 10.
      Returns:
      the arrow size property
      See Also:
    • getArrowSize

      public final double getArrowSize()
      Returns the value of the arrow size property.
      Returns:
      the arrow size property value
      See Also:
    • 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:
    • arrowIndentProperty

      public final javafx.beans.property.DoubleProperty arrowIndentProperty()
      Controls the distance between the arrow and the corners of the popover. The default value is 12.
      Returns:
      the arrow indent property
      See Also:
    • getArrowIndent

      public final double getArrowIndent()
      Returns the value of the arrow indent property.
      Returns:
      the arrow indent value
      See Also:
    • setArrowIndent

      public final void setArrowIndent(double size)
      Sets the value of the arrow indent property.
      Parameters:
      size - the arrow indent value
      See Also:
    • cornerRadiusProperty

      public final javafx.beans.property.DoubleProperty cornerRadiusProperty()
      Returns the corner radius property for the popover.
      Returns:
      the corner radius property (default is 6)
      See Also:
    • getCornerRadius

      public final double getCornerRadius()
      Returns the value of the corner radius property.
      Returns:
      the corner radius
      See Also:
    • setCornerRadius

      public final void setCornerRadius(double radius)
      Sets the value of the corner radius property.
      Parameters:
      radius - the corner radius
      See Also:
    • arrowLocationProperty

      public final javafx.beans.property.ObjectProperty<PopOver.ArrowLocation> arrowLocationProperty()
      Stores the preferred arrow location. This might not be the actual location of the arrow if auto fix is enabled.
      Returns:
      the arrow location property
      See Also:
    • setArrowLocation

      public final void setArrowLocation(PopOver.ArrowLocation location)
      Sets the value of the arrow location property.
      Parameters:
      location - the requested location
      See Also:
    • getArrowLocation

      public final PopOver.ArrowLocation getArrowLocation()
      Returns the value of the arrow location property.
      Returns:
      the preferred arrow location
      See Also:
    • fadeInDurationProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeInDurationProperty()
      Stores the fade-in duration. This should be set before calling PopOver.show(…).
      Returns:
      the fade-in duration property
      See Also:
    • fadeOutDurationProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeOutDurationProperty()
      Stores the fade-out duration.
      Returns:
      the fade-out duration property
      See Also:
    • getFadeInDuration

      public final javafx.util.Duration getFadeInDuration()
      Returns the value of the fade-in duration property.
      Returns:
      the fade-in duration
      See Also:
    • setFadeInDuration

      public final void setFadeInDuration(javafx.util.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:
    • getFadeOutDuration

      public final javafx.util.Duration getFadeOutDuration()
      Returns the value of the fade-out duration property.
      Returns:
      the fade-out duration
      See Also:
    • setFadeOutDuration

      public final void setFadeOutDuration(javafx.util.Duration duration)
      Sets the value of the fade-out duration property.
      Parameters:
      duration - the requested fade-out duration
      See Also:
    • animatedProperty

      public final javafx.beans.property.BooleanProperty animatedProperty()
      Stores the "animated" flag. If true, then the PopOver will be shown / hidden with a short fade in / out animation.
      Returns:
      the "animated" property
      See Also:
    • 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:
    • 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: