org.openbp.cockpit.modeler.figures.generic
Class XTextFigure

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractFigure
      extended by org.openbp.cockpit.modeler.figures.generic.BasicFigure
          extended by org.openbp.cockpit.modeler.figures.generic.XTextFigure
All Implemented Interfaces:
CH.ifa.draw.framework.Figure, CH.ifa.draw.util.Storable, java.io.Serializable, java.lang.Cloneable, ChildFigure, Colorizable
Direct Known Subclasses:
FixedTitleFigure, TextElementFigure

public class XTextFigure
extends BasicFigure

The text element figure represents a simple text rectangle. The size of the figure is computed automatically based on the text and font settings.

Author:
Heiko Erhardt
See Also:
Serialized Form

Field Summary
protected  java.awt.Rectangle displayBoxCache
          Display box cache
static int HANDLE_DISTANCE
          Distance between display box and font size handle
protected  int originX
          X origin
protected  int originY
          Y origin
 
Fields inherited from class org.openbp.cockpit.modeler.figures.generic.BasicFigure
DECO_FILLCOLOR, DECO_OVERLAY
 
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
 
Constructor Summary
XTextFigure()
          Constructor.
 
Method Summary
 void basicDisplayBox(java.awt.Point newOrigin, java.awt.Point newCorner)
           
protected  void basicMoveBy(int x, int y)
           
 java.lang.String createGeometry()
          Encodes the geometry information of this object into a string.
 java.awt.Rectangle displayBox()
           
protected  void drawFigure(java.awt.Graphics g)
          Draws the figure.
 int getAlignment()
          Gets the text alignment.
 java.awt.Font getFont()
          Gets the text font.
 int getFontSize()
          Gets the font size.
 java.lang.String getText()
          Gets the text to display.
 java.util.Vector handles()
           
 void invalidate()
           
 boolean isAutoSize()
          Gets the auto-size flag.
 void parseGeometry(java.lang.String geometry)
          Decodes the given geometry information by breaking it into single parameters and handing them to parseParameter(java.lang.String).
protected  void parseParameter(java.lang.String parameter)
          Decodes a single geometry parameter.
 void setAlignment(int alignment)
          Sets the text alignment.
 void setAutoSize(boolean autoSize)
          Sets the auto-size flag.
 void setFont(java.awt.Font font)
          Sets the text font.
 void setFontSize(int fontSize)
          Sets the font size.
 void setText(java.lang.String text)
          Sets the text to display.
 
Methods inherited from class org.openbp.cockpit.modeler.figures.generic.BasicFigure
clone, decorateValue, draw, getDecorationOwner, getDefaultFillColor, getFillColor, getParent, setFillColor, setParent
 
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, canConnect, center, changed, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, includes, isEmpty, listener, moveBy, read, release, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface CH.ifa.draw.framework.Figure
addFigureChangeListener, addToContainer, canConnect, center, changed, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, includes, isEmpty, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange
 
Methods inherited from interface CH.ifa.draw.util.Storable
read, write
 

Field Detail

HANDLE_DISTANCE

public static final int HANDLE_DISTANCE
Distance between display box and font size handle

See Also:
Constant Field Values

originX

protected int originX
X origin


originY

protected int originY
Y origin


displayBoxCache

protected java.awt.Rectangle displayBoxCache
Display box cache

Constructor Detail

XTextFigure

public XTextFigure()
Constructor.

Method Detail

basicMoveBy

protected void basicMoveBy(int x,
                           int y)
Specified by:
basicMoveBy in class CH.ifa.draw.standard.AbstractFigure

basicDisplayBox

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

displayBox

public java.awt.Rectangle displayBox()
Specified by:
displayBox in interface CH.ifa.draw.framework.Figure
Specified by:
displayBox in class CH.ifa.draw.standard.AbstractFigure

drawFigure

protected void drawFigure(java.awt.Graphics g)
Description copied from class: BasicFigure
Draws the figure.

Overrides:
drawFigure in class BasicFigure
Parameters:
g - Graphics to draw to

invalidate

public void invalidate()
Specified by:
invalidate in interface CH.ifa.draw.framework.Figure
Overrides:
invalidate in class CH.ifa.draw.standard.AbstractFigure

handles

public java.util.Vector handles()
Specified by:
handles in interface CH.ifa.draw.framework.Figure
Specified by:
handles in class CH.ifa.draw.standard.AbstractFigure

getText

public java.lang.String getText()
Gets the text to display.


setText

public void setText(java.lang.String text)
Sets the text to display.


getFontSize

public int getFontSize()
Gets the font size.


setFontSize

public void setFontSize(int fontSize)
Sets the font size.


getFont

public java.awt.Font getFont()
Gets the text font.


setFont

public void setFont(java.awt.Font font)
Sets the text font.


getAlignment

public int getAlignment()
Gets the text alignment.

Returns:
Text alignment

setAlignment

public void setAlignment(int alignment)
Sets the text alignment.

Parameters:
alignment - Text alignment

isAutoSize

public boolean isAutoSize()
Gets the auto-size flag. Auto-sizes the display box of the figure according to the text extent.


setAutoSize

public void setAutoSize(boolean autoSize)
Sets the auto-size flag. Auto-sizes the display box of the figure according to the text extent.


parseGeometry

public void parseGeometry(java.lang.String geometry)
Decodes the given geometry information by breaking it into single parameters and handing them to parseParameter(java.lang.String).

Parameters:
geometry - '|'-separated geometry information or null

parseParameter

protected void parseParameter(java.lang.String parameter)
Decodes a single geometry parameter.

Parameters:
parameter - Parameter to decode

createGeometry

public java.lang.String createGeometry()
Encodes the geometry information of this object into a string.

Returns:
geometry '|'-sparamted geometry information or null


Copyright © 2011. All Rights Reserved.