org.objectweb.jac.ide.diagrams
Class TextFigure

java.lang.Object
  extended byCH.ifa.draw.standard.AbstractFigure
      extended byCH.ifa.draw.figures.AttributeFigure
          extended byorg.objectweb.jac.ide.diagrams.TextFigure
All Implemented Interfaces:
Cloneable, EventListener, CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.FigureChangeListener, Serializable, CH.ifa.draw.standard.TextHolder
Direct Known Subclasses:
AttachedTextFigure, ClassNameFigure, MemberFigure

public class TextFigure
extends CH.ifa.draw.figures.AttributeFigure
implements CH.ifa.draw.framework.FigureChangeListener, CH.ifa.draw.standard.TextHolder

A TextFigure whose text color can be redefined with the method getTextColor()

See Also:
Serialized Form

Field Summary
protected  int fOriginX
           
protected  int fOriginY
           
 
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
 
Constructor Summary
TextFigure()
           
 
Method Summary
 boolean acceptsTyping()
          Tests whether the figure accepts typing.
 void basicDisplayBox(Point newOrigin, Point newCorner)
           
protected  void basicMoveBy(int x, int y)
           
 void changed()
          Updates the location whenever the figure changes itself.
 void connect(CH.ifa.draw.framework.Figure figure)
           
static Font createCurrentFont()
          Creates the current font to be used for new text figures.
 void disconnect(CH.ifa.draw.framework.Figure disconnectFigure)
          Disconnects a text holder from a connect figure.
 Rectangle displayBox()
           
 void drawBackground(Graphics g)
           
 void drawFrame(Graphics g)
           
 void figureChanged(CH.ifa.draw.framework.FigureChangeEvent e)
           
 void figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent e)
           
 void figureRemoved(CH.ifa.draw.framework.FigureChangeEvent e)
           
 void figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent e)
           
 void figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent e)
           
 Object getAttribute(String name)
          A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.
 Font getFont()
          Gets the font.
 String getText()
          Gets the text shown by the text figure.
protected  Color getTextColor()
           
 Vector handles()
           
 void moveBy(int x, int y)
           
 int overlayColumns()
          Gets the number of columns to be overlaid when the figure is edited.
 boolean readOnly()
          Tests whether this figure is read only.
 void release()
           
 void setAttribute(String name, Object value)
          A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.
static void setCurrentFontName(String name)
          Sets the current font name
static void setCurrentFontSize(int size)
          Sets the current font size.
static void setCurrentFontStyle(int style)
          Sets the current font style.
 void setFont(Font newFont)
          Sets the font.
 void setReadOnly(boolean isReadOnly)
          Sets the read only status of the text figure.
 void setText(String newText)
          Sets the text shown by the text figure.
 Rectangle textDisplayBox()
           
protected  void updateLocation()
          Updates the location relative to the connected figure.
 
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, getZValue, includes, invalidate, isEmpty, listener, removeFigureChangeListener, removeFromContainer, setZValue, size, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fOriginX

protected int fOriginX

fOriginY

protected int fOriginY
Constructor Detail

TextFigure

public TextFigure()
Method Detail

moveBy

public void moveBy(int x,
                   int y)
Specified by:
moveBy in interface CH.ifa.draw.framework.Figure

basicMoveBy

protected void basicMoveBy(int x,
                           int y)

basicDisplayBox

public void basicDisplayBox(Point newOrigin,
                            Point newCorner)
Specified by:
basicDisplayBox in interface CH.ifa.draw.framework.Figure

displayBox

public Rectangle displayBox()
Specified by:
displayBox in interface CH.ifa.draw.framework.Figure

textDisplayBox

public Rectangle textDisplayBox()
Specified by:
textDisplayBox in interface CH.ifa.draw.standard.TextHolder

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 Font getFont()
Gets the font.

Specified by:
getFont in interface CH.ifa.draw.standard.TextHolder

setFont

public void setFont(Font newFont)
Sets the font.


changed

public void changed()
Updates the location whenever the figure changes itself.

Specified by:
changed in interface CH.ifa.draw.framework.Figure

getAttribute

public Object getAttribute(String name)
A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.

Specified by:
getAttribute in interface CH.ifa.draw.framework.Figure

setAttribute

public void setAttribute(String name,
                         Object value)
A text figure understands the "FontSize", "FontStyle", and "FontName" attributes.

Specified by:
setAttribute in interface CH.ifa.draw.framework.Figure

getText

public String getText()
Gets the text shown by the text figure.

Specified by:
getText in interface CH.ifa.draw.standard.TextHolder

setText

public void setText(String newText)
Sets the text shown by the text figure.

Specified by:
setText in interface CH.ifa.draw.standard.TextHolder

acceptsTyping

public boolean acceptsTyping()
Tests whether the figure accepts typing.

Specified by:
acceptsTyping in interface CH.ifa.draw.standard.TextHolder

drawBackground

public void drawBackground(Graphics g)

drawFrame

public void drawFrame(Graphics g)

getTextColor

protected Color getTextColor()

overlayColumns

public int overlayColumns()
Gets the number of columns to be overlaid when the figure is edited.

Specified by:
overlayColumns in interface CH.ifa.draw.standard.TextHolder

handles

public Vector handles()
Specified by:
handles in interface CH.ifa.draw.framework.Figure

connect

public void connect(CH.ifa.draw.framework.Figure figure)
Specified by:
connect in interface CH.ifa.draw.standard.TextHolder

figureChanged

public void figureChanged(CH.ifa.draw.framework.FigureChangeEvent e)
Specified by:
figureChanged in interface CH.ifa.draw.framework.FigureChangeListener

figureRemoved

public void figureRemoved(CH.ifa.draw.framework.FigureChangeEvent e)
Specified by:
figureRemoved in interface CH.ifa.draw.framework.FigureChangeListener

figureRequestRemove

public void figureRequestRemove(CH.ifa.draw.framework.FigureChangeEvent e)
Specified by:
figureRequestRemove in interface CH.ifa.draw.framework.FigureChangeListener

figureInvalidated

public void figureInvalidated(CH.ifa.draw.framework.FigureChangeEvent e)
Specified by:
figureInvalidated in interface CH.ifa.draw.framework.FigureChangeListener

figureRequestUpdate

public void figureRequestUpdate(CH.ifa.draw.framework.FigureChangeEvent e)
Specified by:
figureRequestUpdate in interface CH.ifa.draw.framework.FigureChangeListener

updateLocation

protected void updateLocation()
Updates the location relative to the connected figure. The TextFigure is centered around the located point.


release

public void release()
Specified by:
release in interface CH.ifa.draw.framework.Figure

disconnect

public void disconnect(CH.ifa.draw.framework.Figure disconnectFigure)
Disconnects a text holder from a connect figure.

Specified by:
disconnect in interface CH.ifa.draw.standard.TextHolder

createCurrentFont

public static Font createCurrentFont()
Creates the current font to be used for new text figures.


setCurrentFontName

public static void setCurrentFontName(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.