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

Variable Index

 o ARC
Indicator for an arc shape
 o attrOrientation
The orientation specified by the orientation attribute of this node
 o attrStyle
The style specified by the style attribute of this node
 o AUXLABELS
Indicator that the shape has auxiliary labels
 o DIAGONALS
Indicator for drawing additional lines within the shape (e.g., Msquare)
 o distortion
The amount of distortion to introduce into the drawn shape
 o drawOrientation
The orientation used for drawing.
 o drawPoints
A vector of IntPairs for drawing (a Vector is used to handle the case of peripheries > 1)
 o drawShape
The actual shape used for drawing.
 o drawStyle
The style used for drawing.
 o FILLED
Indicator that the shape should be fill-shaded
 o FIXED_SIZE
Indicator that the shape should be of fixed size (when scaled)
 o orientation
The default orientation of this node
 o OVAL
Indicator for an oval shape
 o peripheries
The number of peripheries
 o PERIPHERY_GAP
Gap in pixels between peripheries
 o POLYGON
Indicator for a polygon shape
 o position
The position of the node (resulting from interpreting the pos attributes).
 o RECT
Indicator for a rectangle shape
 o regular
Set to true when width should equal height (as with a Circle or Square).
 o ROUNDED
Indicator for rounding the corner of a shape
 o shape
Defines the drawing style of the node; its value is set when the class object is created
 o sides
The number of sides for this node.
 o size
The size of the node (resulting from interpreting the width and height attributes).
 o skew
The amount of skewness to introduce into the drawn shape
 o style
The default style of this node
 o TABLE
Indicator for a table (record) shape
 o TEXT
Indicator for a text (plain text) shape

Constructor Index

 o DrawNode()
This constructor creates an uninitialized DrawNode object.

Method Index

 o createPeer(DrawPane)
Creates the drawing peer specific for this object and the specified pane.
 o getDrawOrientation()
Get the angle in degrees representing the drawing orientation of this node.
 o getDrawPoints()
Get the points needed for drawing this node.
 o getDrawShape()
Get the integer representation of the shape as used for drawing for this node.
 o getDrawStyle()
Get the integer representation of the style as used for drawing for this node.
 o getPeripheries()
Get the number of peripheries for this node.
 o getPosition()
 o getShape()
Get the integer representation of the shape as initially specified for this node.
 o getSize()
 o isFixedSize()
 o setBounds()
This method to be called when the bounding box needs to be calculated.
 o setBox()
This method sets up the information needed to draw the node.
 o setPolygon()
This method sets up the information needed to draw the node.
 o setTable()
 o update(Observable, Object)
This method is called whenever an observed Attribute is changed.

Variables

 o PERIPHERY_GAP
 protected static final int PERIPHERY_GAP
Gap in pixels between peripheries

 o ARC
 protected static final int ARC
Indicator for an arc shape

 o OVAL
 protected static final int OVAL
Indicator for an oval shape

 o POLYGON
 protected static final int POLYGON
Indicator for a polygon shape

 o RECT
 protected static final int RECT
Indicator for a rectangle shape

 o TABLE
 protected static final int TABLE
Indicator for a table (record) shape

 o TEXT
 protected static final int TEXT
Indicator for a text (plain text) shape

 o DIAGONALS
 protected static final int DIAGONALS
Indicator for drawing additional lines within the shape (e.g., Msquare)

 o ROUNDED
 protected static final int ROUNDED
Indicator for rounding the corner of a shape

 o AUXLABELS
 protected static final int AUXLABELS
Indicator that the shape has auxiliary labels

 o FILLED
 protected static final int FILLED
Indicator that the shape should be fill-shaded

 o FIXED_SIZE
 protected static final int FIXED_SIZE
Indicator that the shape should be of fixed size (when scaled)

 o shape
 protected int shape
Defines the drawing style of the node; its value is set when the class object is created

 o 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.

 o size
 protected Dimension size
The size of the node (resulting from interpreting the width and height attributes).

 o position
 protected Point position
The position of the node (resulting from interpreting the pos attributes).

 o regular
 protected boolean regular
Set to true when width should equal height (as with a Circle or Square).

 o peripheries
 protected int peripheries
The number of peripheries

 o orientation
 protected double orientation
The default orientation of this node

 o attrOrientation
 protected double attrOrientation
The orientation specified by the orientation attribute of this node

 o drawOrientation
 protected double drawOrientation
The orientation used for drawing. It is the sum of the orientation and attrOrientation variables.

 o 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.

 o distortion
 protected double distortion
The amount of distortion to introduce into the drawn shape

 o skew
 protected double skew
The amount of skewness to introduce into the drawn shape

 o style
 protected int style
The default style of this node

 o attrStyle
 protected int attrStyle
The style specified by the style attribute of this node

 o drawStyle
 protected int drawStyle
The style used for drawing. It is the bitwise OR-ing of the style and attrStyle variables.

 o drawPoints
 protected Vector drawPoints
A vector of IntPairs for drawing (a Vector is used to handle the case of peripheries > 1)

Constructors

 o 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

Methods

 o 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
 o 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
 o 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
 o setTable
 protected void setTable()
 o getPosition
 public Point getPosition()
Returns:
the node position (center point).
 o getSize
 public Dimension getSize()
Returns:
the node size.
 o 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
 o getDrawOrientation
 public double getDrawOrientation()
Get the angle in degrees representing the drawing orientation of this node.

Returns:
the drawing angle in degrees
 o 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
 o 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
 o 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
 o getPeripheries
 public int getPeripheries()
Get the number of peripheries for this node.

Returns:
the number of peripheries
 o 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
 o 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
 o isFixedSize
 public boolean isFixedSize()

All Packages  Class Hierarchy  This Package  Previous  Next  Index