|
JHotDraw 7.0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jhotdraw.draw.AbstractFigure
org.jhotdraw.draw.AttributedFigure
org.jhotdraw.draw.TextAreaFigure
public class TextAreaFigure
A TextAreaFigure contains formatted text.
It automatically rearranges the text to fit its allocated display area,
breaking the lines at word boundaries whenever possible.
The text can contain either LF or CRLF sequences to separate paragraphs,
as well as tab characters for table like formatting and alignment.
Currently the tabs are distributed at regular intervals as determined by
the TabSize property. Tabs align correctly with either fixed
or variable fonts.
If, when resizing, the vertical size of the display box is not enough to
display all the text, TextAreaFigure displays a dashed red line at the
bottom of the figure to indicate there is hidden text.
TextAreFigure uses all standard attributes for the area Rectangle2D.Double,
ie: FillColor, PenColor for the border, FontSize, FontStyle, and FontName,
as well as four additional attributes LeftMargin, RightMargin, TopMargin,
and TabSize.
XXX - TextAreaFigure should not draw a rectangle on its own but rather rely on a decorator. We probably need a DecoratorConnector for this and we need a way to specify the inner bounds of the decorator. We also need a way to center the text of the TextAreaFigure verticaly and horizontaly.
| Field Summary |
|---|
| Fields inherited from class org.jhotdraw.draw.AbstractFigure |
|---|
changingDepth, decorator, listenerList |
| Constructor Summary | |
|---|---|
TextAreaFigure()
Creates a new instance. |
|
TextAreaFigure(java.lang.String text)
|
|
| Method Summary | |
|---|---|
void |
basicSetBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
Sets the logical bounds of the figure and of its decorator figure. |
void |
basicTransform(java.awt.geom.AffineTransform tx)
Moves the figure. |
TextAreaFigure |
clone()
Returns a clone of the figure. |
boolean |
contains(java.awt.geom.Point2D.Double p)
Checks if a point is contained by the figure. |
java.util.Collection<Handle> |
createHandles(int detailLevel)
Creates handles used to manipulate the figure. |
protected void |
drawFill(java.awt.Graphics2D g)
This method is called by method draw() to draw the fill area of the figure. |
protected void |
drawStroke(java.awt.Graphics2D g)
This method is called by method draw() to draw the text of the figure . |
protected void |
drawText(java.awt.Graphics2D g)
|
java.awt.geom.Rectangle2D.Double |
getBounds()
Returns the logical bounds of the figure as a Rectangle. |
java.awt.Color |
getFillColor()
|
java.awt.Font |
getFont()
|
float |
getFontSize()
|
Insets2DDouble |
getInsets()
Returns the insets used to draw text. |
TextHolder |
getLabelFor()
|
java.lang.Object |
getRestoreData()
Gets data which can be used to restore the shape of the figure after a basicTransform has been applied to it. |
int |
getTabSize()
Gets the number of characters used to expand tabs. |
java.lang.String |
getText()
Gets the text shown by the text figure. |
java.awt.Color |
getTextColor()
|
int |
getTextColumns()
Gets the number of columns to be overlaid when the figure is edited. |
Tool |
getTool(java.awt.geom.Point2D.Double p)
Returns a specialized tool for the given coordinate. |
boolean |
isEditable()
|
void |
read(DOMInput in)
|
protected void |
readBounds(DOMInput in)
|
void |
restoreTo(java.lang.Object geometry)
Restores the shape of the figure to a previously stored state. |
void |
setEditable(boolean b)
|
void |
setFontSize(float size)
|
void |
setText(java.lang.String newText)
Sets the text shown by the text figure. |
protected void |
validate()
|
void |
write(DOMOutput out)
|
protected void |
writeBounds(DOMOutput out)
|
| Methods inherited from class org.jhotdraw.draw.AttributedFigure |
|---|
applyAttributesTo, basicSetAttribute, drawConnectors, drawFigure, getAttribute, getAttributeKey, getAttributes, getFigureDrawBounds, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, setAttribute, setAttributeEnabled, setAttributes, writeAttributes |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TextAreaFigure()
public TextAreaFigure(java.lang.String text)
| Method Detail |
|---|
public java.lang.String getText()
getText in interface TextHolderpublic void setText(java.lang.String newText)
setText in interface TextHolder
public void basicSetBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
FigureThis is used by Tool's which create a new Figure and by Tool's which connect a Figure to another Figure.
This is a basic operation which does not fire events.
basicSetBounds in interface Figureanchor - the start point of the boundslead - the end point of the boundsFigure.getBounds()public void basicTransform(java.awt.geom.AffineTransform tx)
AbstractFigureThis is a basic operation for which no events are fired.
basicTransform in interface FigurebasicTransform in class AbstractFiguretx - The transformation.public boolean contains(java.awt.geom.Point2D.Double p)
FigureThis is used for hit testing by Tool's.
contains in interface Figurepublic Insets2DDouble getInsets()
getInsets in interface TextHolderpublic int getTabSize()
TextHolder
getTabSize in interface TextHolderprotected void drawText(java.awt.Graphics2D g)
drawText in class AttributedFigureprotected void drawFill(java.awt.Graphics2D g)
AttributedFigure
drawFill in class AttributedFigureprotected void drawStroke(java.awt.Graphics2D g)
AttributedFigure
drawStroke in class AttributedFigurepublic java.awt.geom.Rectangle2D.Double getBounds()
Figure
getBounds in interface Figurepublic java.util.Collection<Handle> createHandles(int detailLevel)
Figure
createHandles in interface FigurecreateHandles in class AbstractFiguredetailLevel - The detail level of the handles. Usually this is 0 for
bounding box handles and 1 for point handles.
Handleprotected void validate()
validate in class AbstractFigurepublic boolean isEditable()
isEditable in interface TextHolderpublic void setEditable(boolean b)
public int getTextColumns()
TextHolder
getTextColumns in interface TextHolderpublic Tool getTool(java.awt.geom.Point2D.Double p)
Returns null, if no specialized tool is available.
getTool in interface FiguregetTool in class AbstractFigure
protected void readBounds(DOMInput in)
throws java.io.IOException
java.io.IOException
protected void writeBounds(DOMOutput out)
throws java.io.IOException
java.io.IOException
public void read(DOMInput in)
throws java.io.IOException
read in interface DOMStorableread in class AttributedFigurejava.io.IOException
public void write(DOMOutput out)
throws java.io.IOException
write in interface DOMStorablewrite in class AttributedFigurejava.io.IOExceptionpublic TextAreaFigure clone()
Figure
clone in interface Figureclone in class AttributedFigurepublic TextHolder getLabelFor()
getLabelFor in interface TextHolderpublic void restoreTo(java.lang.Object geometry)
Figure
restoreTo in interface Figurepublic java.lang.Object getRestoreData()
Figure
getRestoreData in interface FigureFigure.basicTransform(AffineTransform)public java.awt.Font getFont()
getFont in interface TextHolderpublic java.awt.Color getTextColor()
getTextColor in interface TextHolderpublic java.awt.Color getFillColor()
getFillColor in interface TextHolderpublic void setFontSize(float size)
setFontSize in interface TextHolderpublic float getFontSize()
getFontSize in interface TextHolder
|
Copyright 1996-2006 © JHotDraw.org | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||