- java.lang.Object
-
- javafx.scene.control.SkinBase<C>
-
- javafx.scene.control.skin.VirtualContainerBase<C,I>
-
- javafx.scene.control.skin.TableViewSkinBase<ObservableList<SpreadsheetCell>,ObservableList<SpreadsheetCell>,TableView<ObservableList<SpreadsheetCell>>,TableRow<ObservableList<SpreadsheetCell>>,TableColumn<ObservableList<SpreadsheetCell>,?>>
-
- impl.org.controlsfx.spreadsheet.GridViewSkin
-
- All Implemented Interfaces:
Skin<TableView<ObservableList<SpreadsheetCell>>>
public class GridViewSkin extends TableViewSkinBase<ObservableList<SpreadsheetCell>,ObservableList<SpreadsheetCell>,TableView<ObservableList<SpreadsheetCell>>,TableRow<ObservableList<SpreadsheetCell>>,TableColumn<ObservableList<SpreadsheetCell>,?>>
This skin is actually the skin of the SpreadsheetGridView (tableView) contained within the SpreadsheetView. The skin for the SpreadsheetView itself currently resides inside the SpreadsheetView constructor! We need to extends directly from TableViewSkinBase in order to work-around https://javafx-jira.kenai.com/browse/RT-34753 if we want to set a custom TableViewBehavior.
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_CELL_HEIGHT
Default height of a row.protected SpreadsheetHandle
handle
protected HorizontalPicker
horizontalPickers
protected SpreadsheetView
spreadsheetView
protected VerticalHeader
verticalHeader
-
Constructor Summary
Constructors Constructor Description GridViewSkin(SpreadsheetHandle handle)
* CONSTRUCTOR * *
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
computeFixedRowHeight()
We compute the total height of the fixedRows so that the selection can use it without performance regression.boolean
containsRow(int index)
Indicate whether or not the row at the specified index is currently being displayed.protected TableHeaderRow
createTableHeaderRow()
protected VirtualFlow<TableRow<ObservableList<SpreadsheetCell>>>
createVirtualFlow()
GridViewBehavior
getBehavior()
int
getCellsSize()
ObservableList<TableColumn<ObservableList<SpreadsheetCell>,?>>
getColumns()
protected ObservableSet<Integer>
getCurrentlyFixedRow()
int
getFirstRow(SpreadsheetCell cell, int index)
This return the first index displaying a cell in case of a rowSpan.double
getFixedRowHeight()
ScrollBar
getHBar()
HorizontalHeader
getHorizontalHeader()
int
getItemCount()
GridRow
getRow(int index)
This return the row at the specified index in the list.double
getRowHeight(int row)
Compute the height of a particular row.GridRow
getRowIndexed(int index)
This return the GridRow which has the specified index if found.ObservableList<Integer>
getSelectedColumns()
ObservableList<Integer>
getSelectedRows()
Contains the index of the sortedList.GridCellEditor
getSpreadsheetCellEditorImpl()
ScrollBar
getVBar()
protected void
init()
* PRIVATE/PROTECTED METHOD * *protected void
layoutChildren(double x, double y, double w, double h)
protected void
onFocusAboveCell()
protected void
onFocusBelowCell()
protected void
onSelectAboveCell()
protected void
onSelectBelowCell()
void
resize(TableColumnBase<?,?> tc, int maxRows)
Used in the HorizontalColumnHeader when we need to resize in double click.void
resizeColumnToFitContent(TableColumn<ObservableList<SpreadsheetCell>,?> tc, int maxRows)
We want to have extra space when displaying LocalDate because they will use an editor that display a little icon on the right.void
resizeRowsToDefault()
void
resizeRowsToFitContent()
Will compute for every row the necessary height and fit the line.void
resizeRowsToMaximum()
void
resizeRowToFitContent(int modelRow)
Will compute for the row the necessary height and fit the line.void
scrollHorizontally()
protected void
scrollHorizontally(TableColumn<ObservableList<SpreadsheetCell>,?> col)
void
setHbarValue(double value)
If the scene is not yet instantiated, we need to wait otherwise the VirtualFlow will not shift the cells properly.void
setHbarValue(double value, int count)
-
Methods inherited from class javafx.scene.control.skin.TableViewSkinBase
computePrefHeight, computePrefWidth, dispose, getTableHeaderRow, onFocusLeftCell, onFocusRightCell, onMoveToFirstCell, onMoveToLastCell, onScrollPageDown, onScrollPageUp, onSelectLeftCell, onSelectRightCell, queryAccessibleAttribute, updateItemCount
-
Methods inherited from class javafx.scene.control.skin.VirtualContainerBase
getVirtualFlow, markItemCountDirty
-
Methods inherited from class javafx.scene.control.SkinBase
computeBaselineOffset, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, consumeMouseEvents, executeAccessibleAction, getChildren, getClassCssMetaData, getCssMetaData, getNode, getSkinnable, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, registerChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners
-
-
-
-
Field Detail
-
DEFAULT_CELL_HEIGHT
public static final double DEFAULT_CELL_HEIGHT
Default height of a row.- See Also:
- Constant Field Values
-
handle
protected final SpreadsheetHandle handle
-
spreadsheetView
protected SpreadsheetView spreadsheetView
-
verticalHeader
protected VerticalHeader verticalHeader
-
horizontalPickers
protected HorizontalPicker horizontalPickers
-
-
Constructor Detail
-
GridViewSkin
public GridViewSkin(SpreadsheetHandle handle)
* CONSTRUCTOR * *
-
-
Method Detail
-
getRowHeight
public double getRowHeight(int row)
Compute the height of a particular row. If the row is inGrid.AUTOFIT
,DEFAULT_CELL_HEIGHT
is returned.- Parameters:
row
-- Returns:
-
getFixedRowHeight
public double getFixedRowHeight()
-
getSelectedRows
public ObservableList<Integer> getSelectedRows()
Contains the index of the sortedList.- Returns:
-
getSelectedColumns
public ObservableList<Integer> getSelectedColumns()
-
getSpreadsheetCellEditorImpl
public GridCellEditor getSpreadsheetCellEditorImpl()
-
getRowIndexed
public GridRow getRowIndexed(int index)
This return the GridRow which has the specified index if found. Otherwise null is returned.- Parameters:
index
-- Returns:
-
getFirstRow
public int getFirstRow(SpreadsheetCell cell, int index)
This return the first index displaying a cell in case of a rowSpan. If the returned index is the same as given, it means the current cell is the one showing. Otherwise, it means another cell above will be the one drawn.- Parameters:
cell
-index
-- Returns:
-
getRow
public GridRow getRow(int index)
This return the row at the specified index in the list. The index specified HAS NOTHING to do with the index of the row.- Parameters:
index
-- Returns:
- See Also:
for a getting a row with its real index.
-
containsRow
public final boolean containsRow(int index)
Indicate whether or not the row at the specified index is currently being displayed.- Parameters:
index
-- Returns:
-
getCellsSize
public int getCellsSize()
-
getHBar
public ScrollBar getHBar()
-
getVBar
public ScrollBar getVBar()
-
resizeRowsToFitContent
public void resizeRowsToFitContent()
Will compute for every row the necessary height and fit the line. This can degrade performance a lot so need to use it wisely. But I don't see other solutions right now.
-
resizeRowToFitContent
public void resizeRowToFitContent(int modelRow)
Will compute for the row the necessary height and fit the line. This can degrade performance a lot so need to use it wisely. But I don't see other solutions right now.- Parameters:
modelRow
-
-
resizeRowsToMaximum
public void resizeRowsToMaximum()
-
resizeRowsToDefault
public void resizeRowsToDefault()
-
resizeColumnToFitContent
public void resizeColumnToFitContent(TableColumn<ObservableList<SpreadsheetCell>,?> tc, int maxRows)
We want to have extra space when displaying LocalDate because they will use an editor that display a little icon on the right. Thus, that icon is reducing the visibility of the date string.
-
init
protected final void init()
* PRIVATE/PROTECTED METHOD * *
-
getBehavior
public GridViewBehavior getBehavior()
-
getCurrentlyFixedRow
protected final ObservableSet<Integer> getCurrentlyFixedRow()
-
getColumns
public ObservableList<TableColumn<ObservableList<SpreadsheetCell>,?>> getColumns()
-
resize
public void resize(TableColumnBase<?,?> tc, int maxRows)
Used in the HorizontalColumnHeader when we need to resize in double click.- Parameters:
tc
-maxRows
-
-
layoutChildren
protected void layoutChildren(double x, double y, double w, double h)
-
onFocusAboveCell
protected void onFocusAboveCell()
-
onFocusBelowCell
protected void onFocusBelowCell()
-
onSelectAboveCell
protected void onSelectAboveCell()
-
onSelectBelowCell
protected void onSelectBelowCell()
-
createVirtualFlow
protected VirtualFlow<TableRow<ObservableList<SpreadsheetCell>>> createVirtualFlow()
- Overrides:
createVirtualFlow
in classVirtualContainerBase<TableView<ObservableList<SpreadsheetCell>>,TableRow<ObservableList<SpreadsheetCell>>>
-
createTableHeaderRow
protected TableHeaderRow createTableHeaderRow()
-
getHorizontalHeader
public HorizontalHeader getHorizontalHeader()
-
scrollHorizontally
public void scrollHorizontally()
-
scrollHorizontally
protected void scrollHorizontally(TableColumn<ObservableList<SpreadsheetCell>,?> col)
-
computeFixedRowHeight
public void computeFixedRowHeight()
We compute the total height of the fixedRows so that the selection can use it without performance regression.
-
getItemCount
public final int getItemCount()
- Specified by:
getItemCount
in classVirtualContainerBase<TableView<ObservableList<SpreadsheetCell>>,TableRow<ObservableList<SpreadsheetCell>>>
-
setHbarValue
public void setHbarValue(double value)
If the scene is not yet instantiated, we need to wait otherwise the VirtualFlow will not shift the cells properly.- Parameters:
value
-
-
setHbarValue
public void setHbarValue(double value, int count)
-
-