edu.brook.ascape.view
Class BaseCellView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--edu.brook.ascape.view.CanvasView
                    |
                    +--edu.brook.ascape.view.BaseCellView
Direct Known Subclasses:
BaseAgentCellView, Scrolling1DView, StretchyView

public abstract class BaseCellView
extends CanvasView

A generic base class for views that draw some kind of spatial view of a group of cells. Cell views have a default draw feature that draws a background for the cell, using the cell color feature.

Since:
1.0
Version:
1.9
See Also:
Serialized Form

Field Summary
protected  int borderSize
          Size of border around each cell.
protected  ColorFeature cellColorFeature
          The color feature used to set the cell draw color
protected  CellCustomizer cellCustomizer
          The panel responsible for customizing a selected cell.
 DrawFeature cells_fill_draw_feature
          Draws the provided object, assumed to be a cell, by filling it using the cell color feature.
 DrawFeature cells_fill_draw_inset_feature
          Draws the provided object, assumed to be a cell, by filling it using the cell color feature.
protected  int cellSize
          Size of each individual cell, typically in pixels.
protected  VectorSelection drawSelection
          The draw features that have been selected to draw.
protected  boolean updateAllRequested
          Has an update all been requested?
protected  ViewCustomizer viewCustomizer
          The panel responsible for customizing this view.
 
Fields inherited from class edu.brook.ascape.view.CanvasView
awaitingUpdate, bufferedGraphics, bufferedImage, currentUpdate, drawEveryNUpdates, frame, name, recorder, recordNext, scape
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
BaseCellView()
          Constructs a BaseCellView, adding a listener to present a settings frame when the user double-clicks on the view.
 
Method Summary
 void build()
          Builds the view.
 Cell cellAtPixel(int x, int y)
           
 void displayCellCustomizer()
          Displays a window for altering the setting for this view.
 void displayViewCustomizer()
          Displays a window for altering the setting for this view.
protected  void drawSelectedCell(java.awt.Graphics g)
           
 int getBorderSize()
          Returns a one-dimension size in pixels of the cell border.
 ColorFeature getCellColorFeature()
          Returns the color feature that will be used for determining cell color.
 int getCellSize()
          Returns a one-dimension size of pixels used to represent each cell.
 Cell getCustomizeCell()
           
 VectorSelection getDrawSelection()
          Returns the selection of draw features for this view.
 void hideCellCustomizer()
          Hides window for altering the setting for this view.
 void onUpdate()
          On notification of a scape update, draws the actual overhead view.
 void requestUpdateAll()
          Requests that all cells be updated, irregardless of wether they have requested it or not.
 void setBorderSize(int borderSize)
          Sets the border size in pixels.
 void setCellColorFeature(ColorFeature cellColorFeature)
          Set the color feature that will be used for determining cell color.
 void setCellSize(int cellSize)
          Sets the number of pixels used to represent each cell.
 void setCustomizeCell(Cell cell)
           
 
Methods inherited from class edu.brook.ascape.view.CanvasView
addNotify, addScape, finalize, getDrawEveryNUpdates, getGraphicsRecorder, getName, getPreferredSize, getScape, getViewFrame, initializeBuffer, onIterate, onSetup, onStart, onStop, paint, removeScape, scapeUpdated, setDrawEveryNUpdates, setGraphicsRecorder, setName, setViewFrame, toString, update, updated
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setSize, setSize, setVisible, show, show, size, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cells_fill_draw_feature

public final DrawFeature cells_fill_draw_feature
Draws the provided object, assumed to be a cell, by filling it using the cell color feature.

cells_fill_draw_inset_feature

public final DrawFeature cells_fill_draw_inset_feature
Draws the provided object, assumed to be a cell, by filling it using the cell color feature.

cellSize

protected int cellSize
Size of each individual cell, typically in pixels. 6 by default.

borderSize

protected int borderSize
Size of border around each cell. 0 by default.

cellColorFeature

protected ColorFeature cellColorFeature
The color feature used to set the cell draw color

drawSelection

protected VectorSelection drawSelection
The draw features that have been selected to draw.

updateAllRequested

protected boolean updateAllRequested
Has an update all been requested?

viewCustomizer

protected ViewCustomizer viewCustomizer
The panel responsible for customizing this view.

cellCustomizer

protected CellCustomizer cellCustomizer
The panel responsible for customizing a selected cell.
Constructor Detail

BaseCellView

public BaseCellView()
Constructs a BaseCellView, adding a listener to present a settings frame when the user double-clicks on the view.
Method Detail

getCustomizeCell

public Cell getCustomizeCell()

setCustomizeCell

public void setCustomizeCell(Cell cell)

build

public void build()
Builds the view. Sets the color feature defaults, adds the default oval and fill draw features, and selects the draw agents as ovals feature.
Overrides:
build in class CanvasView

onUpdate

public void onUpdate()
On notification of a scape update, draws the actual overhead view.
Parameters:
scapeEvent - a scape event update, usually unspecified
Overrides:
onUpdate in class CanvasView

displayViewCustomizer

public void displayViewCustomizer()
Displays a window for altering the setting for this view. May be a no op if (in the case of no swing support) a customizer isn't available for the environment.

displayCellCustomizer

public void displayCellCustomizer()
Displays a window for altering the setting for this view. May be a no op if (in the case of no swing support) a viewCustomizer isn't available for the environment.

cellAtPixel

public Cell cellAtPixel(int x,
                        int y)

drawSelectedCell

protected void drawSelectedCell(java.awt.Graphics g)

hideCellCustomizer

public void hideCellCustomizer()
Hides window for altering the setting for this view.

getDrawSelection

public VectorSelection getDrawSelection()
Returns the selection of draw features for this view.

getCellColorFeature

public ColorFeature getCellColorFeature()
Returns the color feature that will be used for determining cell color. The default color feature is simply the getColor() method of the cell.

setCellColorFeature

public void setCellColorFeature(ColorFeature cellColorFeature)
Set the color feature that will be used for determining cell color. The default color feature is simply the getColor() method of the cell.
Parameters:
cellColorFeature - the color feature, whose object is assumed to be a cell populating this lattice

getCellSize

public int getCellSize()
Returns a one-dimension size of pixels used to represent each cell.

setCellSize

public void setCellSize(int cellSize)
Sets the number of pixels used to represent each cell.
Parameters:
cellSize - number of pixels per edge

getBorderSize

public int getBorderSize()
Returns a one-dimension size in pixels of the cell border.

setBorderSize

public void setBorderSize(int borderSize)
Sets the border size in pixels.
Parameters:
cellSize - number of pixels

requestUpdateAll

public void requestUpdateAll()
Requests that all cells be updated, irregardless of wether they have requested it or not. Should be called whenever a change that can affect the view as a whole, such as a change in draw selection, is made. is made.

(c) 1998-2000 The Brookings Insitution
Webpage