Synergy Home Page

au.edu.swin.synergy.plugin.modeller
Class BModel

java.lang.Object
  |
  +--au.edu.swin.synergy.plugin.modeller.BModel

public class BModel
extends Object
implements BSaveable, BTreeNode, BDiagram

Contains a collection of nodes, arcs, and terminators. Can be added to a project, and saved to file.

Author:
Matthew Evans, Imron Alston

Field Summary
static int kChangePackageNotCompatible
           
static int kChangePackageOK
           
protected static String kDefaultName
           
static String kFileExtension
           
protected static String kKeyName
           
 
Constructor Summary
BModel()
          Default constructor for BSaveable
BModel(BProject parent, String name, String path)
           
BModel(BProject parent, String name, String path, BPackageModel packageModel)
           
 
Method Summary
 void addDrawable(BDrawable drawable)
           
 void addElement(BModelElement fElement)
           
 void addVisibleDrawablesToList(Vector visibleList, BScalarRect bounds)
           
 void bringSelectionToFront(Vector selection)
           
protected  boolean checkCircRefViolation(BMetaModel metaModel, BModelArc arc, BModelNode node)
           
protected  boolean checkConnectionViolation(BMetaModel metaModel, BModelArc arc, BModelNode node)
           
protected  boolean checkMaxInViolation(BMetaModel metaModel, BModelArc arc, BModelNode node)
           
protected  boolean checkMaxOutViolation(BMetaModel metaModel, BModelArc arc, BModelNode node)
           
protected  boolean checkStartConnectionViolation(BMetaModel metaModel, BModelArc arc, BModelNode node)
           
 boolean continueAdd(BScalarPoint pos, BDrawable under)
           
 void createDrawable(String drawable, BScalarPoint pos)
           
 void delete(BDrawable drawable)
           
 int doChangePackage(BPackageModel newPackageModel)
          Change the package used by this model.
 void dragAdd(BScalarPoint deltaXY, BDrawable under)
           
 Object getChildAt(int index)
           
 int getChildCount()
           
 BModelElement getElementByID(long ID)
          Get an element by ID.
 int getIndexOf(Object node)
           
 String getName()
           
 long getNewUniqueID()
           
 BPackageModel getPackageModel()
           
 Object getParent()
           
 String getPath()
           
 Vector getPlaceableDrawables()
           
 boolean hasBeenModified()
          This identifies whether the model has been changed since it has been opened
 boolean isLeaf()
           
 boolean load(BDataFile file)
           
 void loadedID(long ID)
          This method is called by a model element after is has loaded it's self It makes sure that duplicate ID's are not given out
 void removeAllChildren()
           
 boolean save(BDataFile file)
           
 void sendSelectionToBack(Vector selection)
           
 void setModified(boolean modified)
           
 void setName(String name)
           
 void setPackageModel(BPackageModel packageModel)
           
 void setParent(BProject parent)
           
 void setParent(Object parent)
           
 BDrawable startAdd(BDrawable drawable, BScalarPoint pos, BDrawable under)
          starts adding a drawable to the diagram...
 boolean stopAdd(BScalarPoint pos, BDrawable under, int modifiers)
          stops adding a drawable to the diagram...
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kFileExtension

public static final String kFileExtension

kKeyName

protected static final String kKeyName

kDefaultName

protected static final String kDefaultName

kChangePackageOK

public static final int kChangePackageOK

kChangePackageNotCompatible

public static final int kChangePackageNotCompatible
Constructor Detail

BModel

public BModel(BProject parent,
              String name,
              String path)

BModel

public BModel(BProject parent,
              String name,
              String path,
              BPackageModel packageModel)

BModel

public BModel()
Default constructor for BSaveable
Method Detail

getNewUniqueID

public long getNewUniqueID()

setParent

public void setParent(BProject parent)

loadedID

public void loadedID(long ID)
This method is called by a model element after is has loaded it's self It makes sure that duplicate ID's are not given out

setPackageModel

public void setPackageModel(BPackageModel packageModel)

getPackageModel

public BPackageModel getPackageModel()

getPath

public String getPath()

getName

public String getName()
Specified by:
getName in interface BTreeNode

setName

public void setName(String name)
Specified by:
setName in interface BTreeNode

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

toString

public String toString()
Overrides:
toString in class Object

load

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

save

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

getElementByID

public BModelElement getElementByID(long ID)
Get an element by ID. The ID should be unique across distributed versions of a model If the element is not found, it returns null (and yes I know, single entry, single exit.... high Cohesion etc....)

doChangePackage

public int doChangePackage(BPackageModel newPackageModel)
Change the package used by this model. This method is called before doChangePackage
Parameters:
newPackageModel - the packagemodel to change to
Returns:
any of the kChangePackage constants

addVisibleDrawablesToList

public void addVisibleDrawablesToList(Vector visibleList,
                                      BScalarRect bounds)
Specified by:
addVisibleDrawablesToList in interface BDiagram

getPlaceableDrawables

public Vector getPlaceableDrawables()
Specified by:
getPlaceableDrawables in interface BDiagram

addDrawable

public void addDrawable(BDrawable drawable)
Specified by:
addDrawable in interface BDiagram

addElement

public void addElement(BModelElement fElement)

createDrawable

public void createDrawable(String drawable,
                           BScalarPoint pos)
Specified by:
createDrawable in interface BDiagram

startAdd

public BDrawable startAdd(BDrawable drawable,
                          BScalarPoint pos,
                          BDrawable under)
starts adding a drawable to the diagram...
Specified by:
startAdd in interface BDiagram
Pre Condition:
the model must have a valid packageModel,, the package model must have a valid metamodel..

continueAdd

public boolean continueAdd(BScalarPoint pos,
                           BDrawable under)
Specified by:
continueAdd in interface BDiagram

dragAdd

public void dragAdd(BScalarPoint deltaXY,
                    BDrawable under)
Specified by:
dragAdd in interface BDiagram

stopAdd

public boolean stopAdd(BScalarPoint pos,
                       BDrawable under,
                       int modifiers)
stops adding a drawable to the diagram...
Specified by:
stopAdd in interface BDiagram
Pre Condition:
the packageModel cannot be null, the packageModel's metamodel cannot be null..

delete

public void delete(BDrawable drawable)
Specified by:
delete in interface BDiagram

bringSelectionToFront

public void bringSelectionToFront(Vector selection)
Specified by:
bringSelectionToFront in interface BDiagram

sendSelectionToBack

public void sendSelectionToBack(Vector selection)
Specified by:
sendSelectionToBack in interface BDiagram

checkConnectionViolation

protected boolean checkConnectionViolation(BMetaModel metaModel,
                                           BModelArc arc,
                                           BModelNode node)
Returns:
true if rule evaluation/arc adding is to continue.... needs to perform all handling of the violation if one occurs.

checkStartConnectionViolation

protected boolean checkStartConnectionViolation(BMetaModel metaModel,
                                                BModelArc arc,
                                                BModelNode node)

checkMaxInViolation

protected boolean checkMaxInViolation(BMetaModel metaModel,
                                      BModelArc arc,
                                      BModelNode node)

checkMaxOutViolation

protected boolean checkMaxOutViolation(BMetaModel metaModel,
                                       BModelArc arc,
                                       BModelNode node)

checkCircRefViolation

protected boolean checkCircRefViolation(BMetaModel metaModel,
                                        BModelArc arc,
                                        BModelNode node)

hasBeenModified

public boolean hasBeenModified()
This identifies whether the model has been changed since it has been opened
Returns:
if the model has been modified

setModified

public void setModified(boolean modified)

Synergy Home Page