byucc.jhdl.apps.Viewers.NewTreeBrowser
Class TreeBrowserCellRenderer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JLabel
                  extended byjavax.swing.tree.DefaultTreeCellRenderer
                      extended bybyucc.jhdl.apps.Viewers.NewTreeBrowser.TreeBrowserCellRenderer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants, javax.swing.tree.TreeCellRenderer

public class TreeBrowserCellRenderer
extends javax.swing.tree.DefaultTreeCellRenderer

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 java.awt.image.BufferedImage _clBuf
           
 javax.swing.ImageIcon[] _clImage
           
 java.awt.image.BufferedImage _memBuf
           
 javax.swing.ImageIcon[] _memImage
           
 java.awt.image.BufferedImage _structBuf
           
 javax.swing.ImageIcon[] _structImage
           
 java.awt.image.BufferedImage _tbBuf
           
 javax.swing.ImageIcon _tbImage
           
static java.awt.Color BACKGROUND_COLOR
           
static java.lang.String CL_ICON_FILE
          Source image for a combinational logic icon.
static java.awt.Color DEFAULT_BACKGROUND_COLOR
           
static java.awt.Font DEFAULT_FONT
           
static java.awt.Color FOREGROUND_COLOR
          The color for printing names of cells that are being power-logged.
static boolean HIGHLIGHT_LEAFS
           
static java.lang.String MEM_ICON_FILE
          Source image for a memory cell icon.
static java.awt.Color SELECTION_COLOR
           
static java.lang.String STRUCT_ICON_FILE
          Source image for a structural cell icon.
static java.lang.String TB_ICON_FILE
          Source image for a test bench cell icon.
static boolean VIEW_FULL_NAME
           
 
Fields inherited from class javax.swing.tree.DefaultTreeCellRenderer
backgroundNonSelectionColor, backgroundSelectionColor, borderSelectionColor, closedIcon, hasFocus, leafIcon, openIcon, selected, textNonSelectionColor, textSelectionColor
 
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 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
TreeBrowserCellRenderer()
           
 
Method Summary
static int colorRedToBlue(int i, int steps)
          Simply utility for computing RGB values for a blue-to-red gradient.
static int colorRedToWhite(int i, int steps)
          Simply utility for computing RGB values for a white-to-red gradient.
static java.awt.image.BufferedImage getBufferedImageAsResourceStream(java.lang.Class cls, java.lang.String file)
          Utility for loading an image from the classpath, rather from an absolute filepath.
 java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
          Returns a Component for rendering the tree node for the given object.
 java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus, boolean overRide)
          Returns a Component for rendering the tree node for the given object.
static java.awt.image.BufferedImage renderColorDerivative(java.awt.image.BufferedImage base_image, int original_fill, int replacement)
          Creates a series of icons based on a source image, with varying colorings.
static java.awt.image.BufferedImage[] renderColorDerivatives(java.awt.image.BufferedImage base_image, int original_fill, int steps)
          Creates a series of icons based on a source image, with varying colorings.
 
Methods inherited from class javax.swing.tree.DefaultTreeCellRenderer
firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundNonSelectionColor, getBackgroundSelectionColor, getBorderSelectionColor, getClosedIcon, getDefaultClosedIcon, getDefaultLeafIcon, getDefaultOpenIcon, getFont, getLeafIcon, getOpenIcon, getPreferredSize, getTextNonSelectionColor, getTextSelectionColor, paint, repaint, repaint, revalidate, setBackground, setBackgroundNonSelectionColor, setBackgroundSelectionColor, setBorderSelectionColor, setClosedIcon, setFont, setLeafIcon, setOpenIcon, setTextNonSelectionColor, setTextSelectionColor, 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, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CL_ICON_FILE

public static final java.lang.String CL_ICON_FILE
Source image for a combinational logic icon.

See Also:
Constant Field Values

TB_ICON_FILE

public static final java.lang.String TB_ICON_FILE
Source image for a test bench cell icon.

See Also:
Constant Field Values

STRUCT_ICON_FILE

public static final java.lang.String STRUCT_ICON_FILE
Source image for a structural cell icon.

See Also:
Constant Field Values

MEM_ICON_FILE

public static final java.lang.String MEM_ICON_FILE
Source image for a memory cell icon.

See Also:
Constant Field Values

_clImage

public javax.swing.ImageIcon[] _clImage

_tbImage

public javax.swing.ImageIcon _tbImage

_structImage

public javax.swing.ImageIcon[] _structImage

_memImage

public javax.swing.ImageIcon[] _memImage

_clBuf

public java.awt.image.BufferedImage _clBuf

_tbBuf

public java.awt.image.BufferedImage _tbBuf

_structBuf

public java.awt.image.BufferedImage _structBuf

_memBuf

public java.awt.image.BufferedImage _memBuf

FOREGROUND_COLOR

public static final java.awt.Color FOREGROUND_COLOR
The color for printing names of cells that are being power-logged.


DEFAULT_BACKGROUND_COLOR

public static final java.awt.Color DEFAULT_BACKGROUND_COLOR

BACKGROUND_COLOR

public static final java.awt.Color BACKGROUND_COLOR

SELECTION_COLOR

public static final java.awt.Color SELECTION_COLOR

DEFAULT_FONT

public static final java.awt.Font DEFAULT_FONT

VIEW_FULL_NAME

public static boolean VIEW_FULL_NAME

HIGHLIGHT_LEAFS

public static boolean HIGHLIGHT_LEAFS
Constructor Detail

TreeBrowserCellRenderer

public TreeBrowserCellRenderer()
Method Detail

getTreeCellRendererComponent

public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree,
                                                       java.lang.Object value,
                                                       boolean sel,
                                                       boolean expanded,
                                                       boolean leaf,
                                                       int row,
                                                       boolean hasFocus)
Returns a Component for rendering the tree node for the given object.

Parameters:
tree - Tree in which this node resides.
value - Object (AbstractPowerNode) which represents the node.
sel - true if the node is currently selected.
expanded - true if the node is currently expanded.
leaf - true if the node is a leaf.
row - The row in the tree occupied by this node.
hasFocus - true if the tree currently has focus
Returns:
The component needed to render the tree node.

getTreeCellRendererComponent

public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree,
                                                       java.lang.Object value,
                                                       boolean sel,
                                                       boolean expanded,
                                                       boolean leaf,
                                                       int row,
                                                       boolean hasFocus,
                                                       boolean overRide)
Returns a Component for rendering the tree node for the given object.

Parameters:
tree - Tree in which this node resides.
value - Object (AbstractPowerNode) which represents the node.
sel - true if the node is currently selected.
expanded - true if the node is currently expanded.
leaf - true if the node is a leaf.
row - The row in the tree occupied by this node.
hasFocus - true if the tree currently has focus
Returns:
The component needed to render the tree node.

colorRedToBlue

public static int colorRedToBlue(int i,
                                 int steps)
Simply utility for computing RGB values for a blue-to-red gradient.

Parameters:
i - The index in the color series to be created.
steps - The total number of colors in the series.
Returns:
The RGB color that corresponds to the given index in the gradient series.

colorRedToWhite

public static int colorRedToWhite(int i,
                                  int steps)
Simply utility for computing RGB values for a white-to-red gradient.

Parameters:
i - The index in the color series to be created.
steps - The total number of colors in the series.
Returns:
The RGB color that corresponds to the given index in the gradient series.

renderColorDerivative

public static java.awt.image.BufferedImage renderColorDerivative(java.awt.image.BufferedImage base_image,
                                                                 int original_fill,
                                                                 int replacement)
Creates a series of icons based on a source image, with varying colorings. The source image has a special "tag" color that indicates which part of the original image is to be recolored. The recoloring sequence currently is a gradient pattern, but could be anything.

Parameters:
base_image - The source image.
original_fill - The "tag" color to be replaced.
Returns:
An array of recolored images.

renderColorDerivatives

public static java.awt.image.BufferedImage[] renderColorDerivatives(java.awt.image.BufferedImage base_image,
                                                                    int original_fill,
                                                                    int steps)
Creates a series of icons based on a source image, with varying colorings. The source image has a special "tag" color that indicates which part of the original image is to be recolored. The recoloring sequence currently is a gradient pattern, but could be anything.

Parameters:
base_image - The source image.
original_fill - The "tag" color to be replaced.
steps - The number of derivative images to be created.
Returns:
An array of recolored images.

getBufferedImageAsResourceStream

public static java.awt.image.BufferedImage getBufferedImageAsResourceStream(java.lang.Class cls,
                                                                            java.lang.String file)
Utility for loading an image from the classpath, rather from an absolute filepath. Allows for transparent access of images from JARs.

Parameters:
cls - The class of the caller (gives the relative class path).
file - The name of the image file to be loaded.
Returns:
The image stored in the file.


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.