cb.petal
Class PetalFile

java.lang.Object
  |
  +--cb.petal.PetalFile
All Implemented Interfaces:
java.lang.Cloneable, PetalNode, java.io.Serializable, javax.swing.tree.TreeModel

public class PetalFile
extends java.lang.Object
implements PetalNode, javax.swing.tree.TreeModel

Top level node (aka. model) containing two children: Petal and Design. To be used in GUI applications it also may be used as the tree model for a JTree.

Version:
$Id: PetalFile.java,v 1.15 2001/11/01 15:56:49 dahm Exp $
Author:
M. Dahm
See Also:
Serialized Form

Constructor Summary
PetalFile()
           
PetalFile(Petal petal, Design design)
           
 
Method Summary
 void accept(Visitor v)
           
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          Adds a listener for the TreeModelEvent posted after the tree changes.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
           
 java.util.List getAssociations(Class clazz)
          If the association has registered itself properly (done in Association.init() by default) one can look up what associations a class has.
 java.lang.Object getChild(java.lang.Object node, int index)
          Returns the child of parent at index index in the parent's child array.
 int getChildCount()
           
 int getChildCount(java.lang.Object node)
          Returns the number of children of parent.
 Class getClassByQualifiedName(java.lang.String qual)
           
 Class getClassByQuid(java.lang.String quid)
           
 Class getClassByQuidu(HasQuidu obj)
           
 Design getDesign()
           
 int getIndexOfChild(java.lang.Object node, java.lang.Object child)
           
 java.lang.String getKind()
           
 LogicalCategory getLogicalCategory()
           
 java.lang.String getModelName()
           
 int getNewTag()
          Tags are numbered consecutively within a model file.
 Petal getPetal()
           
static java.lang.String getQuid()
           
 QuidObject getQuidObject(java.lang.String quid)
           
 QuidObject getReferencedObject(HasQuidu obj)
           
 java.lang.Object getRoot()
           
 UseCaseCategory getUseCaseCategory()
           
 boolean isLeaf(java.lang.Object node)
           
 void registerAssociation(Association a)
          Register the association internally, i.e.
 void registerClass(Class clazz)
          Register class by its fully qualified name
 void registerQuidObject(QuidObject obj)
          Register class by its "quid" property.
 void registerQuidObject(java.lang.String quid, QuidObject obj)
          Register class by its quid property.
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Removes a listener previously added with addTreeModelListener().
 void setDesign(Design p)
           
 void setModelName(java.lang.String v)
           
 void setPetal(Petal p)
           
 java.lang.String toString()
           
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          Messaged when the user has altered the value for the item identified by path to newValue.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PetalFile

public PetalFile(Petal petal,
                 Design design)

PetalFile

public PetalFile()
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

setPetal

public void setPetal(Petal p)

getPetal

public Petal getPetal()

setDesign

public void setDesign(Design p)

getDesign

public Design getDesign()

getModelName

public java.lang.String getModelName()

setModelName

public void setModelName(java.lang.String v)

accept

public void accept(Visitor v)
Specified by:
accept in interface PetalNode

getKind

public java.lang.String getKind()
Specified by:
getKind in interface PetalNode

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getQuid

public static java.lang.String getQuid()
Returns:
unique quid - as with Rational Rose this is simply the current time expressed as the number of seconds elapsed since January 1, 1970 + some random number. If the resulting string is shorter than 12 characters it is filled up with some random characters.

registerQuidObject

public final void registerQuidObject(java.lang.String quid,
                                     QuidObject obj)
Register class by its quid property.

registerQuidObject

public final void registerQuidObject(QuidObject obj)
Register class by its "quid" property.

getQuidObject

public final QuidObject getQuidObject(java.lang.String quid)
Returns:
object by its "quid" (if registered via init())

getClassByQuid

public final Class getClassByQuid(java.lang.String quid)
Returns:
class object by its "quid" property (if registered via init())

getClassByQuidu

public final Class getClassByQuidu(HasQuidu obj)
Returns:
class object by the quidu reference, i.e. a HasQuidu contains a reference to a class denoted by the "quidu" property

getReferencedObject

public final QuidObject getReferencedObject(HasQuidu obj)

registerClass

public final void registerClass(Class clazz)
Register class by its fully qualified name

getClassByQualifiedName

public final Class getClassByQualifiedName(java.lang.String qual)
Returns:
class by its fully qualified name

registerAssociation

public final void registerAssociation(Association a)
Register the association internally, i.e. associate it with the given classes. So the classes can look up the associations related to them.

getAssociations

public final java.util.List getAssociations(Class clazz)
If the association has registered itself properly (done in Association.init() by default) one can look up what associations a class has.

getLogicalCategory

public LogicalCategory getLogicalCategory()
Returns:
top level LogicalCategory

getUseCaseCategory

public UseCaseCategory getUseCaseCategory()
Returns:
top level UseCaseCategory

getNewTag

public final int getNewTag()
Tags are numbered consecutively within a model file. So we just use in internal counter.

getRoot

public java.lang.Object getRoot()
Specified by:
getRoot in interface javax.swing.tree.TreeModel
Returns:
the root of the tree which is just "this" object.

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.
Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener().
Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Returns:
true if (petal) node is a leaf.

getChildCount

public int getChildCount(java.lang.Object node)
Returns the number of children of parent.
Specified by:
getChildCount in interface javax.swing.tree.TreeModel

getChild

public java.lang.Object getChild(java.lang.Object node,
                                 int index)
Returns the child of parent at index index in the parent's child array.
Specified by:
getChild in interface javax.swing.tree.TreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object node,
                           java.lang.Object child)
Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

getChildCount

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

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Messaged when the user has altered the value for the item identified by path to newValue. TODO
Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel