Class AbstractGCellRenderer

All Implemented Interfaces:
GComponent, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, SwingConstants
Direct Known Subclasses:
GListCellRenderer, GTableCellRenderer

public abstract class AbstractGCellRenderer extends GDHtmlLabel
A common base class for list and table renderer objects, unifying the Ghidra look and feel.

It allows (but default-disables) HTML content, automatically paints alternating row background colors, and highlights the drop target in a drag-n-drop operation.

See Also:
  • Field Details

    • systemAlternateRowColors

      protected static boolean systemAlternateRowColors
    • focusBorder

      protected final Border focusBorder
    • noFocusBorder

      protected final Border noFocusBorder
    • defaultFont

      protected Font defaultFont
    • fixedWidthFont

      protected Font fixedWidthFont
    • boldFont

      protected Font boldFont
    • dropRow

      protected int dropRow
  • Constructor Details

    • AbstractGCellRenderer

      public AbstractGCellRenderer()
  • Method Details

    • setShouldAlternateRowBackgroundColors

      public void setShouldAlternateRowBackgroundColors(boolean alternate)
    • shouldAlternateRowBackgroundColor

      public boolean shouldAlternateRowBackgroundColor()
      Return whether or not the renderer should alternate row background colors.

      A renderer is unable to override an enforcing DISABLE_ALTERNATING_ROW_COLORS_PROPERTY system property -- if the property has disabled alternating colors (i.e., set to 'true'), this method returns false. If the property is false, individual renderers may assert control over alternating row colors.

      Returns:
      True if the rows may be painted in alternate background colors, false otherwise
      See Also:
      • DISABLE_ALTERNATING_ROW_COLORS_PROPERTY
    • getAlternatingBackgroundColor

      protected Color getAlternatingBackgroundColor(JComponent parent, int row)
      Returns the background color appropriate for the given component. This may vary depending upon the current OS.
      Parameters:
      parent - The parent being rendered -- likely a list or table.
      row - The row being rendered.
      Returns:
      the color
    • setFont

      public void setFont(Font f)
      Overrides:
      setFont in class JComponent
    • superSetFont

      protected void superSetFont(Font font)
    • setBold

      protected void setBold()
    • setDropRow

      public void setDropRow(int dropRow)
      Sets the row where DnD would perform drop operation.
      Parameters:
      dropRow - the drop row
    • getNoFocusBorder

      protected Border getNoFocusBorder()
    • getDefaultFont

      protected Font getDefaultFont()
    • getFixedWidthFont

      public Font getFixedWidthFont()
    • getBoldFont

      public Font getBoldFont()
    • getDefaultBackgroundColor

      protected Color getDefaultBackgroundColor()
    • getBackgroundColorForRow

      protected Color getBackgroundColorForRow(int row)
    • getErrorForegroundColor

      protected Color getErrorForegroundColor(boolean isSelected)
    • getUneditableForegroundColor

      protected Color getUneditableForegroundColor(boolean isSelected)
    • invalidate

      public void invalidate()
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      invalidate in class Container
    • superValidate

      protected void superValidate()
    • validate

      public void validate()
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      validate in class Container
    • revalidate

      public void revalidate()
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      revalidate in class JComponent
    • repaint

      public void repaint(long tm, int x, int y, int width, int height)
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      repaint in class JComponent
    • repaint

      public void repaint(Rectangle r)
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      repaint in class JComponent
    • repaint

      public void repaint()
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      repaint in class Component
    • firePropertyChange

      protected void firePropertyChange(String property, Object oldValue, Object newValue)
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      firePropertyChange in class Component
    • firePropertyChange

      public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
      See DefaultTableCellRenderer class header javadoc for more info.
      Overrides:
      firePropertyChange in class JComponent
    • setForeground

      public void setForeground(Color fg)
      Overrides this method to ensure that the new foreground color is not a GColorUIResource. Some Look and Feels will ignore color values that extend UIResource, choosing instead their own custom painting behavior. By not using a UIResource, we prevent the Look and Feel from overriding this renderer's color value.
      Overrides:
      setForeground in class JComponent
      Parameters:
      fg - the new foreground color
    • setBackground

      public void setBackground(Color bg)
      Overrides this method to ensure that the new background color is not a GColorUIResource. Some Look and Feels will ignore color values that extend UIResource, choosing instead their own custom painting behavior. By not using a UIResource, we prevent the Look and Feel from overriding this renderer's color value.
      Overrides:
      setBackground in class JComponent
      Parameters:
      bg - the new background color