Module org.controlsfx.controls
Interface CellGraphicFactory<T extends Node>
-
public interface CellGraphicFactory<T extends Node>
If anyone wants to display a specific Graphic in a SpreadsheetCell, a solution is to provide a Node (for example a WebView) that will be displayed in the cell. Because a Node can consume a lot of memory, we need thisCellGraphicFactory
that will recycle the Nodes to only provide them for visible cells.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Node
getNode(SpreadsheetCell cell)
Returns aNode
to display in the cell graphic.Class
getType()
Returns the exact class used in this CellGraphicFactory.void
load(T node, SpreadsheetCell cell)
When aNode
is reused (transfered from one cell to another for example), we ask the Node to reload.void
loadStyle(T node, SpreadsheetCell cell, Font font, Paint textFill, Pos alignment, Background background)
Once aSpreadsheetCell
has been effectively loaded in the grid, this method is called if theNode
wants to access the cell's graphic details.void
setUnusedNode(T node)
Once aNode
is no longer used in a cell, it is given back.
-
-
-
Method Detail
-
getNode
Node getNode(SpreadsheetCell cell)
Returns aNode
to display in the cell graphic. This is called internally by the SpreadsheetView when a cell is being visible and needs to display aNode
.- Parameters:
cell
- the considered SpreadsheetCell- Returns:
- a
Node
to display in the cell graphic
-
load
void load(T node, SpreadsheetCell cell)
When aNode
is reused (transfered from one cell to another for example), we ask the Node to reload. Beware, only reload when necessary! This method can be called several times with the sameNode
and itemValue.- Parameters:
node
- the consideredNode
cell
- the considered SpreadsheetCell
-
loadStyle
void loadStyle(T node, SpreadsheetCell cell, Font font, Paint textFill, Pos alignment, Background background)
Once aSpreadsheetCell
has been effectively loaded in the grid, this method is called if theNode
wants to access the cell's graphic details.- Parameters:
node
- the consideredNode
, may benull
for empty cell.cell
- the considered SpreadsheetCellfont
- the cellFont
textFill
- the text's coloralignment
- the cell's vertical and horizontal alignmentbackground
- the cell's background
-
setUnusedNode
void setUnusedNode(T node)
Once aNode
is no longer used in a cell, it is given back.- Parameters:
node
- theNode
-
getType
Class getType()
Returns the exact class used in this CellGraphicFactory. It is used to determine if the cell's graphic is handled by the cell of by this interface.- Returns:
- the exact class used in this CellGraphicFactory
-
-