Class pmr.stat.DrawableStat
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.stat.DrawableStat
java.lang.Object
|
+----pmr.stat.Stat
|
+----pmr.stat.DrawableStat
- public class DrawableStat
- extends Stat
- implements Drawable
Any Stat which can be drawn as an object should be subclassed from
this rather than from Stat. It provides for drawing the object either
to a default Component (display()) or to an already provided Graphics context
display(Graphics). It also deals with mouse events and similar things.
(cf. pmr.simplegraph.DrawableObject).
- Author:
- (C) P. Murray-Rust, 1996
-
DrawableStat()
- normal constructor
-
action(Event, Object)
- pass any button actions to the object
-
debug()
-
-
display()
- Kicks off a ScrollableTopLevel which contains the object.
-
display(Graphics)
- used by the ScrollableTopLevel to paint the object, or can be used to
draw the object to somewhere else.
-
display(Graphics, Component)
- this may encapsulate the above routine, as we often need the component, e.g.
-
display(Int2Range)
- alternative display routine when we know the target screen area for
the object
-
display(IntSet)
- display the subaddresses in the node; we might need to alter the
hierarchy to cater for this...
-
generalDisplay(Graphics)
- generic display unrelated to object details.
-
getScaler2D()
- get the Scaler2D context (allows 2D scaling, etc)
-
getTranslation()
-
-
highlight(IntSet)
- highlight any subAddresses in Node - default is no action unless overridden
-
isSelected()
-
-
mouseBox(Event, int, int)
- action when mouseBox has been swept out; if not overridden, tries to
scale the object.
-
mouseDown(Event, int, int)
- action when mouse is clicked; if not overridden, no action
-
mouseDrag(Event, int, int)
- action when mouse is dragged; if not overridden, no action
-
mouseUp(Event, int, int)
- action when mouse is unclicked; if not overridden, no action
-
processMouseBox(Int2Range)
- action when mouseBox has been swept out; if not overridden, tries to
scale the object.
-
repaint()
- repaint the component (the best we can do)
-
setComponent(Component)
- set the component that the Drawable is on (if we know)
-
setHighlightable(boolean)
- the subaddresses can be highlighted rather than asked for immediate
action
-
setScaler2D(Scaler2D)
- set the Scaler2D context (allows 2D scaling, etc)
-
setSelected(boolean)
- set the object to be selected
-
setTitle(String)
- set a title.
-
setTranslation(int, int)
- sometimes the display needs translation (e.g.
DrawableStat
public DrawableStat()
- normal constructor
display
public void display() throws ArrayTooSmallException, CoincidentDataException
- Kicks off a ScrollableTopLevel which contains the object. Only one copy
allowed. This STL routes mouse calls, etc. to the DrawableStat which can
then do its own thing with them
- Throws: ArrayTooSmallException
- Most Stat routines will require 2 or more points
- Throws: CoincidentDataException
- All the data fall on one point
setTitle
public void setTitle(String title)
- set a title. If the STL exists, set that title
setTranslation
public void setTranslation(int x,
int y)
- sometimes the display needs translation (e.g. if copied from another
context such as TOC)
getTranslation
public Int2 getTranslation()
display
public void display(Int2Range screenLimits) throws ArrayTooSmallException, CoincidentDataException, InvalidArgumentsException
- alternative display routine when we know the target screen area for
the object
- Throws: ArrayTooSmallException
- Most Stat routines will require 2 or more points
- Throws: CoincidentDataException
- All the data fall on one point
- Throws: InvalidArgumentsException
- 'screenLimits' does not have sensible values
display
public abstract void display(Graphics g)
- used by the ScrollableTopLevel to paint the object, or can be used to
draw the object to somewhere else. By using the Scaler2D approach
it is possible to draw the object to any desired screen location
generalDisplay
public void generalDisplay(Graphics g)
- generic display unrelated to object details. Must be called from
display(g); EXPERIMENTAL - to test clipboard cut/paste approach
display
public void display(IntSet subAddress) throws ArrayTooSmallException, CoincidentDataException
- display the subaddresses in the node; we might need to alter the
hierarchy to cater for this...
- Throws: ArrayTooSmallException
- Most Stat routines will require 2 or more points
- Throws: CoincidentDataException
- All the data fall on one point
highlight
public void highlight(IntSet is)
- highlight any subAddresses in Node - default is no action unless overridden
getScaler2D
public Scaler2D getScaler2D()
- get the Scaler2D context (allows 2D scaling, etc)
setScaler2D
public void setScaler2D(Scaler2D s)
- set the Scaler2D context (allows 2D scaling, etc)
mouseUp
public boolean mouseUp(Event evt,
int x,
int y)
- action when mouse is unclicked; if not overridden, no action
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
- action when mouse is clicked; if not overridden, no action
mouseDrag
public boolean mouseDrag(Event evt,
int x,
int y)
- action when mouse is dragged; if not overridden, no action
mouseBox
public boolean mouseBox(Event evt,
int x,
int y)
- action when mouseBox has been swept out; if not overridden, tries to
scale the object. To disable this, override with 'return true'
processMouseBox
public boolean processMouseBox(Int2Range box)
- action when mouseBox has been swept out; if not overridden, tries to
scale the object. To disable this, override this method with 'return true'
action
public boolean action(Event e,
Object arg)
- pass any button actions to the object
setSelected
public void setSelected(boolean s)
- set the object to be selected
isSelected
public boolean isSelected()
setHighlightable
public void setHighlightable(boolean b)
- the subaddresses can be highlighted rather than asked for immediate
action
setComponent
public void setComponent(Component c)
- set the component that the Drawable is on (if we know)
repaint
public void repaint()
- repaint the component (the best we can do)
debug
public void debug()
All Packages Class Hierarchy This Package Previous Next Index