Class GTableCellRenderingData


  • public class GTableCellRenderingData
    extends java.lang.Object
    A state object to provide a table cell renderer with data beyond the standard Java TableCellRenderer interface.

    Additional data about the context of a rendering operation -- like the columns' Settings or the row-object -- are easily passed to the renderer without refactor of each client.

    • Constructor Detail

      • GTableCellRenderingData

        public GTableCellRenderingData​(javax.swing.JTable jTable,
                                       int column,
                                       Settings columnSettings)
        Create a data object for a specific column in a table
        Parameters:
        jTable - Reference to the associated JTable
        column - View index of this column
        columnSettings - Settings state provided and used by this column
    • Method Detail

      • copyWithNewValue

        public GTableCellRenderingData copyWithNewValue​(java.lang.Object newValue)
        Create a new data object from this data, changing only the cells' value object.

        This method is a convenience for use by renderers that wish to change the value passed to them.

        Parameters:
        newValue - New cell value object
        Returns:
        A new data object with the same state as this object
      • setRowData

        public void setRowData​(int row,
                               java.lang.Object rowObject)
        Set data specific to a row, as used during the rendering phase
        Parameters:
        row - View row index
        rowObject - Object for which this table row is generated
      • setCellData

        public void setCellData​(java.lang.Object value,
                                int column,
                                boolean isSelected,
                                boolean hasFocus)
        Set data specific to a cell, as used during the rendering phase
        Parameters:
        value - The models' value at row-column
        column - the view column index
        isSelected - True if the cell is to be rendered with the selection highlighted; otherwise false
        hasFocus - This cell has the users' focus
      • getTable

        public javax.swing.JTable getTable()
      • getColumnViewIndex

        public int getColumnViewIndex()
      • getColumnModelIndex

        public int getColumnModelIndex()
      • getColumnSettings

        public Settings getColumnSettings()
      • getRowViewIndex

        public int getRowViewIndex()
      • getRowModelIndex

        public int getRowModelIndex()
      • getValue

        public java.lang.Object getValue()
      • getRowObject

        public java.lang.Object getRowObject()
      • isSelected

        public boolean isSelected()
      • hasFocus

        public boolean hasFocus()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object