biouml.model
Class Compartment

java.lang.Object
  extended bycom.beanexplorer.beans.Option
      extended byru.biosoft.access.MutableDataElementSupport
          extended bybiouml.model.DiagramElement
              extended bybiouml.model.Node
                  extended bybiouml.model.Compartment
All Implemented Interfaces:
DataCollection, DataElement, MutableDataElement
Direct Known Subclasses:
Diagram, EquivalentNodeGroup

public class Compartment
extends Node
implements DataCollection

General definition of the compartment as a container for nodes and edges between them.

Pendung:
DataCollectionEvents - primary vector collection is used as event source. To solve the problem we should redefine all events processing like Transformed or Derived DataCollections.

Field Summary
protected  DataCollection collection
          Primary collection.
protected  java.util.HashMap kernelMap
           
protected static org.apache.log4j.Category log
           
static int SHAPE_ELLIPSE
           
static int SHAPE_RECTANGLE
           
static int SHAPE_ROUND_RECTANGLE
           
protected  java.awt.Color shapeColor
           
protected  int shapeType
           
 
Fields inherited from class biouml.model.Node
background, edges, fixed, image, location, shapeSize
 
Fields inherited from class biouml.model.DiagramElement
comment, kernel, role, title, view
 
Fields inherited from class ru.biosoft.access.MutableDataElementSupport
name
 
Fields inherited from class com.beanexplorer.beans.Option
notificationEnabled, propagationEnabled
 
Fields inherited from interface ru.biosoft.access.DataCollection
CHILDREN_NODE_IMAGE, CHILDREN_NODE_VISIBLE, CLASS_PROPERTY, CLASSPATH_JAR_PROPERTY, COMPARATOR_OBJECT, CONFIG_FILE_PROPERTY, CONFIG_PATH_PROPERTY, DATA_ELEMENT_CLASS_PROPERTY, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_SUFFIX, DEFAULT_FILTER_CONFIG_SUFFIX, DEFAULT_FORMAT_CONFIG_SUFFIX, DEFAULT_NODE_CONFIG_SUFFIX, DEFAULT_REPOSITORY, DESCRIPTION_PROPERTY, DISPLAY_NAME_PROPERTY, FILE_PATH_PROPERTY, FILE_PROPERTY, FILTER_PROPERTY, ID_FORMAT, IS_ROOT, JOB_CONTROL_PROPERTY, LATE_CHILDREN_INITIALIZATION, MUTABLE, NAME_PROPERTY, NEXT_CONFIG, NODE_IMAGE, NODE_VISIBLE, PRIMARY_COLLECTION, REMOVE_CHILDREN, TRANSFORMER_CLASS
 
Constructor Summary
Compartment(DataCollection parent, Base kernel)
           
Compartment(DataCollection parent, java.lang.String id, Base kernel)
           
 
Method Summary
 void addDataCollectionListener(DataCollectionListener l)
          Add a listener to the list that's notified each time a change to the data collection occurs.
 DiagramElement clone(Compartment newParent, java.lang.String newName)
           
 void close()
          Closes data collection, releases all resources.
protected  boolean contains(Compartment compartment, java.lang.String name)
           
 boolean contains(DataElement de)
          Returns true if this data collection contains the specified element, false otherwise
 boolean contains(java.lang.String name)
          Returns true if this data collection contains the element with the specified name, false otherwise
 boolean containsKernel(Base kernel)
           
protected  void doClone(Compartment compartment)
           
 Node findNode(java.lang.String id)
           
 DataElement get(java.lang.String name)
          Returns the DataElement with the specified name.
 java.lang.String getCompleteName()
          Returns complete name of data collection.
 java.lang.Class getDataElementType()
          Returns the type of DataElements stored in the data collection.
 DataCollectionInfo getInfo()
          Returns additional info for this data collection.
 java.util.List getKernelNodes(Base kernel)
           
 java.util.List getNameList()
          Returns an unmodifiable view of the data element name list.
 java.awt.Color getShapeColor()
           
 int getShapeType()
           
 int getSize()
          Returns the number of elements in this data collection.
 void init()
           
 boolean isMutable()
          Returns true if this data collection is mutable, false otherwise.
 java.util.Iterator iterator()
          Returns an iterator over the data elements in this collection.
 void moveNodes(int dx, int dy)
          Recursively moves location of intrnal nodes.
 void propagateElementChanged(DataCollection source, DataCollectionEvent primaryEvent)
           
 void propagateElementWillChange(DataCollection source, DataCollectionEvent primaryEvent)
           
 DataElement put(DataElement obj)
          Adds the specified data element to the collection.
 void release(java.lang.String dataElementName)
          Do nothing because cache is not used.
protected  void remapEdge(DataCollection newParent, Edge edge, Node inNode, Node outNode)
           
 void remove(java.lang.String name)
          Removes the specified data element from the collection, if present.
 void removeDataCollectionListener(DataCollectionListener l)
          Remove a listener from the list that's notified each time a change to the data collection occurs.
 void setNotificationEnabled(boolean notificationEnabled)
          Enable/disable events notification of two types: 1) PropertyChangeEvent (inhereted from Option) 2) DataCollectionEvent (encapsulated DataCollection)
 void setPropagationEnabled(boolean propagationEnabled)
          Enable/disable events propagation of two types: 1) PropertyChangeEvent (inhereted from Option) 2) DataCollectionEvent (encapsulated DataCollection)
 void setShapeColor(java.awt.Color shapeColor)
           
 void setShapeType(int shapeType)
           
 
Methods inherited from class biouml.model.Node
addEdge, doClone, edgeIterator, findCommonOrigin, getBackground, getEdges, getImage, getLocation, getShapeSize, isBackgroundHidden, isFixed, isNotResizable, removeEdge, setBackground, setFixed, setImage, setLocation, setLocation, setRelativeLocation, setShapeSize
 
Methods inherited from class biouml.model.DiagramElement
getComment, getKernel, getRole, getTitle, getView, isKernelHidden, isRoleHidden, setComment, setKernel, setRole, setTitle, setView
 
Methods inherited from class ru.biosoft.access.MutableDataElementSupport
getName, getOrigin, toString
 
Methods inherited from class com.beanexplorer.beans.Option
addPropertyChangeListener, copyListenersTo, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getParent, isNotificationEnabled, isPropagationEnabled, removePropertyChangeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ru.biosoft.access.DataCollection
isNotificationEnabled, isPropagationEnabled
 
Methods inherited from interface ru.biosoft.access.DataElement
getName, getOrigin
 
Methods inherited from interface ru.biosoft.access.MutableDataElement
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

log

protected static org.apache.log4j.Category log

kernelMap

protected java.util.HashMap kernelMap

shapeColor

protected java.awt.Color shapeColor

SHAPE_RECTANGLE

public static final int SHAPE_RECTANGLE
See Also:
Constant Field Values

SHAPE_ROUND_RECTANGLE

public static final int SHAPE_ROUND_RECTANGLE
See Also:
Constant Field Values

SHAPE_ELLIPSE

public static final int SHAPE_ELLIPSE
See Also:
Constant Field Values

shapeType

protected int shapeType

collection

protected DataCollection collection
Primary collection.

Constructor Detail

Compartment

public Compartment(DataCollection parent,
                   java.lang.String id,
                   Base kernel)

Compartment

public Compartment(DataCollection parent,
                   Base kernel)
Method Detail

findNode

public Node findNode(java.lang.String id)
              throws java.lang.Exception
Throws:
java.lang.Exception

moveNodes

public void moveNodes(int dx,
                      int dy)
Recursively moves location of intrnal nodes.


containsKernel

public boolean containsKernel(Base kernel)

getKernelNodes

public java.util.List getKernelNodes(Base kernel)

getShapeColor

public java.awt.Color getShapeColor()

setShapeColor

public void setShapeColor(java.awt.Color shapeColor)

getShapeType

public int getShapeType()

setShapeType

public void setShapeType(int shapeType)

getInfo

public DataCollectionInfo getInfo()
Description copied from interface: DataCollection
Returns additional info for this data collection. Can return null.

Specified by:
getInfo in interface DataCollection
Returns:
Additional info for this data collection.
See Also:
DataCollectionInfo

getSize

public int getSize()
Description copied from interface: DataCollection
Returns the number of elements in this data collection.

Specified by:
getSize in interface DataCollection
Returns:
Size of this data collection.

getDataElementType

public java.lang.Class getDataElementType()
Description copied from interface: DataCollection
Returns the type of DataElements stored in the data collection.

Specified by:
getDataElementType in interface DataCollection
Returns:
Type of DataElements stored in the data collection.

isMutable

public boolean isMutable()
Description copied from interface: DataCollection
Returns true if this data collection is mutable, false otherwise.

Specified by:
isMutable in interface DataCollection
Returns:
true if primary data collection is mutable,
false otherwise..

contains

public boolean contains(java.lang.String name)
Description copied from interface: DataCollection
Returns true if this data collection contains the element with the specified name, false otherwise

Specified by:
contains in interface DataCollection
Parameters:
name - name of data element
Returns:
true if this data collection contains the element with specified name,
false otherwise

contains

public boolean contains(DataElement de)
Description copied from interface: DataCollection
Returns true if this data collection contains the specified element, false otherwise

Specified by:
contains in interface DataCollection
Parameters:
de - specified data element
Returns:
true if this data collection contains the element wit specified name,
false otherwise

iterator

public java.util.Iterator iterator()
Description copied from interface: DataCollection
Returns an iterator over the data elements in this collection. There are no guarantees concerning the order in which the elements are returned. If the data collection is modified while an iteration over it is in progress, the results of the iteration are undefined.

Specified by:
iterator in interface DataCollection

getNameList

public java.util.List getNameList()
Description copied from interface: DataCollection
Returns an unmodifiable view of the data element name list. Query operations on the returned list "read through" to the internal name list, and attempts to modify the returned list, whether direct or via its iterator, result in an UnsupportedOperationException. The returned list is backed by the data collection, so changes to the data collection are reflected in the returned list. The name list can be sorted or unsorted depending on the DataCollection implementing class.

Specified by:
getNameList in interface DataCollection
Returns:
list of names

get

public DataElement get(java.lang.String name)
                throws java.lang.Exception
Description copied from interface: DataCollection
Returns the DataElement with the specified name. Returns null if the data collection contains no data element for this name.

Specified by:
get in interface DataCollection
Throws:
java.lang.Exception

put

public DataElement put(DataElement obj)
                throws java.lang.Exception
Description copied from interface: DataCollection
Adds the specified data element to the collection. If the data collection previously contained the specified element, the old value is replaced.

Specified by:
put in interface DataCollection
Returns:
previous version of the data element, or null if there was no one.
Throws:
java.lang.Exception
See Also:
DataCollection.isMutable()

remove

public void remove(java.lang.String name)
            throws java.lang.Exception
Description copied from interface: DataCollection
Removes the specified data element from the collection, if present. Notifies all listeners if the data element was removed.

Specified by:
remove in interface DataCollection
Returns:
the removed data element.
Throws:
java.lang.Exception - If error occured.
See Also:
DataCollection.isMutable()

addDataCollectionListener

public void addDataCollectionListener(DataCollectionListener l)
Description copied from interface: DataCollection
Add a listener to the list that's notified each time a change to the data collection occurs.

Specified by:
addDataCollectionListener in interface DataCollection
Parameters:
l - the DataCollectionListener
Pendung:
replace

removeDataCollectionListener

public void removeDataCollectionListener(DataCollectionListener l)
Description copied from interface: DataCollection
Remove a listener from the list that's notified each time a change to the data collection occurs.

Specified by:
removeDataCollectionListener in interface DataCollection
Parameters:
l - the DataCollectionListener
Pendung:
replace

getCompleteName

public java.lang.String getCompleteName()
Description copied from interface: DataCollection
Returns complete name of data collection.

Specified by:
getCompleteName in interface DataCollection
Returns:
Full name of DataCollection in the tree hierarchy.

close

public void close()
           throws java.lang.Exception
Description copied from interface: DataCollection
Closes data collection, releases all resources. This method invalidates DataCollection instance.

Specified by:
close in interface DataCollection
Throws:
java.lang.Exception - If error occured.
Pendung:
to think

init

public void init()
Pendung:
to think

release

public void release(java.lang.String dataElementName)
Do nothing because cache is not used.

Specified by:
release in interface DataCollection

setNotificationEnabled

public void setNotificationEnabled(boolean notificationEnabled)
Enable/disable events notification of two types: 1) PropertyChangeEvent (inhereted from Option) 2) DataCollectionEvent (encapsulated DataCollection)

Specified by:
setNotificationEnabled in interface DataCollection

setPropagationEnabled

public void setPropagationEnabled(boolean propagationEnabled)
Enable/disable events propagation of two types: 1) PropertyChangeEvent (inhereted from Option) 2) DataCollectionEvent (encapsulated DataCollection)

Specified by:
setPropagationEnabled in interface DataCollection

propagateElementWillChange

public void propagateElementWillChange(DataCollection source,
                                       DataCollectionEvent primaryEvent)
Specified by:
propagateElementWillChange in interface DataCollection
To do:
comment

propagateElementChanged

public void propagateElementChanged(DataCollection source,
                                    DataCollectionEvent primaryEvent)
Specified by:
propagateElementChanged in interface DataCollection
To do:
comment

clone

public DiagramElement clone(Compartment newParent,
                            java.lang.String newName)
                     throws java.lang.IllegalArgumentException
Overrides:
clone in class Node
Throws:
java.lang.IllegalArgumentException

doClone

protected void doClone(Compartment compartment)
Pendung:
clone edge properties (inPort, outPort, ...)

remapEdge

protected void remapEdge(DataCollection newParent,
                         Edge edge,
                         Node inNode,
                         Node outNode)
                  throws java.lang.Exception
Throws:
java.lang.Exception

contains

protected boolean contains(Compartment compartment,
                           java.lang.String name)


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.