att.grappa
Class GrappaNexus

java.lang.Object
  extended by att.grappa.GrappaNexus
All Implemented Interfaces:
GrappaConstants, java.awt.image.ImageObserver, java.awt.Shape, java.lang.Cloneable, java.util.Observer

public class GrappaNexus
extends java.lang.Object
implements GrappaConstants, java.lang.Cloneable, java.awt.image.ImageObserver, java.util.Observer, java.awt.Shape

This class brings together shape, text and attribute information related to bounding and drawing an element.

Version:
1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Field Summary
static double arcHeightFactor
          RoundRectangle arc height factor
static double arcWidthFactor
          RoundRectangle arc width factor
(package private)  java.awt.geom.Rectangle2D bbox
           
 boolean boundText
          Indicates if element text should be included in the element bounding box.
 boolean clearText
          Indicates if the area bounding the element text should be filled/outlined along with the element when being drawn.
(package private)  java.awt.Color color
           
private  java.lang.Object custom_shape
           
(package private)  boolean dirty
           
 boolean drawText
          Indicates if element text should be drawn when drawing the element.
(package private)  Element element
           
(package private)  java.awt.Color fillcolor
           
(package private)  java.awt.Font font
           
(package private)  java.awt.Color font_color
           
(package private)  java.awt.Image image
           
(package private)  boolean imageLoading
           
private  long lastDecorationUpdate
           
private  long lastImageUpdate
           
private  long lastShapeUpdate
           
private  long lastStyleUpdate
           
private  long lastTextUpdate
           
(package private)  long lastUpdate
           
(package private)  GrappaPoint[] lpos
           
(package private)  java.lang.String[] lstr
           
private  java.lang.Object[] objs
           
(package private)  java.awt.Shape shape
           
(package private)  int shapeType
           
(package private)  java.awt.Stroke stroke
           
(package private)  GrappaStyle style
           
(package private)  java.awt.geom.Area textArea
           
private  int windingRule
           
 
Fields inherited from interface att.grappa.GrappaConstants
_NO_TYPE, ANONYMOUS_PREFIX, BBOX_ATTR, BBOX_HASH, BOX_SHAPE, BOX_TYPE, CLUSTERRANK_ATTR, COLOR_ATTR, COLOR_HASH, COLOR_TYPE, CUSTOM_ATTR, CUSTOM_HASH, CUSTOM_SHAPE, DELETION_MASK, DIAMOND_SHAPE, DIR_ATTR, DIR_HASH, DIR_TYPE, DISTORTION_ATTR, DISTORTION_HASH, DOUBLE_TYPE, DOUBLECIRCLE_SHAPE, DOUBLEOCTAGON_SHAPE, EDGE, EGG_SHAPE, FILLCOLOR_ATTR, FILLCOLOR_HASH, FONTCOLOR_ATTR, FONTCOLOR_HASH, FONTNAME_ATTR, FONTNAME_HASH, FONTSIZE_ATTR, FONTSIZE_HASH, FONTSTYLE_ATTR, FONTSTYLE_HASH, FONTSTYLE_TYPE, GRAPPA_BACKGROUND_COLOR_ATTR, GRAPPA_BACKGROUND_COLOR_HASH, GRAPPA_DELETION_STYLE_ATTR, GRAPPA_DELETION_STYLE_HASH, GRAPPA_FONTSIZE_ADJUSTMENT_ATTR, GRAPPA_FONTSIZE_ADJUSTMENT_HASH, GRAPPA_SELECTION_STYLE_ATTR, GRAPPA_SELECTION_STYLE_HASH, GRAPPA_SHAPE, HASHLIST_TYPE, HEADLABEL_ATTR, HEADLABEL_HASH, HEADLP_ATTR, HEADLP_HASH, HEIGHT_ATTR, HEIGHT_HASH, HEXAGON_SHAPE, HIGHLIGHT_MASK, HIGHLIGHT_OFF, HIGHLIGHT_ON, HIGHLIGHT_TOGGLE, HOUSE_SHAPE, IDENTXFRM, IMAGE_ATTR, IMAGE_HASH, INTEGER_TYPE, INVERTEDHOUSE_SHAPE, INVERTEDTRAPEZIUM_SHAPE, INVERTEDTRIANGLE_SHAPE, LABEL_ATTR, LABEL_HASH, LINE_SHAPE, LINE_TYPE, LOG10, LP_ATTR, LP_HASH, MARGIN_ATTR, MARGIN_HASH, MCIRCLE_SHAPE, MCLIMIT_ATTR, MCLIMIT_HASH, MDIAMOND_SHAPE, MINBOX_ATTR, MINBOX_HASH, MINLEN_ATTR, MINLEN_HASH, MINSIZE_ATTR, MINSIZE_HASH, MRECORD_SHAPE, MSQUARE_SHAPE, NBSP, NEW_LINE, NO_SHAPE, NODE, NODESEP_ATTR, NODESEP_HASH, OCTAGON_SHAPE, ORIENTATION_ATTR, ORIENTATION_HASH, OVAL_SHAPE, PACKAGE_PREFIX, PARALLELOGRAM_SHAPE, PATCH_ATTR, PATCH_HASH, PENTAGON_SHAPE, PERIPHERIES_ATTR, PERIPHERIES_HASH, PERIPHERY_GAP, PKG_LOWER, PKG_UPLOW, PKG_UPPER, PLAINTEXT_SHAPE, POINT_SHAPE, POINT_TYPE, PointsPerInch, POLYGON_SHAPE, POS_ATTR, POS_HASH, PRINTLIST_ATTR, PRINTLIST_HASH, RANKDIR_ATTR, RANKDIR_HASH, RANKSEP_ATTR, RANKSEP_HASH, RECORD_SHAPE, RECTS_ATTR, RECTS_HASH, ROTATION_ATTR, ROTATION_HASH, ROUNDEDBOX_SHAPE, SELECTION_MASK, SHAPE_ATTR, SHAPE_HASH, SHAPE_MASK, SHAPE_TYPE, SIDES_ATTR, SIDES_HASH, SIZE_ATTR, SIZE_HASH, SIZE_TYPE, SKEW_ATTR, SKEW_HASH, STRING_TYPE, STYLE_ATTR, STYLE_HASH, STYLE_TYPE, SUBGRAPH, SYSTEM, TAG_ATTR, TAG_HASH, TAILLABEL_ATTR, TAILLABEL_HASH, TAILLP_ATTR, TAILLP_HASH, TIP_ATTR, TIP_HASH, TRAPEZIUM_SHAPE, TRIANGLE_SHAPE, TRIPLEOCTAGON_SHAPE, TYPES_SHIFT, WEIGHT_ATTR, WEIGHT_HASH, WIDTH_ATTR, WIDTH_HASH
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GrappaNexus(Element elem)
          Constructs a new GrappaNexus object from an element.
 
Method Summary
private  void bboxCheckSet()
           
 java.lang.Object clone()
          Creates a new object of the same class as this object.
 boolean contains(double x, double y)
           
 boolean contains(double x, double y, double width, double height)
           
 boolean contains(java.awt.geom.Point2D p)
           
 boolean contains(java.awt.geom.Rectangle2D r)
           
(package private)  void draw(java.awt.Graphics2D g2d)
          Draw the element using the supplied Graphics2D context.
(package private)  void drawImage(java.awt.Graphics2D g2d)
          Draw the image associated with the IMAGE_ATTR using the supplied Graphics2D context.
(package private)  void fill(java.awt.Graphics2D g2d)
          Fill the element using the supplied Graphics2D context.
 java.awt.Rectangle getBounds()
           
 java.awt.geom.Rectangle2D getBounds2D()
           
 Element getElement()
          Get the underlying element.
 java.awt.Image getImage()
          Return the image, if any, loaded for this element
 java.awt.geom.PathIterator getPathIterator()
          Equivalent to getPathIterator(null).
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
           
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
           
 int getWindingRule()
          Return the winding rule for this line.
 boolean imageUpdate(java.awt.Image image, int flags, int x, int y, int width, int height)
           
 boolean intersects(double x, double y, double width, double height)
           
 boolean intersects(java.awt.geom.Rectangle2D r)
           
 boolean isImageLoading()
          Return status of image loading.
(package private)  java.awt.geom.Rectangle2D rawBounds2D()
           
 void rebuild()
          Recompute the components of this GrappaNexus.
 void update(java.util.Observable obs, java.lang.Object arg)
          This method is called whenever the observed object is changed.
 void updateDecoration()
          Update the decoration information for the underlying element.
 void updateImage()
          Update the image information for the underlying element.
 void updateShape()
          Update the shape information for the underlying element.
 void updateStyle()
          Update the shape information for the underlying element.
 void updateText()
          Update the text information for the underlying element.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arcHeightFactor

public static double arcHeightFactor
RoundRectangle arc height factor


arcWidthFactor

public static double arcWidthFactor
RoundRectangle arc width factor


textArea

java.awt.geom.Area textArea

shape

java.awt.Shape shape

shapeType

int shapeType

bbox

java.awt.geom.Rectangle2D bbox

style

GrappaStyle style

fillcolor

java.awt.Color fillcolor

color

java.awt.Color color

image

java.awt.Image image

imageLoading

boolean imageLoading

dirty

boolean dirty

stroke

java.awt.Stroke stroke

objs

private java.lang.Object[] objs

custom_shape

private java.lang.Object custom_shape

boundText

public boolean boundText
Indicates if element text should be included in the element bounding box. By default, it is.

See Also:
Grappa.shapeBoundText

clearText

public boolean clearText
Indicates if the area bounding the element text should be filled/outlined along with the element when being drawn. By default, it is not.

See Also:
Grappa.shapeClearText

drawText

public boolean drawText
Indicates if element text should be drawn when drawing the element. By default, it is.

See Also:
Grappa.shapeDrawText

element

Element element

lastUpdate

long lastUpdate

lastShapeUpdate

private long lastShapeUpdate

lastTextUpdate

private long lastTextUpdate

lastStyleUpdate

private long lastStyleUpdate

lastDecorationUpdate

private long lastDecorationUpdate

lastImageUpdate

private long lastImageUpdate

font

java.awt.Font font

lstr

java.lang.String[] lstr

lpos

GrappaPoint[] lpos

font_color

java.awt.Color font_color

windingRule

private int windingRule
Constructor Detail

GrappaNexus

public GrappaNexus(Element elem)
Constructs a new GrappaNexus object from an element.

Parameters:
elem - the Element needing a GrappaNexus object.
Method Detail

getElement

public Element getElement()
Get the underlying element.

Returns:
the element underlying this GrappaNexus.

getImage

public java.awt.Image getImage()
Return the image, if any, loaded for this element

Returns:
an image or null

isImageLoading

public boolean isImageLoading()
Return status of image loading. Returns true whenever an image has begun loading for this element, but has not yet completed.

Returns:
true, during image loading; false, otherwise

getWindingRule

public int getWindingRule()
Return the winding rule for this line.

Returns:
one of WIND_NON_ZERO or WIND_EVEN_ODD

rebuild

public void rebuild()
Recompute the components of this GrappaNexus.

See Also:
updateStyle, updateDecoration, updateShape, updateText, updateImage

updateShape

public void updateShape()
Update the shape information for the underlying element. For nodes, the distortion, height, orientation, peripheries, pos, rotation, shape, sides, skew and width attributes are examined. For edges, the pos attribute is examined. For subgraph, the bounding box is recomputed.


updateStyle

public void updateStyle()
Update the shape information for the underlying element. The style attribute is examined.


updateText

public void updateText()
Update the text information for the underlying element. The fontcolor, fontname, fontsize, fontstyle, and label attributes are examined. The lp attribute is also examined for edges and subgraphs.


updateDecoration

public void updateDecoration()
Update the decoration information for the underlying element. The color and fontcolor attributes are examined. For edges, the dir attribute is examined.


updateImage

public void updateImage()
Update the image information for the underlying element.


imageUpdate

public final boolean imageUpdate(java.awt.Image image,
                                 int flags,
                                 int x,
                                 int y,
                                 int width,
                                 int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

bboxCheckSet

private void bboxCheckSet()

clone

public java.lang.Object clone()
Creates a new object of the same class as this object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.
Throws:
java.lang.OutOfMemoryError - if there is not enough memory.
See Also:
Cloneable

contains

public boolean contains(double x,
                        double y)
Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(double x,
                        double y,
                        double width,
                        double height)
Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Point2D p)
Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Rectangle2D r)
Specified by:
contains in interface java.awt.Shape

getBounds

public java.awt.Rectangle getBounds()
Specified by:
getBounds in interface java.awt.Shape

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Specified by:
getBounds2D in interface java.awt.Shape

rawBounds2D

java.awt.geom.Rectangle2D rawBounds2D()

getPathIterator

public java.awt.geom.PathIterator getPathIterator()
Equivalent to getPathIterator(null).

See Also:
getPathIterator(AffineTransform)

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Specified by:
getPathIterator in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at,
                                                  double flatness)
Specified by:
getPathIterator in interface java.awt.Shape

intersects

public boolean intersects(double x,
                          double y,
                          double width,
                          double height)
Specified by:
intersects in interface java.awt.Shape

intersects

public boolean intersects(java.awt.geom.Rectangle2D r)
Specified by:
intersects in interface java.awt.Shape

update

public void update(java.util.Observable obs,
                   java.lang.Object arg)
This method is called whenever the observed object is changed. When certain observed attributes (attributes of interest) are changed, this method will update the GrappaNexus as needed.

Specified by:
update in interface java.util.Observer
Parameters:
obs - the Observable must be an Attribute
arg - either a Long giving the update time of the Attribute as returned by System.getTimeInMillis() or it is a two element Object array, where the first element is a new Attribute to be observed in place of that passed via obs and the second element is the update time of this new Attribute.

draw

void draw(java.awt.Graphics2D g2d)
Draw the element using the supplied Graphics2D context.

Parameters:
g2d - the Graphics2D context to be used for drawing

fill

void fill(java.awt.Graphics2D g2d)
Fill the element using the supplied Graphics2D context.

Parameters:
g2d - the Graphics2D context to be used for drawing

drawImage

void drawImage(java.awt.Graphics2D g2d)
Draw the image associated with the IMAGE_ATTR using the supplied Graphics2D context.

Parameters:
g2d - the Graphics2D context to be used for drawing