|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JLabel | +--org.gjt.universe.gui.tree.TVRenderer
Field Summary | |
protected static java.lang.String[] |
colorMap
|
protected static int |
currentTurn
|
static java.lang.String |
DKGRAY
|
static java.lang.String |
GRAY
|
static java.lang.String |
GREEN
|
protected boolean |
hasFocus
|
static java.awt.Color |
HIDDEN_COLOR
|
static java.lang.String |
I_NOTE
|
static java.lang.String |
I_ORDERS
|
static java.lang.String |
I_UNKNOWN
|
protected static java.util.Hashtable |
iconTable
|
static java.awt.Color |
LABEL_COLOR
|
static java.lang.String |
LTGRAY
|
protected static java.lang.String[] |
nameMap
|
static java.lang.String |
RED
|
protected java.lang.StringBuffer |
sb
|
protected java.lang.StringBuffer |
sb2
|
protected static java.lang.StringBuffer |
sbTemp
|
protected boolean |
selected
|
protected int |
treeType
|
static java.lang.String |
WHITE
|
static java.lang.String |
YELLOW
|
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.Container |
|
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 | |
TVRenderer()
Create the Renderer for the TreeViewer. |
Method Summary | |
static java.lang.String |
colorToHex(java.awt.Color c)
Converts a color to a 6-digit RGB hex. |
protected static void |
createIconTable()
Creates the table of icons which are used during rendering |
protected static javax.swing.ImageIcon |
getIcon(java.lang.String name)
Get an icon from the icon table. |
static java.lang.String[] |
getPlayerColorMap()
Returns data set by setPlayerNameMap(); really should only be called by TreeViewer |
static java.lang.String[] |
getPlayerNameMap()
Returns data set by setPlayerNameMap(); really should only be called by TreeViewer |
java.awt.Component |
getTreeCellRendererComponent(javax.swing.JTree tree,
java.lang.Object value,
boolean sel,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
The main rendering code, as defined by the interface TreeCellRenderer. |
protected java.lang.String |
makeSimpleText(TVData data)
This makes a label without the fancy coloring and other options like bold/italics/whatever. |
protected java.lang.String |
makeTipText(java.lang.String in)
Convert tabs & newlines that may be in annotations into HTML acceptable text for use in tooltips. |
protected static java.lang.String |
mapIDToOwner(boolean useColor,
int ownerID)
Maps a user id to a name; appends color information if useColor is true. |
void |
paint(java.awt.Graphics g)
This paints the focus-box and highlites (selected) box. |
static void |
setCurrentTurn(int value)
Set the current turn; used for computing how out-of-date data is. |
static void |
setMapping(java.lang.String[] names,
java.awt.Color[] colors)
Map Names & Colors to an index. |
void |
setModelType(int type)
Sets the model type; should only be called by TreeViewer. |
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPreferredSize, 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, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, 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, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, 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 |
public static final java.lang.String I_NOTE
public static final java.lang.String I_UNKNOWN
public static final java.lang.String I_ORDERS
public static final java.lang.String GREEN
public static final java.lang.String RED
public static final java.lang.String YELLOW
public static final java.lang.String DKGRAY
public static final java.lang.String GRAY
public static final java.lang.String LTGRAY
public static final java.lang.String WHITE
public static final java.awt.Color LABEL_COLOR
public static final java.awt.Color HIDDEN_COLOR
protected static java.util.Hashtable iconTable
protected static int currentTurn
protected static java.lang.String[] nameMap
protected static java.lang.String[] colorMap
protected static java.lang.StringBuffer sbTemp
protected int treeType
protected boolean selected
protected boolean hasFocus
protected java.lang.StringBuffer sb
protected java.lang.StringBuffer sb2
Constructor Detail |
public TVRenderer()
Method Detail |
public static void setCurrentTurn(int value)
public static void setMapping(java.lang.String[] names, java.awt.Color[] colors)
names
- Array of player namescolors
- Array of player colors (display colors)public static java.lang.String[] getPlayerNameMap()
public static java.lang.String[] getPlayerColorMap()
public void setModelType(int type)
type
- The model type, as defined in TVModelprotected static java.lang.String mapIDToOwner(boolean useColor, int ownerID)
useColor
- append color information if true.ownerID
- the owner id (0 to MaxPlayer-1).protected static void createIconTable()
protected static javax.swing.ImageIcon getIcon(java.lang.String name)
public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
getTreeCellRendererComponent
in interface javax.swing.tree.TreeCellRenderer
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
protected java.lang.String makeTipText(java.lang.String in)
public static java.lang.String colorToHex(java.awt.Color c)
protected java.lang.String makeSimpleText(TVData data)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |