S
- The type of the UI control (e.g. the type of the 'row').T
- The type of the content in all cells in this table column.@IDProperty(value="id") public abstract class TableColumnBase<S,T> extends Object implements EventTarget, Styleable
TableView
and TreeTableView
) are
made up of zero or more instances of a concrete TableColumnBase subclass
(TableColumn
and TreeTableColumn
, respectively). Each
table column in a table is responsible for displaying (and editing) the contents
of that column. As well as being responsible for displaying and editing data
for a single column, a table column also contains the necessary properties to:
minWidth
/prefWidth
/maxWidth
and width
properties)
visibility
toggled
header text
nested columns
it may contain
context menu
when the user
right-clicks the column header area
comparator
, sortable
and
sortType).
text
(what to show in the column header area), and the column
cell value factory
(which is used to populate individual cells in the
column). Refer to the class documentation for TableColumn
and
TreeTableColumn
for more information.TableColumn
,
TreeTableColumn
,
TablePositionBase
Modifier and Type | Field and Description |
---|---|
static Comparator |
DEFAULT_COMPARATOR
By default all columns will use this comparator to perform sorting.
|
Modifier | Constructor and Description |
---|---|
protected |
TableColumnBase()
Creates a default TableColumn with default cell factory, comparator, and
onEditCommit implementation.
|
protected |
TableColumnBase(String text)
Creates a TableColumn with the text set to the provided string, with
default cell factory, comparator, and onEditCommit implementation.
|
Modifier and Type | Method and Description |
---|---|
<E extends Event> |
addEventHandler(EventType<E> eventType,
EventHandler<E> eventHandler)
Registers an event handler to this table column.
|
EventDispatchChain |
buildEventDispatchChain(EventDispatchChain tail)
Construct an event dispatch chain for this target.
|
ObjectProperty<Comparator<T>> |
comparatorProperty() |
ObjectProperty<ContextMenu> |
contextMenuProperty() |
BooleanProperty |
editableProperty() |
T |
getCellData(int index)
Returns the actual value for a cell at a given row index (and which
belongs to this table column).
|
T |
getCellData(S item)
Returns the actual value for a cell from the given item.
|
abstract ObservableValue<T> |
getCellObservableValue(int index)
Attempts to return an ObservableValue<T> for the item in the given
index (which is of type S).
|
abstract ObservableValue<T> |
getCellObservableValue(S item)
Attempts to return an ObservableValue<T> for the given item (which
is of type S).
|
abstract ObservableList<? extends TableColumnBase<S,?>> |
getColumns()
This enables support for nested columns, which can be useful to group
together related data.
|
Comparator<T> |
getComparator() |
ContextMenu |
getContextMenu() |
Node |
getGraphic() |
String |
getId()
The id of this
Styleable . |
double |
getMaxWidth() |
double |
getMinWidth() |
TableColumnBase<S,?> |
getParentColumn() |
double |
getPrefWidth() |
ObservableMap<Object,Object> |
getProperties()
Returns an observable map of properties on this table column for use
primarily by application developers.
|
ObservableSet<PseudoClass> |
getPseudoClassStates()
Return the pseudo-class state of this Styleable.
|
Node |
getSortNode() |
String |
getStyle()
A string representation of the CSS style associated with this
specific
Node . |
ObservableList<String> |
getStyleClass()
A list of String identifiers which can be used to logically group
Nodes, specifically for an external style engine.
|
String |
getText() |
Object |
getUserData()
Returns a previously set Object property, or null if no such property
has been set using the
setUserData(java.lang.Object) method. |
double |
getWidth() |
ObjectProperty<Node> |
graphicProperty() |
boolean |
hasProperties()
Tests if this table column has properties.
|
StringProperty |
idProperty() |
BooleanProperty |
impl_fixedProperty()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
boolean |
impl_isFixed()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
boolean |
impl_isReorderable()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
BooleanProperty |
impl_reorderableProperty()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_setFixed(boolean value)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_setReorderable(boolean value)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_setWidth(double width)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
boolean |
isEditable() |
boolean |
isResizable() |
boolean |
isSortable() |
boolean |
isVisible() |
DoubleProperty |
maxWidthProperty()
The maximum width the table column is permitted to be resized to.
|
DoubleProperty |
minWidthProperty() |
ReadOnlyObjectProperty<TableColumnBase<S,?>> |
parentColumnProperty() |
DoubleProperty |
prefWidthProperty()
The preferred width of the TableColumn.
|
<E extends Event> |
removeEventHandler(EventType<E> eventType,
EventHandler<E> eventHandler)
Unregisters a previously registered event handler from this table column.
|
BooleanProperty |
resizableProperty() |
void |
setComparator(Comparator<T> value) |
void |
setContextMenu(ContextMenu value) |
void |
setEditable(boolean value) |
void |
setGraphic(Node value) |
void |
setId(String value) |
void |
setMaxWidth(double value) |
void |
setMinWidth(double value) |
void |
setPrefWidth(double value) |
void |
setResizable(boolean value) |
void |
setSortable(boolean value) |
void |
setSortNode(Node value) |
void |
setStyle(String value) |
void |
setText(String value) |
void |
setUserData(Object value)
Convenience method for setting a single Object property that can be
retrieved at a later date.
|
void |
setVisible(boolean value) |
BooleanProperty |
sortableProperty() |
ObjectProperty<Node> |
sortNodeProperty() |
StringProperty |
styleProperty() |
StringProperty |
textProperty() |
BooleanProperty |
visibleProperty() |
ReadOnlyDoubleProperty |
widthProperty()
The width of this column.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCssMetaData, getStyleableParent, getTypeSelector
public static final Comparator DEFAULT_COMPARATOR
Comparable
. If it is, the Comparable.compareTo(java.lang.Object)
method is called, otherwise this method will defer to
Collator.compare(java.lang.String, java.lang.String)
.protected TableColumnBase()
protected TableColumnBase(String text)
text
- The string to show when the TableColumn is placed within the TableView.public final StringProperty textProperty()
public final void setText(String value)
public final String getText()
public final void setVisible(boolean value)
public final boolean isVisible()
public final BooleanProperty visibleProperty()
public final TableColumnBase<S,?> getParentColumn()
public final ReadOnlyObjectProperty<TableColumnBase<S,?>> parentColumnProperty()
public final void setContextMenu(ContextMenu value)
public final ContextMenu getContextMenu()
public final ObjectProperty<ContextMenu> contextMenuProperty()
public final void setId(String value)
public final String getId()
Styleable
Styleable
. This simple string identifier is useful for
finding a specific Node within the scene graph. While the id of a Node
should be unique within the scene graph, this uniqueness is not enforced.
This is analogous to the "id" attribute on an HTML element
(CSS ID Specification).
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows: scene.lookup("#myId");
.
public final StringProperty idProperty()
public final void setStyle(String value)
public final String getStyle()
Styleable
Node
. This is analogous to the "style" attribute of an
HTML element. Note that, like the HTML style attribute, this
variable contains style properties and values and not the
selector portion of a style rule.public final StringProperty styleProperty()
public ObservableList<String> getStyleClass()
getStyleClass
in interface Styleable
public final void setGraphic(Node value)
public final Node getGraphic()
public final ObjectProperty<Node> graphicProperty()
public final void setSortNode(Node value)
public final Node getSortNode()
public final ObjectProperty<Node> sortNodeProperty()
public final ReadOnlyDoubleProperty widthProperty()
public final double getWidth()
public final void setMinWidth(double value)
public final double getMinWidth()
public final DoubleProperty minWidthProperty()
public final DoubleProperty prefWidthProperty()
public final void setPrefWidth(double value)
public final double getPrefWidth()
public final DoubleProperty maxWidthProperty()
public final void setMaxWidth(double value)
public final double getMaxWidth()
public final BooleanProperty resizableProperty()
public final void setResizable(boolean value)
public final boolean isResizable()
public final BooleanProperty sortableProperty()
public final void setSortable(boolean value)
public final boolean isSortable()
@Deprecated public final BooleanProperty impl_reorderableProperty()
@Deprecated public final void impl_setReorderable(boolean value)
@Deprecated public final boolean impl_isReorderable()
@Deprecated public final BooleanProperty impl_fixedProperty()
@Deprecated public final void impl_setFixed(boolean value)
@Deprecated public final boolean impl_isFixed()
public final ObjectProperty<Comparator<T>> comparatorProperty()
public final void setComparator(Comparator<T> value)
public final Comparator<T> getComparator()
public final void setEditable(boolean value)
public final boolean isEditable()
public final BooleanProperty editableProperty()
public final ObservableMap<Object,Object> getProperties()
public boolean hasProperties()
public void setUserData(Object value)
getUserData()
.value
- The value to be stored - this can later be retrieved by calling
getUserData()
.public Object getUserData()
setUserData(java.lang.Object)
method.public abstract ObservableList<? extends TableColumnBase<S,?>> getColumns()
This has no impact on the table as such - all column indices point to the leaf columns only, and it isn't possible to sort using the parent column, just the leaf columns. In other words, this is purely a visual feature.
public final T getCellData(int index)
index
- The row index for which the data is required.public final T getCellData(S item)
item
- The item from which a value of type T should be extracted.public abstract ObservableValue<T> getCellObservableValue(int index)
This is achieved by calling the cell value factory
, and
returning whatever it returns when passed a CellDataFeatures
(see,
for example, the CellDataFeatures classes belonging to
TableColumn
and
TreeTableColumn
for more
information).
index
- The index of the item (of type S) for which an
ObservableValue<T> is sought.public abstract ObservableValue<T> getCellObservableValue(S item)
This is achieved by calling the cell value factory
, and
returning whatever it returns when passed a CellDataFeatures
(see,
for example, the CellDataFeatures classes belonging to
TableColumn
and
TreeTableColumn
for more
information).
item
- The item (of type S) for which an ObservableValue<T> is
sought.public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
EventTarget
. This event target is
not automatically added to the chain, so if it wants to process events,
it needs to add an EventDispatcher
for itself to the chain.
In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.
The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.
The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.
buildEventDispatchChain
in interface EventTarget
tail
- the initial chain to build frompublic <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)
eventType
- the type of the events to receive by the handlereventHandler
- the handler to registerNullPointerException
- if the event type or handler is nullpublic <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)
eventType
- the event type from which to unregistereventHandler
- the handler to unregisterNullPointerException
- if the event type or handler is null@Deprecated public void impl_setWidth(double width)
public final ObservableSet<PseudoClass> getPseudoClassStates()
getPseudoClassStates
in interface Styleable
Copyright © 2020. All rights reserved.