T
- This type is used to represent the type of the objects stored in
the CharmListViews items
ObservableList.K
- This is type returned by the headers function
when applied to the items
to generate the keys in a sorted map that will define the headers.
It extends Comparable
, so elements can have a natural order,
without the need to specify a comparator.
usually one field of T, so the
CharmListView control can differ headers for the list by applying a
Function over the elements.@DefaultProperty(value="items")
public class CharmListView<T,K extends java.lang.Comparable>
extends javafx.scene.control.Control
header function
.
Headers can be seen as the keys in a sorted map, that once defined are used to
classify the items. For every category, the first item is duplicated and marked
as header. Different formatting and sorting options can be applied to the
header items so they can be distinguised from the standard items.
By default the header for the top most visible item is displayed floating
on top of the list, and it is replaced with the next one when the list is
scrolled with a slide out effect.
The control uses internally a HeadersList class: an
ObservableList
that wraps a
SortedList and the headers created by the header function.
A simple example of how to create and populate a CharmListView of names (Strings) ordered and classified by their number of letters is shown here:
ObservableList<String> names = FXCollections.observableArrayList(
"Julia", "Ian", "Sue", "Matthew", "Hannah", "Stephan", "Denise");
CharmListView<String, Integer> charmListView = new CharmListView<>(names);
charmListView.setHeadersFunction(String::length);
Another feasible approach for setting the items is to simply call:
ObservableList<T> content = ...
charmListView.setItems(content);
The elements of the CharmListView are contained within the
items
ObservableList
. This
ObservableList is automatically observed by the CharmListView, such that any
changes that occur inside the ObservableList will be automatically shown in
the CharmListView itself and, consequently, headers will be updated too.
Following with the previous example, now a cell factory for the headers will be provided:
charmListView.setHeaderCellFactory( p->new ListCellImpl<String>
(){
@Override protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if(item!=null && !empty){
setText("Length: " + Integer.toString(item.length()));
setGraphic(null);
} else {
setText(null);
setGraphic(null);
}
}
});
The same result could be achieved by providing a StringConverter
to the
function:
charmListView.setConverter(new StringConverter <Integer>
() {
@Override public String toString(Integer object) {
return "Length: " + Integer.toString(object);
}
});
and calling toString
on the header cell factory
updateItem
:
setText(charmListView.toString(item));
comparatorProperty()
for the standard items, and
headersComparatorProperty()
for the header items.
For instance, this comparator will reverse the natural order for the cells
within headers:
charmListView.setComparator((s1,s2)->s2.compareTo(s1));
{"3", "Sue", "Ian", "5", "Julia", "6", "Hannah", "Denise", "7", "Stephan", "Matthew"}
If no comparator is provided, the cells will be placed in the same order they
were provided.
This will reverse the order on the headers, while sorting by natural order on the
standard cells:
charmListView.setHeaderComparator((i1,i2)->i2-i1);
charmListView.setComparator((s1,s2)->s1.compareTo(s2));
{"7", "Matthew", "Stephan", "6", "Denise", "Hannah", "5", "Julia", "3", "Ian", "Sue"}
CharmListCell
Type | Property and Description |
---|---|
javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>>> |
cellFactory
The cell factory for standard items.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>>> |
cellHeaderFactory
The cell factory for header items.
|
javafx.beans.property.ObjectProperty<java.util.Comparator<? super T>> |
comparator
The comparator that denotes the order of the items within the headers.
|
javafx.beans.property.ObjectProperty<javafx.util.StringConverter<K>> |
converter
The
StringConverter property used to format the result of type K
after applying the headers function
to the data model |
javafx.beans.property.BooleanProperty |
floatingHeaderVisible
By default the header for the most top visible item is displayed floating
on top of the list, and it is replaced with the next one when the list is
scrolled with a slide out effect.
|
javafx.beans.property.ObjectProperty<java.util.Comparator<? super K>> |
headersComparator
The comparator that denotes the order of the headers.
|
javafx.beans.property.ObjectProperty<java.util.function.Function<? super T,K>> |
headersFunction
The
Function for the CharmListView. |
javafx.beans.property.ListProperty<T> |
items
The underlying data model for the CharmListView.
|
javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>> |
onPullToRefresh
The
EventHandler to be called whenever there's a Swipe Refresh. |
javafx.beans.property.ObjectProperty<javafx.scene.Node> |
placeholder
This Node is shown to the user when the CharmListView has no content to show.
|
javafx.beans.property.BooleanProperty |
refreshIndicatorVisible
The visibility of a refresh indicator that will signal to the user that this list is busy updating itself.
|
javafx.beans.property.ObjectProperty<T> |
selectedItem
Refers to the selected item property, which is used to indicate
the currently selected item in the CharmListView.
|
contextMenu, skinClassName, skin, tooltip
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
Constructor and Description |
---|
CharmListView()
Creates a default CharmListView which will display contents stacked vertically.
|
CharmListView(javafx.collections.ObservableList<T> list)
Creates a default CharmListView which will stack the contents retrieved from the
provided
ObservableList vertically. |
Modifier and Type | Method and Description |
---|---|
javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>>> |
cellFactoryProperty()
The cell factory for standard items.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>>> |
cellHeaderFactoryProperty()
The cell factory for header items.
|
javafx.beans.property.ObjectProperty<java.util.Comparator<? super T>> |
comparatorProperty()
The comparator that denotes the order of the items within the headers.
|
javafx.beans.property.ObjectProperty<javafx.util.StringConverter<K>> |
converterProperty()
The
StringConverter property used to format the result of type K
after applying the headers function
to the data model |
protected javafx.scene.control.Skin<?> |
createDefaultSkin() |
javafx.beans.property.BooleanProperty |
floatingHeaderVisibleProperty()
By default the header for the most top visible item is displayed floating
on top of the list, and it is replaced with the next one when the list is
scrolled with a slide out effect.
|
javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> |
getCellFactory()
Returns the current cell factory callback function for standard items.
|
java.util.Comparator<? super T> |
getComparator()
Returns the
Comparator that is used to
sort the standard items |
javafx.util.StringConverter<K> |
getConverter()
Returns the
StringConverter used to format the headers. |
javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> |
getHeaderCellFactory()
Returns the current cell factory callback function for header items.
|
java.util.Comparator<? super K> |
getHeaderComparator()
Returns the
Comparator that is used to
sort the headers items |
java.util.function.Function<? super T,K> |
getHeadersFunction()
Returns the
Function that is used to
generate the headers |
javafx.collections.ObservableList<T> |
getHeadersList()
Returns an
ObservableList that contains the
items currently being shown to the user including the headers. |
javafx.event.EventHandler<javafx.event.ActionEvent> |
getOnPullToRefresh()
Gets the value of the property onPullToRefresh.
|
javafx.scene.Node |
getPlaceholder()
Returns the
Node to be shown to the user when the
CharmListView has no content to show. |
T |
getSelectedItem()
Gets the value of the property selectedItem.
|
javafx.beans.property.ObjectProperty<java.util.Comparator<? super K>> |
headersComparatorProperty()
The comparator that denotes the order of the headers.
|
javafx.beans.property.ObjectProperty<java.util.function.Function<? super T,K>> |
headersFunctionProperty()
The
Function for the CharmListView. |
boolean |
isFloatingHeaderVisible()
Returns true if the floating header for the most top visible item is visible, or
false otherwise.
|
boolean |
isRefreshIndicatorVisible()
Gets the value of the property refreshIndicatorVisible.
|
javafx.beans.property.ListProperty<T> |
itemsProperty()
The underlying data model for the CharmListView.
|
javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>> |
onPullToRefreshProperty()
The
EventHandler to be called whenever there's a Swipe Refresh. |
javafx.beans.property.ObjectProperty<javafx.scene.Node> |
placeholderProperty()
This Node is shown to the user when the CharmListView has no content to show.
|
void |
refresh()
Calling
refresh() forces the CharmListView control to recreate and
repopulate the cells necessary to populate the visual bounds of the control. |
javafx.beans.property.BooleanProperty |
refreshIndicatorVisibleProperty()
The visibility of a refresh indicator that will signal to the user that this list is busy updating itself.
|
void |
scrollTo(T object)
Scrolls the CharmListView so that the given item is the first visible
item within the viewport, after the floating header if the latter is
visible
|
void |
scrollToHeader(T object)
Scrolls the CharmListView so that the given header is the first visible
header within the viewport
|
javafx.beans.property.ObjectProperty<T> |
selectedItemProperty()
Refers to the selected item property, which is used to indicate
the currently selected item in the CharmListView.
|
void |
setCellFactory(javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> value)
Sets a new cell factory to use for the standard items in the CharmListView.
|
void |
setComparator(java.util.Comparator<? super T> comparator)
Sets the comparator for the standard items of the CharmListView.
|
void |
setConverter(javafx.util.StringConverter<K> value)
Sets the
StringConverter to be used to format the headers |
void |
setFloatingHeaderVisible(boolean visible)
Sets the visibility of the floating header for the most top visible item.
|
void |
setHeaderCellFactory(javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> value)
Sets a new cell factory to use for the header items in the CharmListView.
|
void |
setHeaderComparator(java.util.Comparator<? super K> headerComparator)
Sets the comparator for the header items of the CharmListView.
|
void |
setHeadersFunction(java.util.function.Function<? super T,K> function)
Sets the headers function for the CharmListView.
|
void |
setItems(javafx.collections.ObservableList<T> value)
Sets the underlying data model for the CharmListView.
|
void |
setOnPullToRefresh(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler)
Sets the value of the property onPullToRefresh.
|
void |
setPlaceholder(javafx.scene.Node value)
Sets a
Node to be shown to the user when the
CharmListView has no content to show. |
void |
setRefreshIndicatorVisible(boolean value)
Sets the value of the property refreshIndicatorVisible.
|
void |
setSelectedItem(T value)
Sets the value of the property selectedItem.
|
java.lang.String |
toString(T item)
A convenient method to format the result of applying the
headers function to the given item, using
the string converter if it is provided. |
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getSkin, getTooltip, impl_cssGetFocusTraversableInitialValue, impl_processCSS, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, 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, 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
getChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, 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, 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_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.ListProperty<T> itemsProperty
setItems(ObservableList)
public final javafx.beans.property.ObjectProperty<java.util.function.Function<? super T,K extends java.lang.Comparable>> headersFunctionProperty
Function
for the CharmListView.
Note that it has a generic type T that must match the type of the CharmListView
itself, and a generic type K that implements Comparable
.
The provided function will by applied to all the T items, returning elements of
type K that will be sorted to obtain the unique keys that define the headers.
CharmListView control reacts to changes in this function.getHeadersFunction()
,
setHeadersFunction(Function)
public final javafx.beans.property.ObjectProperty<java.util.Comparator<? super T>> comparatorProperty
getComparator()
,
setComparator(Comparator)
public final javafx.beans.property.ObjectProperty<java.util.Comparator<? super K extends java.lang.Comparable>> headersComparatorProperty
headers function
to the items of the list, and not over the items themselves.
CharmListView control reacts to changes in this comparator.public final javafx.beans.property.ObjectProperty<javafx.util.StringConverter<K extends java.lang.Comparable>> converterProperty
StringConverter
property used to format the result of type K
after applying the headers function
to the data modelgetConverter()
,
setConverter(StringConverter)
public final javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K extends java.lang.Comparable>,CharmListCell<T>>> cellFactoryProperty
Cell
class documentation
for more detail.getCellFactory()
,
setCellFactory(Callback)
public final javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K extends java.lang.Comparable>,CharmListCell<T>>> cellHeaderFactoryProperty
Cell
class documentation
for more detail.public final javafx.beans.property.BooleanProperty floatingHeaderVisibleProperty
public final javafx.beans.property.ObjectProperty<javafx.scene.Node> placeholderProperty
getPlaceholder()
,
setPlaceholder(Node)
public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>> onPullToRefreshProperty
EventHandler
to be called whenever there's a Swipe Refresh. This EventHandler
will run on
a background thread. To enable pull to refresh set a handler for this property.public final javafx.beans.property.BooleanProperty refreshIndicatorVisibleProperty
public final javafx.beans.property.ObjectProperty<T> selectedItemProperty
getSelectedItem()
,
setSelectedItem(T)
public CharmListView()
ObservableList
is created. To add elements
to the control the recommended approach is calling
setItems(javafx.collections.ObservableList)
.
Refer to the CharmListView
class documentation for details on the
default state of other properties.
public CharmListView(javafx.collections.ObservableList<T> list)
ObservableList
vertically.
Refer to the CharmListView
class documentation for details on the
default state of other properties.
list
- An observable list of elements of type Tpublic final javafx.collections.ObservableList<T> getHeadersList()
ObservableList
that contains the
items currently being shown to the user including the headers.ObservableList
containing the items
to be shown to the user, including the inserted headers if a
Function
is provided.public final void setItems(javafx.collections.ObservableList<T> value)
value
- An observable list
of elements of type Tpublic final javafx.beans.property.ListProperty<T> itemsProperty()
setItems(ObservableList)
public final javafx.beans.property.ObjectProperty<java.util.function.Function<? super T,K>> headersFunctionProperty()
Function
for the CharmListView.
Note that it has a generic type T that must match the type of the CharmListView
itself, and a generic type K that implements Comparable
.
The provided function will by applied to all the T items, returning elements of
type K that will be sorted to obtain the unique keys that define the headers.
CharmListView control reacts to changes in this function.getHeadersFunction()
,
setHeadersFunction(Function)
public final java.util.function.Function<? super T,K> getHeadersFunction()
Function
that is used to
generate the headerspublic final void setHeadersFunction(java.util.function.Function<? super T,K> function)
Comparable
function
- The Function
to generate
the headerspublic final javafx.beans.property.ObjectProperty<java.util.Comparator<? super T>> comparatorProperty()
getComparator()
,
setComparator(Comparator)
public final java.util.Comparator<? super T> getComparator()
Comparator
that is used to
sort the standard itemspublic final void setComparator(java.util.Comparator<? super T> comparator)
comparator
- The Comparator
used to sort
the standard itemspublic final javafx.beans.property.ObjectProperty<java.util.Comparator<? super K>> headersComparatorProperty()
headers function
to the items of the list, and not over the items themselves.
CharmListView control reacts to changes in this comparator.public final java.util.Comparator<? super K> getHeaderComparator()
Comparator
that is used to
sort the headers itemspublic final void setHeaderComparator(java.util.Comparator<? super K> headerComparator)
headers function
to the items of the list, and not over the items themselves.headerComparator
- The Comparator
used to sort
the header itemspublic final javafx.beans.property.ObjectProperty<javafx.util.StringConverter<K>> converterProperty()
StringConverter
property used to format the result of type K
after applying the headers function
to the data modelgetConverter()
,
setConverter(StringConverter)
public final void setConverter(javafx.util.StringConverter<K> value)
StringConverter
to be used to format the headersvalue
- The StringConverter used to format the headerspublic final javafx.util.StringConverter<K> getConverter()
StringConverter
used to format the headers.public final void setCellFactory(javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> value)
CharmListCell
's to be thrown away, and new
CharmListCell's created with the new cell factory.
In order to specialize the Cell used for the CharmListView on standard items,
an implementation of the cellFactory callback function defined on the
CharmListView must be provided, taking care of creating a new Cell instance
and configuring that Cell such that it reacts to changes in its state.
It is convenient the use of anonymous inner classes, that simply return
instances of CharmListCell whenever it is called, overriding the
updateItem
method.value
- The cell factory callback
function
to create standard CharmListCells.public final javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> getCellFactory()
callback
function
used to create standard CharmListCells.public final javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>>> cellFactoryProperty()
Cell
class documentation
for more detail.getCellFactory()
,
setCellFactory(Callback)
public final void setHeaderCellFactory(javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> value)
CharmListCell
's to be thrown away, and new
CharmListCell's created with the new cell factory.
In order to specialize the Cell used for the CharmListView on header items,
an implementation of the cellFactory callback function defined on the
CharmListView must be provided, taking care of creating a new Cell instance
and configuring that Cell such that it reacts to changes in its state.
It is convenient the use of anonymous inner classes, that simply return
instances of CharmListCell whenever it is called, overriding the
updateItem
method.value
- The cell factory callback
function
to create header CharmListCells.public final javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>> getHeaderCellFactory()
callback
function
used to create header CharmListCells.public final javafx.beans.property.ObjectProperty<javafx.util.Callback<CharmListView<T,K>,CharmListCell<T>>> cellHeaderFactoryProperty()
Cell
class documentation
for more detail.public final void setFloatingHeaderVisible(boolean visible)
visible
- Boolean parameter to set the floating header visible or notpublic final boolean isFloatingHeaderVisible()
public final javafx.beans.property.BooleanProperty floatingHeaderVisibleProperty()
public final javafx.beans.property.ObjectProperty<javafx.scene.Node> placeholderProperty()
getPlaceholder()
,
setPlaceholder(Node)
public final void setPlaceholder(javafx.scene.Node value)
Node
to be shown to the user when the
CharmListView has no content to show.value
- A Node
for the place holderpublic final javafx.scene.Node getPlaceholder()
Node
to be shown to the user when the
CharmListView has no content to show.Node
used on the place holderpublic final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>> onPullToRefreshProperty()
EventHandler
to be called whenever there's a Swipe Refresh. This EventHandler
will run on
a background thread. To enable pull to refresh set a handler for this property.public final void setOnPullToRefresh(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler)
EventHandler
to be called whenever there's a Swipe Refresh. This EventHandler
will run on
a background thread. To enable pull to refresh set a handler for this property.public final javafx.event.EventHandler<javafx.event.ActionEvent> getOnPullToRefresh()
EventHandler
to be called whenever there's a Swipe Refresh. This EventHandler
will run on
a background thread. To enable pull to refresh set a handler for this property.public final javafx.beans.property.BooleanProperty refreshIndicatorVisibleProperty()
public final void setRefreshIndicatorVisible(boolean value)
public final boolean isRefreshIndicatorVisible()
public final javafx.beans.property.ObjectProperty<T> selectedItemProperty()
getSelectedItem()
,
setSelectedItem(T)
public final T getSelectedItem()
public final void setSelectedItem(T value)
public void scrollTo(T object)
object
- The object that should be visible to the user.public void scrollToHeader(T object)
object
- The header that should be visible to the user.public java.lang.String toString(T item)
headers function
to the given item, using
the string converter
if it is provided.item
- to apply the headers function and format with the string converterpublic void refresh()
refresh()
forces the CharmListView control to recreate and
repopulate the cells necessary to populate the visual bounds of the control.
In other words, this forces the CharmListView to update what it is showing to
the user. This is useful in cases where the underlying data source has
changed in a way that is not observed by the CharmListView itself.protected javafx.scene.control.Skin<?> createDefaultSkin()
createDefaultSkin
in class javafx.scene.control.Control