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 this CellGraphicFactory that will recycle the Nodes to only provide them for visible cells.
    • Method Detail

      • getNode

        Node getNode​(SpreadsheetCell cell)
        Returns a Node to display in the cell graphic. This is called internally by the SpreadsheetView when a cell is being visible and needs to display a Node.
        cell - the considered SpreadsheetCell
        a Node to display in the cell graphic
      • load

        void load​(T node,
                  SpreadsheetCell cell)
        When a Node 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 same Node and itemValue.
        node - the considered Node
        cell - the considered SpreadsheetCell
      • loadStyle

        void loadStyle​(T node,
                       SpreadsheetCell cell,
                       Font font,
                       Paint textFill,
                       Pos alignment,
                       Background background)
        Once a SpreadsheetCell has been effectively loaded in the grid, this method is called if the Node wants to access the cell's graphic details.
        node - the considered Node, may be null for empty cell.
        cell - the considered SpreadsheetCell
        font - the cell Font
        textFill - the text's color
        alignment - the cell's vertical and horizontal alignment
        background - the cell's background
      • setUnusedNode

        void setUnusedNode​(T node)
        Once a Node is no longer used in a cell, it is given back.
        node - the Node
      • 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.
        the exact class used in this CellGraphicFactory