Class IndexedCell<T>

Type Parameters:
T - The type of the item contained within the Cell.
All Implemented Interfaces:
Styleable, EventTarget, Skinnable
Direct Known Subclasses:
ListCell, TableCell, TableRow, TreeCell, TreeTableCell, TreeTableRow

public class IndexedCell<T> extends Cell<T>
An implementation of Cell which contains an index property which maps into the data model underlying the visualization. Despite this, IndexedCell should not be instantiated directly in a cell factory (refer to Cell for more details on what a cell factory is). Instead of creating IndexedCell directly, you should instead make use of the control-specific cell implementations (for example, ListCell, TreeCell) TableRow and TableCell). For more information about using and customizing cells, refer to the Cell API documentation.

Because each sequential index represents a single sequential element in the control, this allows for easy alternative row highlighting. By default the controls which use Cells provide their own alternative row highlighting colors, but this can be overridden using two pseudo class states provided by IndexedCell: "even" and "odd".

Since:
JavaFX 2.0
  • Property Details

  • Constructor Details

    • IndexedCell

      public IndexedCell()
      Creates a default IndexedCell with the default style class of 'indexed-cell'.
  • Method Details

    • getIndex

      public final int getIndex()
      Returns the index that this cell represents in the underlying control data model.
      Returns:
      the index that this cell represents in the underlying control data model
    • indexProperty

      public final ReadOnlyIntegerProperty indexProperty()
      The location of this cell in the virtualized control (e.g: ListView, TreeView, TableView, etc). This is the model index which corresponds exactly with the Cell item property. For example, in the case of a ListView, this means the following: cell.item == listView.getItems().get(cell.getIndex())
      Returns:
      the location of this cell in the virtualized control
      See Also:
    • updateIndex

      public void updateIndex(int newIndex)
      Updates the index associated with this IndexedCell. Note: This function is intended to be used by experts, primarily by those implementing new Skins. It is not common for developers or designers to access this function directly.
      Parameters:
      newIndex - the index associated with this indexed cell