|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractPaintable
|
+--com.rolemodelsoft.drawlet.basics.AbstractFigure
|
+--com.rolemodelsoft.drawlet.text.TextLabel
This provides a basic implementation of a figure which displays simple text. It is assumed that this figure may be connected to another figure via its locator, but it can be used as just raw text also.
| Field Summary | |
protected java.awt.Font |
font
The font with which to paint the label. |
protected int |
height
Used to cache the height value to calc bounds faster. |
protected int |
left
Used to cache the left value to calc bounds faster. |
protected MovableLocator |
locator
The location of the label, the topLeft of where the string shows up. |
protected StringRenderer |
renderer
The renderer used to actually display the label. |
protected java.lang.String |
string
The string which serves as the label. |
protected java.awt.Color |
textColor
The color with which to paint the label. |
protected int |
top
Used to cache the top value to calc bounds faster. |
protected static int |
unset
Since ints are not objects and zero could be valid for any cache, we need to come up with "unset" values for each. |
protected int |
width
Used to cache the width value to calc bounds faster. |
| Fields inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure |
listeners,
locationListeners |
| Constructor Summary | |
TextLabel()
Constructs a new instance of a label. |
|
TextLabel(java.awt.Color color)
Constructs and initializes a new instance of a label with the given Color. |
|
TextLabel(java.awt.Font font)
Constructs and initializes a new instance of a label with the given Font. |
|
TextLabel(java.awt.Font font,
java.awt.Color color)
Constructs and initializes a new instance of a label with the given Font and Color. |
|
TextLabel(java.lang.String string)
Constructs and initializes a new instance of a label with the given String. |
|
TextLabel(java.lang.String string,
java.awt.Font font)
Constructs and initializes a new instance of a label with the given String and Font. |
|
TextLabel(java.lang.String string,
java.awt.Font font,
java.awt.Color color)
Constructs and initializes a new instance of a label with the given String, Font, and Color. |
|
| Method Summary | |
protected void |
basicMove(Locator newLocator)
Moves the receiver to a new location. |
protected void |
basicTranslate(int x,
int y)
Moves the receiver in the x and y direction. |
protected java.awt.Font |
defaultFont()
Answer the default/initial value for the Font. |
protected MovableLocator |
defaultLocator()
Answer the default/initial value for the Locator. |
protected java.lang.String |
defaultString()
Answer the default/initial value for the String. |
protected java.awt.Color |
defaultTextColor()
Answer the default/initial value for the color to paint the text. |
java.lang.Object |
duplicateIn(java.util.Hashtable duplicates)
Duplicates the receiver and places the duplicate in the given Hashtable. |
Handle |
editTool(int x,
int y)
Answers a Handle that will provide editing capabilities on the receiver. |
protected void |
freeFromFigure(Figure figure)
Remove any dependence on the Figure. |
java.awt.Rectangle |
getBounds()
Returns the current bounds of the receiver. |
java.awt.Font |
getFont()
Answer the Font with which the receiver paints. |
Handle[] |
getHandles()
Answer the Handles associated with the receiver. |
int |
getHeight()
Returns the height of the receiver. |
java.awt.Rectangle |
getLabelBounds()
Returns the current bounds of the label. |
protected int |
getLabelHeight()
Returns the height of the label of this figure. |
protected int |
getLabelLeft()
Returns the leftmost coordinate of the label of this figure. |
protected int |
getLabelTop()
Returns the topmost coordinate of the label of this figure. |
protected int |
getLabelWidth()
Returns the width of the label of this figure. |
int |
getLeft()
Returns the leftmost coordinate of the receiver. |
Locator |
getLocator()
Returns the current locator of the receiver. |
protected StringRenderer |
getRenderer()
Answer the renderer to use to display the label. |
java.lang.String |
getString()
Answer the String the receiver paints. |
DrawingStyle |
getStyle()
Answer the DrawingStyle which defines how to paint the receiver. |
java.awt.Color |
getTextColor()
Answer the Color to use when drawing text. |
int |
getTop()
Returns the topmost coordinate of the receiver. |
int |
getWidth()
Returns the width of the receiver. |
protected boolean |
isListening(Figure figure)
Answers whether the receiver is listening to the figure directly or indirectly (via chain of listeners). |
boolean |
isObsolete()
Answers whether the receiver is obsolete True if some event has happened that makes this a meaningless object. |
void |
locationChanged(java.beans.PropertyChangeEvent event)
Called when the location of something the receiver is listening to has changed. |
void |
move(Locator locator)
Moves the receiver to a new location. |
void |
paint(java.awt.Graphics g)
Paints the receiver. |
void |
postDuplicate(java.util.Hashtable duplicates)
After a series of Figures are duplicated, this can be sent to each of the duplicates to resolve any changes it might like to reconcile. |
void |
relationChanged(java.beans.PropertyChangeEvent event)
Called when the relation of something the receiver is listening to has changed. |
Locator |
requestConnection(Figure requestor,
int x,
int y)
Answers a Locator corresponding to a significant point on the receiver that will serve as a connection to the requesting Figure. |
protected void |
resetBoundsCache()
Flush caches with respect to determining bounds. |
protected void |
resetLocationCache()
Flush caches with respect to determining location |
protected void |
resetSizeCache()
Flush caches with respect to determining size |
void |
setFont(java.awt.Font newFont)
Set the Font with which to paint text This is a TemplateMethod with hooks: resetBoundsCache() changedShape() |
void |
setString(java.lang.String newString)
Set the string the figure paints. |
void |
setStyle(DrawingStyle style)
Set the style defining how to paint the figure. |
void |
setTextColor(java.awt.Color color)
Set the Color to use when drawing text. |
void |
shapeChanged(java.beans.PropertyChangeEvent event)
Called when the shape of something the receiver is listening to has changed. |
void |
sizeChanged(java.beans.PropertyChangeEvent event)
Called when the size of something the receiver is listening to has changed. |
protected void |
updateLocation()
The Figure has notified the receiver of a change. |
protected int |
xMargin()
Answer the margin to use in the x direction. |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure |
addPropertyChangeListener,
addRelatedLocationListener,
basicMove,
changedLocation,
changedShape,
changedSize,
contains,
contains,
contains,
deleteLocationListeners,
disconnect,
duplicate,
estimatedDuplicateSize,
figureFromLocator,
fireLocationChange,
firePropertyChange,
firePropertyChange,
fireRelationChange,
fireShapeChange,
fireSizeChange,
getLocation,
intersects,
intersects,
isWithin,
isWithin,
locatorAt,
move,
relatedLocationListeners,
removePropertyChangeListener,
removeRelatedLocationListener,
setBounds,
setSize,
setSize,
translate |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractPaintable |
getBottom,
getRight,
getSize |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected java.lang.String string
protected java.awt.Font font
protected java.awt.Color textColor
protected MovableLocator locator
protected transient StringRenderer renderer
protected static int unset
protected int width
protected int height
protected int left
protected int top
| Constructor Detail |
public TextLabel()
public TextLabel(java.awt.Color color)
color - the color with which to display the labelpublic TextLabel(java.awt.Font font)
font - the font with which to display the label.
public TextLabel(java.awt.Font font,
java.awt.Color color)
font - the Font with which to display the label.color - the Color with which to display the label.public TextLabel(java.lang.String string)
string - the String to display as the label.
public TextLabel(java.lang.String string,
java.awt.Font font)
string - the String to display as the label.font - the Font with which to display the label.
public TextLabel(java.lang.String string,
java.awt.Font font,
java.awt.Color color)
string - the String to display as the label.font - the Font with which to display the label.color - the Color with which to display the label.| Method Detail |
protected void basicMove(Locator newLocator)
newLocator - the Locator to base the figure's positiongetLocator(),
move(com.rolemodelsoft.drawlet.Locator)
protected void basicTranslate(int x,
int y)
x - amount to move in the x directiony - amount to move in the y directiongetLocator()protected java.awt.Font defaultFont()
protected MovableLocator defaultLocator()
protected java.lang.String defaultString()
protected java.awt.Color defaultTextColor()
public java.lang.Object duplicateIn(java.util.Hashtable duplicates)
duplicates - the Hashtable to put the duplicate in.
public Handle editTool(int x,
int y)
x - the x coordinate to potentially begin editing.y - the y coordinate to potentially begin editing.protected void freeFromFigure(Figure figure)
figure - the Figure to disassociate.public java.awt.Rectangle getBounds()
public java.awt.Font getFont()
public Handle[] getHandles()
public int getHeight()
public java.awt.Rectangle getLabelBounds()
protected int getLabelHeight()
protected int getLabelLeft()
protected int getLabelTop()
protected int getLabelWidth()
public int getLeft()
public Locator getLocator()
protected StringRenderer getRenderer()
public java.lang.String getString()
public DrawingStyle getStyle()
public java.awt.Color getTextColor()
public int getTop()
public int getWidth()
protected boolean isListening(Figure figure)
figure - the Figure to test.public boolean isObsolete()
public void locationChanged(java.beans.PropertyChangeEvent event)
event - the event describing the change.public void move(Locator locator)
locator - the Locator which identifies the desired x, y coordinates.getLocator(),
basicMove(com.rolemodelsoft.drawlet.Locator)public void paint(java.awt.Graphics g)
g - the specified Graphics window.public void postDuplicate(java.util.Hashtable duplicates)
duplicates - a Hashtable with originals as keys and duplicates as elements.public void relationChanged(java.beans.PropertyChangeEvent event)
event - the event describing the change.
public Locator requestConnection(Figure requestor,
int x,
int y)
x - the x coordinate of the requested locatory - the y coordinate of the requested locatorprotected void resetBoundsCache()
protected void resetLocationCache()
protected void resetSizeCache()
public void setFont(java.awt.Font newFont)
newFont - the Font to use for text.public void setString(java.lang.String newString)
newString - the string to paint.public void setStyle(DrawingStyle style)
style - the specified DrawingStyle.public void setTextColor(java.awt.Color color)
color - the Color.public void shapeChanged(java.beans.PropertyChangeEvent event)
event - the event describing the change.public void sizeChanged(java.beans.PropertyChangeEvent event)
event - the event describing the change.protected void updateLocation()
protected int xMargin()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||