Package ptolemy.moml
Class LibraryAttribute
- java.lang.Object
- 
- ptolemy.kernel.util.NamedObj
- 
- ptolemy.kernel.util.Attribute
- 
- ptolemy.kernel.util.ConfigurableAttribute
- 
- ptolemy.moml.LibraryAttribute
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- Changeable,- Configurable,- Debuggable,- DebugListener,- Derivable,- ModelErrorHandler,- MoMLExportable,- Moveable,- Nameable,- Settable
 
 public class LibraryAttribute extends ConfigurableAttribute This class is a configurable singleton attribute that associates a component library with a model. By convention, it is typically named "_library". A visual editor that opens a model containing this attribute will offer the contents of its library as the component library for editing the model. "Singleton" means that if this attribute is placed in a model, it will replace any previous singleton attribute that has the same name. "Configurable" means that the contents of the library can be set in a configure element in MoML, or via the configure() method. The library can also be set by calling setLibrary(); this will override any library specified by configure.When creating a library to associate with this attribute, the library should be created in the same workspace as this attribute (as returned by the workspace() method). Normally, it will have no container. The text specified in the configure element (or a call to the configure() method) is not parsed until the getLibrary() method is called. Thus, the overhead of creating the library is avoided if the library is not used. - Since:
- Ptolemy II 1.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (janneck)
- Pt.ProposedRating:
- Yellow (eal)
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObjNamedObj.ContainedObjectsIterator
 - 
Nested classes/interfaces inherited from interface ptolemy.kernel.util.SettableSettable.Visibility
 
- 
 - 
Field Summary- 
Fields inherited from class ptolemy.kernel.util.NamedObj_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 - 
Fields inherited from interface ptolemy.kernel.util.SettableEXPERT, FULL, NONE, NOT_EDITABLE
 
- 
 - 
Constructor SummaryConstructors Constructor Description LibraryAttribute()Construct a new attribute with no container and an empty string as its name.LibraryAttribute(NamedObj container, java.lang.String name)Construct an attribute with the given container and name.LibraryAttribute(Workspace workspace)Construct a new attribute with no container and an empty string as a name.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description CompositeEntitygetLibrary()Return the library specified by the configure() method or the setLibrary() method, or null if it has not been set.voidsetLibrary(CompositeEntity library)Specify the library, overriding any library that might have been or might later be specified by a call to configure().- 
Methods inherited from class ptolemy.kernel.util.ConfigurableAttribute_exportMoMLContents, _propagateValue, addValueListener, clone, configure, getBase, getConfigureSource, getConfigureText, getDefaultExpression, getExpression, getValueAsString, getVisibility, removeValueListener, setExpression, setVisibility, validate, value
 - 
Methods inherited from class ptolemy.kernel.util.Attribute_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 - 
Methods inherited from class ptolemy.kernel.util.NamedObj_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface ptolemy.kernel.util.Nameabledescription, getContainer, getFullName, getName, getName, setName
 - 
Methods inherited from interface ptolemy.kernel.util.SettablegetDisplayName
 
- 
 
- 
- 
- 
Constructor Detail- 
LibraryAttributepublic LibraryAttribute() Construct a new attribute with no container and an empty string as its name. Add the attribute to the workspace directory. Increment the version number of the workspace.
 - 
LibraryAttributepublic LibraryAttribute(Workspace workspace) Construct a new attribute with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. Add the attribute to the workspace directory. Increment the version number of the workspace.- Parameters:
- workspace- The workspace that will list the attribute.
 
 - 
LibraryAttributepublic LibraryAttribute(NamedObj container, java.lang.String name) throws NameDuplicationException, IllegalActionException Construct an attribute with the given container and name. If an attribute already exists with the same name as the one specified here, that is an instance of class LibraryAttribute (or a derived class), then that attribute is removed before this one is inserted in the container.- Parameters:
- container- The container.
- name- The name of this attribute.
- Throws:
- IllegalActionException- If the attribute cannot be contained by the proposed container.
- NameDuplicationException- If the container already has an attribute with this name, and the class of that container is not LibraryAttribute.
 
 
- 
 - 
Method Detail- 
getLibrarypublic CompositeEntity getLibrary() throws java.lang.Exception Return the library specified by the configure() method or the setLibrary() method, or null if it has not been set. If the configure() method has defined the library, then calling this method will parse the MoML in specified in the configure() call to create the library. The parser for the top-level container of this attribute will be used, if there is one. Otherwise, a new parser will be used. Note that the library will be reparsed each time this is called. This method ensures that the library that is returned contains an attribute called "_libraryMarker" so that a user interface recognizes it as a library.- Returns:
- The library, or null if none.
- Throws:
- java.lang.Exception- If the library specification is invalid, for example because the MoML cannot be parsed, or because it does not define an instance of CompositeEntity.
- See Also:
- setLibrary(CompositeEntity)
 
 - 
setLibrarypublic void setLibrary(CompositeEntity library) Specify the library, overriding any library that might have been or might later be specified by a call to configure(). This method ensures that the library contains an attribute named "_libraryMarker" by creating one if it is not there.- Parameters:
- library- The library.
- See Also:
- getLibrary()
 
 
- 
 
-