All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.TextLabelPeer

java.lang.Object
   |
   +----att.grappa.TextLabelPeer

public class TextLabelPeer
extends Object
A class for drawing text labels. The TextLabelPeer is associated with a DrawObjectPeer and a TextLabel.

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

Constructor Index

 o TextLabelPeer(DrawObjectPeer, TextLabel)
Creates a TextLabelPeer instance.

Method Index

 o draw(Graphics, GraphicContext)
Draws the text label using the specified graphics information.
 o drawString(String, Point, int, GraphicContext, Graphics, DrawPane)
Draw a string in the drawing pane.
 o getBounds()
Gets the bounds of this peer in terms of the DrawPane coordinates.
 o getCenter()
Get the (scaled) center point of the text.
 o getDrawObject()
Get the DrawObject associated with this object.
 o getDrawObjectPeer()
Get the DrawObjectPeer associated with this object.
 o getDrawPane()
Get the DrawPane associated with this object.
 o getTextLabel()
Get the TextLabel associated with this object.
 o inPeer(int, int)
Checks if the supplied co-ordinates are in this peer.
 o setupPeer()
Setup this peer.

Constructors

 o TextLabelPeer
 public TextLabelPeer(DrawObjectPeer drwObjPr,
                      TextLabel textLabel)
Creates a TextLabelPeer instance.

Parameters:
drwObjPr - the DrawObjectPeer associated with this TextLabelPeer
textLabel - the TextLabel associated with this peer

Methods

 o getBounds
 public Rectangle getBounds()
Gets the bounds of this peer in terms of the DrawPane coordinates.

Returns:
the bounding box of the peer
 o inPeer
 public boolean inPeer(int x,
                       int y)
Checks if the supplied co-ordinates are in 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; false otherwise.
 o draw
 public void draw(Graphics gr,
                  GraphicContext context)
Draws the text label using the specified graphics information.

Parameters:
gr - the AWT graphics context to use for drawing, if the value is null, then the off-screen canvas Graphics is used.
context - the graphic context to use when drawing. If the context is null, the object's context is used.
 o getDrawObjectPeer
 public DrawObjectPeer getDrawObjectPeer()
Get the DrawObjectPeer associated with this object.

Returns:
the associated DrawObjectPeer.
 o getDrawObject
 public DrawObject getDrawObject()
Get the DrawObject associated with this object. The association is through the DrawObjectPeer.

Returns:
the associated DrawObject.
See Also:
getDrawObjectPeer
 o getTextLabel
 public TextLabel getTextLabel()
Get the TextLabel associated with this object.

Returns:
the associated TextLabel.
 o getDrawPane
 public DrawPane getDrawPane()
Get the DrawPane associated with this object. The association is through the DrawObjectPeer.

Returns:
the associated DrawPane.
See Also:
getDrawObjectPeer
 o setupPeer
 public void setupPeer()
Setup this peer. The setup does the actual co-ordinate mappings from what is available in the TextLabel object to the DrawPane co-ordinates.

 o drawString
 public static void drawString(String text,
                               Point pt,
                               int justify,
                               GraphicContext gc,
                               Graphics gr,
                               DrawPane dp)
Draw a string in the drawing pane.

Parameters:
text - the text to draw
pt - the center point of the text in graph co-ordinates
justify - text justification indicator
gc - the Grappa graphic context to use
gr - the AWT graphic context to use
dp - the drawing pane whose linear mapping will be used
 o getCenter
 public Point getCenter()
Get the (scaled) center point of the text.

Returns:
the text center point.

All Packages  Class Hierarchy  This Package  Previous  Next  Index