au.edu.swin.synergy.plugin.modeller
Class BModelElement
java.lang.Object
|
+--au.edu.swin.synergy.plugin.diagram.BDrawable
|
+--au.edu.swin.synergy.plugin.modeller.BModelElement
- Direct Known Subclasses:
- BModelArc, BModelNode
- public abstract class BModelElement
- extends BDrawable
- implements BTreeNode, BSaveable, BPropertyBagItem
- See Also:
- Serialized Form
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 |
Methods inherited from class au.edu.swin.synergy.plugin.diagram.BDrawable |
checkSizerHit,
checkXFormBounds,
checkXFormHit,
contains,
continueAdd,
copy,
delete,
dragAdd,
dragMove,
dragResize,
getBasicStroke,
getBounds,
getColour,
getIconHeight,
getIconWidth,
getPos,
getPropertyPanel,
incPos,
intersects,
isDeletable,
isHighlighted,
isInside,
isSelected,
isStatusFlag,
isTransformed,
paintIcon,
setFlag,
setHighlighted,
setName,
setPos,
setPos,
setSelected,
snapToGrid,
startAdd,
startMove,
startResize,
stopAdd,
stopMove,
stopResize,
toString |
metaElement
protected BMetaElement metaElement
kUnassignedID
public static final int kUnassignedID
- This is a unique ID which is used to identify a paticular object when loading models
and detecting conflicts
uniqueID
protected long uniqueID
ruleStatus
protected int ruleStatus
BModelElement
public BModelElement(BMetaElement element)
getProperties
public abstract Vector getProperties()
getUniqueID
public long getUniqueID()
setRuleStatus
public void setRuleStatus(int ruleStatus)
getRuleStatus
public int getRuleStatus()
updateCommon
public void updateCommon(Vector common)
getMetaElement
public BMetaElement getMetaElement()
setMetaElement
public void setMetaElement(BMetaElement element)
getID
public long getID()
transform
public abstract 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 inPoint
- parentPos - coordinates of any parent object- Overrides:
- transform in class BDrawable
render
public abstract 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
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
load
public boolean load(BDataFile file)
- Loads the BDrawable from a file
- Specified by:
- load in interface BSaveable
- Parameters:
BDataFile
- file - the file to load from- Returns:
- boolean - true on success, false on failure.
- Overrides:
- load in class BDrawable
resolveLoadedObject
public void resolveLoadedObject(BModel model)
- This method is where pointers to required objects are set up
Because the file is saved flat, with (eventualy) no duplication
of data, they have to be set after the object is loaded.
This is done after to load to allow for circular refrences. (or forward dependancies)
resolveText
public void resolveText()
checkID
public void checkID(BModel model)
save
public boolean save(BDataFile file)
- Saves the BDrawable to a file
- Specified by:
- save in interface BSaveable
- Parameters:
BDataFile
- file - the file to save to- Returns:
- boolean - true on success, false on failure.
- Overrides:
- save in class BDrawable
doSaveText
public void doSaveText()
- Create a copy of text in the package properties so it is save to change the package
updateBounds
public abstract 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
doPasted
public void doPasted(BDiagram diagram)
- Called when a drawable is pasted onto a diagram.
When things like model elements are pasted
they need to change their package
- Overrides:
- doPasted in class BDrawable
setConflict
public void setConflict(int fConflict)
getConflict
public int getConflict()
findChanges
public abstract int findChanges(BModelElement oldElement)
- Detect changes in versions of this object.
If a change is detected, any information from oldElement which the user might want to know
should be stored in this.
getPropertyValue
public Object getPropertyValue(String name)
- Specified by:
- getPropertyValue in interface BPropertyBagItem
isChangeAllowed
public boolean isChangeAllowed(String name,
Object oldValue,
Object newValue)
- Specified by:
- isChangeAllowed in interface BPropertyBagItem
addProperties
public void addProperties(BPropertyBag bag)