ptolemy.vergil.basic
Class DocAttribute

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.kernel.util.SingletonAttribute
              extended by ptolemy.vergil.basic.DocAttribute
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Singleton

public class DocAttribute
extends SingletonAttribute

An attribute containing documentation for a Ptolemy II object.

Since:
Ptolemy II 5.2
Version:
$Id: DocAttribute.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (eal)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 StringAttribute author
          The author field.
 StringAttribute description
          The description.
 StringAttribute since
          The since field.
 StringAttribute version
          The version field.
 
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
DocAttribute()
          Construct an empty DocAttribute.
DocAttribute(NamedObj container, java.lang.String name)
          Construct a documentation attribute with the given name contained by the specified entity.
DocAttribute(Workspace workspace)
          Construct a DocAttribute in a given workspace.
 
Method Summary
 java.lang.String getParameterDoc(java.lang.String name)
          Return the documentation for the given parameter, or null if there none.
 java.lang.String getPortDoc(java.lang.String name)
          Return the documentation for the given port, or null if there none.
 void refreshParametersAndPorts()
          For each parameter and port in the container, create a parameter with the same name appended with either " (port)" or " (parameter)".
 
Methods inherited from class ptolemy.kernel.util.SingletonAttribute
setContainer
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, 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, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

author

public StringAttribute author
The author field.


description

public StringAttribute description
The description.


since

public StringAttribute since
The since field.


version

public StringAttribute version
The version field.

Constructor Detail

DocAttribute

public DocAttribute(NamedObj container,
                    java.lang.String name)
             throws IllegalActionException,
                    NameDuplicationException
Construct a documentation attribute with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.

Parameters:
container - The container.
name - The name of this attribute.
Throws:
IllegalActionException - If the attribute is not of an acceptable class for the container, or if the name contains a period.
NameDuplicationException - If the name coincides with an attribute already in the container.

DocAttribute

public DocAttribute()
Construct an empty DocAttribute.


DocAttribute

public DocAttribute(Workspace workspace)
Construct a DocAttribute in a given workspace.

Parameters:
workspace - The workspace in which to construct the DocAttribute.
Method Detail

getParameterDoc

public java.lang.String getParameterDoc(java.lang.String name)
Return the documentation for the given parameter, or null if there none.

Parameters:
name - The name of the parameter.
Returns:
The documentation for the given parameter, or null if there is none.

getPortDoc

public java.lang.String getPortDoc(java.lang.String name)
Return the documentation for the given port, or null if there none.

Parameters:
name - The name of the port.
Returns:
The documentation for the given port, or null if there is none.

refreshParametersAndPorts

public void refreshParametersAndPorts()
For each parameter and port in the container, create a parameter with the same name appended with either " (port)" or " (parameter)". For parameters, only those that are settable are shown, and only if the visibility is "FULL". This method also removes any parameters that have no corresponding parameter or port in the container. Since this method modifies the model by adding or removing parameters to this attribute, it should be called from inside a change request.