ptolemy.actor.gui
Class ModelDirectory

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.kernel.CompositeEntity
                      extended byptolemy.actor.gui.ModelDirectory
All Implemented Interfaces:
Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable

public class ModelDirectory
extends CompositeEntity

A directory of open models. An instance of this class is contained by a Configuration. Each open model is represented by an instance of Effigy. An effigy represents the model data. It contains a string attribute named "identifier" with a string value that uniquely identifies the model. A typical choice (which depend on the configuration) is the canonical URL for a MoML file that describes the model. An effigy also contains all open instances of Tableau associated with the model.

Since:
Ptolemy II 1.0
Version:
$Id: ModelDirectory.java,v 1.29 2004/04/13 05:12:07 cxh Exp $
Author:
Steve Neuendorffer and Edward A. Lee
See Also:
Configuration, Effigy, Tableau, Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Yellow (eal)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
ModelDirectory(CompositeEntity container, java.lang.String name)
          Construct a model directory with the specified container and name.
 
Method Summary
protected  void _removeEntity(ComponentEntity entity)
          Remove the specified entity, and if there are no more models in the directory, except possibly the configuration, then remove this directory from its container.
 Effigy getEffigy(java.lang.String identifier)
          Get the effigy of the model that corresponds to the specified identifier.
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_addEntity, _addRelation, _adjustDeferrals, _description, _exportMoMLContents, _finishedAddEntity, _removeRelation, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, clone, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, entityList, entityList, exportLinks, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, isOpaque, newRelation, numberOfClassDefinitions, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, uniqueName, validateSettables
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_addPort, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, newPort, propagateExistence, setContainer, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getFullName, getName, getName
 

Constructor Detail

ModelDirectory

public ModelDirectory(CompositeEntity container,
                      java.lang.String name)
               throws IllegalActionException,
                      NameDuplicationException
Construct a model directory with the specified container and name.

Parameters:
container - The configuration that contains this directory.
name - The name of the directory.
Throws:
IllegalActionException - If the entity cannot be contained by the proposed container. This should not be thrown.
NameDuplicationException - If the name coincides with an entity already in the container.
Method Detail

getEffigy

public Effigy getEffigy(java.lang.String identifier)
Get the effigy of the model that corresponds to the specified identifier.

Parameters:
identifier - The identifier for the model, such as a URL.
Returns:
The effigy for the model, or null if the model is not in the directory.

_removeEntity

protected void _removeEntity(ComponentEntity entity)
Remove the specified entity, and if there are no more models in the directory, except possibly the configuration, then remove this directory from its container. This method should not be used directly. Call the setContainer() method of the entity instead with a null argument. The entity is assumed to be contained by this composite (otherwise, nothing happens). This does not alter the entity in any way. This method is not synchronized on the workspace, so the caller should be. This class overrides the superclass to check if this composite is empty, and if so, calls system.exit

Overrides:
_removeEntity in class CompositeEntity
Parameters:
entity - The entity to remove.