T
- The type of the item contained within the ListCell.public class ListCell<T> extends IndexedCell<T>
The Cell
type used within ListView
instances. In addition
to the API defined on Cell and IndexedCell
, the ListCell is more
tightly bound to a ListView, allowing for better support of editing events,
etc.
A ListView maintains selection, indicating which cell(s) have been selected, and focus, indicating the current focus owner for any given ListView. For each property, each ListCell has a boolean reflecting whether this specific cell is selected or focused. To achieve this, each ListCell has a reference back to the ListView that it is being used within. Each ListCell belongs to one and only one ListView.
Note that in the case of virtualized controls like ListView, when a cell
has focus this is not in the same sense as application focus. When a ListCell
has focus it simply represents the fact that the cell will receive keyboard
events in the situation that the owning ListView actually contains focus. Of
course, in the case where a cell has a Node set in the
graphic
property, it is completely legal for this
Node to request, and acquire focus as would normally be expected.
Type | Property and Description |
---|---|
<any> |
listView
The ListView associated with this Cell.
|
indexProperty
editableProperty, editingProperty, emptyProperty, itemProperty, selectedProperty
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, graphicProperty, graphicTextGapProperty, labelPaddingProperty, lineSpacingProperty, mnemonicParsingProperty, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, underlineProperty, wrapTextProperty
contextMenuProperty, skinClassNameProperty, skinProperty, tooltipProperty
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DEFAULT_STYLE_CLASS
*
Stylesheet Handling *
*
|
private InvalidationListener |
editingListener
Listens to the editing index on the ListView.
|
private boolean |
firstRun |
private InvalidationListener |
focusedListener
Listens to the focus model on the ListView.
|
private <any> |
focusModelPropertyListener
Listens to the focusModel property on the ListView.
|
private <any> |
itemsListener
Listens to the items on the ListView.
|
private InvalidationListener |
itemsPropertyListener
Listens to the items property on the ListView.
|
private <any> |
listView
The ListView associated with this Cell.
|
private <any> |
selectedListener
Listens to the selection model on the ListView.
|
private <any> |
selectionModelPropertyListener
Listens to the selectionModel property on the ListView.
|
private boolean |
updateEditingIndex |
private WeakInvalidationListener |
weakEditingListener |
private WeakInvalidationListener |
weakFocusedListener |
private <any> |
weakFocusModelPropertyListener |
private <any> |
weakItemsListener |
private WeakInvalidationListener |
weakItemsPropertyListener |
private <any> |
weakSelectedListener |
private <any> |
weakSelectionModelPropertyListener |
Constructor and Description |
---|
ListCell()
Creates a default ListCell with the default style class of 'list-cell'.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelEdit()
Call this function to transition from an editing state into a non-editing
state, without saving any user input.
|
void |
commitEdit(T newValue)
Call this function when appropriate (based on the user interaction requirements
of your cell editing user interface) to do two things:
Fire the appropriate events back to the backing UI control (e.g.
|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
void |
executeAccessibleAction(AccessibleAction action,
java.lang.Object... parameters) |
ListView<T> |
getListView()
Gets the value of the property listView.
|
(package private) void |
indexChanged(int oldIndex,
int newIndex)
This method is called whenever the index is changed, regardless of whether
the new index is the same as the old index.
|
<any> |
listViewProperty()
The ListView associated with this Cell.
|
java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
private void |
setListView(ListView<T> value) |
void |
startEdit()
Call this function to transition from a non-editing state into an editing
state, if the cell is editable.
|
private void |
updateEditing() |
private void |
updateFocus() |
private void |
updateItem(int oldIndex) |
void |
updateListView(ListView<T> listView)
Updates the ListView associated with this Cell.
|
private void |
updateSelection() |
getIndex, indexProperty, updateIndex
editableProperty, editingProperty, emptyProperty, getInitialFocusTraversable, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, layoutChildren, selectedProperty, setEditable, setItem, setSelected, updateItem, updateSelected
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getAlignment, getClassCssMetaData, getContentBias, getContentDisplay, getControlCssMetaData, getEllipsisString, getFont, getGraphic, getGraphicTextGap, getInitialAlignment, getLabelPadding, getLineSpacing, getText, getTextAlignment, getTextFill, getTextOverrun, graphicProperty, graphicTextGapProperty, isMnemonicParsing, isUnderline, isWrapText, labelPaddingProperty, lineSpacingProperty, mnemonicParsingProperty, setAlignment, setContentDisplay, setEllipsisString, setFont, setGraphic, setGraphicTextGap, setLineSpacing, setMnemonicParsing, setText, setTextAlignment, setTextFill, setTextOverrun, setUnderline, setWrapText, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, toString, underlineProperty, wrapTextProperty
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getControlChildren, getCssMetaData, getSkin, getTooltip, isResizable, loadSkinClass, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
public final <any> listViewProperty
getListView()
private final InvalidationListener editingListener
private boolean updateEditingIndex
private final <any> selectedListener
private final <any> selectionModelPropertyListener
private final <any> itemsListener
private final InvalidationListener itemsPropertyListener
private final InvalidationListener focusedListener
private final <any> focusModelPropertyListener
private final WeakInvalidationListener weakEditingListener
private final <any> weakSelectedListener
private final <any> weakSelectionModelPropertyListener
private final <any> weakItemsListener
private final WeakInvalidationListener weakItemsPropertyListener
private final WeakInvalidationListener weakFocusedListener
private final <any> weakFocusModelPropertyListener
private <any> listView
private boolean firstRun
private static final java.lang.String DEFAULT_STYLE_CLASS
public ListCell()
public final <any> listViewProperty()
getListView()
void indexChanged(int oldIndex, int newIndex)
indexChanged
in class IndexedCell<T>
protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.createDefaultSkin
in class Control
public void startEdit()
public void commitEdit(T newValue)
ListView
). This will begin the process of pushing this edit
back to the relevant data source / property (although it does not
guarantee that this will be successful - that is dependent upon the
specific edit commit handler being used). Refer to the UI control
class javadoc for more detail.In general there is no need to override this method in custom cell
implementations - it should be sufficient to simply call this method
when appropriate (e.g. when the user pressed the Enter key, you may do something
like cell.commitEdit(converter.fromString(textField.getText()));
commitEdit
in class Cell<T>
newValue
- The value as input by the end user, which should be
persisted in the relevant way given the data source underpinning the
user interface and the install edit commit handler of the UI control.public void cancelEdit()
cancelEdit
in class Cell<T>
private void updateItem(int oldIndex)
public final void updateListView(ListView<T> listView)
listView
- the ListView associated with this cellprivate void updateSelection()
private void updateFocus()
private void updateEditing()
public java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
queryAccessibleAttribute
in class Control
public void executeAccessibleAction(AccessibleAction action, java.lang.Object... parameters)
executeAccessibleAction
in class Control