S
- The type of the TableView generic type (i.e. S == TableView<S>).
This should also match with the first generic type in TableColumn.T
- The type of the item contained within the Cell.public class TableCell<S,T> extends IndexedCell<T>
TableView
. To
represent this intersection, a TableCell contains an
index
property, as well as a
tableColumn
property. In addition, a TableCell
instance knows what TableRow
it exists in.
A note about selection: A TableCell visually shows it is selected when two conditions are met:
TableSelectionModel.isSelected(int, TableColumnBase)
method
returns true for the row / column that this cell represents, andcell selection mode
property is set to true (to represent that it is allowable to select
individual cells (and not just rows of cells)).TableView
,
TableColumn
,
Cell
,
IndexedCell
,
TableRow
Type | Property and Description |
---|---|
<any> |
tableColumn
The TableColumn instance that backs this TableCell.
|
<any> |
tableRow
The TableRow that this TableCell currently finds itself placed within.
|
<any> |
tableView
The TableView associated with this TableCell.
|
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 InvalidationListener |
columnIdListener |
private int |
columnIndex |
private <any> |
columnStyleClassListener |
private InvalidationListener |
columnStyleListener |
private <any> |
currentObservableValue |
private static java.lang.String |
DEFAULT_STYLE_CLASS
*
Stylesheet Handling *
*
|
private InvalidationListener |
editingListener |
private InvalidationListener |
focusedListener |
private boolean |
isFirstRun |
private boolean |
isLastVisibleColumn |
private boolean |
itemDirty
*
Callbacks and Events *
*
|
(package private) boolean |
lockItemOnEdit
*
Private fields *
*
|
private java.lang.ref.WeakReference<S> |
oldRowItemRef |
private static PseudoClass |
PSEUDO_CLASS_LAST_VISIBLE |
private <any> |
selectedListener |
private <any> |
tableColumn
*
Properties *
*
|
private <any> |
tableRow
The TableRow that this TableCell currently finds itself placed within.
|
private InvalidationListener |
tableRowUpdateObserver |
private <any> |
tableView |
private boolean |
updateEditingIndex |
private <any> |
visibleLeafColumnsListener |
private WeakInvalidationListener |
weakColumnIdListener |
private <any> |
weakColumnStyleClassListener |
private WeakInvalidationListener |
weakColumnStyleListener |
private WeakInvalidationListener |
weakEditingListener |
private WeakInvalidationListener |
weakFocusedListener |
private <any> |
weakSelectedListener |
private WeakInvalidationListener |
weaktableRowUpdateObserver |
private <any> |
weakVisibleLeafColumnsListener |
Constructor and Description |
---|
TableCell()
Constructs a default TableCell instance with a style class of 'table-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.
|
private void |
cleanUpTableViewListeners(TableView<S> tableView) |
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) |
TableColumn<S,T> |
getTableColumn()
Gets the value of the property tableColumn.
|
TableRow<S> |
getTableRow()
Gets the value of the property tableRow.
|
TableView<S> |
getTableView()
Gets the value of the property tableView.
|
(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.
|
private boolean |
isInCellSelectionMode() |
protected void |
layoutChildren() |
private boolean |
match(TablePosition<S,?> pos) |
private void |
possiblySetId(java.lang.String idCandidate) |
private void |
possiblySetStyle(java.lang.String styleCandidate) |
java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
private void |
setTableColumn(TableColumn<S,T> value) |
private void |
setTableRow(TableRow<S> value) |
private void |
setTableView(TableView<S> value) |
void |
startEdit()
Call this function to transition from a non-editing state into an editing
state, if the cell is editable.
|
<any> |
tableColumnProperty()
The TableColumn instance that backs this TableCell.
|
<any> |
tableRowProperty()
The TableRow that this TableCell currently finds itself placed within.
|
<any> |
tableViewProperty()
The TableView associated with this TableCell.
|
private <any> |
tableViewPropertyImpl() |
private void |
updateColumnIndex() |
private void |
updateEditing() |
private void |
updateFocus() |
private void |
updateItem(int oldIndex) |
void |
updateSelected(boolean selected)
Updates whether this cell is in a selected state or not.
|
private void |
updateSelection() |
void |
updateTableColumn(TableColumn col)
Updates the TableColumn associated with this TableCell.
|
void |
updateTableRow(TableRow tableRow)
Updates the TableRow associated with this TableCell.
|
void |
updateTableView(TableView tv)
Updates the TableView associated with this TableCell.
|
getIndex, indexProperty, updateIndex
editableProperty, editingProperty, emptyProperty, getInitialFocusTraversable, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, selectedProperty, setEditable, setItem, setSelected, updateItem
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> tableColumnProperty
public final <any> tableViewProperty
getTableView()
public final <any> tableRowProperty
getTableRow()
boolean lockItemOnEdit
private boolean itemDirty
private <any> selectedListener
private final InvalidationListener focusedListener
private final InvalidationListener tableRowUpdateObserver
private final InvalidationListener editingListener
private <any> visibleLeafColumnsListener
private <any> columnStyleClassListener
private final InvalidationListener columnStyleListener
private final InvalidationListener columnIdListener
private final <any> weakSelectedListener
private final WeakInvalidationListener weakFocusedListener
private final WeakInvalidationListener weaktableRowUpdateObserver
private final WeakInvalidationListener weakEditingListener
private final WeakInvalidationListener weakColumnStyleListener
private final WeakInvalidationListener weakColumnIdListener
private final <any> weakVisibleLeafColumnsListener
private final <any> weakColumnStyleClassListener
private <any> tableColumn
private <any> tableView
private <any> tableRow
private boolean isLastVisibleColumn
private int columnIndex
private boolean updateEditingIndex
private <any> currentObservableValue
private boolean isFirstRun
private java.lang.ref.WeakReference<S> oldRowItemRef
private static final java.lang.String DEFAULT_STYLE_CLASS
private static final PseudoClass PSEUDO_CLASS_LAST_VISIBLE
public TableCell()
public final <any> tableColumnProperty()
private void setTableColumn(TableColumn<S,T> value)
public final TableColumn<S,T> getTableColumn()
public final <any> tableViewProperty()
getTableView()
private <any> tableViewPropertyImpl()
public final <any> tableRowProperty()
getTableRow()
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>
public void updateSelected(boolean selected)
updateSelected
in class Cell<T>
selected
- whether or not to select this cell.protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.createDefaultSkin
in class Control
void indexChanged(int oldIndex, int newIndex)
IndexedCell
indexChanged
in class IndexedCell<T>
private void updateColumnIndex()
private void updateSelection()
private void updateFocus()
private void updateEditing()
private boolean match(TablePosition<S,?> pos)
private boolean isInCellSelectionMode()
private void updateItem(int oldIndex)
protected void layoutChildren()
Cell
layoutChildren
in class Cell<T>
public final void updateTableView(TableView tv)
tv
- the TableView associated with this TableCellpublic final void updateTableRow(TableRow tableRow)
tableRow
- the TableRow associated with this TableCellpublic final void updateTableColumn(TableColumn col)
col
- the TableColumn associated with this TableCellprivate void possiblySetId(java.lang.String idCandidate)
private void possiblySetStyle(java.lang.String styleCandidate)
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