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

Constructor Index

 o DrawableStat()
normal constructor

Method Index

 o action(Event, Object)
pass any button actions to the object
 o debug()
 o display()
Kicks off a ScrollableTopLevel which contains the object.
 o display(Graphics)
used by the ScrollableTopLevel to paint the object, or can be used to draw the object to somewhere else.
 o display(Graphics, Component)
this may encapsulate the above routine, as we often need the component, e.g.
 o display(Int2Range)
alternative display routine when we know the target screen area for the object
 o display(IntSet)
display the subaddresses in the node; we might need to alter the hierarchy to cater for this...
 o generalDisplay(Graphics)
generic display unrelated to object details.
 o getScaler2D()
get the Scaler2D context (allows 2D scaling, etc)
 o getTranslation()
 o highlight(IntSet)
highlight any subAddresses in Node - default is no action unless overridden
 o isSelected()
 o mouseBox(Event, int, int)
action when mouseBox has been swept out; if not overridden, tries to scale the object.
 o mouseDown(Event, int, int)
action when mouse is clicked; if not overridden, no action
 o mouseDrag(Event, int, int)
action when mouse is dragged; if not overridden, no action
 o mouseUp(Event, int, int)
action when mouse is unclicked; if not overridden, no action
 o processMouseBox(Int2Range)
action when mouseBox has been swept out; if not overridden, tries to scale the object.
 o repaint()
repaint the component (the best we can do)
 o setComponent(Component)
set the component that the Drawable is on (if we know)
 o setHighlightable(boolean)
the subaddresses can be highlighted rather than asked for immediate action
 o setScaler2D(Scaler2D)
set the Scaler2D context (allows 2D scaling, etc)
 o setSelected(boolean)
set the object to be selected
 o setTitle(String)
set a title.
 o setTranslation(int, int)
sometimes the display needs translation (e.g.

Constructors

 o DrawableStat
  public DrawableStat()
normal constructor

Methods

 o 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
 o setTitle
  public void setTitle(String title)
set a title. If the STL exists, set that title
 o setTranslation
  public void setTranslation(int x,
                             int y)
sometimes the display needs translation (e.g. if copied from another context such as TOC)
 o getTranslation
  public Int2 getTranslation()
 o 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
 o 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
 o 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
 o 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
 o highlight
  public void highlight(IntSet is)
highlight any subAddresses in Node - default is no action unless overridden
 o getScaler2D
  public Scaler2D getScaler2D()
get the Scaler2D context (allows 2D scaling, etc)
 o setScaler2D
  public void setScaler2D(Scaler2D s)
set the Scaler2D context (allows 2D scaling, etc)
 o mouseUp
  public boolean mouseUp(Event evt,
                         int x,
                         int y)
action when mouse is unclicked; if not overridden, no action
 o mouseDown
  public boolean mouseDown(Event evt,
                           int x,
                           int y)
action when mouse is clicked; if not overridden, no action
 o mouseDrag
  public boolean mouseDrag(Event evt,
                           int x,
                           int y)
action when mouse is dragged; if not overridden, no action
 o 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'
 o 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'
 o action
  public boolean action(Event e,
                        Object arg)
pass any button actions to the object
 o setSelected
  public void setSelected(boolean s)
set the object to be selected
 o isSelected
  public boolean isSelected()
 o setHighlightable
  public void setHighlightable(boolean b)
the subaddresses can be highlighted rather than asked for immediate action
 o setComponent
  public void setComponent(Component c)
set the component that the Drawable is on (if we know)
 o repaint
  public void repaint()
repaint the component (the best we can do)
 o debug
  public void debug()

All Packages  Class Hierarchy  This Package  Previous  Next  Index