public class ConfigurableAttribute extends Attribute implements Configurable, Settable
<property name="x" class="ptolemy.moml.ConfigurableAttribute"> <configure source="url">xxx</configure> </property>The value of this property, obtained via the value() method, will be whatever text is contained by the referenced URL (which is optional), followed by the text "xxx".
NamedObj.ContainedObjectsIterator
Settable.Visibility
_attributes, _changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
EXPERT, FULL, NONE, NOT_EDITABLE
Constructor and Description |
---|
ConfigurableAttribute()
Construct a new attribute with no
container and an empty string as its name.
|
ConfigurableAttribute(NamedObj container,
java.lang.String name)
Construct a new attribute with the given container and name.
|
ConfigurableAttribute(Workspace workspace)
Construct a new attribute with
no container and an empty string as a name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_exportMoMLContents(java.io.Writer output,
int depth)
Write a MoML description of the contents of this object.
|
protected void |
_propagateValue(NamedObj destination)
Propagate the value of this object to the
specified object.
|
void |
addValueListener(ValueListener listener)
Add a listener to be notified when the value of this attribute changes.
|
java.lang.Object |
clone(Workspace workspace)
Clone the attribute.
|
void |
configure(java.net.URL base,
java.lang.String source,
java.lang.String text)
Configure the object with data from the specified input source
(a URL) and/or textual data.
|
java.net.URL |
getBase()
Return the base specified in the most recent call to the
configure() method, or null if none.
|
java.lang.String |
getConfigureSource()
Return the source specified in the most recent call to the
configure() method, or null if none.
|
java.lang.String |
getConfigureText()
Return the text specified in the most recent call to the
configure() method, or null if none.
|
java.lang.String |
getDefaultExpression()
Return the default value of this Settable,
if there is one.
|
java.lang.String |
getExpression()
Return the the result of calling value().
|
java.lang.String |
getValueAsString()
Get the value of the attribute, which is the evaluated expression.
|
Settable.Visibility |
getVisibility()
Get the visibility of this attribute, as set by setVisibility().
|
void |
removeValueListener(ValueListener listener)
Remove a listener from the list of listeners that is
notified when the value of this attribute changes.
|
void |
setExpression(java.lang.String expression)
Set the value of the string attribute and notify the container
of the value of this attribute by calling attributeChanged(),
and notify any listeners that have
been registered using addValueListener().
|
void |
setVisibility(Settable.Visibility visibility)
Set the visibility of this attribute.
|
java.util.Collection |
validate()
Validate this attribute by calling
value() . |
java.lang.String |
value()
Return the value given by the configure tag.
|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
_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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDisplayName
description, getContainer, getFullName, getName, getName, setName
public ConfigurableAttribute()
public ConfigurableAttribute(Workspace workspace)
workspace
- The workspace that will list the attribute.public ConfigurableAttribute(NamedObj container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name.IllegalActionException
- If the attribute cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
attribute with this name.public void addValueListener(ValueListener listener)
addValueListener
in interface Settable
listener
- The listener to add.removeValueListener(ValueListener)
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
public void configure(java.net.URL base, java.lang.String source, java.lang.String text) throws java.lang.Exception
configure
in interface Configurable
base
- The base relative to which references within the input
are found, or null if this is not known, or there is none.
This argument is ignored in this method.source
- The input source, which specifies a URL.text
- Configuration information given as text.java.lang.Exception
- Not thrown in this base class.public java.net.URL getBase()
public java.lang.String getConfigureSource()
getConfigureSource
in interface Configurable
public java.lang.String getConfigureText()
getConfigureText
in interface Configurable
public java.lang.String getDefaultExpression()
getDefaultExpression
in interface Settable
setExpression(String)
public java.lang.String getExpression()
getExpression
in interface Settable
value()
,
setExpression(String)
public java.lang.String getValueAsString()
getValueAsString
in interface Settable
getExpression()
public Settable.Visibility getVisibility()
getVisibility
in interface Settable
setVisibility(Settable.Visibility)
public void removeValueListener(ValueListener listener)
removeValueListener
in interface Settable
listener
- The listener to remove.addValueListener(ValueListener)
public void setExpression(java.lang.String expression) throws IllegalActionException
setExpression
in interface Settable
expression
- The text to configure the attribute with.IllegalActionException
- If the change is not acceptable
to the container.getExpression()
public void setVisibility(Settable.Visibility visibility)
setVisibility
in interface Settable
visibility
- The visibility of this attribute.getVisibility()
public java.util.Collection validate() throws IllegalActionException
value()
.
Notify the container and listeners that the value of this
attribute has changed.validate
in interface Settable
IllegalActionException
- If the change is not acceptable
to the container.public java.lang.String value() throws java.io.IOException
java.io.IOException
- If the URL given in the configure method
(if any) cannot be read.protected void _exportMoMLContents(java.io.Writer output, int depth) throws java.io.IOException
_exportMoMLContents
in class NamedObj
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.java.io.IOException
- If an I/O error occurs.NamedObj.exportMoML(Writer, int)
protected void _propagateValue(NamedObj destination) throws IllegalActionException
_propagateValue
in class NamedObj
destination
- Object to which to propagate the
value.IllegalActionException
- If the value cannot
be propagated.