Spec-Zone.ru › OpenJavaFX 8
javafx.scene.control.cell

Class MapValueFactory<T>

java.lang.Object
  • javafx.scene.control.cell.MapValueFactory<T>

Type Parameters:

T - The type of the class contained within the TableColumn cells.

All Implemented Interfaces:

Callback<TableColumn.CellDataFeatures<Map,T>,ObservableValue<T>>



public class MapValueFactory<T>
extends Object
implements Callback<TableColumn.CellDataFeatures<Map,T>,ObservableValue<T>>
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 personsMapList = ...
 
 TableColumn<Map, String> firstNameColumn = new TableColumn<Map, String>("First Name");
 firstNameColumn.setCellValueFactory(new MapValueFactory<String>("firstName"));
 
 TableView table = new TableView(personMapList);
 tableView.getColumns().setAll(firstNameColumn);

In this example, there is a list of Map instances, where each Map instance representsa 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

  • Constructor Summary

    Constructors
    Constructor and Description
    MapValueFactory(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.
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    ObservableValue<T> call(TableColumn.CellDataFeatures<Map,T> cdf)
    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.
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Detail

    • MapValueFactory

      public MapValueFactory(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 - The key to use to lookup the value in the Map.

  • Method Detail

    • call

      public ObservableValue<T> call(TableColumn.CellDataFeatures<Map,T> cdf)
      Description copied from interface: Callback
      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.

      Specified by:

      call in interface Callback<TableColumn.CellDataFeatures<Map,T>,ObservableValue<T>>

      Parameters:

      cdf - The single argument upon which the returned value should be determined.

      Returns:

      An object of type R that may be determined based on the provided parameter value.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API