com.isti.util.gui
Class SymbolIconCellRenderer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLabel
                  extended by javax.swing.DefaultListCellRenderer
                      extended by com.isti.util.gui.SymbolIconCellRenderer
All Implemented Interfaces:
SymbolConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.ListCellRenderer, javax.swing.SwingConstants

public class SymbolIconCellRenderer
extends javax.swing.DefaultListCellRenderer
implements SymbolConstants

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.DefaultListCellRenderer
javax.swing.DefaultListCellRenderer.UIResource
 
Nested classes/interfaces inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static java.lang.String DEFAULT_SPACER_STRING
          define spacer string to leave blank space where symbol will go
 
Fields inherited from class javax.swing.DefaultListCellRenderer
noFocusBorder
 
Fields inherited from class javax.swing.JLabel
labelFor
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.isti.util.gui.SymbolConstants
CIRCLE_SYMBOL_OBJECT, RECTANGLE_SYMBOL_OBJECT, TRIANGLE_SYMBOL_OBJECT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SymbolIconCellRenderer()
          Creates a renderer with a symbol icon.
 
Method Summary
 void clearSymbolChar()
          Clears any character symbol in use, making a circle symbol be used instead.
 int getIconHeight()
          Returns the icon's height.
 int getIconWidth()
          Returns the icon's width.
 java.lang.String getLabelText()
          Get the label text.
protected  java.lang.String getLabelText(java.lang.Object value)
          Get the label text for the value.
 java.awt.Component getListCellRendererComponent(javax.swing.JList list, java.lang.Object value, int index, boolean isSelected, boolean cellHasFocus)
          Return a component that has been configured to display the specified value.
 java.lang.String getSpacerString()
          Gets the spacer string used to create space for the symbol.
protected  java.lang.String getText(java.lang.String labelText)
          Get the text for the specified label text.
 boolean isCharSymbol()
          Gets a flag indicating whether or not a character symbol is in use.
 void setBoldFlag(boolean flgVal)
          Sets whether or not the the character symbol is displayed using a bold font.
 java.awt.Color setColorObj(java.awt.Color colorObj)
          Sets the color for the symbol.
 java.awt.Color setColorObj(int colorRGB)
          Sets the color for the symbol.
 void setFillFlag(boolean flgVal)
          Sets whether or not the the object symbol is filled.
 void setIcon(javax.swing.Icon icon)
          Set the icon.
 void setIcon(SymbolIcon icon)
          Set the icon.
 void setLabelText(java.lang.String labelText)
          Set the label text.
 void setOutlineColorObj(java.awt.Color colorObj)
          Sets the outline color to be used for filled symbols.
 void setSpacerString(java.lang.String str)
          Sets the spacer string used to create space for the symbol.
 void setSymbolChar(char symbolChar)
          Sets the character symbol to be used.
 void setSymbolObject(int symbolObj)
          Sets the object symbol to be used.
 java.lang.String toString()
          Return the label text.
protected  void updateLabelText(java.lang.String labelText)
          Update the label text.
protected  void updateText()
          Update the text.
 
Methods inherited from class javax.swing.DefaultListCellRenderer
firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, invalidate, isOpaque, repaint, repaint, repaint, revalidate, validate
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, 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, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SPACER_STRING

protected static final java.lang.String DEFAULT_SPACER_STRING
define spacer string to leave blank space where symbol will go

See Also:
Constant Field Values
Constructor Detail

SymbolIconCellRenderer

public SymbolIconCellRenderer()
Creates a renderer with a symbol icon.

Method Detail

clearSymbolChar

public void clearSymbolChar()
Clears any character symbol in use, making a circle symbol be used instead.


getIconHeight

public int getIconHeight()
Returns the icon's height.

Returns:
an int specifying the fixed height of the icon.

getIconWidth

public int getIconWidth()
Returns the icon's width.

Returns:
an int specifying the fixed width of the icon.

getLabelText

public java.lang.String getLabelText()
Get the label text.

Returns:
the label text.

getLabelText

protected java.lang.String getLabelText(java.lang.Object value)
Get the label text for the value.

Parameters:
value - the value.
Returns:
the label text for the value.

getListCellRendererComponent

public java.awt.Component getListCellRendererComponent(javax.swing.JList list,
                                                       java.lang.Object value,
                                                       int index,
                                                       boolean isSelected,
                                                       boolean cellHasFocus)
Return a component that has been configured to display the specified value. That component's paint method is then called to "render" the cell. If it is necessary to compute the dimensions of a list because the list cells do not have a fixed size, this method is called to generate a component on which getPreferredSize can be invoked.

Specified by:
getListCellRendererComponent in interface javax.swing.ListCellRenderer
Overrides:
getListCellRendererComponent in class javax.swing.DefaultListCellRenderer
Parameters:
list - The JList we're painting.
value - The value returned by list.getModel().getElementAt(index).
index - The cells index.
isSelected - True if the specified cell was selected.
cellHasFocus - True if the specified cell has the focus.
Returns:
A component whose paint() method will render the specified value.

getSpacerString

public java.lang.String getSpacerString()
Gets the spacer string used to create space for the symbol.

Returns:
the spacer string used to create space for the symbol.

getText

protected java.lang.String getText(java.lang.String labelText)
Get the text for the specified label text.

Parameters:
labelText - the label text.
Returns:
the text.

isCharSymbol

public boolean isCharSymbol()
Gets a flag indicating whether or not a character symbol is in use.

Returns:
true if a character symbol is in use, false if a object symbol is in use.

setBoldFlag

public void setBoldFlag(boolean flgVal)
Sets whether or not the the character symbol is displayed using a bold font.

Parameters:
flgVal - true for bold, false for normal font.

setColorObj

public java.awt.Color setColorObj(java.awt.Color colorObj)
Sets the color for the symbol.

Parameters:
colorObj - the color to use.
Returns:
the color.

setColorObj

public java.awt.Color setColorObj(int colorRGB)
Sets the color for the symbol.

Parameters:
colorRGB - the color RGB to use.
Returns:
the color.

setFillFlag

public void setFillFlag(boolean flgVal)
Sets whether or not the the object symbol is filled.

Parameters:
flgVal - true if the object is to be filled; false if not.

setIcon

public void setIcon(javax.swing.Icon icon)
Set the icon.

Overrides:
setIcon in class javax.swing.JLabel
Parameters:
icon - the icon (ignored if not SymbolIcon.)

setIcon

public void setIcon(SymbolIcon icon)
Set the icon.

Parameters:
icon - the icon (ignored if null.)

setLabelText

public void setLabelText(java.lang.String labelText)
Set the label text.

Parameters:
labelText - the label text.

setOutlineColorObj

public void setOutlineColorObj(java.awt.Color colorObj)
Sets the outline color to be used for filled symbols.

Parameters:
colorObj - the color for the symbol outline, or null for no outline.

setSpacerString

public void setSpacerString(java.lang.String str)
Sets the spacer string used to create space for the symbol.

Parameters:
str - a string blanks for spacing.

setSymbolChar

public void setSymbolChar(char symbolChar)
Sets the character symbol to be used.

Parameters:
symbolChar - the character symbol to use, or '(char)0' to have no character symbol (and use circle symbol instead).

setSymbolObject

public void setSymbolObject(int symbolObj)
Sets the object symbol to be used.

Parameters:
symbolObj - the object symbol to use.

toString

public java.lang.String toString()
Return the label text.

Overrides:
toString in class java.awt.Component
Returns:
the label text.

updateLabelText

protected void updateLabelText(java.lang.String labelText)
Update the label text.

Parameters:
labelText - the label text.

updateText

protected void updateText()
Update the text.