Top Fields Constructors Methods
impl.org.controlsfx.spreadsheet

public Class GridRowSkin

extends CellSkinBase<TableRow<ObservableList<SpreadsheetCell>>>
Class Inheritance
Imports
java.lang.ref.Reference, .WeakReference, java.util.ArrayList, .HashMap, .HashSet, .List, .Map, .Set, javafx.collections.ObservableList, javafx.scene.Node, javafx.scene.control.TableColumn, .TableColumnBase, .TableRow, javafx.scene.control.skin.CellSkinBase, org.controlsfx.control.spreadsheet.Grid, .SpreadsheetCell, .SpreadsheetColumn, .SpreadsheetView

Field Summary

Modifier and TypeField and Description
private final List<CellView>
private Reference<HashMap<TableColumnBase<S, T>, CellView>>
private final SpreadsheetHandle
private final SpreadsheetView

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected double
computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

protected double
computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

protected double
computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase.

protected double
computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase.

private CellView
getCell(TableColumnBase<S, T> tcb)

This will retrieve a cell for the specified column.

private HashMap<TableColumnBase<S, T>, CellView>
getCellsMap()

Return the Cache.

private double
getFixedRowShift(int index)

Return the space we need to shift that row if it's fixed.

private double
getTableRowHeight(int row)

Return the height of a row.

private void
handleFixedCell(List<CellView> fixedCells, int index)

This handles the fixed cells in column.

private boolean
private boolean
private boolean
isInvisible(double
beginning of the cell
x
,
double
total width of the cell
width
,
double hbarValue, double
width of the visible portion of the tableView
headerWidth
,
int columnSpan)

Return true if the current cell is part of the sceneGraph.

protected void
layoutChildren(double x, final double y, final double w, final double h)

Overrides javafx.scene.control.skin.LabeledSkinBase.layoutChildren.

The Layout algorithm works like this: - Get the labeled w/h, graphic w/h, text w/h - Compute content w/h based on graphicVPos, graphicHPos, graphicTextGap, and graphic w/h and text w/h - (Note that the text content has been pre-truncated where necessary) - compute content x/y based on content w/h and labeled w/h and the labeled's hpos and vpos - position the graphic and text

private void
putCellsInCache()

This will put all current displayed cell into the cache.

private void
private void
removeUselessCell(int index)

Here we want to remove of the sceneGraph cells that are not used.

private void
requestCellUpdate()

/ fixedCellSize = fixedCellSizeProperty().get(); / fixedCellSizeEnabled = fixedCellSize > 0;

Inherited from javafx.scene.control.skin.CellSkinBase:
cellSizePropertygetCellSizegetClassCssMetaDatagetCssMetaData

Field Detail

cellsback to summary
private final List<CellView> cells
cellsMapback to summary
private Reference<HashMap<TableColumnBase<S, T>, CellView>> cellsMap
handleback to summary
private final SpreadsheetHandle handle
spreadsheetViewback to summary
private final SpreadsheetView spreadsheetView

Constructor Detail

GridRowSkinback to summary
public GridRowSkin(SpreadsheetHandle handle, TableRow<ObservableList<SpreadsheetCell>> gridRow)

Method Detail

computeMaxHeightback to summary
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computeMaxHeight.

Doc from javafx.scene.control.skin.LabeledSkinBase.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

Annotations
@Override
computeMinHeightback to summary
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computeMinHeight.

Doc from javafx.scene.control.skin.LabeledSkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

Annotations
@Override
computePrefHeightback to summary
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computePrefHeight.

Doc from javafx.scene.control.skin.LabeledSkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase. The default implementation calculates this height as the height of the area occupied by its managed children when they are positioned at their current positions at their preferred heights.

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.LabeledSkinBase.computePrefWidth.

Doc from javafx.scene.control.skin.LabeledSkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase. The default implementation calculates this width as the width of the area occupied by its managed children when they are positioned at their current positions at their preferred widths.

Annotations
@Override
getCellback to summary
private CellView getCell(TableColumnBase<S, T> tcb)

This will retrieve a cell for the specified column. If the cell exists in the cache, it's extracted from it. Otherwise, a cell is created.

getCellsMapback to summary
private HashMap<TableColumnBase<S, T>, CellView> getCellsMap()

Return the Cache. Here we use a WeakReference because the WeakHashMap is not working. TableCell added to it are not removed if the GC wants them. So we put the whole cache in WeakReference. In normal condition, the cache is not trashed that much and is efficient. In the case where the user scroll horizontally a lot, that cache can then be trashed in order to avoid OutOfMemoryError.

getFixedRowShiftback to summary
private double getFixedRowShift(int index)

Return the space we need to shift that row if it's fixed. Also update the GridViewSkin#getCurrentlyFixedRow() .

getTableRowHeightback to summary
private double getTableRowHeight(int row)

Return the height of a row.

handleFixedCellback to summary
private void handleFixedCell(List<CellView> fixedCells, int index)

This handles the fixed cells in column.

hasLeftBorderback to summary
private boolean hasLeftBorder(CellView tableCell)
hasRightBorderback to summary
private boolean hasRightBorder(CellView tableCell)
isInvisibleback to summary
private boolean isInvisible(double x, double width, double hbarValue, double headerWidth, int columnSpan)

Return true if the current cell is part of the sceneGraph.

Parameters
x:double

beginning of the cell

width:double

total width of the cell

headerWidth:double

width of the visible portion of the tableView

layoutChildrenback to summary
protected void layoutChildren(double x, final double y, final double w, final double h)

Overrides javafx.scene.control.skin.LabeledSkinBase.layoutChildren.

Doc from javafx.scene.control.skin.LabeledSkinBase.layoutChildren.

The Layout algorithm works like this: - Get the labeled w/h, graphic w/h, text w/h - Compute content w/h based on graphicVPos, graphicHPos, graphicTextGap, and graphic w/h and text w/h - (Note that the text content has been pre-truncated where necessary) - compute content x/y based on content w/h and labeled w/h and the labeled's hpos and vpos - position the graphic and text

Annotations
@Override
putCellsInCacheback to summary
private void putCellsInCache()

This will put all current displayed cell into the cache.

removeDeportedCellsback to summary
private void removeDeportedCells()
removeUselessCellback to summary
private void removeUselessCell(int index)

Here we want to remove of the sceneGraph cells that are not used. Before we were removing the cells that we were getting from the cache. But that is not enough because some cells can be added somehow, and stay within the row. Since we do not often clear the children because of some deportedCell present inside, we must use that Predicate to clear all CellView not contained in cells and with the same index. Thus we preserve the deported cell.

requestCellUpdateback to summary
private void requestCellUpdate()

/ fixedCellSize = fixedCellSizeProperty().get(); / fixedCellSizeEnabled = fixedCellSize > 0;