Class Display
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----GWin
|
+----Display
- public abstract class Display
- extends GWin
- implements Parsable, Watcher, Watchable
A display object can display simulation variables in a separate window.
This code is (c) 1996 Leemon Baird
<leemon@cs.cmu.edu>,
http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely.
If the code is modified, please state so in the comments.
- Version:
- 1.01, 24 July 96
- Author:
- Leemon Baird
-
buffBounds
- bounds of buffer
-
buffer
- offscreen buffer used for double buffering
-
disableDisplays
- Should all the displays be disabled (still record data, but don't display it)?
-
flicker
- Should drawing to the screen not be double buffered (use offscreen buffer for no flicker)?
-
image
- image corresponding to buffer
-
plotBuffer
- smaller region within offscreen buffer used for double buffering
-
repaintInProgress
- is a repaint currently queued (and so there's no need to call repaint() again)?
-
watchManager
- The WatchManager that this Watcher watches
-
wmName
- the prefix string for the name of every watched variable (passed in to setWatchManager)
-
Display()
-
-
BNF(int)
-
-
destroy()
- This is called when the user closes the window.
-
drawAll(Graphics)
- Override this to draw directly to the display.
-
getName()
- Return the variable "name" that was passed into setWatchManager
-
getParameters(int)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
-
getWatchManager()
- Get the WatchManager being used
-
initialize(int)
- Initialize, either partially or completely.
-
paint(Graphics)
- Redraw the display.
-
parse(Parser, int)
- Parse the input file to get the parameters for this object.
-
repaint()
- Repaint the screen if a repaint isn't already queued.
-
setWatchManager(WatchManager, String)
- Remember the WatchManager for this object and create the window.
-
unparse(Unparser, int)
- Output a description of this object that can be parsed with parse().
-
unregister(String)
- One of the watched variables has been unregistered.
-
update(Graphics)
- Redraw the display without flicker.
-
update(String, Pointer, Watchable)
- One of the watched variables has changed, so look at it and others.
disableDisplays
public static boolean disableDisplays
- Should all the displays be disabled (still record data, but don't display it)?
watchManager
public WatchManager watchManager
- The WatchManager that this Watcher watches
wmName
public String wmName
- the prefix string for the name of every watched variable (passed in to setWatchManager)
flicker
public PBoolean flicker
- Should drawing to the screen not be double buffered (use offscreen buffer for no flicker)?
buffer
public Graphics buffer
- offscreen buffer used for double buffering
plotBuffer
public Graphics plotBuffer
- smaller region within offscreen buffer used for double buffering
image
public Image image
- image corresponding to buffer
buffBounds
public Dimension buffBounds
- bounds of buffer
repaintInProgress
public PBoolean repaintInProgress
- is a repaint currently queued (and so there's no need to call repaint() again)?
Display
public Display()
setWatchManager
public void setWatchManager(WatchManager wm,
String name)
- Remember the WatchManager for this object and create the window.
After everything is parsed and windows are created, all experiments
are given a watchManager by Simulator, then it starts giving each
Display a watchManager. This is where
the Display should register each variable it wants to watch.
getName
public String getName()
- Return the variable "name" that was passed into setWatchManager
- Overrides:
- getName in class Component
getWatchManager
public WatchManager getWatchManager()
- Get the WatchManager being used
getParameters
public Object[][] getParameters(int lang)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
- See Also:
- getParameters
BNF
public String BNF(int lang)
unparse
public void unparse(Unparser u,
int lang)
- Output a description of this object that can be parsed with parse().
parse
public Object parse(Parser p,
int lang) throws ParserException
- Parse the input file to get the parameters for this object.
- Throws: ParserException
- parser didn't find the required token
unregister
public void unregister(String watchedVar)
- One of the watched variables has been unregistered.
The watcher doesn't have to do anything, but might
remove this variable from some internal data structure.
update
public void update(String changedName,
Pointer changedVar,
Watchable obj)
- One of the watched variables has changed, so look at it and others.
It should call checkMoved() to
make sure the window is a legal size.
update
public void update(Graphics g)
- Redraw the display without flicker. Normally update() first
erases the screen, then calls paint(), but it's overridden
here so it won't erase. Don't override update() or paint(). Override
drawAll() instead. When it is time to redraw the display, call repaint();
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Redraw the display. Do not override update(Graphics) or paint(Graphics).
Override drawAll() instead. When it is time to redraw the
display, call repaint().
- Overrides:
- paint in class GWin
repaint
public void repaint()
- Repaint the screen if a repaint isn't already queued. Do not override repaint().
- Overrides:
- repaint in class Component
drawAll
public void drawAll(Graphics g)
- Override this to draw directly to the display.
It should clear the entire window and redraw everything.
It is called by paint() which is called when a window is created, uncovered,
or saved to the disk as a GIF or Postscript file.
destroy
public void destroy()
- This is called when the user closes the window. Override it
to react to that event (e.g. kill threads, dispose of Graphics)
- Overrides:
- destroy in class GWin
initialize
public void initialize(int level)
- Initialize, either partially or completely.
- See Also:
- initialize