|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--edu.brook.ascape.view.CanvasView
A base class for a canvas that acts as an observer of scapes. Provides for double buffer and notifiation of scape updates.
| Field Summary | |
protected boolean |
awaitingUpdate
Has the buffer been modified? Are we waiting for the paint method to update it to the onscreen image? |
protected java.awt.Graphics |
bufferedGraphics
The garphics for double-buffering. |
protected java.awt.Image |
bufferedImage
The image for double-buffering. |
protected int |
currentUpdate
The update currently being drawn. |
protected int |
drawEveryNUpdates
Specifies the number of updates that occur between each draw. |
protected ViewFrameBridge |
frame
The frame this view is displayed in. |
protected java.lang.String |
name
The name of the view. |
protected GraphicsRecorder |
recorder
A recorder for the graphic of this view. |
protected boolean |
recordNext
Are we waiting for a record to occur? |
protected Scape |
scape
The scape being viewed. |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
CanvasView()
Constructs a canvas view. |
|
CanvasView(java.lang.String name)
Constructs a canvas view. |
|
| Method Summary | |
void |
addNotify()
Override addNotify to build buffer. |
void |
addScape(Scape scape)
Add a scape to this listener. |
void |
build()
Prepare the component view, once the view's scape has been created. |
void |
finalize()
Attempts to free buffer memory as soon as possible upon canvas destruction. |
int |
getDrawEveryNUpdates()
Returns a name for the view as defined by set name. |
GraphicsRecorder |
getGraphicsRecorder()
Returns a recorder that can be used to record the graphics of this view. |
java.lang.String |
getName()
Returns a name for the view as defined by set name. |
java.awt.Dimension |
getPreferredSize()
Returns default preferred size of width 300 and height 200. |
Scape |
getScape()
Returns the scape this canvas views. |
ViewFrameBridge |
getViewFrame()
Returns the frame this view occupies, null if none. |
protected void |
initializeBuffer(int width,
int height)
Initialize the buffer to the supplied width and height. |
void |
onIterate()
Called when scape is iterated. |
void |
onSetup()
Method called when the scape is ready for setup. |
void |
onStart()
Method called when the scape is started. |
void |
onStop()
Method called when the scape is stopped. |
void |
onUpdate()
Called when scape reports an update event. |
void |
paint(java.awt.Graphics g)
Paints the canvas. |
void |
removeScape(Scape scape)
Removes the scape from this listener. |
void |
scapeUpdated(ScapeEvent scapeEvent)
Notifies this view that its scape has been updated. |
void |
setDrawEveryNUpdates(int drawEveryNUpdates)
Sets the name of this view. |
void |
setGraphicsRecorder(GraphicsRecorder recorder)
Sets the recorder that can be used to record the graphics of this view. |
void |
setName(java.lang.String name)
Sets the name of this view. |
void |
setViewFrame(ViewFrameBridge frame)
Sets the frame this view appears in. |
java.lang.String |
toString()
Returns a short description of this view. |
void |
update(java.awt.Graphics g)
Override the Canvas update method so that the canvas is not automatically cleared before painting. |
void |
updated()
Called (typically from paint) when this view has been 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 |
protected transient java.awt.Image bufferedImage
protected transient java.awt.Graphics bufferedGraphics
protected Scape scape
protected ViewFrameBridge frame
protected GraphicsRecorder recorder
protected boolean awaitingUpdate
protected int drawEveryNUpdates
protected int currentUpdate
protected java.lang.String name
protected boolean recordNext
| Constructor Detail |
public CanvasView()
public CanvasView(java.lang.String name)
name - a user relevant name for this view| Method Detail |
public void build()
public void addNotify()
protected void initializeBuffer(int width,
int height)
width - the width of the bufferheight - the height of the bufferpublic java.awt.Dimension getPreferredSize()
public Scape getScape()
public void addScape(Scape scape)
throws java.util.TooManyListenersException
scape - the scape to make this canvas the observer ofpublic void removeScape(Scape scape)
scape - the scape to removepublic ViewFrameBridge getViewFrame()
public void setViewFrame(ViewFrameBridge frame)
public void onIterate()
public void onSetup()
public void onUpdate()
public void onStart()
public void onStop()
public void scapeUpdated(ScapeEvent scapeEvent)
scapeEvent - a scape event updatepublic void updated()
public int getDrawEveryNUpdates()
public void setDrawEveryNUpdates(int drawEveryNUpdates)
name - a user relevant name for this viewpublic java.lang.String getName()
public void setName(java.lang.String name)
name - a user relevant name for this viewpublic GraphicsRecorder getGraphicsRecorder()
public void setGraphicsRecorder(GraphicsRecorder recorder)
public java.lang.String toString()
public void update(java.awt.Graphics g)
public void paint(java.awt.Graphics g)
g - the graphics context.public void finalize()
|
(c) 1998-2000 The Brookings Insitution Webpage |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||