All Packages Class Hierarchy This Package Previous Next Index
Class att.grappa.DrawNode
java.lang.Object
|
+----att.grappa.DrawObject
|
+----att.grappa.DrawNode
- public class DrawNode
- extends DrawObject
The base class for node drawing.
Simple extensions of this class permit the drawing of a wide variety
of shapes. Consequently, many of the variables are made directly
available to subclasses of this one.
- Version:
- 1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
- Author:
- John Mocenigo, Research @ AT&T Labs
-
ARC
- Indicator for an arc shape
-
attrOrientation
- The orientation specified by the orientation attribute of this node
-
attrStyle
- The style specified by the style attribute of this node
-
AUXLABELS
- Indicator that the shape has auxiliary labels
-
DIAGONALS
- Indicator for drawing additional lines within the shape (e.g., Msquare)
-
distortion
- The amount of distortion to introduce into the drawn shape
-
drawOrientation
- The orientation used for drawing.
-
drawPoints
- A vector of IntPairs for drawing (a Vector is used to handle the
case of peripheries > 1)
-
drawShape
- The actual shape used for drawing.
-
drawStyle
- The style used for drawing.
-
FILLED
- Indicator that the shape should be fill-shaded
-
FIXED_SIZE
- Indicator that the shape should be of fixed size (when scaled)
-
orientation
- The default orientation of this node
-
OVAL
- Indicator for an oval shape
-
peripheries
- The number of peripheries
-
PERIPHERY_GAP
- Gap in pixels between peripheries
-
POLYGON
- Indicator for a polygon shape
-
position
- The position of the node (resulting from interpreting the pos attributes).
-
RECT
- Indicator for a rectangle shape
-
regular
- Set to true when width should equal height (as with a Circle or Square).
-
ROUNDED
- Indicator for rounding the corner of a shape
-
shape
- Defines the drawing style of the node; its
value is set when the class object is created
-
sides
- The number of sides for this node.
-
size
- The size of the node (resulting from interpreting the width and
height attributes).
-
skew
- The amount of skewness to introduce into the drawn shape
-
style
- The default style of this node
-
TABLE
- Indicator for a table (record) shape
-
TEXT
- Indicator for a text (plain text) shape
-
DrawNode()
- This constructor creates an uninitialized DrawNode object.
-
createPeer(DrawPane)
- Creates the drawing peer specific for this object and the specified pane.
-
getDrawOrientation()
- Get the angle in degrees representing the drawing orientation of this node.
-
getDrawPoints()
- Get the points needed for drawing this node.
-
getDrawShape()
- Get the integer representation of the shape as used for drawing for this node.
-
getDrawStyle()
- Get the integer representation of the style as used for drawing for this node.
-
getPeripheries()
- Get the number of peripheries for this node.
-
getPosition()
-
-
getShape()
- Get the integer representation of the shape as initially specified for this node.
-
getSize()
-
-
isFixedSize()
-
-
setBounds()
- This method to be called when the bounding box needs to be calculated.
-
setBox()
- This method sets up the information needed to draw the node.
-
setPolygon()
- This method sets up the information needed to draw the node.
-
setTable()
-
-
update(Observable, Object)
- This method is called whenever an observed Attribute is changed.
PERIPHERY_GAP
protected static final int PERIPHERY_GAP
- Gap in pixels between peripheries
ARC
protected static final int ARC
- Indicator for an arc shape
OVAL
protected static final int OVAL
- Indicator for an oval shape
POLYGON
protected static final int POLYGON
- Indicator for a polygon shape
RECT
protected static final int RECT
- Indicator for a rectangle shape
TABLE
protected static final int TABLE
- Indicator for a table (record) shape
TEXT
protected static final int TEXT
- Indicator for a text (plain text) shape
DIAGONALS
protected static final int DIAGONALS
- Indicator for drawing additional lines within the shape (e.g., Msquare)
ROUNDED
protected static final int ROUNDED
- Indicator for rounding the corner of a shape
AUXLABELS
protected static final int AUXLABELS
- Indicator that the shape has auxiliary labels
FILLED
protected static final int FILLED
- Indicator that the shape should be fill-shaded
FIXED_SIZE
protected static final int FIXED_SIZE
- Indicator that the shape should be of fixed size (when scaled)
shape
protected int shape
- Defines the drawing style of the node; its
value is set when the class object is created
drawShape
protected int drawShape
- The actual shape used for drawing.
This value may differ from
shape
since
setBounds()
may alter the value of
drawShape
from that
of shape
to use
a polygon to handle skewing a rectangle, for example.
size
protected Dimension size
- The size of the node (resulting from interpreting the width and
height attributes).
position
protected Point position
- The position of the node (resulting from interpreting the pos attributes).
regular
protected boolean regular
- Set to true when width should equal height (as with a Circle or Square).
peripheries
protected int peripheries
- The number of peripheries
orientation
protected double orientation
- The default orientation of this node
attrOrientation
protected double attrOrientation
- The orientation specified by the orientation attribute of this node
drawOrientation
protected double drawOrientation
- The orientation used for drawing.
It is the sum of the orientation and attrOrientation variables.
sides
protected int sides
- The number of sides for this node.
When sides is less than three, an oval shape is indicated; otherwise
it specifies the number of sides of a polygon. If the bounding box
is square, then the sides are sure to be of equal length.
distortion
protected double distortion
- The amount of distortion to introduce into the drawn shape
skew
protected double skew
- The amount of skewness to introduce into the drawn shape
style
protected int style
- The default style of this node
attrStyle
protected int attrStyle
- The style specified by the style attribute of this node
drawStyle
protected int drawStyle
- The style used for drawing.
It is the bitwise OR-ing of the style and attrStyle variables.
drawPoints
protected Vector drawPoints
- A vector of IntPairs for drawing (a Vector is used to handle the
case of peripheries > 1)
DrawNode
public DrawNode()
- This constructor creates an uninitialized DrawNode object.
Upon creation, a default
set of attributes for observing are specified (in addition to those
specified when its
super()
constructor is called.
- See Also:
- Observer
setBounds
public Rectangle setBounds()
- This method to be called when the bounding box needs to be calculated.
- Returns:
- the bounding box of this object in graph co-ordinates
- Overrides:
- setBounds in class DrawObject
setBox
protected void setBox()
- This method sets up the information needed to draw the node.
It is called from setBounds (where drawOrientation is set).
After obtaining the bounding box, it sets up the outline and
additional periphery information for shapes other than those that
require the
Graphics
method drawPolygon()
.
- See Also:
- setPolygon
setPolygon
protected void setPolygon()
- This method sets up the information needed to draw the node.
It is called from setBounds (where drawOrientation is set).
After obtaining the bounding box, it sets up the outline and
additional periphery information for shapes that
require the
Graphics
method drawPolygon()
.
- See Also:
- setPolygon
setTable
protected void setTable()
getPosition
public Point getPosition()
- Returns:
- the node position (center point).
getSize
public Dimension getSize()
- Returns:
- the node size.
getDrawStyle
public int getDrawStyle()
- Get the integer representation of the style as used for drawing for this node.
- Returns:
- the drawing style of this node as an integer
- See Also:
- DIAGONALS, ROUNDED, AUXLABELS, FILLED
getDrawOrientation
public double getDrawOrientation()
- Get the angle in degrees representing the drawing orientation of this node.
- Returns:
- the drawing angle in degrees
getDrawPoints
public Vector getDrawPoints()
- Get the points needed for drawing this node.
The drawing points are contained in a vector of
IntPairs
,
each element of the vector is one of the peripheries of the node.
The first element in the vector is the outermost periphery.
The points represented by the elements in the IntPairs
are
either the actual points needed to draw the shape, as in the case of
polygon shapes, or are the points that define the shapes bounding box,
which are sufficient for drawing rectangles, ovals and arcs.
- Returns:
- a vector of
IntPairs
objects
getDrawShape
public int getDrawShape()
- Get the integer representation of the shape as used for drawing for this node.
- Returns:
- the drawing shape of this node as an integer
- See Also:
- ARC, OVAL, POLYGON, RECT, TABLE, TEXT
getShape
public int getShape()
- Get the integer representation of the shape as initially specified for this node.
- Returns:
- the shape of this node as an integer
- See Also:
- ARC, OVAL, POLYGON, RECT, TABLE, TEXT
getPeripheries
public int getPeripheries()
- Get the number of peripheries for this node.
- Returns:
- the number of peripheries
update
public void update(Observable obs,
Object arg)
- This method is called whenever an observed Attribute is changed.
It is required by the
Observer
interface.
- Parameters:
- obs - the observable object that has been updated
- arg - when not null, it indicates that
obs
need no longer be
observed and in its place arg
should be observed.
- Overrides:
- update in class DrawObject
createPeer
public void createPeer(DrawPane pane)
- Creates the drawing peer specific for this object and the specified pane.
- Parameters:
- pane - the
DrawPane
upon which the object will be drawn.
- Overrides:
- createPeer in class DrawObject
isFixedSize
public boolean isFixedSize()
All Packages Class Hierarchy This Package Previous Next Index