CH.ifa.draw.figures
Class TextFigure
- java.lang.Object
-
- CH.ifa.draw.standard.AbstractFigure
-
- CH.ifa.draw.figures.AttributeFigure
-
- CH.ifa.draw.figures.TextFigure
-
- All Implemented Interfaces:
- Figure, FigureChangeListener, TextHolder, Storable, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
- Direct Known Subclasses:
- NodeFigure, NumberTextFigure, UpdatableTextFigure
public class TextFigure extends AttributeFigure implements FigureChangeListener, TextHolder
A text figure.- See Also:
TextTool, Serialized Form
-
-
Field Summary
-
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
-
-
Constructor Summary
Constructors Constructor and Description TextFigure()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanacceptsTyping()Tests whether the figure accepts typing.voidbasicDisplayBox(java.awt.Point newOrigin, java.awt.Point newCorner)Sets the display box of a figure.voidchanged()Updates the location whenever the figure changes itself.voidconnect(Figure figure)Connects a figure to another figure.static java.awt.FontcreateCurrentFont()Creates the current font to be used for new text figures.voiddisconnect()Disconnects the text figure.java.awt.RectangledisplayBox()Gets the display box of a figure.voiddrawBackground(java.awt.Graphics g)Draws the background of the figure.voiddrawFrame(java.awt.Graphics g)Draws the frame of the figure.voidfigureChanged(FigureChangeEvent e)Sent when a figure changedvoidfigureInvalidated(FigureChangeEvent e)Sent when an area is invalidvoidfigureRemoved(FigureChangeEvent e)Sent when a figure was removedvoidfigureRequestRemove(FigureChangeEvent e)Sent when requesting to remove a figure.voidfigureRequestUpdate(FigureChangeEvent e)Sent when an update should happen.java.lang.ObjectgetAttribute(java.lang.String name)A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.java.awt.FontgetFont()Gets the font.java.lang.StringgetText()Gets the text shown by the text figure.java.util.Vectorhandles()Returns the handles of a Figure that can be used to manipulate some of its attributes.voidmoveBy(int x, int y)Moves the figure by the given offset.intoverlayColumns()Gets the number of columns to be overlaid when the figure is edited.voidread(StorableInput dr)Reads the Figure from a StorableInput.booleanreadOnly()Tests whether this figure is read only.voidrelease()A figure is released from the drawing.voidsetAttribute(java.lang.String name, java.lang.Object value)A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.static voidsetCurrentFontName(java.lang.String name)Sets the current font namestatic voidsetCurrentFontSize(int size)Sets the current font size.static voidsetCurrentFontStyle(int style)Sets the current font style.voidsetFont(java.awt.Font newFont)Sets the font.voidsetReadOnly(boolean isReadOnly)Sets the read only status of the text figure.voidsetText(java.lang.String newText)Sets the text shown by the text figure.java.awt.RectangletextDisplayBox()voidwrite(StorableOutput dw)Stores the Figure to a StorableOutput.-
Methods inherited from class CH.ifa.draw.figures.AttributeFigure
draw, getDefaultAttribute, getFillColor, getFrameColor
-
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, canConnect, center, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, includes, invalidate, isEmpty, listener, removeFigureChangeListener, removeFromContainer, size, willChange
-
-
-
-
Method Detail
-
moveBy
public void moveBy(int x, int y)Description copied from class:AbstractFigureMoves the figure by the given offset.- Specified by:
moveByin interfaceFigure- Overrides:
moveByin classAbstractFigure
-
basicDisplayBox
public void basicDisplayBox(java.awt.Point newOrigin, java.awt.Point newCorner)Description copied from class:AbstractFigureSets the display box of a figure. This is the method that subclassers override. Clients usually call displayBox.- Specified by:
basicDisplayBoxin interfaceFigure- Specified by:
basicDisplayBoxin classAbstractFigure- Parameters:
newOrigin- the new originnewCorner- the new corner- See Also:
AbstractFigure.displayBox(java.awt.Point, java.awt.Point)
-
displayBox
public java.awt.Rectangle displayBox()
Description copied from class:AbstractFigureGets the display box of a figure.- Specified by:
displayBoxin interfaceFigure- Specified by:
displayBoxin classAbstractFigure- See Also:
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)
-
textDisplayBox
public java.awt.Rectangle textDisplayBox()
- Specified by:
textDisplayBoxin interfaceTextHolder
-
readOnly
public boolean readOnly()
Tests whether this figure is read only.
-
setReadOnly
public void setReadOnly(boolean isReadOnly)
Sets the read only status of the text figure.
-
getFont
public java.awt.Font getFont()
Gets the font.- Specified by:
getFontin interfaceTextHolder
-
setFont
public void setFont(java.awt.Font newFont)
Sets the font.
-
changed
public void changed()
Updates the location whenever the figure changes itself.- Specified by:
changedin interfaceFigure- Overrides:
changedin classAbstractFigure- See Also:
FigureChangeEvent,Figure.changed()
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.- Specified by:
getAttributein interfaceFigure- Overrides:
getAttributein classAttributeFigure
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.- Specified by:
setAttributein interfaceFigure- Overrides:
setAttributein classAttributeFigure
-
getText
public java.lang.String getText()
Gets the text shown by the text figure.- Specified by:
getTextin interfaceTextHolder
-
setText
public void setText(java.lang.String newText)
Sets the text shown by the text figure.- Specified by:
setTextin interfaceTextHolder
-
acceptsTyping
public boolean acceptsTyping()
Tests whether the figure accepts typing.- Specified by:
acceptsTypingin interfaceTextHolder
-
drawBackground
public void drawBackground(java.awt.Graphics g)
Description copied from class:AttributeFigureDraws the background of the figure.- See Also:
AttributeFigure.draw(java.awt.Graphics)
-
drawFrame
public void drawFrame(java.awt.Graphics g)
Description copied from class:AttributeFigureDraws the frame of the figure.- See Also:
AttributeFigure.draw(java.awt.Graphics)
-
overlayColumns
public int overlayColumns()
Gets the number of columns to be overlaid when the figure is edited.- Specified by:
overlayColumnsin interfaceTextHolder
-
handles
public java.util.Vector handles()
Description copied from class:AbstractFigureReturns the handles of a Figure that can be used to manipulate some of its attributes.- Specified by:
handlesin interfaceFigure- Specified by:
handlesin classAbstractFigure- Returns:
- a Vector of handles
- See Also:
Handle
-
write
public void write(StorableOutput dw)
Description copied from class:AttributeFigureStores the Figure to a StorableOutput.- Specified by:
writein interfaceStorable- Overrides:
writein classAttributeFigure
-
read
public void read(StorableInput dr) throws java.io.IOException
Description copied from class:AttributeFigureReads the Figure from a StorableInput.- Specified by:
readin interfaceStorable- Overrides:
readin classAttributeFigure- Throws:
java.io.IOException
-
connect
public void connect(Figure figure)
Description copied from interface:TextHolderConnects a figure to another figure.- Specified by:
connectin interfaceTextHolder
-
figureChanged
public void figureChanged(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when a figure changed- Specified by:
figureChangedin interfaceFigureChangeListener
-
figureRemoved
public void figureRemoved(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when a figure was removed- Specified by:
figureRemovedin interfaceFigureChangeListener
-
figureRequestRemove
public void figureRequestRemove(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when requesting to remove a figure.- Specified by:
figureRequestRemovein interfaceFigureChangeListener
-
figureInvalidated
public void figureInvalidated(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when an area is invalid- Specified by:
figureInvalidatedin interfaceFigureChangeListener
-
figureRequestUpdate
public void figureRequestUpdate(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when an update should happen.- Specified by:
figureRequestUpdatein interfaceFigureChangeListener
-
release
public void release()
Description copied from class:AbstractFigureA figure is released from the drawing. You never call this method directly. Release notifies its listeners.- Specified by:
releasein interfaceFigure- Overrides:
releasein classAbstractFigure- See Also:
Figure.release()
-
disconnect
public void disconnect()
Disconnects the text figure.
-
createCurrentFont
public static java.awt.Font createCurrentFont()
Creates the current font to be used for new text figures.
-
setCurrentFontName
public static void setCurrentFontName(java.lang.String name)
Sets the current font name
-
setCurrentFontSize
public static void setCurrentFontSize(int size)
Sets the current font size.
-
setCurrentFontStyle
public static void setCurrentFontStyle(int style)
Sets the current font style.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG