Synergy Home Page

au.edu.swin.synergy.shapes
Class BTextArea

java.lang.Object
  |
  +--au.edu.swin.synergy.plugin.diagram.BDrawable
        |
        +--au.edu.swin.synergy.shapes.BRectShape
              |
              +--au.edu.swin.synergy.shapes.BTextArea

public class BTextArea
extends BRectShape
implements BSaveable, BPropertyBagItem, BTreeNode

See Also:
Serialized Form

Field Summary
protected static String kKeyText
           
protected static String kKeyVisible
           
static String kName
           
static int kTextSize
           
protected  FontMetrics metric
          Used to calc positisons of text within this area depending on the font.
protected  Vector strings
           
protected  Color textColour
           
protected  Font textFont
           
protected  int textSize
           
protected  boolean visible
           
 
Fields inherited from class au.edu.swin.synergy.shapes.BRectShape
doFill, doOutline, fillColour, kDefaultDoFill, kDefaultDoOutline, kDefaultFillColor, kDefaultLineColor, kDefaultOutlineColor, kDefaultShapeStyle, kDefaultStrokeCap, kDefaultStrokeJoin, kDefaultStrokeLimit, kDefaultStrokePhase, kDefaultStrokeWidth, kDefaultUseFillColor, kDefaultUseOutlineColor, kKeyDoFill, kKeyDoOutline, kKeyFillColor, kKeyLineColor, kKeyOutlineColor, kKeyShapeStyle, kKeyStrokeCap, kKeyStrokeDash, kKeyStrokeJoin, kKeyStrokeLimit, kKeyStrokePhase, kKeyStrokeWidth, kKeyUseFillColor, kKeyUseOutlineColor, lineColour, lineSize, local, outlineColour, shapeStyle, sizerNum, stroke, tmpXformed, useFillColour, useOutlineColour, xformed
 
Fields inherited from class au.edu.swin.synergy.plugin.diagram.BDrawable
bounds, iconOOZ, kBackward, kDefaultName, kDefaultStatus, kEmptyFlag, kForward, kHighlightFlag, kHitBounds, kHitSizer, kKeyName, kKeyStatus, kNotHit, kSelectedFlag, kSizerCtrlPoint1, kSizerCtrlPoint2, kSizerEndArc, kSizerHalfH, kSizerHalfW, kSizerNorthEast, kSizerNorthWest, kSizerSouthEast, kSizerSouthWest, kSizerStartArc, lastFrame, name, paintCount, pos, sizerColour, statusFlag, tmpBounds
 
Constructor Summary
BTextArea()
           
BTextArea(BTextArea ta)
           
BTextArea(int x, int y, int w, int h)
           
BTextArea(String str)
           
 
Method Summary
 void addString(String str)
          Append a string onto the existing list of strings to be displayed in text area.
 void arcTransform(BView viewport, BScalarPoint centerPt, int frameCounter)
          A little specialised transform function which is only called when this property belongs to an arc...
 void calcDelta(BScalarPoint startPt, BScalarPoint endPt)
          Used to calculate distance for our accosicated arcs midPt.
 void calcVisibleStrs(FontMetrics fm)
          Go through our list of strings return vector containing those which are visible.
 void clearArea()
          Clears all strings held within this text area.
 void copy(BTextArea src)
           
 void dragMove(BScalarPoint deltaXY)
           
 Object getChildAt(int index)
           
 int getChildCount()
           
 BScalarPoint getDeltaXY()
           
 Font getFont()
           
 int getIndexOf(Object node)
           
 BScalarRect getLocation()
           
 FontMetrics getMetric()
           
 String getName()
           
 Object getParent()
           
 Object getPropertyValue(String property)
           
 Vector getRefToStrings()
           
 Vector getStrings()
          Creates and returns a complete copy of our string vector.
 boolean isChangeAllowed(String name, Object oldValue, Object newValue)
           
 boolean isLeaf()
           
 boolean isVisible()
           
 boolean load(BDataFile file)
           
 BDrawable newInstance()
          Creates and returns a new instance of the BDrawable object
 void paintIcon(Component c, Graphics g, int x, int y)
           
 void removeAllChildren()
           
 void renderFill(Graphics2D g2)
           
 void renderShape(Graphics2D g2)
          Renders the transformed coordinates of the drawable object to a Graphics2D Left to subclasses to implement as needed Subclasses should check to make sure if they are supposed to fill or outline the shape, as well as whether or not they should use their own colours.
 boolean save(BDataFile file)
           
 Font scaleFont(float oozVal)
           
 void setArc(BPackageArc arc)
           
protected  void setClippedRect(Graphics2D g2)
          Calculates the clipped area of rect against the viewport.
 void setLocation(BScalarRect loc)
           
 void setMultipleStrings(Vector strs)
          Used when vector may be retrieved from text box.
 void setParent(Object parent)
           
 void setString(String str)
          For display of one line text areas.
 void setVisible(boolean show)
           
 void transform(BView viewport, BScalarPoint parentPos, int frameCounter)
           
 
Methods inherited from class au.edu.swin.synergy.shapes.BRectShape
checkSizerHit, checkXFormBounds, copy, dragAdd, dragResize, getFillColour, getLineColour, getPropertyPanel, getStroke, getStyle, render, renderOutlineAndSizers, renderRect, renderRectShape, setDoFill, setFillColour, setHighlighted, setLineColour, setLocalBounds, setLocalWH, setLocalXY, setOutlineColour, setSelected, setStroke, setStyle, startAdd, startResize, stopAdd, stopResize, updateBounds
 
Methods inherited from class au.edu.swin.synergy.plugin.diagram.BDrawable
checkXFormHit, contains, continueAdd, copy, delete, doPasted, getBasicStroke, getBounds, getColour, getIconHeight, getIconWidth, getPos, incPos, intersects, isDeletable, isHighlighted, isInside, isSelected, isStatusFlag, isTransformed, setFlag, setName, setPos, setPos, snapToGrid, startMove, stopMove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kName

public static final String kName

kTextSize

public static final int kTextSize

visible

protected boolean visible

strings

protected volatile Vector strings

metric

protected FontMetrics metric
Used to calc positisons of text within this area depending on the font.

textFont

protected Font textFont

textColour

protected Color textColour

textSize

protected int textSize

kKeyText

protected static final String kKeyText

kKeyVisible

protected static final String kKeyVisible
Constructor Detail

BTextArea

public BTextArea(int x,
                 int y,
                 int w,
                 int h)

BTextArea

public BTextArea(String str)

BTextArea

public BTextArea(BTextArea ta)

BTextArea

public BTextArea()
Method Detail

addString

public void addString(String str)
Append a string onto the existing list of strings to be displayed in text area.
Parameters:
str - String to be appended onto existing vector.

setMultipleStrings

public void setMultipleStrings(Vector strs)
Used when vector may be retrieved from text box.
Parameters:
strs - Vector of strings for text area to display.

setString

public void setString(String str)
For display of one line text areas.
Parameters:
str - String to be displayed.

clearArea

public void clearArea()
Clears all strings held within this text area.

getPropertyValue

public Object getPropertyValue(String property)
Specified by:
getPropertyValue in interface BPropertyBagItem

isChangeAllowed

public boolean isChangeAllowed(String name,
                               Object oldValue,
                               Object newValue)
Specified by:
isChangeAllowed in interface BPropertyBagItem

getMetric

public FontMetrics getMetric()

getFont

public Font getFont()

getStrings

public Vector getStrings()
Creates and returns a complete copy of our string vector.

getRefToStrings

public Vector getRefToStrings()

calcVisibleStrs

public void calcVisibleStrs(FontMetrics fm)
Go through our list of strings return vector containing those which are visible.

getDeltaXY

public BScalarPoint getDeltaXY()

calcDelta

public void calcDelta(BScalarPoint startPt,
                      BScalarPoint endPt)
Used to calculate distance for our accosicated arcs midPt.
Pre Condition:
pos MUST be set. Important to note when adding...

setArc

public void setArc(BPackageArc arc)

dragMove

public void dragMove(BScalarPoint deltaXY)
Overrides:
dragMove in class BDrawable

transform

public void transform(BView viewport,
                      BScalarPoint parentPos,
                      int frameCounter)
Overrides:
transform in class BRectShape

arcTransform

public void arcTransform(BView viewport,
                         BScalarPoint centerPt,
                         int frameCounter)
A little specialised transform function which is only called when this property belongs to an arc...
Parameters:
parentRect - start pt, length and width of arc.

renderFill

public void renderFill(Graphics2D g2)
Overrides:
renderFill in class BRectShape

renderShape

public void renderShape(Graphics2D g2)
Renders the transformed coordinates of the drawable object to a Graphics2D Left to subclasses to implement as needed Subclasses should check to make sure if they are supposed to fill or outline the shape, as well as whether or not they should use their own colours.
Parameters:
Graphics2D - g2 - the place to render the object to.
Overrides:
renderShape in class BRectShape

setVisible

public void setVisible(boolean show)

isVisible

public boolean isVisible()

setLocation

public void setLocation(BScalarRect loc)

getLocation

public BScalarRect getLocation()

setClippedRect

protected void setClippedRect(Graphics2D g2)
Calculates the clipped area of rect against the viewport. Must credit java source Rectangle.insection () function for the algorithm used.

scaleFont

public Font scaleFont(float oozVal)

newInstance

public BDrawable newInstance()
Creates and returns a new instance of the BDrawable object
Returns:
a new instance of this BDrawable object.
Overrides:
newInstance in class BRectShape

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Overrides:
paintIcon in class BRectShape

copy

public void copy(BTextArea src)

load

public boolean load(BDataFile file)
Specified by:
load in interface BSaveable
Overrides:
load in class BRectShape

save

public boolean save(BDataFile file)
Specified by:
save in interface BSaveable
Overrides:
save in class BRectShape

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface BTreeNode

getChildAt

public Object getChildAt(int index)
Specified by:
getChildAt in interface BTreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface BTreeNode

getParent

public Object getParent()
Specified by:
getParent in interface BTreeNode

getIndexOf

public int getIndexOf(Object node)
Specified by:
getIndexOf in interface BTreeNode

setParent

public void setParent(Object parent)
Specified by:
setParent in interface BTreeNode

removeAllChildren

public void removeAllChildren()
Specified by:
removeAllChildren in interface BTreeNode

getName

public String getName()
Specified by:
getName in interface BTreeNode
Overrides:
getName in class BDrawable

Synergy Home Page