APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javafx.scene.control

public Class TableColumn<S, T>

extends TableColumnBase<S, T>
implements EventTarget
Class Inheritance
All Implemented Interfaces
javafx.event.EventTarget
Type Parameters
<S>
The type of the TableView generic type (i.e. S == TableView<S>)
<T>
The type of the content in all cells in this TableColumn.
Imports
com.sun.javafx.scene.control.Properties, javafx.scene.control.skin.NestedTableColumnHeader, .TableColumnHeader, .TableHeaderRow, .TableViewSkin, javafx.beans.property.ObjectProperty, .SimpleObjectProperty, .ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, .WeakListChangeListener, javafx.css.CssMetaData, .Styleable, javafx.event.Event, .EventHandler, .EventTarget, .EventType, javafx.scene.Node, javafx.scene.control.cell.PropertyValueFactory, javafx.util.Callback, java.util.Collections, .List, .Map, javafx.beans.value.ObservableValue, .WritableValue

A TableView is made up of a number of TableColumn instances. Each TableColumn 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 TableColumn also contains the necessary properties to: When creating a TableColumn instance, perhaps the two most important properties to set are the column 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). This can be achieved using some variation on the following code:
ObservableList<Person> data = ...
TableView<Person> tableView = new TableView<Person>(data);

TableColumn<Person,String> firstNameCol = new TableColumn<Person,String>("First Name");
firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
    public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
        // p.getValue() returns the Person instance for a particular TableView row
        return p.getValue().firstNameProperty();
    }
 });

tableView.getColumns().add(firstNameCol);}
This approach assumes that the object returned from p.getValue() has a JavaFX ObservableValue that can simply be returned. The benefit of this is that the TableView will internally create bindings to ensure that, should the returned ObservableValue change, the cell contents will be automatically refreshed.

In situations where a TableColumn must interact with classes created before JavaFX, or that generally do not wish to use JavaFX apis for properties, it is possible to wrap the returned value in a ReadOnlyObjectWrapper instance. For example:

firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
    public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
        return new ReadOnlyObjectWrapper(p.getValue().getFirstName());
    }
 });
It is hoped that over time there will be convenience cell value factories developed and made available to developers. As of the JavaFX 2.0 release, there is one such convenience class: PropertyValueFactory. This class removes the need to write the code above, instead relying on reflection to look up a given property from a String. Refer to the PropertyValueFactory class documentation for more information on how to use this with a TableColumn. Finally, for more detail on how to use TableColumn, there is further documentation in the TableView class documentation.
Since
JavaFX 2.0
See Also
TableView, TableCell, TablePosition

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TableColumn.CellDataFeatures<
The TableView type
S
,
The TableColumn type
T
>

A support class used in TableColumn as a wrapper class to provide all necessary information for a particular Cell.

public static class
TableColumn.CellEditEvent<
The type of the TableView generic type
S
,
The type of the content in all cells in this TableColumn
T
>

An event that is fired when a user performs an edit on a table cell.

public static enum
TableColumn.SortType

Enumeration that specifies the type of sorting being applied to a specific column.

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Callback<TableColumn<S, T>, TableCell<S, T>>>
cellFactory

The cell factory for all cells in this column.

private ObjectProperty<Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>>>
cellValueFactory

The cell value factory needs to be set to specify how to populate all cells within a single TableColumn.

private final ObservableList<TableColumn<S, ?>>
private ListChangeListener<TableColumn<S, ?>>
public static final Callback<TableColumn<?, ?>, TableCell<?, ?>>
DEFAULT_CELL_FACTORY

If no cellFactory is specified on a TableColumn instance, then this one will be used by default.

private EventHandler<TableColumn.CellEditEvent<S, T>>
private static final String
private static final EventType<?>
private static final EventType<?>
private static final EventType<?>
private static final EventType<?>
private ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>
private ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>
private ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>
private ObjectProperty<TableColumn.SortType>
sortType

Used to state whether this column, if it is part of a sort order (see TableView#getSortOrder() for more details), should be sorted in ascending or descending order.

private ReadOnlyObjectWrapper<TableView<S>>
tableView

The TableView that this TableColumn belongs to.

private WeakListChangeListener<TableColumn<S, ?>>
Inherited from javafx.scene.control.TableColumnBase:
DEFAULT_COMPARATORDEFAULT_MAX_WIDTHDEFAULT_MIN_WIDTHDEFAULT_WIDTHeventHandlerManager

Constructor Summary

AccessConstructor and Description
public
TableColumn()

Creates a default TableColumn with default cell factory, comparator, and onEditCommit implementation.

public
TableColumn(String
The string to show when the TableColumn is placed within the TableView.
text
)

Creates a TableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Callback<TableColumn<S, T>, TableCell<S, T>>>
public final ObjectProperty<Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>>>
public static <
The type of the TableView generic type
S
,
The type of the content in all cells in this TableColumn
T
>
EventType<TableColumn.CellEditEvent<S, T>>

Returns:

The any TableColumn edit event
editAnyEvent
()

Parent event for any TableColumn edit event.

public static <
The type of the TableView generic type
S
,
The type of the content in all cells in this TableColumn
T
>
EventType<TableColumn.CellEditEvent<S, T>>

Returns:

The cancel an edit event
editCancelEvent
()

Indicates that the editing has been canceled, meaning that no change should be made to the backing data source.

public static <
The type of the TableView generic type
S
,
The type of the content in all cells in this TableColumn
T
>
EventType<TableColumn.CellEditEvent<S, T>>

Returns:

The commit an edit event
editCommitEvent
()

Indicates that the editing has been committed by the user, meaning that a change should be made to the backing data source to reflect the new data.

public static <
The type of the TableView generic type
S
,
The type of the content in all cells in this TableColumn
T
>
EventType<TableColumn.CellEditEvent<S, T>>

Returns:

The start an edit event
editStartEvent
()

Indicates that the user has performed some interaction to start an edit event, or alternatively the TableView#edit(int, javafx.scene.control.TableColumn) method has been called.

public final Callback<TableColumn<S, T>, TableCell<S, T>>
public final ObservableValue<T>
getCellObservableValue(int index)

Implements abstract javafx.scene.control.TableColumnBase.getCellObservableValue.

Attempts to return an ObservableValue<T> for the item in the given index (which is of type S).

public final ObservableValue<T>
getCellObservableValue(S item)

Implements abstract javafx.scene.control.TableColumnBase.getCellObservableValue.

Attempts to return an ObservableValue<T> for the given item (which is of type S).

public final Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>>
public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData
getClassCssMetaData
()

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public final ObservableList<TableColumn<S, ?>>
getColumns()

Implements abstract javafx.scene.control.TableColumnBase.getColumns.

This enables support for nested columns, which can be useful to group together related data.

public List<CssMetaData<? extends Styleable, ?>>
getCssMetaData()

Implements javafx.css.Styleable.getCssMetaData.

The CssMetaData of this Styleable.

public final EventHandler<TableColumn.CellEditEvent<S, T>>
public final EventHandler<TableColumn.CellEditEvent<S, T>>
public final EventHandler<TableColumn.CellEditEvent<S, T>>
public final TableColumn.SortType
public Node
getStyleableNode()

Overrides default javafx.css.Styleable.getStyleableNode.

Returns the Node that represents this Styleable object.

public Styleable

Returns:

getTableView()
getStyleableParent
()

Implements javafx.css.Styleable.getStyleableParent.

Return the parent of this Styleable, or null if there is no parent.

public final TableView<S>
public String

Returns:

"TableColumn"
getTypeSelector
()

Implements javafx.css.Styleable.getTypeSelector.

The type of this Styleable that is to be used in selector matching.

public final ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>

Returns:

the on edit cancel property
onEditCancelProperty
()

This event handler will be fired when the user cancels editing a cell.

public final ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>

Returns:

the on edit commit property
onEditCommitProperty
()

This event handler will be fired when the user successfully commits their editing.

public final ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>

Returns:

the on edit start property
onEditStartProperty
()

This event handler will be fired when the user successfully initiates editing.

private TableColumnHeader
public final void
public final void
public final void
public final void
public final void
public final void
pack-priv final void
public final ObjectProperty<TableColumn.SortType>
public final ReadOnlyObjectProperty<TableView<S>>
Inherited from javafx.scene.control.TableColumnBase:
addEventFilteraddEventHandlerbuildEventDispatchChaincomparatorPropertycontextMenuPropertydoSetWidtheditablePropertygetCellDatagetCellDatagetComparatorgetContextMenugetGraphicgetIdgetMaxWidthgetMinWidthgetParentColumngetPrefWidthgetPropertiesgetPseudoClassStatesgetSortNodegetStylegetStyleClassgetTextgetUserDatagetWidthgraphicPropertyhasPropertiesidPropertyisEditableisReorderableisResizableisSortableisVisiblemaxWidthPropertyminWidthPropertyparentColumnPropertyprefWidthPropertyremoveEventFilterremoveEventHandlerreorderablePropertyresizablePropertysetComparatorsetContextMenusetEditablesetGraphicsetIdsetMaxWidthsetMinWidthsetParentColumnsetPrefWidthsetReorderablesetResizablesetSortablesetSortNodesetStylesetTextsetUserDatasetVisiblesetWidthsortablePropertysortNodePropertystylePropertytextPropertyupdateColumnWidthsvisiblePropertywidthProperty

Field Detail

cellFactoryback to summary
private final ObjectProperty<Callback<TableColumn<S, T>, TableCell<S, T>>> cellFactory

The cell factory for all cells in this column. The cell factory is responsible for rendering the data contained within each TableCell for a single table column.

By default, TableColumn uses the default cell factory, but this can be replaced with a custom implementation, for example, to show data in a different way or to support editing. There is a lot of documentation on creating custom cell factories elsewhere (see Cell and TableView for example).

Finally, there are a number of pre-built cell factories available in the javafx.scene.control.cell package.

cellValueFactoryback to summary
private ObjectProperty<Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>>> cellValueFactory

The cell value factory needs to be set to specify how to populate all cells within a single TableColumn. A cell value factory is a Callback that provides a CellDataFeatures instance, and expects an ObservableValue to be returned. The returned ObservableValue instance will be observed internally to allow for immediate updates to the value to be reflected on screen. An example of how to set a cell value factory is:


lastNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
    public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
        // p.getValue() returns the Person instance for a particular TableView row
        return p.getValue().lastNameProperty();
    }
 });
}
A common approach is to want to populate cells in a TableColumn using a single value from a Java bean. To support this common scenario, there is the PropertyValueFactory class. Refer to this class for more information on how to use it, but briefly here is how the above use case could be simplified using the PropertyValueFactory class:

lastNameCol.setCellValueFactory(new PropertyValueFactory<Person,String>("lastName"));
See Also
PropertyValueFactory
columnsback to summary
private final ObservableList<TableColumn<S, ?>> columns
columnsListenerback to summary
private ListChangeListener<TableColumn<S, ?>> columnsListener
DEFAULT_CELL_FACTORYback to summary
public static final Callback<TableColumn<?, ?>, TableCell<?, ?>> DEFAULT_CELL_FACTORY

If no cellFactory is specified on a TableColumn instance, then this one will be used by default. At present it simply renders the TableCell item property within the graphic property if the item is a Node, or it simply calls toString() if it is not null, setting the resulting string inside the text property.

DEFAULT_EDIT_COMMIT_HANDLERback to summary
private EventHandler<TableColumn.CellEditEvent<S, T>> DEFAULT_EDIT_COMMIT_HANDLER
DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS
EDIT_ANY_EVENTback to summary
private static final EventType<?> EDIT_ANY_EVENT
EDIT_CANCEL_EVENTback to summary
private static final EventType<?> EDIT_CANCEL_EVENT
EDIT_COMMIT_EVENTback to summary
private static final EventType<?> EDIT_COMMIT_EVENT
EDIT_START_EVENTback to summary
private static final EventType<?> EDIT_START_EVENT
onEditCancelback to summary
private ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>> onEditCancel
onEditCommitback to summary
private ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>> onEditCommit
onEditStartback to summary
private ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>> onEditStart
sortTypeback to summary
private ObjectProperty<TableColumn.SortType> sortType

Used to state whether this column, if it is part of a sort order (see TableView#getSortOrder() for more details), should be sorted in ascending or descending order. Simply toggling this property will result in the sort order changing in the TableView, assuming of course that this column is in the sortOrder ObservableList to begin with.

tableViewback to summary
private ReadOnlyObjectWrapper<TableView<S>> tableView

The TableView that this TableColumn belongs to.

weakColumnsListenerback to summary
private WeakListChangeListener<TableColumn<S, ?>> weakColumnsListener

Constructor Detail

TableColumnback to summary
public TableColumn()

Creates a default TableColumn with default cell factory, comparator, and onEditCommit implementation.

TableColumnback to summary
public TableColumn(String text)

Creates a TableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation.

Parameters
text:String

The string to show when the TableColumn is placed within the TableView.

Method Detail

cellFactoryPropertyback to summary
public final ObjectProperty<Callback<TableColumn<S, T>, TableCell<S, T>>> cellFactoryProperty()
cellValueFactoryPropertyback to summary
public final ObjectProperty<Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>>> cellValueFactoryProperty()
editAnyEventback to summary
public static <S, T> EventType<TableColumn.CellEditEvent<S, T>> editAnyEvent()

Parent event for any TableColumn edit event.

Parameters
<S>
The type of the TableView generic type
<T>
The type of the content in all cells in this TableColumn
Returns:EventType<TableColumn.CellEditEvent<S, T>>

The any TableColumn edit event

Annotations
@SuppressWarnings:unchecked
editCancelEventback to summary
public static <S, T> EventType<TableColumn.CellEditEvent<S, T>> editCancelEvent()

Indicates that the editing has been canceled, meaning that no change should be made to the backing data source.

Parameters
<S>
The type of the TableView generic type
<T>
The type of the content in all cells in this TableColumn
Returns:EventType<TableColumn.CellEditEvent<S, T>>

The cancel an edit event

Annotations
@SuppressWarnings:unchecked
editCommitEventback to summary
public static <S, T> EventType<TableColumn.CellEditEvent<S, T>> editCommitEvent()

Indicates that the editing has been committed by the user, meaning that a change should be made to the backing data source to reflect the new data.

Parameters
<S>
The type of the TableView generic type
<T>
The type of the content in all cells in this TableColumn
Returns:EventType<TableColumn.CellEditEvent<S, T>>

The commit an edit event

Annotations
@SuppressWarnings:unchecked
editStartEventback to summary
public static <S, T> EventType<TableColumn.CellEditEvent<S, T>> editStartEvent()

Indicates that the user has performed some interaction to start an edit event, or alternatively the TableView#edit(int, javafx.scene.control.TableColumn) method has been called.

Parameters
<S>
The type of the TableView generic type
<T>
The type of the content in all cells in this TableColumn
Returns:EventType<TableColumn.CellEditEvent<S, T>>

The start an edit event

Annotations
@SuppressWarnings:unchecked
getCellFactoryback to summary
public final Callback<TableColumn<S, T>, TableCell<S, T>> getCellFactory()
getCellObservableValueback to summary
public final ObservableValue<T> getCellObservableValue(int index)

Implements abstract javafx.scene.control.TableColumnBase.getCellObservableValue.

Doc from javafx.scene.control.TableColumnBase.getCellObservableValue.

Attempts to return an ObservableValue<T> for the item in the given index (which is of type S). In other words, this method expects to receive an integer value that is greater than or equal to zero, and less than the size of the underlying data model. If the index is valid, this method will return an ObservableValue<T> for this specific column.

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).

Annotations
@Override
getCellObservableValueback to summary
public final ObservableValue<T> getCellObservableValue(S item)

Implements abstract javafx.scene.control.TableColumnBase.getCellObservableValue.

Doc from javafx.scene.control.TableColumnBase.getCellObservableValue.

Attempts to return an ObservableValue<T> for the given item (which is of type S). In other words, this method expects to receive an object from the underlying data model for the entire 'row' in the table, and it must return an ObservableValue<T> for the value in this specific column.

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).

Annotations
@Override
getCellValueFactoryback to summary
public final Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>> getCellValueFactory()
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

Returns:List<CssMetaData<? extends Styleable, ?>>

the CssMetaData

Since
JavaFX 8.0
getColumnsback to summary
public final ObservableList<TableColumn<S, ?>> getColumns()

Implements abstract javafx.scene.control.TableColumnBase.getColumns.

Doc from javafx.scene.control.TableColumnBase.getColumns.

This enables support for nested columns, which can be useful to group together related data. For example, we may have a 'Name' column with two nested columns for 'First' and 'Last' names.

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.

Annotations
@Override
getCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData()

Implements javafx.css.Styleable.getCssMetaData.

Doc from javafx.css.Styleable.getCssMetaData.

The CssMetaData of this Styleable. This may be returned as an unmodifiable list.

Annotations
@Override
Since
JavaFX 8.0
getOnEditCancelback to summary
public final EventHandler<TableColumn.CellEditEvent<S, T>> getOnEditCancel()
getOnEditCommitback to summary
public final EventHandler<TableColumn.CellEditEvent<S, T>> getOnEditCommit()
getOnEditStartback to summary
public final EventHandler<TableColumn.CellEditEvent<S, T>> getOnEditStart()
getSortTypeback to summary
public final TableColumn.SortType getSortType()
getStyleableNodeback to summary
public Node getStyleableNode()

Overrides default javafx.css.Styleable.getStyleableNode.

Doc from javafx.css.Styleable.getStyleableNode.

Returns the Node that represents this Styleable object. This method should be overridden in cases where the Styleable is not itself a Node, so that it may optionally return the relevant root node representation of itself. By default this method returns null, which can mean that either the Styleable itself is a Node, or if that is not the case, that the Styleable does not have a node representation available at the time of request.

Annotations
@Override
getStyleableParentback to summary
public Styleable getStyleableParent()

Implements javafx.css.Styleable.getStyleableParent.

Doc from javafx.css.Styleable.getStyleableParent.

Return the parent of this Styleable, or null if there is no parent.

Returns:Styleable

getTableView()

Annotations
@Override
Since
JavaFX 8.0
getTableViewback to summary
public final TableView<S> getTableView()
getTypeSelectorback to summary
public String getTypeSelector()

Implements javafx.css.Styleable.getTypeSelector.

Doc from javafx.css.Styleable.getTypeSelector.

The type of this Styleable that is to be used in selector matching. This is analogous to an "element" in HTML. (CSS Type Selector).

Returns:String

"TableColumn"

Annotations
@Override
Since
JavaFX 8.0
onEditCancelPropertyback to summary
public final ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>> onEditCancelProperty()

This event handler will be fired when the user cancels editing a cell.

Returns:ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>

the on edit cancel property

onEditCommitPropertyback to summary
public final ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>> onEditCommitProperty()

This event handler will be fired when the user successfully commits their editing.

Returns:ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>

the on edit commit property

onEditStartPropertyback to summary
public final ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>> onEditStartProperty()

This event handler will be fired when the user successfully initiates editing.

Returns:ObjectProperty<EventHandler<TableColumn.CellEditEvent<S, T>>>

the on edit start property

scanback to summary
private TableColumnHeader scan(TableColumnHeader header)
setCellFactoryback to summary
public final void setCellFactory(Callback<TableColumn<S, T>, TableCell<S, T>> value)
setCellValueFactoryback to summary
public final void setCellValueFactory(Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>> value)
setOnEditCancelback to summary
public final void setOnEditCancel(EventHandler<TableColumn.CellEditEvent<S, T>> value)
setOnEditCommitback to summary
public final void setOnEditCommit(EventHandler<TableColumn.CellEditEvent<S, T>> value)
setOnEditStartback to summary
public final void setOnEditStart(EventHandler<TableColumn.CellEditEvent<S, T>> value)
setSortTypeback to summary
public final void setSortType(TableColumn.SortType value)
setTableViewback to summary
pack-priv final void setTableView(TableView<S> value)
sortTypePropertyback to summary
public final ObjectProperty<TableColumn.SortType> sortTypeProperty()
tableViewPropertyback to summary
public final ReadOnlyObjectProperty<TableView<S>> tableViewProperty()
javafx.scene.control back to summary

public Class TableColumn.CellDataFeatures<S, T>

extends Object
Class Inheritance
Type Parameters
<S>
The TableView type
<T>
The TableColumn type

A support class used in TableColumn as a wrapper class to provide all necessary information for a particular Cell. Once instantiated, this class is immutable.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private final TableColumn<S, T>
private final TableView<S>
private final S

Constructor Summary

AccessConstructor and Description
public
CellDataFeatures(TableView<S>
The TableView that this instance refers to.
tableView
,
TableColumn<S, T>
The TableColumn that this instance refers to.
tableColumn
,
S
The value for a row in the TableView.
value
)

Instantiates a CellDataFeatures instance with the given properties set as read-only values of this instance.

Method Summary

Modifier and TypeMethod and Description
public TableColumn<S, T>

Returns:

the TableColumn passed in to the constructor
getTableColumn
()

Returns the TableColumn passed in to the constructor.

public TableView<S>

Returns:

the TableView passed in to the constructor
getTableView
()

Returns the TableView passed in to the constructor.

public S

Returns:

the value passed in to the constructor
getValue
()

Returns the value passed in to the constructor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

tableColumnback to summary
private final TableColumn<S, T> tableColumn
tableViewback to summary
private final TableView<S> tableView
valueback to summary
private final S value

Constructor Detail

CellDataFeaturesback to summary
public CellDataFeatures(TableView<S> tableView, TableColumn<S, T> tableColumn, S value)

Instantiates a CellDataFeatures instance with the given properties set as read-only values of this instance.

Parameters
tableView:TableView<S>

The TableView that this instance refers to.

tableColumn:TableColumn<S, T>

The TableColumn that this instance refers to.

value:S

The value for a row in the TableView.

Method Detail

getTableColumnback to summary
public TableColumn<S, T> getTableColumn()

Returns the TableColumn passed in to the constructor.

Returns:TableColumn<S, T>

the TableColumn passed in to the constructor

getTableViewback to summary
public TableView<S> getTableView()

Returns the TableView passed in to the constructor.

Returns:TableView<S>

the TableView passed in to the constructor

getValueback to summary
public S getValue()

Returns the value passed in to the constructor.

Returns:S

the value passed in to the constructor

javafx.scene.control back to summary

public Class TableColumn.CellEditEvent<S, T>

extends Event
Class Inheritance
Type Parameters
<S>
The type of the TableView generic type
<T>
The type of the content in all cells in this TableColumn

An event that is fired when a user performs an edit on a table cell.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
public static final EventType<?>
ANY

Hides javafx.event.Event.ANY.

Common supertype for all cell edit event types.
private final T
private final transient TablePosition<S, T>
private static final long
Inherited from javafx.event.Event:
consumedeventTypeNULL_SOURCE_TARGETtarget

Constructor Summary

AccessConstructor and Description
public
CellEditEvent(TableView<S>
The TableView on which this event occurred.
table
,
TablePosition<S, T>
The position upon which this event occurred.
pos
,
EventType<TableColumn.CellEditEvent<S, T>>
The type of event that occurred.
eventType
,
T
The value input by the end user.
newValue
)

Creates a new event that can be subsequently fired to the relevant listeners.

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

An Object representing the new value input by the user.
getNewValue
()

Returns the new value input by the end user.

public T

Returns:

Returns the value stored in the position being edited, or null if it can not be retrieved.
getOldValue
()

Attempts to return the old value at the position referred to in the TablePosition returned by getTablePosition().

public S

Returns:

the value for the row
getRowValue
()

Convenience method that returns the value for the row (that is, from the TableView items list), for the row contained within the TablePosition returned in getTablePosition().

public TableColumn<S, T>

Returns:

The TableColumn that the edit occurred in.
getTableColumn
()

Returns the TableColumn upon which this event occurred.

public TablePosition<S, T>

Returns:

The position upon which this event occurred.
getTablePosition
()

Returns the position upon which this event occurred.

public TableView<S>

Returns:

The TableView control upon which this event occurred.
getTableView
()

Returns the TableView upon which this event occurred.

Inherited from javafx.event.Event:
cloneconsumecopyForfireEventgetEventTypegetTargetisConsumed

Field Detail

ANYback to summary
public static final EventType<?> ANY

Hides javafx.event.Event.ANY.

Common supertype for all cell edit event types.

Since
JavaFX 8.0
newValueback to summary
private final T newValue
Annotations
@SuppressWarnings:doclint:missing
posback to summary
private final transient TablePosition<S, T> pos
serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.event.Event.serialVersionUID.

Constructor Detail

CellEditEventback to summary
public CellEditEvent(TableView<S> table, TablePosition<S, T> pos, EventType<TableColumn.CellEditEvent<S, T>> eventType, T newValue)

Creates a new event that can be subsequently fired to the relevant listeners.

Parameters
table:TableView<S>

The TableView on which this event occurred.

pos:TablePosition<S, T>

The position upon which this event occurred.

eventType:EventType<TableColumn.CellEditEvent<S, T>>

The type of event that occurred.

newValue:T

The value input by the end user.

Method Detail

getNewValueback to summary
public T getNewValue()

Returns the new value input by the end user. This is not the value to go back into the TableView.items list - this new value represents just the input for a single cell, so it is likely that it needs to go back into a property within an item in the TableView.items list.

Returns:T

An Object representing the new value input by the user.

getOldValueback to summary
public T getOldValue()

Attempts to return the old value at the position referred to in the TablePosition returned by getTablePosition(). This may return null for a number of reasons.

Returns:T

Returns the value stored in the position being edited, or null if it can not be retrieved.

getRowValueback to summary
public S getRowValue()

Convenience method that returns the value for the row (that is, from the TableView items list), for the row contained within the TablePosition returned in getTablePosition().

Returns:S

the value for the row

getTableColumnback to summary
public TableColumn<S, T> getTableColumn()

Returns the TableColumn upon which this event occurred.

Returns:TableColumn<S, T>

The TableColumn that the edit occurred in.

getTablePositionback to summary
public TablePosition<S, T> getTablePosition()

Returns the position upon which this event occurred.

Returns:TablePosition<S, T>

The position upon which this event occurred.

getTableViewback to summary
public TableView<S> getTableView()

Returns the TableView upon which this event occurred.

Returns:TableView<S>

The TableView control upon which this event occurred.

javafx.scene.control back to summary

public final Enum TableColumn.SortType

extends Enum<TableColumn.SortType>
Class Inheritance

Enumeration that specifies the type of sorting being applied to a specific column.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
public static final TableColumn.SortType
ASCENDING

Column will be sorted in an ascending order.

public static final TableColumn.SortType
DESCENDING

Column will be sorted in a descending order.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TableColumn.SortType
public static TableColumn.SortType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ASCENDINGback to summary
public static final TableColumn.SortType ASCENDING

Column will be sorted in an ascending order.

DESCENDINGback to summary
public static final TableColumn.SortType DESCENDING

Column will be sorted in a descending order.

Constructor Detail

SortTypeback to summary
private SortType()

Method Detail

valueOfback to summary
public static TableColumn.SortType valueOf(String name)
valuesback to summary
public static TableColumn.SortType[] values()