Class ColumnRenderer

All Implemented Interfaces:
AutoResizableTableCellRenderer, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, TableCellRenderer
Direct Known Subclasses:
ArrayRenderer, DBColumnRenderer, LogLevelColumnRenderer, PersistentQueryStatusColumnRenderer

public class ColumnRenderer extends GenericColumnRenderer
A GenericColumnRenderer that prioritizes properties (foreground, background, font, etc) specified by the GuiColumn. It is also contextually aware of other row states (such as staleness).
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getBackground

      public Color getBackground(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      Get the background color for the current cell. If the GuiColumn specified a background and the row is not selected it will use the GuiColumn's color. Otherwise it will use the colors specified by the UIDefaults. If the model indicates that the cell is stale, it will wash the color.
      Overrides:
      getBackground in class GenericColumnRenderer
      Parameters:
      table - The table being rendered.
      value - The value to render.
      isSelected - If this cell is selected.
      hasFocus - If this cell has focus.
      row - The current row number.
      column - The current column index.
      Returns:
      A Color to use for this cell's background.
      See Also:
    • getForeground

      protected Color getForeground(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      Get the foreground color for the current cell. If the GuiColumn specified a foreground use that, unless the value is null. If the model indicates that the cell is stale it will wash the color.
      Overrides:
      getForeground in class GenericColumnRenderer
      Parameters:
      table - The table being rendered.
      value - The value being rendered.
      isSelected - If the cell is selected.
      hasFocus - If the cell has focus.
      row - The current row number.
      column - The current column index.
      Returns:
      A Color to use for this cell's foreground.
      See Also:
    • getHorizontalAlignment

      protected int getHorizontalAlignment(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      Get the horizontal alignment for the cell. If specified by the GuiColumn it will use that value. otherwise it will Right align numbers, and left align everything else.
      Overrides:
      getHorizontalAlignment in class GenericColumnRenderer
      Parameters:
      table - The table being rendered.
      value - The value being rendered.
      isSelected - If the cell is selected.
      hasFocus - If the cell has focus.
      row - The current row number.
      column - The current column index.
      Returns:
      The cell's horizontal alignment.
      ImplNote:
      This method does _not_ invoke super.
    • getFont

      protected Font getFont(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      Get the font for the cell. If specified by the GuiColumn that will be used. Otherwise it will delegate to GenericColumnRenderer.getFont(JTable, Object, boolean, boolean, int, int)
      Overrides:
      getFont in class GenericColumnRenderer
      Parameters:
      table - The table being rendered.
      value - The value being rendered.
      isSelected - If the cell is selected.
      hasFocus - If the cell has focus.
      row - The current row number.
      column - The current column index.
      Returns:
      The font to use.
    • getText

      protected String getText(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      Get the text for this cell. This uses the Format from the GuiColumn. Arrays will formatted using ArrayFormatter
      Overrides:
      getText in class GenericColumnRenderer
      Parameters:
      table - The table being rendered.
      value - The value being rendered.
      isSelected - If the cell is selected.
      hasFocus - If the cell has focus.
      row - The current row number.
      column - The current column index.
      Returns:
      The String to render
      ImplNote:
      This does not invoke super except in case of formatting error.
    • shouldApplyNumberFormatting

      protected boolean shouldApplyNumberFormatting(Object value)
      Overrides:
      shouldApplyNumberFormatting in class GenericColumnRenderer