- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.control.Control
-
- com.gluonhq.charm.glisten.control.AvatarPane<T>
-
- Type Parameters:
T
- This type is used to represent the type of the objects stored in the AvatarPane'sitems
ObservableList.
- All Implemented Interfaces:
Styleable
,EventTarget
,Skinnable
@DefaultProperty("items") public class AvatarPane<T> extends Control
The AvatarPane contains a collection of
Avatar
s on the top, over a contentNode
. Typically the content being shown is a description of the corresponding selected Avatar, the user selects an Avatar by clicking/tapping that Avatar.An items property exists to hold the collection of items from a data model. For the creation of each Avatar the programmer must set an Avatar factory, the Avatar factory receives an item and should create an Avatar based on that item. A content factory, with a return type of Node, is also needed to populate the content beneath the Avatars.
Example
The following example creates an AvatarPane containing a list of speakers. Sets the Avatar factory with a factory that returns an Avatar with
speaker.getPicture()
as theImage
URL, and sets a content factory that returns a vertical list containingspeaker.getFullName()
,speaker.getJobTitle()
,speaker.getCompany()
andspeaker.getSummary()
.AvatarPane<Speaker> avatarPane = new AvatarPane<>(speakers); avatarPane.setAvatarFactory(speaker -> { Avatar avatar = new Avatar(); Image image = new Image(speaker.getPicture()); avatar.setImage(image); return avatar; }); avatarPane.setContentFactory(speaker -> { VBox container = new VBox(); Label name = new Label(speaker.getFullName()); name.setWrapText(true); Label jobTitle = new Label(speaker.getJobTitle()); jobTitle.setWrapText(true); Label company = new Label(speaker.getCompany()); company.setWrapText(true); Label summary = new Label(speaker.getSummary()); summary.setWrapText(true); container.getChildren().addAll(name, jobTitle, company, summary); return container; });
- Since:
- 4.2.0
- See Also:
Avatar
-
-
Property Summary
Properties Type Property Description ObjectProperty<Callback<T,Avatar>>
avatarFactory
For every item in the AvatarPane the avatar factory is called to get theAvatar
to be placed with the other Avatars on the top.BooleanProperty
collapsible
If set to true the AvatarPane may be expanded or collapsed (refer toexpandedProperty()
) by the user by pressing the currently selectedAvatar
.ObjectProperty<Callback<T,Node>>
contentFactory
ObjectProperty<Runnable>
exitAction
BooleanProperty
expanded
Whether the content should be expanded.ListProperty<T>
items
The list of items to be shown in this AvatarPane.ObjectProperty<T>
value
The selected item.-
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 AvatarPane()
The default constructor, creates an empty AvatarPane with no items.AvatarPane(ObservableList<T> items)
Creates an AvatarPane with the items passed in as a parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectProperty<Callback<T,Avatar>>
avatarFactoryProperty()
For every item in the AvatarPane the avatar factory is called to get theAvatar
to be placed with the other Avatars on the top.BooleanProperty
collapsibleProperty()
If set to true the AvatarPane may be expanded or collapsed (refer toexpandedProperty()
) by the user by pressing the currently selectedAvatar
.ObjectProperty<Callback<T,Node>>
contentFactoryProperty()
protected Skin<?>
createDefaultSkin()
ObjectProperty<Runnable>
exitActionProperty()
BooleanProperty
expandedProperty()
Whether the content should be expanded.Callback<T,Avatar>
getAvatarFactory()
Gets the value of the property avatarFactory.Callback<T,Node>
getContentFactory()
Gets the value of the property contentFactory.Runnable
getExitAction()
Gets the value of the property exitAction.ObservableList<T>
getItems()
Gets the value of the property items.String
getUserAgentStylesheet()
T
getValue()
Gets the value of the property value.boolean
isCollapsible()
Gets the value of the property collapsible.boolean
isExpanded()
Gets the value of the property expanded.ListProperty<T>
itemsProperty()
The list of items to be shown in this AvatarPane.void
setAvatarFactory(Callback<T,Avatar> value)
Sets the value of the property avatarFactory.void
setCollapsible(boolean value)
Sets the value of the property collapsible.void
setContentFactory(Callback<T,Node> value)
Sets the value of the property contentFactory.void
setExitAction(Runnable value)
Sets the value of the property exitAction.void
setExpanded(boolean value)
Sets the value of the property expanded.void
setItems(ObservableList<T> items)
Sets the value of the property items.void
setValue(T value)
Sets the value of the property value.ObjectProperty<T>
valueProperty()
The selected item.-
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
-
items
public final ListProperty<T> itemsProperty
The list of items to be shown in this AvatarPane.- See Also:
getItems()
,setItems(ObservableList)
-
avatarFactory
public final ObjectProperty<Callback<T,Avatar>> avatarFactoryProperty
For every item in the AvatarPane the avatar factory is called to get theAvatar
to be placed with the other Avatars on the top.- See Also:
getAvatarFactory()
,setAvatarFactory(Callback)
-
contentFactory
public final ObjectProperty<Callback<T,Node>> contentFactoryProperty
For every item in the AvatarPane the content factory is called to get the contentNode
to show below the correspondingAvatar
.- See Also:
getContentFactory()
,setContentFactory(Callback)
-
value
public final ObjectProperty<T> valueProperty
The selected item. The selected item changes as the user taps/clicks on anAvatar
.- See Also:
getValue()
,setValue(T)
-
expanded
public final BooleanProperty expandedProperty
Whether the content should be expanded. If set to true the content will be visible, otherwise it will not.- Default value:
- true
- See Also:
isExpanded()
,setExpanded(boolean)
-
collapsible
public final BooleanProperty collapsibleProperty
If set to true the AvatarPane may be expanded or collapsed (refer toexpandedProperty()
) by the user by pressing the currently selectedAvatar
.- Default value:
- false
- See Also:
isCollapsible()
,setCollapsible(boolean)
-
exitAction
public final ObjectProperty<Runnable> exitActionProperty
- See Also:
getExitAction()
,setExitAction(Runnable)
-
-
Constructor Detail
-
AvatarPane
public AvatarPane()
The default constructor, creates an empty AvatarPane with no items.
-
AvatarPane
public AvatarPane(ObservableList<T> items)
Creates an AvatarPane with the items passed in as a parameter. By default the first item is the selected item.- Parameters:
items
- The items to be included in this AvatarPane.
-
-
Method Detail
-
itemsProperty
public final ListProperty<T> itemsProperty()
The list of items to be shown in this AvatarPane.- See Also:
getItems()
,setItems(ObservableList)
-
getItems
public final ObservableList<T> getItems()
Gets the value of the property items.- Property description:
- The list of items to be shown in this AvatarPane.
-
setItems
public final void setItems(ObservableList<T> items)
Sets the value of the property items.- Property description:
- The list of items to be shown in this AvatarPane.
-
avatarFactoryProperty
public final ObjectProperty<Callback<T,Avatar>> avatarFactoryProperty()
For every item in the AvatarPane the avatar factory is called to get theAvatar
to be placed with the other Avatars on the top.- See Also:
getAvatarFactory()
,setAvatarFactory(Callback)
-
getAvatarFactory
public final Callback<T,Avatar> getAvatarFactory()
Gets the value of the property avatarFactory.- Property description:
- For every item in the AvatarPane the avatar factory is called to get the
Avatar
to be placed with the other Avatars on the top.
-
setAvatarFactory
public final void setAvatarFactory(Callback<T,Avatar> value)
Sets the value of the property avatarFactory.- Property description:
- For every item in the AvatarPane the avatar factory is called to get the
Avatar
to be placed with the other Avatars on the top.
-
contentFactoryProperty
public final ObjectProperty<Callback<T,Node>> contentFactoryProperty()
For every item in the AvatarPane the content factory is called to get the contentNode
to show below the correspondingAvatar
.- See Also:
getContentFactory()
,setContentFactory(Callback)
-
getContentFactory
public final Callback<T,Node> getContentFactory()
Gets the value of the property contentFactory.
-
setContentFactory
public final void setContentFactory(Callback<T,Node> value)
Sets the value of the property contentFactory.
-
valueProperty
public final ObjectProperty<T> valueProperty()
The selected item. The selected item changes as the user taps/clicks on anAvatar
.- See Also:
getValue()
,setValue(T)
-
getValue
public final T getValue()
Gets the value of the property value.- Property description:
- The selected item. The selected item changes as the user taps/clicks on an
Avatar
.
-
setValue
public final void setValue(T value)
Sets the value of the property value.- Property description:
- The selected item. The selected item changes as the user taps/clicks on an
Avatar
.
-
expandedProperty
public final BooleanProperty expandedProperty()
Whether the content should be expanded. If set to true the content will be visible, otherwise it will not.- Default value:
- true
- See Also:
isExpanded()
,setExpanded(boolean)
-
setExpanded
public final void setExpanded(boolean value)
Sets the value of the property expanded.- Property description:
- Whether the content should be expanded. If set to true the content will be visible, otherwise it will not.
- Default value:
- true
-
isExpanded
public final boolean isExpanded()
Gets the value of the property expanded.- Property description:
- Whether the content should be expanded. If set to true the content will be visible, otherwise it will not.
- Default value:
- true
-
collapsibleProperty
public final BooleanProperty collapsibleProperty()
If set to true the AvatarPane may be expanded or collapsed (refer toexpandedProperty()
) by the user by pressing the currently selectedAvatar
.- Default value:
- false
- See Also:
isCollapsible()
,setCollapsible(boolean)
-
setCollapsible
public final void setCollapsible(boolean value)
Sets the value of the property collapsible.- Property description:
- If set to true the AvatarPane may be expanded or collapsed (refer to
expandedProperty()
) by the user by pressing the currently selectedAvatar
. - Default value:
- false
-
isCollapsible
public final boolean isCollapsible()
Gets the value of the property collapsible.- Property description:
- If set to true the AvatarPane may be expanded or collapsed (refer to
expandedProperty()
) by the user by pressing the currently selectedAvatar
. - Default value:
- false
-
exitActionProperty
public final ObjectProperty<Runnable> exitActionProperty()
- See Also:
getExitAction()
,setExitAction(Runnable)
-
getExitAction
public final Runnable getExitAction()
Gets the value of the property exitAction.- Property description:
-
setExitAction
public final void setExitAction(Runnable value)
Sets the value of the property exitAction.- Property description:
-
createDefaultSkin
protected Skin<?> createDefaultSkin()
- Overrides:
createDefaultSkin
in classControl
-
getUserAgentStylesheet
public String getUserAgentStylesheet()
- Overrides:
getUserAgentStylesheet
in classRegion
-
-