|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.standard.AbstractFigure
org.jhotdraw.figures.AttributeFigure
org.jhotdraw.contrib.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 rectangle,
ie: FillColor, PenColor for the border, FontSize, FontStyle, and FontName,
as well as four additional attributes LeftMargin, RightMargin, TopMargin,
and TabSize.
Field Summary |
---|
Fields inherited from interface org.jhotdraw.framework.Figure |
---|
POPUP_MENU |
Constructor Summary | |
---|---|
TextAreaFigure()
Constructor for the TextAreaFigure object |
Method Summary | |
---|---|
boolean |
acceptsTyping()
Tests whether the figure accepts typing. |
void |
basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
Sets the display box for the figure |
void |
connect(Figure figure)
Connects the figure to another figure |
java.awt.Font |
createFont()
Creates the font from current attributes. |
void |
disconnect(Figure disconnectFigure)
Disconnects a text holder from a connect figure. |
java.awt.Rectangle |
displayBox()
Returns the current display box for the figure |
void |
draw(java.awt.Graphics g)
Draws the figure. |
void |
drawBackground(java.awt.Graphics g)
Draws the background for the figure. |
void |
drawFrame(java.awt.Graphics g)
Draws the frame around the text |
void |
figureChanged(FigureChangeEvent e)
A connected figure has changed, update the figure's location |
void |
figureInvalidated(FigureChangeEvent e)
Description of the Method |
void |
figureRemoved(FigureChangeEvent e)
The figure is about to be removed from another composite figure |
void |
figureRequestRemove(FigureChangeEvent e)
A request to remove the figure from another composite figure |
void |
figureRequestUpdate(FigureChangeEvent e)
Sent when an update should happen. |
java.lang.Object |
getAttribute(java.lang.String name)
Deprecated. use getAttribute(FigureAttributeConstant) |
java.awt.Font |
getFont()
Gets the font. |
Figure |
getRepresentingFigure()
Usually, a TextHolders is implemented by a Figure subclass. |
java.lang.String |
getText()
Gets the text of the figure |
java.awt.Color |
getTextColor()
Gets the text color of a figure. |
HandleEnumeration |
handles()
Returns an iterator of standard sizing handles to manipulate the figure |
boolean |
isEmpty()
Gets the empty attribute of the figure. |
boolean |
isFontDirty()
Gets the fontDirty attribute of the TextAreaFigure object |
boolean |
isReadOnly()
|
boolean |
isSizeDirty()
Returns the current size dirty status |
boolean |
isTextDirty()
Gets the textDirty attribute of the TextAreaFigure object |
void |
moveBy(int x,
int y)
Moves the figure the supplied offset |
int |
overlayColumns()
Gets the number of columns to be overlaid when the figure is edited. |
void |
read(StorableInput dr)
Reads the figure from StorableInput |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Deprecated. use setAttribute(FigureAttributeConstant, Object) |
void |
setFont(java.awt.Font newFont)
Sets the font. |
void |
setFontDirty(boolean newFontIsDirty)
Sets the fontDirty attribute of the TextAreaFigure object |
void |
setReadOnly(boolean newReadOnly)
|
void |
setSizeDirty(boolean newSizeIsDirty)
Called to set the dirty status of the size |
void |
setText(java.lang.String newText)
Sets the text of the figure |
java.awt.Rectangle |
textDisplayBox()
Returns the display box for the text |
void |
write(StorableOutput dw)
Writes the figure to StorableOutput |
Methods inherited from class org.jhotdraw.figures.AttributeFigure |
---|
getAttribute, getDefaultAttribute, getDefaultAttribute, getFillColor, getFrameColor, initDefaultAttribute, setAttribute, setDefaultAttribute |
Methods inherited from class org.jhotdraw.standard.AbstractFigure |
---|
addDependendFigure, addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, getDecoratedFigure, getDependendFigures, getTextHolder, getZValue, includes, invalidate, listener, release, removeDependendFigure, removeFigureChangeListener, removeFromContainer, setZValue, size, visit, willChange |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextAreaFigure()
Method Detail |
---|
public java.lang.String getText()
getText
in interface TextHolder
public void setText(java.lang.String newText)
setText
in interface TextHolder
newText
- The new text valuepublic java.awt.Rectangle textDisplayBox()
textDisplayBox
in interface TextHolder
public java.awt.Font createFont()
public boolean isReadOnly()
public void setReadOnly(boolean newReadOnly)
public boolean acceptsTyping()
acceptsTyping
in interface TextHolder
public boolean isTextDirty()
public void setSizeDirty(boolean newSizeIsDirty)
newSizeIsDirty
- The new sizeDirty valuepublic boolean isSizeDirty()
public java.awt.Font getFont()
getFont
in interface TextHolder
public void setFont(java.awt.Font newFont)
newFont
- The new font valuepublic int overlayColumns()
overlayColumns
in interface TextHolder
public void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)
basicDisplayBox
in interface Figure
basicDisplayBox
in class AbstractFigure
origin
- origin pointcorner
- corner pointFigure
public HandleEnumeration handles()
handles
in interface Figure
handles
in class AbstractFigure
Handle
public java.awt.Rectangle displayBox()
displayBox
in interface Figure
displayBox
in class AbstractFigure
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)
public void moveBy(int x, int y)
moveBy
in interface Figure
moveBy
in class AbstractFigure
x
- x displacementy
- y displacementpublic void drawBackground(java.awt.Graphics g)
g
- The graphics to use for the drawingAttributeFigure.draw(java.awt.Graphics)
public void draw(java.awt.Graphics g)
draw
in interface Figure
draw
in class AttributeFigure
g
- The graphics to use for the drawingpublic void drawFrame(java.awt.Graphics g)
g
- The graphics to use for the drawingAttributeFigure.draw(java.awt.Graphics)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface Figure
getAttribute
in class AttributeFigure
name
- the attribute's name
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface Figure
setAttribute
in class AttributeFigure
name
- the new attribute namevalue
- the new attribute valuepublic void write(StorableOutput dw)
write
in interface Storable
write
in class AttributeFigure
dw
- the output storablepublic void read(StorableInput dr) throws java.io.IOException
read
in interface Storable
read
in class AttributeFigure
dr
- Description of the Parameter
java.io.IOException
- the inout storablepublic void connect(Figure figure)
connect
in interface TextHolder
figure
- the connecting figurepublic void disconnect(Figure disconnectFigure)
disconnect
in interface TextHolder
disconnectFigure
- the disconnecting figurepublic void figureInvalidated(FigureChangeEvent e)
figureInvalidated
in interface FigureChangeListener
e
- Description of the Parameterpublic void figureChanged(FigureChangeEvent e)
figureChanged
in interface FigureChangeListener
e
- Description of the Parameterpublic void figureRemoved(FigureChangeEvent e)
figureRemoved
in interface FigureChangeListener
e
- Description of the Parameterpublic void figureRequestRemove(FigureChangeEvent e)
figureRequestRemove
in interface FigureChangeListener
e
- Description of the Parameterpublic void figureRequestUpdate(FigureChangeEvent e)
FigureChangeListener
figureRequestUpdate
in interface FigureChangeListener
e
- Description of the Parameterpublic java.awt.Color getTextColor()
getAttribute(java.lang.String)
public boolean isEmpty()
isEmpty
in interface Figure
isEmpty
in class AbstractFigure
Figure.isEmpty()
public boolean isFontDirty()
public void setFontDirty(boolean newFontIsDirty)
newFontIsDirty
- The new fontDirty valuepublic Figure getRepresentingFigure()
getRepresentingFigure
in interface TextHolder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |