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

public Class MapValueFactory<T>

extends Object
implements Callback<TableColumn.CellDataFeatures<Map<K, V>, T>, ObservableValue<T>>
Class Inheritance
All Implemented Interfaces
javafx.util.Callback
Type Parameters
<T>
The type of the class contained within the TableColumn cells.
Imports
java.util.Map, javafx.beans.NamedArg, javafx.beans.property.ReadOnlyBooleanWrapper, .ReadOnlyDoubleWrapper, .ReadOnlyFloatWrapper, .ReadOnlyIntegerWrapper, .ReadOnlyLongWrapper, .ReadOnlyObjectWrapper, .ReadOnlyStringWrapper, javafx.beans.value.ObservableValue, javafx.scene.control.TableCell, .TableColumn, .TableColumn.CellDataFeatures, .TableView, javafx.util.Callback

A convenience implementation of the Callback interface, designed specifically for use within the TableColumn cell value factory. An example of how to use this class is:

ObservableList<Map> personsMapList = ...

TableColumn<Map, String> firstNameColumn = new TableColumn<Map, String>("First Name");
firstNameColumn.setCellValueFactory(new MapValueFactory<String>("firstName"));

TableView<Map> table = new TableView<Map>(personMapList);
tableView.getColumns().setAll(firstNameColumn);

In this example, there is a list of Map instances, where each Map instance represents a single row in the TableView. The "firstName" string is used as a key into this map, and the value corresponding to this key is returned, if one exists. If the value is an ObservableValue, then this is returned directly, otherwise the value is wrapped in a ReadOnlyObjectWrapper.

Since
JavaFX 2.2
See Also
TableColumn, TableView, TableCell, PropertyValueFactory

Field Summary

Modifier and TypeField and Description
private final Object

Constructor Summary

AccessConstructor and Description
public
MapValueFactory(final Object
The key to use to lookup the value in the Map.
key
)

Creates a default MapValueFactory, which will use the provided key to lookup the value for cells in the TableColumn in which this MapValueFactory is installed (via the cell value factory property.

Method Summary

Modifier and TypeMethod and Description
public ObservableValue<T>
call(TableColumn.CellDataFeatures<Map<K, V>, T> cdf)

Implements javafx.util.Callback.call.

The call method is called when required, and is given a single argument of type P, with a requirement that an object of type R is returned.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
private final Object key

Constructor Detail

MapValueFactoryback to summary
public MapValueFactory(final Object key)

Creates a default MapValueFactory, which will use the provided key to lookup the value for cells in the TableColumn in which this MapValueFactory is installed (via the cell value factory property.

Parameters
key:Object

The key to use to lookup the value in the Map.

Method Detail

callback to summary
public ObservableValue<T> call(TableColumn.CellDataFeatures<Map<K, V>, T> cdf)

Implements javafx.util.Callback.call.

Doc from javafx.util.Callback.call.

The call method is called when required, and is given a single argument of type P, with a requirement that an object of type R is returned.

Annotations
@Override