Synergy Home Page

au.edu.swin.synergy.shapes
Class BRectShape

java.lang.Object
  |
  +--au.edu.swin.synergy.plugin.diagram.BDrawable
        |
        +--au.edu.swin.synergy.shapes.BRectShape
Direct Known Subclasses:
BEllipse, BRectangle, BRoundRect, BTextArea

public abstract class BRectShape
extends BDrawable
implements BSaveable

See Also:
Serialized Form

Field Summary
protected  boolean doFill
           
protected  boolean doOutline
           
protected  Color fillColour
           
protected static String kDefaultDoFill
           
protected static String kDefaultDoOutline
           
protected static String kDefaultFillColor
           
protected static String kDefaultLineColor
           
protected static String kDefaultOutlineColor
           
protected static String kDefaultShapeStyle
           
protected static String kDefaultStrokeCap
           
protected static String kDefaultStrokeJoin
           
protected static String kDefaultStrokeLimit
           
protected static String kDefaultStrokePhase
           
protected static String kDefaultStrokeWidth
           
protected static String kDefaultUseFillColor
           
protected static String kDefaultUseOutlineColor
           
protected static String kKeyDoFill
          loads a BRectShape form a data file
protected static String kKeyDoOutline
           
protected static String kKeyFillColor
           
protected static String kKeyLineColor
           
protected static String kKeyOutlineColor
           
protected static String kKeyShapeStyle
           
protected static String kKeyStrokeCap
           
protected static String kKeyStrokeDash
           
protected static String kKeyStrokeJoin
           
protected static String kKeyStrokeLimit
           
protected static String kKeyStrokePhase
           
protected static String kKeyStrokeWidth
           
protected static String kKeyUseFillColor
           
protected static String kKeyUseOutlineColor
           
protected  Color lineColour
           
protected  int lineSize
          When multiple lines are drawn, this is assigned line width, instead creating new instance.
protected  BScalarRect local
           
protected  Color outlineColour
           
protected  Integer shapeStyle
           
protected  int sizerNum
           
protected  BasicStroke stroke
           
protected  Rectangle tmpXformed
           
protected  boolean useFillColour
           
protected  boolean useOutlineColour
           
protected  Rectangle 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
protected BRectShape()
           
protected BRectShape(int x, int y, int w, int h)
           
 
Method Summary
 int checkSizerHit(Point pt)
          Checks to see if a sizer has been hit by a point Works on xformed values.
 int checkXFormBounds(Point pt)
          Checks to see if a point has hit the transformed bounds of this object
 void copy(BRectShape src)
          copies the data from the src BRectShape into this one.
 void dragAdd(BScalarPoint deltaXY)
           
 void dragResize(BScalarPoint deltaXY)
          Called as the drawable is being resized
 Color getFillColour()
           
 Color getLineColour()
           
 BPropPanel getPropertyPanel()
           
 BasicStroke getStroke()
           
 Integer getStyle()
           
 boolean load(BDataFile file)
           
abstract  BDrawable newInstance()
          Creates and returns a new instance of the BDrawable object
 void paintIcon(Component c, Graphics g, int x, int y)
           
 void render(Graphics2D g2)
           
abstract  void renderFill(Graphics2D g2)
           
 void renderOutlineAndSizers(Graphics2D g2)
          Only render the outline and the sizing boxes....
 void renderRect(Graphics2D g2, int noLines)
           
 void renderRectShape(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.
abstract  void renderShape(Graphics2D g2)
           
 boolean save(BDataFile file)
          saaves the BRectShape to a data file
 void setDoFill(boolean doFill)
           
 void setFillColour(Color colour)
           
 void setHighlighted(boolean on)
           
 void setLineColour(Color colour)
           
 void setLocalBounds(BRectShape rec)
           
 void setLocalWH(int w, int h)
           
 void setLocalXY(BScalarPoint pt)
           
 void setOutlineColour(Color colour)
           
 void setSelected(boolean on)
           
 void setStroke(BasicStroke stroke)
           
 void setStyle(Integer style)
           
 void startAdd()
           
 void startResize(int sizerNum)
          called when the drawable is about to be resized..
 void stopAdd()
           
 void stopResize()
           
 void transform(BView viewport, BScalarPoint parentPos, int frameCounter)
          Transforms the coordinates of the rectshape to a new coordinate space, as defined by the viewport and parent pos.
 void updateBounds()
          updates the bounding region of the drawable Called when something requires the bounds of the drawable to be updated.
 
Methods inherited from class au.edu.swin.synergy.plugin.diagram.BDrawable
checkXFormHit, contains, continueAdd, copy, delete, doPasted, dragMove, getBasicStroke, getBounds, getColour, getIconHeight, getIconWidth, getName, 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

local

protected BScalarRect local

xformed

protected Rectangle xformed

tmpXformed

protected Rectangle tmpXformed

doFill

protected boolean doFill

doOutline

protected boolean doOutline

useFillColour

protected boolean useFillColour

useOutlineColour

protected boolean useOutlineColour

fillColour

protected Color fillColour

outlineColour

protected Color outlineColour

lineColour

protected Color lineColour

sizerNum

protected int sizerNum

lineSize

protected int lineSize
When multiple lines are drawn, this is assigned line width, instead creating new instance.

shapeStyle

protected Integer shapeStyle

stroke

protected transient BasicStroke stroke

kKeyDoFill

protected static final String kKeyDoFill
loads a BRectShape form a data file

kDefaultDoFill

protected static final String kDefaultDoFill

kKeyUseFillColor

protected static final String kKeyUseFillColor

kDefaultUseFillColor

protected static final String kDefaultUseFillColor

kKeyFillColor

protected static final String kKeyFillColor

kDefaultFillColor

protected static final String kDefaultFillColor

kKeyDoOutline

protected static final String kKeyDoOutline

kDefaultDoOutline

protected static final String kDefaultDoOutline

kKeyUseOutlineColor

protected static final String kKeyUseOutlineColor

kDefaultUseOutlineColor

protected static final String kDefaultUseOutlineColor

kKeyOutlineColor

protected static final String kKeyOutlineColor

kDefaultOutlineColor

protected static final String kDefaultOutlineColor

kKeyShapeStyle

protected static final String kKeyShapeStyle

kDefaultShapeStyle

protected static final String kDefaultShapeStyle

kKeyLineColor

protected static final String kKeyLineColor

kDefaultLineColor

protected static final String kDefaultLineColor

kKeyStrokeWidth

protected static final String kKeyStrokeWidth

kDefaultStrokeWidth

protected static final String kDefaultStrokeWidth

kKeyStrokeCap

protected static final String kKeyStrokeCap

kDefaultStrokeCap

protected static final String kDefaultStrokeCap

kKeyStrokeJoin

protected static final String kKeyStrokeJoin

kDefaultStrokeJoin

protected static final String kDefaultStrokeJoin

kKeyStrokeLimit

protected static final String kKeyStrokeLimit

kDefaultStrokeLimit

protected static final String kDefaultStrokeLimit

kKeyStrokePhase

protected static final String kKeyStrokePhase

kDefaultStrokePhase

protected static final String kDefaultStrokePhase

kKeyStrokeDash

protected static final String kKeyStrokeDash
Constructor Detail

BRectShape

protected BRectShape(int x,
                     int y,
                     int w,
                     int h)

BRectShape

protected BRectShape()
Method Detail

renderRectShape

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

renderFill

public abstract void renderFill(Graphics2D g2)

renderShape

public abstract void renderShape(Graphics2D g2)

renderRect

public void renderRect(Graphics2D g2,
                       int noLines)

newInstance

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

transform

public void transform(BView viewport,
                      BScalarPoint parentPos,
                      int frameCounter)
Transforms the coordinates of the rectshape to a new coordinate space, as defined by the viewport and parent pos.
Parameters:
BView - viewport - the viewport that this object is going to be drawn in
Point - parentPos - coordinates of any parent object
Overrides:
transform in class BDrawable

render

public void render(Graphics2D g2)
Overrides:
render in class BDrawable

renderOutlineAndSizers

public void renderOutlineAndSizers(Graphics2D g2)
Only render the outline and the sizing boxes....

paintIcon

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

checkXFormBounds

public int checkXFormBounds(Point pt)
Checks to see if a point has hit the transformed bounds of this object
Parameters:
Point - pt - the point to check the hit against..
Returns:
kNotHit - not hit
Overrides:
checkXFormBounds in class BDrawable

checkSizerHit

public int checkSizerHit(Point pt)
Checks to see if a sizer has been hit by a point Works on xformed values. Subclasses should determine appropriate places for the sizer..
Parameters:
Point - pt - the point to check the hit against
Returns:
kNotHit - not hit
Overrides:
checkSizerHit in class BDrawable

startAdd

public void startAdd()
Overrides:
startAdd in class BDrawable

dragAdd

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

stopAdd

public void stopAdd()
Overrides:
stopAdd in class BDrawable

startResize

public void startResize(int sizerNum)
called when the drawable is about to be resized..
Parameters:
int - sizerNum - a sizerNum returned from checkSizerHit
Overrides:
startResize in class BDrawable

dragResize

public void dragResize(BScalarPoint deltaXY)
Called as the drawable is being resized
Overrides:
dragResize in class BDrawable

stopResize

public void stopResize()
Overrides:
stopResize in class BDrawable

updateBounds

public void updateBounds()
updates the bounding region of the drawable Called when something requires the bounds of the drawable to be updated. Subclasses should determine a suitable way to update themselves.
Overrides:
updateBounds in class BDrawable

copy

public void copy(BRectShape src)
copies the data from the src BRectShape into this one.
Parameters:
BRectShape - src - the sourc BRectShape..

getPropertyPanel

public BPropPanel getPropertyPanel()
Overrides:
getPropertyPanel in class BDrawable

setLocalXY

public void setLocalXY(BScalarPoint pt)

setLocalWH

public void setLocalWH(int w,
                       int h)

setLocalBounds

public void setLocalBounds(BRectShape rec)

setDoFill

public void setDoFill(boolean doFill)

setFillColour

public void setFillColour(Color colour)

getFillColour

public Color getFillColour()

setOutlineColour

public void setOutlineColour(Color colour)

setLineColour

public void setLineColour(Color colour)

getLineColour

public Color getLineColour()

setStroke

public void setStroke(BasicStroke stroke)

setStyle

public void setStyle(Integer style)

getStyle

public Integer getStyle()

getStroke

public BasicStroke getStroke()

setHighlighted

public void setHighlighted(boolean on)
Overrides:
setHighlighted in class BDrawable

setSelected

public void setSelected(boolean on)
Overrides:
setSelected in class BDrawable

load

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

save

public boolean save(BDataFile file)
saaves the BRectShape to a data file
Specified by:
save in interface BSaveable
Parameters:
file - the file to save the rect shape to
Overrides:
save in class BDrawable

Synergy Home Page