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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color
Color to use for the background when the node isn't selected.protected Color
Color to use for the background when a node is selected.protected Color
Color to use for the focus indicator when the node has focus.protected boolean
True if has focus.protected int
protected JLabel
protected boolean
Is the value currently selected.protected int
protected Color
Color to use for the foreground for non-selected nodes.protected Color
Color to use for the foreground for selected nodes.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
addSubText
(JLabel subText) getIcon()
getListCellRendererComponent
(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) getText()
getToolTipText
(MouseEvent event) Overridden to provide the tooltip text for the sub component in this JPanel under the given mouse eventgetTreeCellRendererComponent
(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) boolean
void
Paints the value.protected boolean
protected void
protected void
void
setBackgroundNonSelectionColor
(Color backgroundNonSelectionColor) void
setBackgroundSelectionColor
(Color backgroundSelectionColor) void
setBorderSelectionColor
(Color borderSelectionColor) void
setDrawsFocusBorderAroundIcon
(boolean drawsFocusBorderAroundIcon) void
void
void
void
setTextNonSelectionColor
(Color textNonSelectionColor) void
setTextSelectionColor
(Color textSelectionColor) void
setToolTipText
(String text) protected String
valueToText
(Object value) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
selected
protected boolean selectedIs the value currently selected. -
hasFocus
protected boolean hasFocusTrue if has focus. -
textSelectionColor
Color to use for the foreground for selected nodes. -
textNonSelectionColor
Color to use for the foreground for non-selected nodes. -
backgroundSelectionColor
Color to use for the background when a node is selected. -
backgroundNonSelectionColor
Color to use for the background when the node isn't selected. -
borderSelectionColor
Color to use for the focus indicator when the node has focus. -
label
-
iconCount
protected int iconCount -
subTextIndex
protected int subTextIndex
-
-
Constructor Details
-
PanelBasedTreeCellRenderer
public PanelBasedTreeCellRenderer()
-
-
Method Details
-
paintBackground
protected boolean paintBackground() -
addIcon
-
addIcon
-
addSubText
-
removeSubText
protected void removeSubText() -
removeAllIcons
protected void removeAllIcons() -
getToolTipText
Overridden to provide the tooltip text for the sub component in this JPanel under the given mouse event- Overrides:
getToolTipText
in classJComponent
-
getTreeCellRendererComponent
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) - Specified by:
getTreeCellRendererComponent
in interfaceTreeCellRenderer
-
getListCellRendererComponent
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) - Specified by:
getListCellRendererComponent
in interfaceListCellRenderer
-
valueToText
-
paint
Paints the value. The background is filled based on selected.- Overrides:
paint
in classJComponent
-
getBackgroundNonSelectionColor
- Returns:
- Returns the backgroundNonSelectionColor.
-
setBackgroundNonSelectionColor
- Parameters:
backgroundNonSelectionColor
- The backgroundNonSelectionColor to set.
-
getBackgroundSelectionColor
- Returns:
- Returns the backgroundSelectionColor.
-
setBackgroundSelectionColor
- Parameters:
backgroundSelectionColor
- The backgroundSelectionColor to set.
-
getBorderSelectionColor
- Returns:
- Returns the borderSelectionColor.
-
setBorderSelectionColor
- 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
- Returns:
- Returns the textNonSelectionColor.
-
setTextNonSelectionColor
- Parameters:
textNonSelectionColor
- The textNonSelectionColor to set.
-
getTextSelectionColor
- Returns:
- Returns the textSelectionColor.
-
setTextSelectionColor
- Parameters:
textSelectionColor
- The textSelectionColor to set.
-
getIcon
-
getText
-
setIcon
-
setText
-
setFont
- Overrides:
setFont
in classJComponent
-
setToolTipText
- Overrides:
setToolTipText
in classJComponent
-