Top Description Fields Constructors Methods
org.controlsfx.control.spreadsheet

public final Class SpreadsheetColumn

extends Object
Class Inheritance
Static Imports
impl.org.controlsfx.i18n.Localization.asKey, .Localization.localize

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
SpreadsheetView

Field Summary

Modifier and TypeField and Description
private final boolean
pack-priv final TableColumn<ObservableList<SpreadsheetCell>, SpreadsheetCell>
private final ObjectProperty<Filter>
private MenuItem
private final Integer
private final SpreadsheetView
spreadsheetView

Private Fields * *

Constructor Summary

AccessConstructor and Description
pack-priv
SpreadsheetColumn(final TableColumn<ObservableList<SpreadsheetCell>, SpreadsheetCell> column, final SpreadsheetView spreadsheetView, final Integer indexColumn, Grid grid)

Creates a new SpreadsheetColumn.

Method Summary

Modifier and TypeMethod and Description
public ObjectProperty<T>
public void
fitColumn()

If the column is resizable, it will compute the optimum width for all the visible cells to be visible.

private ContextMenu

Returns:

a context menu.
getColumnContextMenu
()

Generate a context Menu in order to freeze/unfreeze some column It is shown when right-clicking on the column header

public Filter
public final double

Returns:

the maximum width for this SpreadsheetColumn.
getMaxWidth
()

Return the maximum width for this SpreadsheetColumn.

public final double

Returns:

the minimum width for this SpreadsheetColumn.
getMinWidth
()

Return the minimum width for this SpreadsheetColumn.

private String
public double

Returns:

the actual width of the column
getWidth
()

Return the actual width of the column.

private boolean

Returns:

if it's freezable.
initCanFix
(Grid grid)

Verify that you can freeze this column.

public boolean

Returns:

true if this column is freezable.
isColumnFixable
()

Indicate whether this column can be frozen or not.

public boolean

Returns:

true if this column is frozen.
isFixed
()

Return whether this column is frozen or not.

public final DoubleProperty

Returns:

the Property related to the maximum width of this SpreadsheetColumn.
maxWidthProperty
()

Return the Property related to the maximum width of this SpreadsheetColumn.

public final DoubleProperty

Returns:

the Property related to the minimum width of this SpreadsheetColumn.
minWidthProperty
()

Return the Property related to the minimum width of this SpreadsheetColumn.

public void
setFilter(Filter filter)

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.

public final void
setMaxWidth(double value)

Set the maximum width for this SpreadsheetColumn.

public final void
setMinWidth(double value)

Set the minimum width for this SpreadsheetColumn.

public void
setPrefWidth(double width)

Set the width of this column.

public void
setResizable(boolean b)

If this column can be resized by the user

private void
setText(String text)

Private Methods * *

public final ReadOnlyDoubleProperty

Returns:

the Property related to the actual width of the column.
widthProperty
()

Return the Property related to the actual width of the column.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

canFixback to summary
private final boolean canFix
columnback to summary
pack-priv final TableColumn<ObservableList<SpreadsheetCell>, SpreadsheetCell> column
filterPropertyback to summary
private final ObjectProperty<Filter> filterProperty
fixItemback to summary
private MenuItem fixItem
indexColumnback to summary
private final Integer indexColumn
spreadsheetViewback to summary
private final SpreadsheetView spreadsheetView

Private Fields * *

Constructor Detail

SpreadsheetColumnback to summary
pack-priv SpreadsheetColumn(final TableColumn<ObservableList<SpreadsheetCell>, SpreadsheetCell> column, final SpreadsheetView spreadsheetView, final Integer indexColumn, Grid grid)

Creates a new SpreadsheetColumn.

Method Detail

filterPropertyback to summary
public ObjectProperty<T> filterProperty()
fitColumnback to summary
public void fitColumn()

If the column is resizable, it will compute the optimum width for all the visible cells to be visible.

getColumnContextMenuback to summary
private ContextMenu getColumnContextMenu()

Generate a context Menu in order to freeze/unfreeze some column It is shown when right-clicking on the column header

Returns:ContextMenu

a context menu.

getFilterback to summary
public Filter getFilter()
getMaxWidthback to summary
public final double getMaxWidth()

Return the maximum width for this SpreadsheetColumn.

Returns:double

the maximum width for this SpreadsheetColumn.

getMinWidthback to summary
public final double getMinWidth()

Return the minimum width for this SpreadsheetColumn.

Returns:double

the minimum width for this SpreadsheetColumn.

getTextback to summary
private String getText()
getWidthback to summary
public double getWidth()

Return the actual width of the column.

Returns:double

the actual width of the column

initCanFixback to summary
private boolean initCanFix(Grid grid)

Verify that you can freeze this column.

Returns:boolean

if it's freezable.

isColumnFixableback to summary
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:boolean

true if this column is freezable.

isFixedback to summary
public boolean isFixed()

Return whether this column is frozen or not.

Returns:boolean

true if this column is frozen.

maxWidthPropertyback to summary
public final DoubleProperty maxWidthProperty()

Return the Property related to the maximum width of this SpreadsheetColumn.

Returns:DoubleProperty

the Property related to the maximum width of this SpreadsheetColumn.

minWidthPropertyback to summary
public final DoubleProperty minWidthProperty()

Return the Property related to the minimum width of this SpreadsheetColumn.

Returns:DoubleProperty

the Property related to the minimum width of this SpreadsheetColumn.

setFilterback to summary
public void setFilter(Filter filter)
setFixedback to summary
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.

setMaxWidthback to summary
public final void setMaxWidth(double value)

Set the maximum width for this SpreadsheetColumn.

setMinWidthback to summary
public final void setMinWidth(double value)

Set the minimum width for this SpreadsheetColumn.

setPrefWidthback to summary
public void setPrefWidth(double width)

Set the width of this column.

setResizableback to summary
public void setResizable(boolean b)

If this column can be resized by the user

setTextback to summary
private void setText(String text)

Private Methods * *

widthPropertyback to summary
public final ReadOnlyDoubleProperty widthProperty()

Return the Property related to the actual width of the column.

Returns:ReadOnlyDoubleProperty

the Property related to the actual width of the column.