public class Effigy extends CompositeEntity
The Effigy class extends CompositeEntity, so an instance of Effigy can contain entities. By convention, an effigy contains all open instances of Tableau associated with the model. It also contains a string attribute named "identifier" with a value that uniquely identifies the model. A typical choice (which depends on the configuration) is the canonical URI for a MoML file that describes the model. In the case of an effigy contained by another, a typical choice is the URI of the parent effigy, a pound sign "#", and a name.
An effigy may contain other effigies. The master effigy in such a containment hierarchy is typically associated with a URI or file. Contained effigies are associated with the same file, and represent structured data within the top-level representation in the file. The masterEffigy() method returns that master effigy. The topEffigy() method in this base class returns the same master effigy. However, in derived classes, a master effigy may be contained by another effigy, so the top effigy is not the same as the master effigy. The top effigy is directly contained by the ModelDirectory in the Configuration.
NOTE: It might seem more natural for the identifier to match the name of the effigy rather than recording the identifier in a string attribute. But in Ptolemy II, an entity name cannot have periods in it, and a URI typically does have periods in it.
To determine the Effigy of a NamedObj, use
Configuration.findEffigy(NamedObj)
.
ModelDirectory
,
Tableau
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
StringAttribute |
identifier
The identifier for the effigy.
|
URIAttribute |
uri
The URI for the effigy.
|
_levelCrossingLinks
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
Effigy(CompositeEntity container,
java.lang.String name)
Construct an effigy with the given name and container.
|
Effigy(Workspace workspace)
Create a new effigy in the specified workspace with an empty string
for its name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_checkContainer(CompositeEntity container)
Check that the specified container is of a suitable class for
this entity, i.e., ModelDirectory or Effigy.
|
protected void |
_removeEntity(ComponentEntity entity)
Remove the specified entity from this container.
|
void |
attributeChanged(Attribute attribute)
If the argument is the identifier parameter, then set
the title of all contained Tableaux to the value of the parameter;
if the argument is the uri parameter, then check to see
whether it is writable, and call setModifiable() appropriately.
|
boolean |
closeTableaux()
Close all tableaux contained by this effigy, and by any effigies
it contains.
|
static Effigy |
findToplevelEffigy(NamedObj object)
Find the effigy associated with the top level of the object, and if not
found but the top level has a ContainmentExtender attribute, use that
attribute to find the containment extender of the top level and continue
the search.
|
TableauFactory |
getTableauFactory()
Get a tableau factory that offers views of this effigy, or
null if none has been specified.
|
java.io.File |
getWritableFile()
Return a writable file for the URI given by the uri
parameter of this effigy, if there is one, or return
null if there is not.
|
boolean |
isModifiable()
Return whether the model data is modifiable.
|
boolean |
isModified()
Return the data associated with the master effigy (as
returned by masterEffigy()) has been modified.
|
boolean |
isSystemEffigy()
Return whether this effigy is a system effigy.
|
Effigy |
masterEffigy()
Return the effigy that is "in charge" of this effigy.
|
int |
numberOfOpenTableaux()
Return the total number of open tableau for this effigy
effigy and all effigies it contains.
|
void |
setContainer(CompositeEntity container)
Override the base class so that tableaux contained by this object
are removed before this effigy is removed from the ModelDirectory.
|
void |
setModifiable(boolean flag)
If the argument is false, the specify that that the model is not
modifiable, even if the URI associated with this effigy is writable.
|
void |
setModified(boolean modified)
Record whether the data associated with this effigy has been
modified since it was first read or last saved.
|
void |
setSystemEffigy(boolean isSystemEffigy)
Set the effigy to be a system effigy if the given flag is true.
|
void |
setTableauFactory(TableauFactory factory)
Specify a tableau factory that offers multiple views of this effigy.
|
Tableau |
showTableaux()
Make all tableaux associated with this effigy and any effigies it
contains visible by raising or deiconifying them.
|
Effigy |
topEffigy()
Return the top-level effigy that (deeply) contains this one.
|
void |
writeFile(java.io.File file)
Write the model associated with this effigy
to the specified file.
|
_addEntity, _addRelation, _adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _finishedAddEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, clone, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, isOpaque, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, newRelation, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setName
_addPort, _removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, decorators, 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, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDerivedLevel, getDerivedList, propagateValue
description, getDisplayName, getFullName, getName, getName
public StringAttribute identifier
public URIAttribute uri
public Effigy(Workspace workspace)
workspace
- The workspace for this effigy.public Effigy(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the effigy.IllegalActionException
- If the entity cannot be contained
by the proposed container.NameDuplicationException
- If the name coincides with
an entity already in the container.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the base class throws it.public boolean closeTableaux()
public static Effigy findToplevelEffigy(NamedObj object) throws IllegalActionException
object
- The object.IllegalActionException
- If attributes cannot be retrieved, or
the container that an attribute points to is invalid.public TableauFactory getTableauFactory()
setTableauFactory(TableauFactory)
public java.io.File getWritableFile()
public boolean isModifiable()
masterEffigy()
public boolean isModified()
masterEffigy()
,
setModifiable(boolean)
public boolean isSystemEffigy()
public Effigy masterEffigy()
topEffigy()
public int numberOfOpenTableaux()
public void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException
setContainer
in class CompositeEntity
container
- The directory in which to list this effigy.IllegalActionException
- If the proposed container is not
an instance of ModelDirectory, or if the superclass throws it.NameDuplicationException
- If the container already has
an entity with the specified name.ComponentEntity.getContainer()
public void setModifiable(boolean flag)
flag
- False to prevent writing to the URI.masterEffigy()
,
isModifiable()
,
isModified()
,
setModified(boolean)
public void setModified(boolean modified)
modified
- True if the data has been modified.masterEffigy()
,
isModifiable()
,
isModified()
,
setModifiable(boolean)
public void setSystemEffigy(boolean isSystemEffigy)
isSystemEffigy
- True if this is to be a system effigy.public void setTableauFactory(TableauFactory factory)
factory
- A tableau factory offering multiple views.getTableauFactory()
public Tableau showTableaux()
public Effigy topEffigy()
public void writeFile(java.io.File file) throws java.io.IOException
file
- The file to write to.java.io.IOException
- If the write fails.protected void _checkContainer(CompositeEntity container) throws IllegalActionException
container
- The proposed container.IllegalActionException
- If the container is not of
an acceptable class.protected void _removeEntity(ComponentEntity entity)
_removeEntity
in class CompositeEntity
entity
- The tableau to remove.