gcspy.vis
Class TileManager

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by gcspy.vis.TileManager
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TileManager
extends javax.swing.JComponent

Canvas that manages tiles

Author:
Tony Printezis, Richard Jones
See Also:
Serialized Form

Nested Class Summary
static class TileManager.Tile
          Tile types
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TileManager(java.lang.String title, int maxTiles)
          Create a new tile manager
TileManager(java.lang.String title, int maxTiles, boolean singleRow)
          Create a new tile manager
TileManager(java.lang.String title, int maxTiles, boolean singleRow, boolean enableSelect)
          Create a new tile manager
TileManager(java.lang.String title, int maxTiles, TileManagerColors colorConfig, boolean singleRow, boolean enableSelect)
          Create a new tile manager
 
Method Summary
 void addListener(TileManagerListener listener)
          Add a listener
 void clear()
          Clear the tile area
 void clearMarkers()
          Clear all the markers
 void deselectTile()
          Deselect a (previously selected, if any) tile
 void disableSelection()
          Disable tile selection
 void enableFooter(boolean enable)
          Enable/disable the footer
 void enableSelection()
          Enable tile selection
 void flush()
          Flush the image
 int getIndex(int x, int y)
          Get the index of a tile
(package private)  void mapImage()
          Draw the image including markers, selected tile
 void paintComponent(java.awt.Graphics g)
           
 void paintLink(int index)
          Paints the link *after* the tile
 void paintSeparator(int index)
          Paints a separator *before* the tile
 void paintTile(int index, java.awt.Color c)
          Paints a tile
 void paintTile(int index, java.awt.Color c, TileManager.Tile tile)
          Paints a tile with overflow
 void paintTile(int index, java.awt.Color c, TileManager.Tile tile, boolean force)
          Paints a tile with overflow
 void paintTileOverflow(int index, java.awt.Color c)
          Paints a tile with overflow
 void paintTileZero(int index)
          Paints a tile with value zero
 void resize(int tileNum)
          Resize the tiles area
 void selectRange(int from, int to, java.awt.Color c)
          Selects a tile range
 void selectTile(int selectedTile)
          Select a tile
 void setColumns(int cols)
          Set the number of columns in the tiles area
 void setDrawFrame(boolean drawFrame)
          Draw the frame if not a single row and drawFrame has changed
 void setTileSizeLarge()
          Set tiles to be large
 void setTileSizeSmall()
          Set tiles to be small
 void setTileSizeTiny()
          Set tiles to be tiny
 void setTileUnused(int index)
          Paints a tile with the 'off' color
 void setWidth(int widthNew)
          Set the width of the tiles area
 void setWindow(int low, int num)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
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, 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, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, 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
 

Constructor Detail

TileManager

public TileManager(java.lang.String title,
                   int maxTiles)
Create a new tile manager

Parameters:
title - A title for this area
maxTiles - The maximum number of tiles in this area

TileManager

public TileManager(java.lang.String title,
                   int maxTiles,
                   boolean singleRow)
Create a new tile manager

Parameters:
title - A title for this area
maxTiles - The maximum number of tiles in this area
singleRow - True if the area is a single row

TileManager

public TileManager(java.lang.String title,
                   int maxTiles,
                   boolean singleRow,
                   boolean enableSelect)
Create a new tile manager

Parameters:
title - A title for this area
maxTiles - The maximum number of tiles in this area
singleRow - True if the area is a single row
enableSelect - True if tiles can be selected

TileManager

public TileManager(java.lang.String title,
                   int maxTiles,
                   TileManagerColors colorConfig,
                   boolean singleRow,
                   boolean enableSelect)
Create a new tile manager

Parameters:
title - A title for this area
maxTiles - The maximum number of tiles in this area
colorConfig - A colour configuration for the tiles
singleRow - True if the area is a single row
enableSelect - True if tiles can be selected
Method Detail

getIndex

public int getIndex(int x,
                    int y)
Get the index of a tile

Parameters:
x - The x coord
y - The y coord
Returns:
The unadjusted index

clear

public void clear()
Clear the tile area


mapImage

void mapImage()
Draw the image including markers, selected tile


flush

public void flush()
Flush the image


paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paintSeparator

public void paintSeparator(int index)
Paints a separator *before* the tile

Parameters:
index - the unadjusted index

paintLink

public void paintLink(int index)
Paints the link *after* the tile

Parameters:
index - the unadjusted index

selectRange

public void selectRange(int from,
                        int to,
                        java.awt.Color c)
Selects a tile range

Parameters:
from - unadjusted from index
to - unadjusted to index
c - the selection colour

setTileUnused

public void setTileUnused(int index)
Paints a tile with the 'off' color

Parameters:
index - the unadjusted index

paintTile

public void paintTile(int index,
                      java.awt.Color c)
Paints a tile

Parameters:
index - the unadjusted index
c - the colour of the tile

paintTileZero

public void paintTileZero(int index)
Paints a tile with value zero

Parameters:
index - the unadjusted index

paintTileOverflow

public void paintTileOverflow(int index,
                              java.awt.Color c)
Paints a tile with overflow

Parameters:
index - the unadjusted index
c - The tile colour

paintTile

public void paintTile(int index,
                      java.awt.Color c,
                      TileManager.Tile tile)
Paints a tile with overflow

Parameters:
index - the unadjusted index
c - The tile colour
tile - the tile kind

paintTile

public void paintTile(int index,
                      java.awt.Color c,
                      TileManager.Tile tile,
                      boolean force)
Paints a tile with overflow

Parameters:
index - the unadjusted index
c - The colour of the tile
tile - the tile kind
force - force the painting regardless of overflow or visibility

setColumns

public void setColumns(int cols)
Set the number of columns in the tiles area

Parameters:
cols - the number of columns

setWidth

public void setWidth(int widthNew)
Set the width of the tiles area

Parameters:
widthNew - the new width

resize

public void resize(int tileNum)
Resize the tiles area

Parameters:
tileNum - The new number of tiles in the area

enableFooter

public void enableFooter(boolean enable)
Enable/disable the footer

Parameters:
enable - True if the footer is enabled

setWindow

public void setWindow(int low,
                      int num)
Parameters:
low -
num -

setTileSizeLarge

public void setTileSizeLarge()
Set tiles to be large


setTileSizeSmall

public void setTileSizeSmall()
Set tiles to be small


setTileSizeTiny

public void setTileSizeTiny()
Set tiles to be tiny


selectTile

public void selectTile(int selectedTile)
Select a tile

Parameters:
selectedTile - the tile

deselectTile

public void deselectTile()
Deselect a (previously selected, if any) tile


setDrawFrame

public void setDrawFrame(boolean drawFrame)
Draw the frame if not a single row and drawFrame has changed

Parameters:
drawFrame -

addListener

public void addListener(TileManagerListener listener)
Add a listener

Parameters:
listener - the listener

clearMarkers

public void clearMarkers()
Clear all the markers


enableSelection

public void enableSelection()
Enable tile selection


disableSelection

public void disableSelection()
Disable tile selection