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()
.
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"); } }; }); } }
Type | Property and Description |
---|---|
javafx.beans.property.ObjectProperty<javafx.scene.Node> |
content
The content of the PopupView.
|
javafx.css.StyleableObjectProperty<javafx.geometry.Insets> |
popupPadding
Space between the root node of the popup and each side of the scene.
|
javafx.beans.property.ObjectProperty<PopupView.PopupSide> |
side
The side of the owner node to which this Popup should stick to.
|
javafx.beans.property.DoubleProperty |
verticalOffset
By default the original position of the popup is over the owner node.
|
autoHide, backgroundFade, hideTransitionFactory, onHidden, onHiding, onShowing, onShown, showing, showTransitionFactory
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, impl_showMnemonics, impl_treeVisible, 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, visible
Modifier and Type | Class and Description |
---|---|
static class |
PopupView.PopupSide
Enum for side of a owner node PopupView should stick to.
|
Modifier | Constructor and Description |
---|---|
|
PopupView(javafx.scene.Node ownerNode)
Creates a new PopupView instance that will be displayed relative to
the given
ownerNode . |
protected |
PopupView(javafx.scene.Node ownerNode,
PopupRenderer renderer)
Creates a PopupView using the owner node and renderer.
|
Modifier and Type | Method and Description |
---|---|
javafx.beans.property.ObjectProperty<javafx.scene.Node> |
contentProperty()
The content of the PopupView.
|
static java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> |
getClassCssMetaData() |
javafx.scene.Node |
getContent()
Gets the value of the property content.
|
java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> |
getCssMetaData() |
javafx.geometry.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.
|
javafx.css.StyleableObjectProperty<javafx.geometry.Insets> |
popupPaddingProperty()
Space between the root node of the popup and each side of the scene.
|
void |
setContent(javafx.scene.Node content)
Sets the value of the property content.
|
void |
setPopupPadding(javafx.geometry.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.
|
javafx.beans.property.ObjectProperty<PopupView.PopupSide> |
sideProperty()
The side of the owner node to which this Popup should stick to.
|
protected boolean |
useContentSize()
By default, PopupView uses the
contentProperty() 's pref size to layout the content. |
javafx.beans.property.DoubleProperty |
verticalOffsetProperty()
By default the original position of the popup is over the owner node.
|
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
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, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, 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, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, 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, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public final javafx.beans.property.ObjectProperty<javafx.scene.Node> contentProperty
getContent()
,
setContent(Node)
public javafx.beans.property.DoubleProperty verticalOffsetProperty
getVerticalOffset()
,
setVerticalOffset(double)
public final javafx.css.StyleableObjectProperty<javafx.geometry.Insets> popupPaddingProperty
verticalOffset
and layoutY of the root node is less than the top padding.sideProperty()
is set to PopupView.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.sideProperty()
is set to PopupView.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.Insets.EMPTY
getPopupPadding()
,
setPopupPadding(Insets)
public final javafx.beans.property.ObjectProperty<PopupView.PopupSide> sideProperty
getSide()
,
setSide(PopupSide)
protected PopupView(javafx.scene.Node ownerNode, PopupRenderer renderer)
ownerNode
- The node on which this popup is to be shown.renderer
- The renderer to provide the root node for the popup.public PopupView(javafx.scene.Node ownerNode)
ownerNode
.ownerNode
- The node that the popup should be shown relative to.public final javafx.beans.property.ObjectProperty<javafx.scene.Node> contentProperty()
getContent()
,
setContent(Node)
public final void setContent(javafx.scene.Node content)
public final javafx.scene.Node getContent()
public final void setVerticalOffset(double offset)
public double getVerticalOffset()
public javafx.beans.property.DoubleProperty verticalOffsetProperty()
getVerticalOffset()
,
setVerticalOffset(double)
public final javafx.css.StyleableObjectProperty<javafx.geometry.Insets> popupPaddingProperty()
verticalOffset
and layoutY of the root node is less than the top padding.sideProperty()
is set to PopupView.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.sideProperty()
is set to PopupView.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.Insets.EMPTY
getPopupPadding()
,
setPopupPadding(Insets)
public final javafx.geometry.Insets getPopupPadding()
verticalOffset
and layoutY of the root node is less than the top padding.sideProperty()
is set to PopupView.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.sideProperty()
is set to PopupView.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.Insets.EMPTY
public final void setPopupPadding(javafx.geometry.Insets value)
verticalOffset
and layoutY of the root node is less than the top padding.sideProperty()
is set to PopupView.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.sideProperty()
is set to PopupView.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.Insets.EMPTY
public final javafx.beans.property.ObjectProperty<PopupView.PopupSide> sideProperty()
getSide()
,
setSide(PopupSide)
public final PopupView.PopupSide getSide()
public final void setSide(PopupView.PopupSide value)
public void layoutChildren()
layoutChildren
in class Layer
protected boolean useContentSize()
contentProperty()
'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 the Region.getPrefWidth()
and Region.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.
public static java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> getClassCssMetaData()
public java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> getCssMetaData()
getCssMetaData
in interface javafx.css.Styleable
getCssMetaData
in class javafx.scene.layout.Region