Class CellRendererStateSupport

java.lang.Object
com.inductiveautomation.ignition.designer.gui.cellrenderer.CellRendererStateSupport

public final class CellRendererStateSupport extends Object

When creating a cell renderer that has more than one component to manage state of (such as a JLabel for the icon, and a JTextArea for the text), this class can be used to coordinate the cell states so that all the components are in sync: the correct background and foreground for the selected state, eg.

Handles the following renderer state of cells:

  • Selected/Not Selected
  • Enabled/Disabled
  • Focused (see constructor for which components gets the focused border)

The following properties will be set for components supported by this class:

  • Background
  • Foreground

If the passed component is a JLabel and the label has a CellRendererIcon

set, then this class will manage the icon state of the label.

For labels with no icons set in the initial state (the icon for these JLabels are null), use the builder's addToIcons(JLabel).

  • Method Details

    • update

      public void update(boolean isSelected, boolean isEnabled, boolean hasFocus)
    • update

      public void update(boolean isSelected, boolean isEnabled, boolean hasFocus, List<CellRendererStateSupport.CellRendererStateComponent> components)
      Update the states of components in terms of background, foreground, and icon states. Use addToIcons(JLabel) to add components for which you wish the icon states to also be affected by the selected, or enabled state.
    • getDisabledForeground

      public Color getDisabledForeground()
    • getDisabledBackground

      public Color getDisabledBackground()
    • getSelectedForeground

      public Color getSelectedForeground()
    • getSelectedBackground

      public Color getSelectedBackground()
    • getUnselectedForeground

      public Color getUnselectedForeground()
    • getUnselectedBackground

      public Color getUnselectedBackground()
    • builder

      public static CellRendererStateSupport.Builder builder()
    • builder

      public static CellRendererStateSupport.Builder builder(JComponent... components)
      Parameters:
      components -

      List of components for which the component states is to be managed by this class. If the component in the list is a JLabel and that label contains CellRendererIcon, the icon state will be managed by this class.

      The first component in the list will serve as the component for which the focus border will be drawn.