Class TableHeaderRow

All Implemented Interfaces:
Styleable, EventTarget

public class TableHeaderRow
extends StackPane
Region responsible for painting the entire row of column headers.
Since:
9
See Also:
TableView, TableViewSkin, TreeTableView, TreeTableViewSkin
  • Property Details

    • reordering

      public final BooleanProperty reorderingProperty
      Indicates if a reordering operation of a column is in progress. The value is true during a column reordering operation, and false otherwise. When a column is reordered (for example, by dragging its header), this property is updated automatically. Setting the value manually should be done when a subclass overrides the default reordering behavior. Calling setReorderingRegion(TableColumnHeader) before setting this property is required as well.
      Since:
      12
      See Also:
      isReordering(), setReordering(boolean)
  • Constructor Details

    • TableHeaderRow

      public TableHeaderRow​(TableViewSkinBase skin)
      Creates a new TableHeaderRow instance to visually represent the column header area of controls such as TableView and TreeTableView.
      Parameters:
      skin - The skin used by the UI control.
  • Method Details

    • setReordering

      public final void setReordering​(boolean value)
      Sets the value of the property reordering.
      Property description:
      Indicates if a reordering operation of a column is in progress. The value is true during a column reordering operation, and false otherwise. When a column is reordered (for example, by dragging its header), this property is updated automatically. Setting the value manually should be done when a subclass overrides the default reordering behavior. Calling setReorderingRegion(TableColumnHeader) before setting this property is required as well.
      Since:
      12
    • isReordering

      public final boolean isReordering()
      Gets the value of the property reordering.
      Property description:
      Indicates if a reordering operation of a column is in progress. The value is true during a column reordering operation, and false otherwise. When a column is reordered (for example, by dragging its header), this property is updated automatically. Setting the value manually should be done when a subclass overrides the default reordering behavior. Calling setReorderingRegion(TableColumnHeader) before setting this property is required as well.
      Since:
      12
    • reorderingProperty

      public final BooleanProperty reorderingProperty()
      Indicates if a reordering operation of a column is in progress. The value is true during a column reordering operation, and false otherwise. When a column is reordered (for example, by dragging its header), this property is updated automatically. Setting the value manually should be done when a subclass overrides the default reordering behavior. Calling setReorderingRegion(TableColumnHeader) before setting this property is required as well.
      Since:
      12
      See Also:
      isReordering(), setReordering(boolean)
    • getRootHeader

      public final NestedTableColumnHeader getRootHeader()
      Returns the root header for all columns. The root header is a NestedTableColumnHeader that contains the NestedTableColumnHeaders that represent each column. It spans the entire width of the TableView. This allows any developer overriding a TableColumnHeader to easily access the root header and all others TableColumnHeaders.
      Implementation Note:
      This design enforces that column reordering occurs only within a single NestedTableColumnHeader and only at that level.
      Returns:
      the root header
      Since:
      12
    • 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 StackPane
    • 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 StackPane
      Parameters:
      height - the height that should be used if preferred width depends on it
      Returns:
      the computed preferred width for this region
    • computeMinHeight

      protected double computeMinHeight​(double width)
      Computes the minimum height of this region. Returns the sum of the top and bottom insets by default. 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:
      computeMinHeight in class StackPane
      Parameters:
      width - the width that should be used if min height depends on it
      Returns:
      the computed minimum height 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 StackPane
      Parameters:
      width - the width that should be used if preferred height depends on it
      Returns:
      the computed preferred height for this region
    • updateScrollX

      protected void updateScrollX()
      Called whenever the value of the horizontal scrollbar changes in order to request layout changes, shifting the TableColumnHeaders.

      For example, if custom components are added around a TableColumnHeader (such as icons above), they will also need to be shifted. When overriding, calling super() is required to shift the TableColumnHeaders, and it's up to the developer to notify its own custom components of this change.

      Since:
      12
    • updateTableWidth

      protected void updateTableWidth()
      Updates the table width when a resize operation occurs. This method is called continuously when the control width is resizing in order to properly clip this TableHeaderRow. Overriding this method allows a subclass to customize the resizing behavior.

      Normally, the TableHeaderRow is using the full space (TableView width), but in some cases that space may be reduced. For example, if a vertical header that will display the row number is introduced, the TableHeaderRow would need to be clipped a bit shorter in order not to overlap that vertical header. Calling super() first when overriding this method allows Node.getClip() to compute the right width in order apply a transformation.

      Since:
      12
    • createRootHeader

      protected NestedTableColumnHeader createRootHeader()
      Creates a new NestedTableColumnHeader instance. By default this method should not be overridden, but in some circumstances it makes sense (e.g. testing, or when extreme customization is desired).
      Returns:
      A new NestedTableColumnHeader instance.
    • getReorderingRegion

      protected TableColumnHeader getReorderingRegion()
      Returns the current TableColumnHeader being moved during reordering.
      Returns:
      the current TableColumnHeader being moved
      Since:
      12
    • setReorderingRegion

      protected void setReorderingRegion​(TableColumnHeader reorderingRegion)
      Sets the TableColumnHeader that is being moved during a reordering operation. This is automatically set by the TableColumnHeader when reordering starts. This method should only be called manually if the default reordering behavior is overridden. Calling setReordering(boolean) after the call is required.
      Parameters:
      reorderingRegion - the TableColumnHeader being reordered
      Since:
      12