All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.awt.draw.DrawingOperation

java.lang.Object
   |
   +----ncsa.awt.draw.DrawingOperation

public abstract class DrawingOperation
extends Object
implements Marshallable
An abstract class that is subclassed for drawing operations


Variable Index

 o canvas
A component that will be drawn into for this operation
 o clickedPoint
A point used as a reference for this operation
 o plots
A list of drawing primitives
 o primitiveIndex
The index in the plot vector of the primitive to perform this action on.
 o react
Indicates when to perform this action

Constructor Index

 o DrawingOperation()
Constructs a null drawing operation

Method Index

 o getIndex()
Gets the index in the vector for the primitive we're interested in
 o getPlots()
 o getPoint()
Gets where the user clicked.
 o getReaction()
Gets the reaction value for this operation, which is used to determine when the operation should be performed.
 o init(Component, Vector)
Initialize this drawing operation with a place to draw and the primitives involved.
 o locatePrimitive(int, int)
Given a point value (x,y) locate the first primitive on top of the stack that is located at this point: return its index in the Vector
 o newInstance()
Creates a new instance of this operation In order for a newInstance() method to be called directly (without this routine), the user would have to specify the actual name of the object.
 o operation()
Abstract method that must be implemented by the subclassed primitive.
 o setIndex(int)
Sets the index in the vector for the primitive we're interested in
 o setPlots(Vector)
 o setPoint(int, int)
Sets the value of where the user clicked for this operation

Variables

 o plots
 protected transient Vector plots
A list of drawing primitives

 o canvas
 protected transient Component canvas
A component that will be drawn into for this operation

 o react
 protected transient int react
Indicates when to perform this action

 o primitiveIndex
 protected int primitiveIndex
The index in the plot vector of the primitive to perform this action on.

 o clickedPoint
 protected transient Point clickedPoint
A point used as a reference for this operation

Constructors

 o DrawingOperation
 public DrawingOperation()
Constructs a null drawing operation

Methods

 o init
 public void init(Component canvas,
                  Vector plots)
Initialize this drawing operation with a place to draw and the primitives involved.

Parameters:
canvas - the graphics context
plots - the vector of drawing primitives
 o getPlots
 public Vector getPlots()
 o setPoint
 public void setPoint(int x,
                      int y)
Sets the value of where the user clicked for this operation

Parameters:
x - the x coordinate
y - the y coordinate
 o getPoint
 public final Point getPoint()
Gets where the user clicked.

Returns:
the Point which the user clicked
 o getReaction
 public final int getReaction()
Gets the reaction value for this operation, which is used to determine when the operation should be performed.

Returns:
the reaction value (Event.MOUSE_DOWN, Event.MOUSE_UP)
 o setIndex
 public void setIndex(int index)
Sets the index in the vector for the primitive we're interested in

Parameters:
index - the primitive index
 o getIndex
 public final int getIndex()
Gets the index in the vector for the primitive we're interested in

Returns:
the primtive index
 o locatePrimitive
 public int locatePrimitive(int x,
                            int y)
Given a point value (x,y) locate the first primitive on top of the stack that is located at this point: return its index in the Vector

Parameters:
x - the x coordinate
y - the y coordinate
 o newInstance
 public DrawingOperation newInstance()
Creates a new instance of this operation In order for a newInstance() method to be called directly (without this routine), the user would have to specify the actual name of the object. Ideally, this would just be by doing something like:
      dp = (DrawingOperation)Class.forName("Grab").newInstance();
 
However, since these routines exist within a package, the user would have to specify a fully qualified package name and object name to create the object. It could end up looking like:
      dp = (DrawingOperation)Class.forName("ncsa.drawing.Grab").newIns
tance();
 
And, if the package ever changed locations, the code in the user application would need to be modified. In order to spare the user this, I created this routine which handles everything internally.

 o operation
 public abstract DrawingPrimitive operation()
Abstract method that must be implemented by the subclassed primitive.

 o setPlots
 public void setPlots(Vector plots)

All Packages  Class Hierarchy  This Package  Previous  Next  Index