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
-
canvas
- A component that will be drawn into for this operation
-
clickedPoint
- A point used as a reference for this operation
-
plots
-
A list of drawing primitives
-
primitiveIndex
- The index in the plot vector of the primitive to perform
this action on.
-
react
- Indicates when to perform this action
-
DrawingOperation()
- Constructs a null drawing operation
-
getIndex()
- Gets the index in the vector for the primitive we're interested in
-
getPlots()
-
-
getPoint()
-
Gets where the user clicked.
-
getReaction()
- Gets the reaction value for this operation, which is used to
determine when the operation should be performed.
-
init(Component, Vector)
- Initialize this drawing operation with a place to draw and
the primitives involved.
-
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
-
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.
-
operation()
-
Abstract method that must be implemented by the subclassed
primitive.
-
setIndex(int)
- Sets the index in the vector for the primitive we're interested in
-
setPlots(Vector)
-
-
setPoint(int, int)
-
Sets the value of where the user clicked for this operation
plots
protected transient Vector plots
- A list of drawing primitives
canvas
protected transient Component canvas
- A component that will be drawn into for this operation
react
protected transient int react
- Indicates when to perform this action
primitiveIndex
protected int primitiveIndex
- The index in the plot vector of the primitive to perform
this action on.
clickedPoint
protected transient Point clickedPoint
- A point used as a reference for this operation
DrawingOperation
public DrawingOperation()
- Constructs a null drawing operation
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
getPlots
public Vector getPlots()
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
getPoint
public final Point getPoint()
- Gets where the user clicked.
- Returns:
- the Point which the user clicked
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)
setIndex
public void setIndex(int index)
- Sets the index in the vector for the primitive we're interested in
- Parameters:
- index - the primitive index
getIndex
public final int getIndex()
- Gets the index in the vector for the primitive we're interested in
- Returns:
- the primtive index
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
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.
operation
public abstract DrawingPrimitive operation()
- Abstract method that must be implemented by the subclassed
primitive.
setPlots
public void setPlots(Vector plots)
All Packages Class Hierarchy This Package Previous Next Index