- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.layout.Pane
-
- com.gluonhq.charm.glisten.layout.Layer
-
- com.gluonhq.charm.glisten.layout.layer.PopupView
-
- All Implemented Interfaces:
Styleable
,EventTarget
- Direct Known Subclasses:
MenuPopupView
public class PopupView extends Layer
The PopupView class is used to show a list of Nodes within the user interface - it will appear relative to the given owner node. PopupView will stick to either left or right side of the owner node depending on the value of the {
sideProperty()
.Example
The following example shows a PopupView when the user presses the button with the label "Click".
public class MyApp extends MobileApplication{ private Button button; private PopupView popupView; @Override public void init() { addViewFactory(HOME_VIEW, () -> { button = new Button("Click"); button.setOnAction(event -> popupView.show()); popupView = new PopupView(button); VBox vBox = new VBox(); vBox.getChildren().addAll(new Label("Choice 1"), new Label("Choice 2"), new Label("Choice 3")); vBox.setSpacing(5); popupView.setContent(vBox); return new View(button) { @Override protected void updateAppBar(AppBar appBar) { appBar.setTitleText("PopupView"); } }; }); } }
- Since:
- 2.2.0
-
-
Property Summary
Properties Type Property Description ObjectProperty<Node>
content
The content of the PopupView.StyleableObjectProperty<Insets>
popupPadding
Space between the root node of the popup and each side of the scene.ObjectProperty<PopupView.PopupSide>
side
The side of the owner node to which this Popup should stick to.DoubleProperty
verticalOffset
By default the original position of the popup is over the owner node.-
Properties inherited from class com.gluonhq.charm.glisten.layout.Layer
autoHide, backgroundFade, hideTransitionFactory, onHidden, onHiding, onShowing, onShown, showing, showTransitionFactory
-
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, focusVisible, focusWithin, 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PopupView.PopupSide
Enum for side of a owner node PopupView should stick to.
-
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 Modifier Constructor Description PopupView(Node ownerNode)
Creates a new PopupView instance that will be displayed relative to the givenownerNode
.protected
PopupView(Node ownerNode, PopupRenderer renderer)
Creates a PopupView using the owner node and renderer.PopupView(Node ownerNode, Node content)
Creates a new PopupView instance that will be displayed relative to the givenownerNode
with the givencontent
as its content.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectProperty<Node>
contentProperty()
The content of the PopupView.static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
Node
getContent()
Gets the value of the property content.List<CssMetaData<? extends Styleable,?>>
getCssMetaData()
Insets
getPopupPadding()
Gets the value of the property popupPadding.PopupView.PopupSide
getSide()
Gets the value of the property side.double
getVerticalOffset()
Gets the value of the property verticalOffset.void
layoutChildren()
Override this method to add the layout logic for your layer.StyleableObjectProperty<Insets>
popupPaddingProperty()
Space between the root node of the popup and each side of the scene.void
setContent(Node content)
Sets the value of the property content.void
setPopupPadding(Insets value)
Sets the value of the property popupPadding.void
setSide(PopupView.PopupSide value)
Sets the value of the property side.void
setVerticalOffset(double offset)
Sets the value of the property verticalOffset.ObjectProperty<PopupView.PopupSide>
sideProperty()
The side of the owner node to which this Popup should stick to.protected boolean
useContentSize()
By default, PopupView uses thecontentProperty()
's pref size to layout the content.DoubleProperty
verticalOffsetProperty()
By default the original position of the popup is over the owner node.-
Methods inherited from class com.gluonhq.charm.glisten.layout.Layer
autoHideProperty, backgroundFadeProperty, getBackgroundFade, getHideTransitionFactory, getOnHidden, getOnHiding, getOnShowing, getOnShown, getShowTransitionFactory, hide, hideTransitionFactoryProperty, isAutoHide, isShowing, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, setAutoHide, setBackgroundFade, setHideTransitionFactory, setOnHidden, setOnHiding, setOnShowing, setOnShown, setShowTransitionFactory, show, showingProperty, showTransitionFactoryProperty
-
Methods inherited from class javafx.scene.layout.Pane
getChildren
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, 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
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, 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, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, 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, isFocusVisible, isFocusWithin, 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
-
content
public final ObjectProperty<Node> contentProperty
The content of the PopupView.- See Also:
getContent()
,setContent(Node)
-
verticalOffset
public DoubleProperty verticalOffsetProperty
By default the original position of the popup is over the owner node. This is the vertical offset from the original position from which to show the popup.- See Also:
getVerticalOffset()
,setVerticalOffset(double)
-
popupPadding
public final StyleableObjectProperty<Insets> popupPaddingProperty
Space between the root node of the popup and each side of the scene. Does not affect computed width and height calculations.- The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
verticalOffset
and layoutY of the root node is less than the top padding. - The right padding is the difference between the right edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.RIGHT
, the popup is automatically laid out from the right edge of the owner node and not the right edge of the scene. Under such circumstances, if the distance between the right edge of the owner node and the scene is more than the right padding this value will be ignored. - The bottom padding is the difference between the bottom edge of the scene and the popup. It will only be used when the popup is laid out below the owner node.
- The left padding is the difference between the left edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.LEFT
, the popup is automatically laid out its from the left edge of the owner node and not the left edge of the scene. Under such circumstances, if the distance between the left edge of the owner node and the scene is more than the left padding this value will be ignored.
Setting the value to null should be avoided.
Style Guide:
This property can be applied in css using "-fx-popup-padding" which accepts a double value.- Default value:
Insets.EMPTY
- Since:
- 5.0.0
- See Also:
getPopupPadding()
,setPopupPadding(Insets)
- The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
-
side
public final ObjectProperty<PopupView.PopupSide> sideProperty
The side of the owner node to which this Popup should stick to.- See Also:
getSide()
,setSide(PopupView.PopupSide)
-
-
Constructor Detail
-
PopupView
protected PopupView(Node ownerNode, PopupRenderer renderer)
Creates a PopupView using the owner node and renderer.- Parameters:
ownerNode
- The node on which this popup is to be shown.renderer
- The renderer to provide the root node for the popup.- Throws:
NullPointerException
- when theownerNode
parameter isnull
-
PopupView
public PopupView(Node ownerNode)
Creates a new PopupView instance that will be displayed relative to the givenownerNode
.- Parameters:
ownerNode
- The node that the popup should be shown relative to.
-
-
Method Detail
-
contentProperty
public final ObjectProperty<Node> contentProperty()
The content of the PopupView.- See Also:
getContent()
,setContent(Node)
-
setContent
public final void setContent(Node content)
Sets the value of the property content.- Property description:
- The content of the PopupView.
-
getContent
public final Node getContent()
Gets the value of the property content.- Property description:
- The content of the PopupView.
-
setVerticalOffset
public final void setVerticalOffset(double offset)
Sets the value of the property verticalOffset.- Property description:
- By default the original position of the popup is over the owner node. This is the vertical offset from the original position from which to show the popup.
-
getVerticalOffset
public double getVerticalOffset()
Gets the value of the property verticalOffset.- Property description:
- By default the original position of the popup is over the owner node. This is the vertical offset from the original position from which to show the popup.
-
verticalOffsetProperty
public DoubleProperty verticalOffsetProperty()
By default the original position of the popup is over the owner node. This is the vertical offset from the original position from which to show the popup.- See Also:
getVerticalOffset()
,setVerticalOffset(double)
-
popupPaddingProperty
public final StyleableObjectProperty<Insets> popupPaddingProperty()
Space between the root node of the popup and each side of the scene. Does not affect computed width and height calculations.- The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
verticalOffset
and layoutY of the root node is less than the top padding. - The right padding is the difference between the right edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.RIGHT
, the popup is automatically laid out from the right edge of the owner node and not the right edge of the scene. Under such circumstances, if the distance between the right edge of the owner node and the scene is more than the right padding this value will be ignored. - The bottom padding is the difference between the bottom edge of the scene and the popup. It will only be used when the popup is laid out below the owner node.
- The left padding is the difference between the left edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.LEFT
, the popup is automatically laid out its from the left edge of the owner node and not the left edge of the scene. Under such circumstances, if the distance between the left edge of the owner node and the scene is more than the left padding this value will be ignored.
Setting the value to null should be avoided.
Style Guide:
This property can be applied in css using "-fx-popup-padding" which accepts a double value.- Default value:
Insets.EMPTY
- Since:
- 5.0.0
- See Also:
getPopupPadding()
,setPopupPadding(Insets)
- The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
-
getPopupPadding
public final Insets getPopupPadding()
Gets the value of the property popupPadding.- Property description:
- Space between the root node of the popup and each side of the scene.
Does not affect computed width and height calculations.
- The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
verticalOffset
and layoutY of the root node is less than the top padding. - The right padding is the difference between the right edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.RIGHT
, the popup is automatically laid out from the right edge of the owner node and not the right edge of the scene. Under such circumstances, if the distance between the right edge of the owner node and the scene is more than the right padding this value will be ignored. - The bottom padding is the difference between the bottom edge of the scene and the popup. It will only be used when the popup is laid out below the owner node.
- The left padding is the difference between the left edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.LEFT
, the popup is automatically laid out its from the left edge of the owner node and not the left edge of the scene. Under such circumstances, if the distance between the left edge of the owner node and the scene is more than the left padding this value will be ignored.
Setting the value to null should be avoided.
Style Guide:
This property can be applied in css using "-fx-popup-padding" which accepts a double value. - The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
- Default value:
Insets.EMPTY
- Since:
- 5.0.0
-
setPopupPadding
public final void setPopupPadding(Insets value)
Sets the value of the property popupPadding.- Property description:
- Space between the root node of the popup and each side of the scene.
Does not affect computed width and height calculations.
- The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
verticalOffset
and layoutY of the root node is less than the top padding. - The right padding is the difference between the right edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.RIGHT
, the popup is automatically laid out from the right edge of the owner node and not the right edge of the scene. Under such circumstances, if the distance between the right edge of the owner node and the scene is more than the right padding this value will be ignored. - The bottom padding is the difference between the bottom edge of the scene and the popup. It will only be used when the popup is laid out below the owner node.
- The left padding is the difference between the left edge of the scene and popup. Please note
that when
sideProperty()
is set toPopupView.PopupSide.LEFT
, the popup is automatically laid out its from the left edge of the owner node and not the left edge of the scene. Under such circumstances, if the distance between the left edge of the owner node and the scene is more than the left padding this value will be ignored.
Setting the value to null should be avoided.
Style Guide:
This property can be applied in css using "-fx-popup-padding" which accepts a double value. - The top padding is the difference between the top edge of the scene and popup. It will used
when either the popup is laid out on top of the owner node or the sum of
- Default value:
Insets.EMPTY
- Since:
- 5.0.0
-
sideProperty
public final ObjectProperty<PopupView.PopupSide> sideProperty()
The side of the owner node to which this Popup should stick to.- See Also:
getSide()
,setSide(PopupView.PopupSide)
-
getSide
public final PopupView.PopupSide getSide()
Gets the value of the property side.- Property description:
- The side of the owner node to which this Popup should stick to.
-
setSide
public final void setSide(PopupView.PopupSide value)
Sets the value of the property side.- Property description:
- The side of the owner node to which this Popup should stick to.
-
layoutChildren
public void layoutChildren()
Override this method to add the layout logic for your layer. Care should be taken to call this method in overriden methods for proper functioning of the Layer.- Overrides:
layoutChildren
in classLayer
-
useContentSize
protected boolean useContentSize()
By default, PopupView uses thecontentProperty()
's pref size to layout the content. If available bounds is less than the size of the content, the latter is resized to fit the same. When set to false, it uses theRegion.getPrefWidth()
andRegion.getPrefHeight()
of the PopupView to layout the content.In case, this is set to false, care should be taken to set the height and width of the view.
- Returns:
- true, if content size is to be used. Else, returns false.
-
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
- Returns:
- The CssMetaData associated with this class, which may include the CssMetaData of its super classes.
- Since:
- JavaFX 8.0
-
getCssMetaData
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
- Specified by:
getCssMetaData
in interfaceStyleable
- Overrides:
getCssMetaData
in classRegion
- Since:
- JavaFX 8.0
-
-