All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.DrawEdgePeer

java.lang.Object
   |
   +----att.grappa.DrawObjectPeer
           |
           +----att.grappa.DrawEdgePeer

public class DrawEdgePeer
extends DrawObjectPeer
This class provides the basis for actually drawing edge elements on a pane. Extensions of this class and its subclasses allow for the specific drawing requirements of a particular edge element. For each DrawEdge instance and target DrawPane instance, there is one DrawEdgePeer instance. The size and position of the object are possibly scaled and translated from the values originally supplied through the element attributes as a consequence of the characteristics of the DrawPane. Certainly the y-axis is flipped to account for the origin at the upper-left as used by the AWT versus the origin to the lower-left as used by the graph.

Version:
1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Variable Index

 o bbox
 o endArrow
 o lineSize
 o polyline
 o startArrow

Constructor Index

 o DrawEdgePeer(DrawEdge, DrawPane)
Creates a DrawEdgePeer related to the supplied DrawEdge and DrawPane.

Method Index

 o draw(Graphics, GraphicContext)
Draws the edge using the specified graphics information.
 o getBounds()
Gets the bounds of this peer in terms of the DrawPane coordinates.
 o getDrawEdge()
Get the DrawEdge object associated with this peer
 o inPeer(int, int)
Checks if the supplied co-ordinates are in the specific shape of this peer.
 o setupPeer(boolean)
Setup this peer.

Variables

 o polyline
 protected Polygon polyline
 o startArrow
 protected Polygon startArrow
 o endArrow
 protected Polygon endArrow
 o bbox
 protected Rectangle bbox
 o lineSize
 protected int lineSize

Constructors

 o DrawEdgePeer
 public DrawEdgePeer(DrawEdge drawEdge,
                     DrawPane pane)
Creates a DrawEdgePeer related to the supplied DrawEdge and DrawPane.

Parameters:
drawEdge - the source object for this peer object
pane - the pane to use when drawing this peer

Methods

 o inPeer
 public boolean inPeer(int x,
                       int y)
Checks if the supplied co-ordinates are in the specific shape of this peer.

Parameters:
x - the x co-ordinate to check
y - the y co-ordinate to check
Returns:
true if the co-ordinates lie inside the peer or on its boundary, false otherwise.
Overrides:
inPeer in class DrawObjectPeer
 o getBounds
 public Rectangle getBounds()
Gets the bounds of this peer in terms of the DrawPane coordinates.

Returns:
the bounding box of this object
Overrides:
getBounds in class DrawObjectPeer
 o setupPeer
 public void setupPeer(boolean setupTextToo)
Setup this peer. The setup does the actual co-ordinate mappings from what is available in the DrawEdge object to the DrawPane co-ordinates.

Parameters:
setupTextToo - indicates if text peer should be setup as well
Overrides:
setupPeer in class DrawObjectPeer
 o getDrawEdge
 public DrawEdge getDrawEdge()
Get the DrawEdge object associated with this peer

Returns:
the associated DrawEdge object
 o draw
 public void draw(Graphics gr,
                  GraphicContext context)
Draws the edge using the specified graphics information.

Parameters:
gr - the AWT graphic context to use for drawing
context - the Grappa context to use for drawing
Overrides:
draw in class DrawObjectPeer

All Packages  Class Hierarchy  This Package  Previous  Next  Index