Class PanelBasedTreeCellRenderer

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.client.util.gui.tree.PanelBasedTreeCellRenderer
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ListCellRenderer, TreeCellRenderer
Direct Known Subclasses:
BeanCellRenderer, DBBrowseTree.TreeRenderer, NamedQueryBrowseTree.TreeRenderer, TableBrowseTree.TreeRenderer, com.inductiveautomation.ignition.designer.tags.tree.TagRenderer

public class PanelBasedTreeCellRenderer extends JPanel implements TreeCellRenderer, ListCellRenderer
See Also:
  • Field Details

    • selected

      protected boolean selected
      Is the value currently selected.
    • hasFocus

      protected boolean hasFocus
      True if has focus.
    • textSelectionColor

      protected Color textSelectionColor
      Color to use for the foreground for selected nodes.
    • textNonSelectionColor

      protected Color textNonSelectionColor
      Color to use for the foreground for non-selected nodes.
    • backgroundSelectionColor

      protected Color backgroundSelectionColor
      Color to use for the background when a node is selected.
    • backgroundNonSelectionColor

      protected Color backgroundNonSelectionColor
      Color to use for the background when the node isn't selected.
    • borderSelectionColor

      protected Color borderSelectionColor
      Color to use for the focus indicator when the node has focus.
    • label

      protected JLabel label
    • iconCount

      protected int iconCount
    • subTextIndex

      protected int subTextIndex
  • Constructor Details

    • PanelBasedTreeCellRenderer

      public PanelBasedTreeCellRenderer()
  • Method Details

    • paintBackground

      protected boolean paintBackground()
    • addIcon

      protected void addIcon(Icon icon)
    • addIcon

      protected void addIcon(Icon icon, String tooltip)
    • addSubText

      protected void addSubText(JLabel subText)
    • removeSubText

      protected void removeSubText()
    • removeAllIcons

      protected void removeAllIcons()
    • getToolTipText

      public String getToolTipText(MouseEvent event)
      Overridden to provide the tooltip text for the sub component in this JPanel under the given mouse event
      Overrides:
      getToolTipText in class JComponent
    • getTreeCellRendererComponent

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
      Specified by:
      getTreeCellRendererComponent in interface TreeCellRenderer
    • getListCellRendererComponent

      public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
      Specified by:
      getListCellRendererComponent in interface ListCellRenderer
    • valueToText

      protected String valueToText(Object value)
    • paint

      public void paint(Graphics g)
      Paints the value. The background is filled based on selected.
      Overrides:
      paint in class JComponent
    • getBackgroundNonSelectionColor

      public Color getBackgroundNonSelectionColor()
      Returns:
      Returns the backgroundNonSelectionColor.
    • setBackgroundNonSelectionColor

      public void setBackgroundNonSelectionColor(Color backgroundNonSelectionColor)
      Parameters:
      backgroundNonSelectionColor - The backgroundNonSelectionColor to set.
    • getBackgroundSelectionColor

      public Color getBackgroundSelectionColor()
      Returns:
      Returns the backgroundSelectionColor.
    • setBackgroundSelectionColor

      public void setBackgroundSelectionColor(Color backgroundSelectionColor)
      Parameters:
      backgroundSelectionColor - The backgroundSelectionColor to set.
    • getBorderSelectionColor

      public Color getBorderSelectionColor()
      Returns:
      Returns the borderSelectionColor.
    • setBorderSelectionColor

      public void setBorderSelectionColor(Color borderSelectionColor)
      Parameters:
      borderSelectionColor - The borderSelectionColor to set.
    • isDrawsFocusBorderAroundIcon

      public boolean isDrawsFocusBorderAroundIcon()
      Returns:
      Returns the drawsFocusBorderAroundIcon.
    • setDrawsFocusBorderAroundIcon

      public void setDrawsFocusBorderAroundIcon(boolean drawsFocusBorderAroundIcon)
      Parameters:
      drawsFocusBorderAroundIcon - The drawsFocusBorderAroundIcon to set.
    • getTextNonSelectionColor

      public Color getTextNonSelectionColor()
      Returns:
      Returns the textNonSelectionColor.
    • setTextNonSelectionColor

      public void setTextNonSelectionColor(Color textNonSelectionColor)
      Parameters:
      textNonSelectionColor - The textNonSelectionColor to set.
    • getTextSelectionColor

      public Color getTextSelectionColor()
      Returns:
      Returns the textSelectionColor.
    • setTextSelectionColor

      public void setTextSelectionColor(Color textSelectionColor)
      Parameters:
      textSelectionColor - The textSelectionColor to set.
    • getIcon

      public Icon getIcon()
    • getText

      public String getText()
    • setIcon

      public void setIcon(Icon icon)
    • setText

      public void setText(String text)
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • setToolTipText

      public void setToolTipText(String text)
      Overrides:
      setToolTipText in class JComponent