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
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
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)
This method is called by the assistive technology to request the action
indicated by the argument should be executed.
|
TableColumn<S,T> |
getTableColumn() |
TableRow |
getTableRow() |
TableView<S> |
getTableView() |
(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()
Invoked during the layout pass to layout the children in this
Parent . |
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)
*
Accessibility handling *
*
|
private void |
setTableColumn(TableColumn<S,T> value) |
private void |
setTableRow(TableRow 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.
|
ReadOnlyObjectProperty<TableColumn<S,T>> |
tableColumnProperty()
The TableColumn instance that backs this TableCell.
|
ReadOnlyObjectProperty<TableRow> |
tableRowProperty() |
ReadOnlyObjectProperty<TableView<S>> |
tableViewProperty()
The TableView associated with this TableCell.
|
private ReadOnlyObjectWrapper<TableView<S>> |
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, getItem, impl_cssGetFocusTraversableInitialValue, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, selectedProperty, setEditable, setItem, setSelected, updateItem
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getAlignment, getClassCssMetaData, getContentBias, getContentDisplay, getControlCssMetaData, getEllipsisString, getFont, getGraphic, getGraphicTextGap, getLabelPadding, getLineSpacing, getText, getTextAlignment, getTextFill, getTextOverrun, graphicProperty, graphicTextGapProperty, impl_cssGetAlignmentInitialValue, 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, impl_processCSS, isResizable, loadSkinClass, 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, 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, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
boolean lockItemOnEdit
private boolean itemDirty
private ListChangeListener<TablePosition> selectedListener
private final InvalidationListener focusedListener
private final InvalidationListener tableRowUpdateObserver
private final InvalidationListener editingListener
private ListChangeListener<TableColumn<S,?>> visibleLeafColumnsListener
private ListChangeListener<java.lang.String> columnStyleClassListener
private final InvalidationListener columnStyleListener
private final InvalidationListener columnIdListener
private final WeakListChangeListener<TablePosition> weakSelectedListener
private final WeakInvalidationListener weakFocusedListener
private final WeakInvalidationListener weaktableRowUpdateObserver
private final WeakInvalidationListener weakEditingListener
private final WeakInvalidationListener weakColumnStyleListener
private final WeakInvalidationListener weakColumnIdListener
private final WeakListChangeListener<TableColumn<S,?>> weakVisibleLeafColumnsListener
private final WeakListChangeListener<java.lang.String> weakColumnStyleClassListener
private ReadOnlyObjectWrapper<TableColumn<S,T>> tableColumn
private ReadOnlyObjectWrapper<TableView<S>> tableView
private ReadOnlyObjectWrapper<TableRow> tableRow
private boolean isLastVisibleColumn
private int columnIndex
private boolean updateEditingIndex
private ObservableValue<T> 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 ReadOnlyObjectProperty<TableColumn<S,T>> tableColumnProperty()
private void setTableColumn(TableColumn<S,T> value)
public final TableColumn<S,T> getTableColumn()
public final ReadOnlyObjectProperty<TableView<S>> tableViewProperty()
private ReadOnlyObjectWrapper<TableView<S>> tableViewPropertyImpl()
private void setTableRow(TableRow value)
public final TableRow getTableRow()
public final ReadOnlyObjectProperty<TableRow> tableRowProperty()
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()
Control
Parent
. By default it will only set the size of managed,
resizable content to their preferred sizes and does not do any node
positioning.
Subclasses should override this function to layout content as needed.
layoutChildren
in class Control
public final void updateTableView(TableView tv)
public final void updateTableRow(TableRow tableRow)
public final void updateTableColumn(TableColumn col)
private 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
attribute
- the requested attributeparameters
- optional list of parametersAccessibleAttribute
public void executeAccessibleAction(AccessibleAction action, java.lang.Object... parameters)
Node
This method is commonly overridden by subclasses to implement
action that are required for a specific role.
If a particular action is not handled, the super class implementation
must be called.
executeAccessibleAction
in class Control
action
- the action to executeparameters
- optional list of parametersAccessibleAction