Class SpreadsheetColumn

java.lang.Object
org.controlsfx.control.spreadsheet.SpreadsheetColumn

public final class SpreadsheetColumn extends Object
A SpreadsheetView is made up of a number of SpreadsheetColumn instances.

Configuration

SpreadsheetColumns are instantiated by the SpreadsheetView itself, so there is no public constructor for this class. To access the available columns, you need to call SpreadsheetView.getColumns().

SpreadsheetColumn gives you the ability to modify some aspects of the column, for example the width or resizability of the column.

You have the ability to freeze this column at the left of the SpreadsheetView by calling setFixed(boolean). But you are strongly advised to check if it is possible with isColumnFixable() before calling setFixed(boolean). Take a look at the SpreadsheetView description to understand the freezing constraints.

If the column can be frozen, a ContextMenu will appear if the user right-clicks on it. If not, nothing will appear and the user will not have the possibility to freeze it.

Screenshot

The column A is frozen and is covering column B and partially column C. The context menu is being shown and offers the possibility to unfreeze the column.

Screenshot of SpreadsheetColumn
See Also:
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ObjectProperty
     
    final javafx.beans.property.DoubleProperty
    Return the Property related to the maximum width of this SpreadsheetColumn.
    final javafx.beans.property.DoubleProperty
    Return the Property related to the minimum width of this SpreadsheetColumn.
    final javafx.beans.property.ReadOnlyDoubleProperty
    Return the Property related to the actual width of the column.
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.beans.property.ObjectProperty
     
    void
    If the column is resizable, it will compute the optimum width for all the visible cells to be visible.
    Gets the value of the filter property.
    final double
    Return the maximum width for this SpreadsheetColumn.
    final double
    Return the minimum width for this SpreadsheetColumn.
    double
    Return the actual width of the column.
    boolean
    Indicate whether this column can be frozen or not.
    boolean
    Return whether this column is frozen or not.
    final javafx.beans.property.DoubleProperty
    Return the Property related to the maximum width of this SpreadsheetColumn.
    final javafx.beans.property.DoubleProperty
    Return the Property related to the minimum width of this SpreadsheetColumn.
    void
    setFilter(Filter filter)
    Sets the value of the filter property.
    void
    setFixed(boolean fixed)
    Freeze this column to the left if possible, although it is recommended that you call isColumnFixable() before trying to freeze a column.
    final void
    setMaxWidth(double value)
    Set the maximum width for this SpreadsheetColumn.
    final void
    setMinWidth(double value)
    Set the minimum width for this SpreadsheetColumn.
    void
    setPrefWidth(double width)
    Set the width of this column.
    void
    setResizable(boolean b)
    If this column can be resized by the user
    final javafx.beans.property.ReadOnlyDoubleProperty
    Return the Property related to the actual width of the column.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Method Details

    • isFixed

      public boolean isFixed()
      Return whether this column is frozen or not.
      Returns:
      true if this column is frozen.
    • setFixed

      public void setFixed(boolean fixed)
      Freeze this column to the left if possible, although it is recommended that you call isColumnFixable() before trying to freeze a column. If you want to freeze several columns (because of a span for example), add all the columns directly in SpreadsheetView.getFixedColumns(). Always use SpreadsheetView.areSpreadsheetColumnsFixable(java.util.List) before.
      Parameters:
      fixed -
    • setPrefWidth

      public void setPrefWidth(double width)
      Set the width of this column.
      Parameters:
      width -
    • getWidth

      public double getWidth()
      Return the actual width of the column.
      Returns:
      the actual width of the column
    • widthProperty

      public final javafx.beans.property.ReadOnlyDoubleProperty widthProperty()
      Return the Property related to the actual width of the column.
      Returns:
      the Property related to the actual width of the column.
      See Also:
    • setMinWidth

      public final void setMinWidth(double value)
      Set the minimum width for this SpreadsheetColumn.
      Parameters:
      value -
    • getMinWidth

      public final double getMinWidth()
      Return the minimum width for this SpreadsheetColumn.
      Returns:
      the minimum width for this SpreadsheetColumn.
    • minWidthProperty

      public final javafx.beans.property.DoubleProperty minWidthProperty()
      Return the Property related to the minimum width of this SpreadsheetColumn.
      Returns:
      the Property related to the minimum width of this SpreadsheetColumn.
      See Also:
    • maxWidthProperty

      public final javafx.beans.property.DoubleProperty maxWidthProperty()
      Return the Property related to the maximum width of this SpreadsheetColumn.
      Returns:
      the Property related to the maximum width of this SpreadsheetColumn.
      See Also:
    • setMaxWidth

      public final void setMaxWidth(double value)
      Set the maximum width for this SpreadsheetColumn.
      Parameters:
      value -
    • getMaxWidth

      public final double getMaxWidth()
      Return the maximum width for this SpreadsheetColumn.
      Returns:
      the maximum width for this SpreadsheetColumn.
    • setResizable

      public void setResizable(boolean b)
      If this column can be resized by the user
      Parameters:
      b -
    • fitColumn

      public void fitColumn()
      If the column is resizable, it will compute the optimum width for all the visible cells to be visible.
    • isColumnFixable

      public boolean isColumnFixable()
      Indicate whether this column can be frozen or not. Call that method before calling setFixed(boolean) or adding an item to SpreadsheetView.getFixedColumns(). A column cannot be frozen alone if any cell inside the column has a column span superior to one.
      Returns:
      true if this column is freezable.
    • setFilter

      public void setFilter(Filter filter)
      Sets the value of the filter property.
      Property description:
      Parameters:
      filter - the value for the filter property
      See Also:
    • getFilter

      public Filter getFilter()
      Gets the value of the filter property.
      Property description:
      Returns:
      the value of the filter property
      See Also:
    • filterProperty

      public javafx.beans.property.ObjectProperty filterProperty()
      Returns:
      the filter property
      See Also: