Class NestedTableColumnHeader

All Implemented Interfaces:
Styleable, EventTarget

public class NestedTableColumnHeader
extends TableColumnHeader

This class is used to construct the header of a TableView. We take the approach that every TableView header is nested - even if it isn't. This allows for us to use the same code for building a single row of TableColumns as we would with a heavily nested sequences of TableColumns. Because of this, the TableHeaderRow class consists of just one instance of a NestedTableColumnHeader.

Since:
9
See Also:
TableColumnHeader, TableHeaderRow, TableColumnBase
  • Constructor Details

    • NestedTableColumnHeader

      public NestedTableColumnHeader​(TableColumnBase tc)
      Creates a new NestedTableColumnHeader instance to visually represent the given TableColumnBase instance.
      Parameters:
      tc - The table column to be visually represented by this instance.
  • Method Details

    • getColumnHeaders

      public final ObservableList<TableColumnHeader> getColumnHeaders()
      Returns an unmodifiable list of the TableColumnHeader instances that are children of this NestedTableColumnHeader.
      Returns:
      the unmodifiable list of TableColumnHeader of this NestedTableColumnHeader
    • layoutChildren

      protected void layoutChildren()
      Invoked during the layout pass to layout the children in this Parent. By default it will only set the size of managed, resizable content to their preferred sizes and does not do any node positioning.

      Subclasses should override this function to layout content as needed.

      Overrides:
      layoutChildren in class TableColumnHeader
    • computePrefWidth

      protected double computePrefWidth​(double height)
      Computes the preferred width of this region for the given height. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a VERTICAL content bias, then the height parameter can be ignored.
      Overrides:
      computePrefWidth in class TableColumnHeader
      Parameters:
      height - the height that should be used if preferred width depends on it
      Returns:
      the computed preferred width for this region
    • computePrefHeight

      protected double computePrefHeight​(double width)
      Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.
      Overrides:
      computePrefHeight in class TableColumnHeader
      Parameters:
      width - the width that should be used if preferred height depends on it
      Returns:
      the computed preferred height for this region
    • createTableColumnHeader

      protected TableColumnHeader createTableColumnHeader​(TableColumnBase col)
      Creates a new TableColumnHeader instance for the given TableColumnBase instance. The general pattern for implementing this method is as follows:
      • If the given TableColumnBase instance is null, has no child columns, or if the given TableColumnBase instance equals the TableColumnBase instance returned by calling TableColumnHeader.getTableColumn(), then it is suggested to return a TableColumnHeader instance comprised of the given column.
      • Otherwise, we can presume that the given TableColumnBase instance has child columns, and in this case it is suggested to return a NestedTableColumnHeader instance instead.
      Note: In most circumstances this method should not be overridden, but in some circumstances it makes sense (e.g. testing, or when extreme customization is desired).
      Parameters:
      col - the table column
      Returns:
      A new TableColumnHeader instance.