ptolemy.actor.gui
Class ModelDirectory

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

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 57046 2010-01-27 23:35:53Z cxh $
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/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _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
private  void _purgeConfigurationURL()
          If the configuration is present, then purge the model record of the configuration.
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, _deepOpaqueEntityList, _description, _exportMoMLContents, _finishedAddEntity, _recordDecoratedAttributes, _removeRelation, _validateSettables, allAtomicEntityList, allCompositeEntityList, allowLevelCrossingConnect, classDefinitionList, clone, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, isOpaque, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, newRelation, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, setContainer, statistics, uniqueName
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_addPort, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _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, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, 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, getDisplayName, 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.

_purgeConfigurationURL

private void _purgeConfigurationURL()
If the configuration is present, then purge the model record of the configuration. This is done so that if we re-read the configuration.xml file, then we get the ModelDirectory. This came up with applets that bring up a separate window from the browser. To reproduce:
  1. point your browser at a Ptolemy applet demo.
  2. The toplevel applet window containing the demo comes up.
  3. Close the toplevel applet window.
  4. Reload the browser page.
Formerly, we were seeing exceptions about missing directory.