Synergy Home Page

au.edu.swin.synergy.plugin.packager
Class BPackageArc

java.lang.Object
  |
  +--au.edu.swin.synergy.plugin.diagram.BDrawable
        |
        +--au.edu.swin.synergy.plugin.packager.BPackageArc

public class BPackageArc
extends BDrawable
implements BTreeNode

See Also:
Serialized Form

Field Summary
protected  Color arcColour
           
protected  BasicStroke arcStroke
           
protected  BPackageTerminator arcTerminator
           
protected  int arcType
           
protected  BScalarPoint dir
           
protected  Vector drawables
           
protected  BPackageTerminator endTerminator
           
static int kCurvedType
           
protected static String kDefaultArcColor
           
protected static String kDefaultArcType
           
static int kDefaultHeight
           
protected static String kDefaultLineStyle
           
protected static String kDefaultStrokeCap
           
protected static String kDefaultStrokeJoin
           
protected static String kDefaultStrokeLimit
           
protected static String kDefaultStrokePhase
           
protected static String kDefaultStrokeWidth
           
static int kDefaultWidth
           
static int kHalfHitLen
           
static int kHitLen
           
protected static String kKeyArcColor
           
protected static String kKeyArcType
           
protected static String kKeyLineStyle
           
protected static String kKeyStrokeCap
           
protected static String kKeyStrokeDash
           
protected static String kKeyStrokeJoin
           
protected static String kKeyStrokeLimit
           
protected static String kKeyStrokePhase
           
protected static String kKeyStrokeWidth
           
static int kLeftRight
           
static int kNegative
           
static int kNumCtrlPoints
           
static int kPositive
           
static int kSteppedType
           
static int kStraightType
           
static int kTopBottom
           
protected  Integer lineStyle
           
protected  BMetaElement metaElement
           
protected  Object parent
           
protected  Vector properties
           
protected  BPackageTerminator startTerminator
           
 
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
BPackageArc()
          Default constructor for BSaveable
BPackageArc(BMetaElement element)
           
BPackageArc(BPackageArc pa)
           
 
Method Summary
 void addDrawable(BDrawable drawable)
           
 void addTextProperty(int index, BScalarPoint pos)
           
 BScalarPoint calcDirection()
          Calculates the direction of the line...
 int checkCurvedSizerHit(Point pt)
           
 int checkSizerHit(Point pt)
          Checks to see if a sizer has been hit by a point Works on xformed values.
 int checkStraightSizerHit(Point pt)
           
 int checkXFormBounds(Point pt)
          checks the tranformed bounds...used for hit testing with the mouse..
 int checkXFormCurvedBounds(Point pt)
           
 int checkXFormSteppedBounds(Point pt)
           
 int checkXFormStraightBounds(Point pt)
           
 void copy(BPackageArc src)
           
 void dragAdd(BScalarPoint deltaXY)
           
 void dragResize(BScalarPoint deltaXY, int sizer)
          Called as the drawable is being resized
protected  void drawCurve(Graphics2D g2)
           
 BPackageTerminator getArcTerminator()
           
 int getArcType()
           
 Object getChildAt(int index)
           
 int getChildCount()
           
 Color getColour()
           
 Vector getDrawables()
           
 BScalarPoint getEndPos()
           
 BPackageTerminator getEndTerminator()
           
 int getIndexOf(Object node)
           
 BScalarPoint getInfluence(BScalarPoint textPt)
           
 BMetaElement getMetaElement()
           
 String getName()
           
 Object getParent()
           
 Vector getProperties()
           
 BPropPanel getPropertyPanel()
           
 BPackageTerminator getStartTerminator()
           
 int getSteppingType()
           
 BasicStroke getStroke()
           
 Integer getStyle()
           
 BDrawable getTextProperty(int index)
           
 void initCtrlPos()
           
 void initEndPos(BScalarRect rect)
           
protected  void intercept(Point start, Point end, int plane, int bound, Point icept)
           
 boolean intersects(BScalarRect point)
           
 boolean isLeaf()
           
 boolean load(BDataFile file)
          Loads the BDrawable from a file
 BDrawable newInstance()
          Creates and returns a new instance of the BDrawable object
protected  int outcode(Rectangle rect, int posX, int posY)
           
 void paintIcon(Component c, Graphics g, int x, int y)
           
 void removeAllChildren()
           
 void removeDrawable(BDrawable drawable)
           
 void removeDrawable(int index)
           
 void render(Graphics2D g2)
          Renders the transformed coordinates of the drawable object to a Graphics2D
protected  void renderCurve(Graphics2D g2)
           
 void renderCurve(Graphics2D g2, int style)
           
 void renderLine(Graphics2D g2, int style)
           
 void renderProperties(Graphics2D g2)
           
protected  void renderSizersAndOutLine(Graphics2D g2)
           
protected  void renderStepped(Graphics2D g2)
           
 void renderStepped(Graphics2D g2, int style)
           
 boolean save(BDataFile file)
          Saves the BDrawable to a file
 void setArcTerminator(BPackageTerminator at)
           
 void setArcType(int type)
           
 void setColour(Color c)
           
 void setCtrlPoints(BScalarPoint[] ctrl)
           
 void setEndPos(BScalarPoint theEndPos)
           
 void setEndTerminator(BPackageTerminator et)
           
 void setParent(Object parent)
           
 void setStartTerminator(BPackageTerminator st)
           
 void setStroke(BasicStroke stroke)
           
 void setStyle(Integer sStyle)
           
 void startAdd()
           
 void stopAdd()
           
 void transform(BView viewport, BScalarPoint parentPos, int frameCounter)
          Transforms the coordinates of the drawable object to a new coordinate space, as defined by the viewport and parent pos.
 void transformArc(BModelNode startNode, BModelNode endNode, BView viewport, BScalarPoint parentPos, int frameCounter)
           
 void transformCtrl(BView viewport, BScalarPoint parentPos, int frameCounter)
           
protected  void transformEndTerm(BView viewport, int frameCounter)
           
protected  void transformNodePos(BModelNode node, BScalarPoint bspt, Point pt, BView viewport, BScalarPoint parentPos, int frameCounter)
           
 void transformProperties(BView viewport, int frameCounter)
           
protected  void transformStartTerm(BView viewport, int frameCounter)
           
 void transformStepped(BView viewport, BScalarPoint parentPos, int frameCounter)
           
protected  void transformSteppedToSide(BModelNode startNode, BModelNode endNode, BView viewport, int frameCounter)
           
protected  void transformToSide(BModelNode node, Point center, Point finalPt, Point outPt)
          tranforms a center point to the side of the model's bounding box.
 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, dragResize, getBasicStroke, getBounds, getIconHeight, getIconWidth, getPos, incPos, isDeletable, isHighlighted, isInside, isSelected, isStatusFlag, isTransformed, setFlag, setHighlighted, setName, setPos, setPos, setSelected, snapToGrid, startMove, startResize, stopMove, stopResize, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kNumCtrlPoints

public static final int kNumCtrlPoints

kStraightType

public static final int kStraightType

kSteppedType

public static final int kSteppedType

kCurvedType

public static final int kCurvedType

kDefaultHeight

public static final int kDefaultHeight

kDefaultWidth

public static final int kDefaultWidth

kHitLen

public static final int kHitLen

kHalfHitLen

public static final int kHalfHitLen

kLeftRight

public static final int kLeftRight

kTopBottom

public static final int kTopBottom

kPositive

public static final int kPositive

kNegative

public static final int kNegative

drawables

protected Vector drawables

properties

protected Vector properties

parent

protected Object parent

arcColour

protected Color arcColour

arcStroke

protected BasicStroke arcStroke

lineStyle

protected Integer lineStyle

arcType

protected int arcType

metaElement

protected BMetaElement metaElement

startTerminator

protected BPackageTerminator startTerminator

endTerminator

protected BPackageTerminator endTerminator

arcTerminator

protected BPackageTerminator arcTerminator

dir

protected BScalarPoint dir

kKeyArcType

protected static final String kKeyArcType

kDefaultArcType

protected static final String kDefaultArcType

kKeyLineStyle

protected static final String kKeyLineStyle

kDefaultLineStyle

protected static final String kDefaultLineStyle

kKeyArcColor

protected static final String kKeyArcColor

kDefaultArcColor

protected static final String kDefaultArcColor

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

BPackageArc

public BPackageArc(BMetaElement element)

BPackageArc

public BPackageArc(BPackageArc pa)

BPackageArc

public BPackageArc()
Default constructor for BSaveable
Method Detail

getProperties

public Vector getProperties()

getSteppingType

public final int getSteppingType()

getEndTerminator

public BPackageTerminator getEndTerminator()

setEndTerminator

public void setEndTerminator(BPackageTerminator et)

getStartTerminator

public BPackageTerminator getStartTerminator()

setStartTerminator

public void setStartTerminator(BPackageTerminator st)

getArcTerminator

public BPackageTerminator getArcTerminator()

setArcTerminator

public void setArcTerminator(BPackageTerminator at)

getPropertyPanel

public BPropPanel getPropertyPanel()
Overrides:
getPropertyPanel in class BDrawable

initCtrlPos

public void initCtrlPos()

initEndPos

public void initEndPos(BScalarRect rect)

setEndPos

public void setEndPos(BScalarPoint theEndPos)

getDrawables

public Vector getDrawables()

setCtrlPoints

public void setCtrlPoints(BScalarPoint[] ctrl)

addDrawable

public void addDrawable(BDrawable drawable)

removeDrawable

public void removeDrawable(BDrawable drawable)

removeDrawable

public void removeDrawable(int index)

setStroke

public void setStroke(BasicStroke stroke)

getStroke

public BasicStroke getStroke()

setArcType

public void setArcType(int type)

getArcType

public int getArcType()

getStyle

public Integer getStyle()

setStyle

public void setStyle(Integer sStyle)

getColour

public Color getColour()
Overrides:
getColour in class BDrawable

setColour

public void setColour(Color c)

getMetaElement

public BMetaElement getMetaElement()

outcode

protected int outcode(Rectangle rect,
                      int posX,
                      int posY)

intercept

protected void intercept(Point start,
                         Point end,
                         int plane,
                         int bound,
                         Point icept)

addTextProperty

public void addTextProperty(int index,
                            BScalarPoint pos)

getEndPos

public BScalarPoint getEndPos()

getTextProperty

public BDrawable getTextProperty(int index)

transform

public void transform(BView viewport,
                      BScalarPoint parentPos,
                      int frameCounter)
Transforms the coordinates of the drawable object to a new coordinate space, as defined by the viewport and parent pos. Subclasses should follow the following equation for tranforming relevant points etc. xformPt.x = ((localPt.x + parentPos.x + pos.x - viewport.x) * viewport.zoom ) + viewport.halfx;
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

transformArc

public void transformArc(BModelNode startNode,
                         BModelNode endNode,
                         BView viewport,
                         BScalarPoint parentPos,
                         int frameCounter)

transformStartTerm

protected void transformStartTerm(BView viewport,
                                  int frameCounter)

transformEndTerm

protected void transformEndTerm(BView viewport,
                                int frameCounter)

transformProperties

public void transformProperties(BView viewport,
                                int frameCounter)

transformNodePos

protected void transformNodePos(BModelNode node,
                                BScalarPoint bspt,
                                Point pt,
                                BView viewport,
                                BScalarPoint parentPos,
                                int frameCounter)

transformToSide

protected void transformToSide(BModelNode node,
                               Point center,
                               Point finalPt,
                               Point outPt)
tranforms a center point to the side of the model's bounding box. calculates the intesection with the line..

transformSteppedToSide

protected void transformSteppedToSide(BModelNode startNode,
                                      BModelNode endNode,
                                      BView viewport,
                                      int frameCounter)

transformCtrl

public void transformCtrl(BView viewport,
                          BScalarPoint parentPos,
                          int frameCounter)

transformStepped

public void transformStepped(BView viewport,
                             BScalarPoint parentPos,
                             int frameCounter)

render

public void render(Graphics2D g2)
Renders the transformed coordinates of the drawable object to a Graphics2D
Parameters:
Graphics2D - g2 - the place to render the object to.
Overrides:
render in class BDrawable

renderProperties

public void renderProperties(Graphics2D g2)

renderLine

public void renderLine(Graphics2D g2,
                       int style)

renderStepped

public void renderStepped(Graphics2D g2,
                          int style)

renderCurve

public void renderCurve(Graphics2D g2,
                        int style)

drawCurve

protected void drawCurve(Graphics2D g2)

calcDirection

public BScalarPoint calcDirection()
Calculates the direction of the line... comes in handy when rendering multiple line styles.

getInfluence

public BScalarPoint getInfluence(BScalarPoint textPt)

intersects

public boolean intersects(BScalarRect point)
Overrides:
intersects in class BDrawable

renderCurve

protected void renderCurve(Graphics2D g2)

renderStepped

protected void renderStepped(Graphics2D g2)

renderSizersAndOutLine

protected void renderSizersAndOutLine(Graphics2D g2)

checkXFormBounds

public int checkXFormBounds(Point pt)
checks the tranformed bounds...used for hit testing with the mouse..
Overrides:
checkXFormBounds in class BDrawable

checkXFormCurvedBounds

public int checkXFormCurvedBounds(Point pt)

checkXFormStraightBounds

public int checkXFormStraightBounds(Point pt)

checkXFormSteppedBounds

public int checkXFormSteppedBounds(Point pt)

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

checkStraightSizerHit

public int checkStraightSizerHit(Point pt)

checkCurvedSizerHit

public int checkCurvedSizerHit(Point pt)

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

dragResize

public void dragResize(BScalarPoint deltaXY,
                       int sizer)
Called as the drawable is being resized

paintIcon

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

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 BDrawable

copy

public void copy(BPackageArc src)

load

public boolean load(BDataFile file)
Loads the BDrawable from a file
Parameters:
BDataFile - file - the file to load from
Returns:
boolean - true on success, false on failure.
Overrides:
load in class BDrawable

save

public boolean save(BDataFile file)
Saves the BDrawable to a file
Parameters:
BDataFile - file - the file to save to
Returns:
boolean - true on success, false on failure.
Overrides:
save 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

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