|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.AbstractSettableAttribute
ptolemy.kernel.util.StringAttribute
public class StringAttribute
An attribute that has a string value. Use setExpression() to define the value, as in for example
attribute.setExpression("xxx");
The default value of the string contained by this attribute is the empty string.
By default, an instance of this class is fully visible in a user interface. The visibility is indicated to the user interface when the user interface calls the getVisibility() method of this class and the value Settable.FULL is returned to the userInterface.
Note that the string value within StringAttribute cannot reference other StringAttributes or Parameters, so if an actor has a public StringAttribute, then one cannot make the value of that attribute dependent on a value higher in the hierarchy. Usually, actors have public ptolemy.data.expr.Parameters instead of public StringAttributes so that the value can reference other parameters. The primary reason to use StringAttribute is if you want a string that will not be parsed and you do not want to type a leading a trailing double quote.
Settable.FULL
,
Serialized Form
Green (cxh) |
Green (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable |
---|
Settable.Visibility |
Field Summary | |
---|---|
private java.lang.String |
_value
|
private java.util.List |
_valueListeners
|
private Settable.Visibility |
_visibility
|
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_attributes, _changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.kernel.util.Settable |
---|
EXPERT, FULL, NONE, NOT_EDITABLE |
Constructor Summary | |
---|---|
StringAttribute()
Construct an attribute in the default workspace with an empty string as its name. |
|
StringAttribute(NamedObj container,
java.lang.String name)
Construct an attribute with the given name contained by the specified container. |
|
StringAttribute(Workspace workspace)
Construct an attribute in the specified workspace with an empty string as a name. |
Method Summary | |
---|---|
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. |
void |
exportMoML(java.io.Writer output,
int depth,
java.lang.String name)
Write a MoML description of this object, unless it is non-persistent. |
java.lang.String |
getExpression()
Get the value that has been set by setExpression(), or null if there is none. |
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(). |
void |
setVisibility(Settable.Visibility visibility)
Set the visibility of this attribute. |
java.util.Collection |
validate()
Do nothing. |
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute |
---|
getDefaultExpression, getValueAsString |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.kernel.util.Settable |
---|
getDisplayName |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getFullName, getName, getName, setName |
Field Detail |
---|
private java.lang.String _value
private java.util.List _valueListeners
private Settable.Visibility _visibility
Constructor Detail |
---|
public StringAttribute()
public StringAttribute(Workspace workspace)
workspace
- The workspace that will list the attribute.public StringAttribute(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this attribute.
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.Method Detail |
---|
public void addValueListener(ValueListener listener)
listener
- The listener to add.removeValueListener(ValueListener)
public void exportMoML(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
exportMoML
in interface MoMLExportable
exportMoML
in class NamedObj
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name to use instead of the current name.
java.io.IOException
- If an I/O error occurs.NamedObj.isPersistent()
public java.lang.String getExpression()
setExpression(String)
public Settable.Visibility getVisibility()
setVisibility(Settable.Visibility)
public void removeValueListener(ValueListener listener)
listener
- The listener to remove.addValueListener(ValueListener)
public void setExpression(java.lang.String expression) throws IllegalActionException
setExpression
in interface Settable
setExpression
in class AbstractSettableAttribute
expression
- The value of the string attribute.
IllegalActionException
- If the change is not acceptable
to the container.getExpression()
public void setVisibility(Settable.Visibility visibility)
visibility
- The visibility of this attribute.getVisibility()
public java.util.Collection validate() throws IllegalActionException
IllegalActionException
- If the change is not acceptable
to the container.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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |