|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.ConfigurableAttribute
public class ConfigurableAttribute
This class provides a simple way to get a long string into an attribute. It implements Configurable, so its value can be set using a configure MoML element. For example,
<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".
| Green (janneck) |
| 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.net.URL |
_base
|
private java.lang.String |
_configureSource
|
private java.lang.String |
_configureText
|
private java.lang.String |
_defaultText
|
private java.lang.String |
_displayName
|
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 | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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 |
getDisplayName()
Return a name to present to the user. |
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 |
setDisplayName(java.lang.String name)
Set a name to present to the user. |
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. |
| Methods inherited from class ptolemy.kernel.util.Attribute |
|---|
_checkContainer, _getContainedObject, _propagateExistence, 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.Nameable |
|---|
description, getContainer, getFullName, getName, getName, setName |
| Field Detail |
|---|
private java.net.URL _base
private java.lang.String _configureSource
private java.lang.String _configureText
private java.lang.String _defaultText
private java.lang.String _displayName
private java.util.List _valueListeners
private Settable.Visibility _visibility
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public void addValueListener(ValueListener listener)
addValueListener in interface Settablelistener - The listener to add.removeValueListener(ValueListener)
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
clone in class Attributeworkspace - The workspace in which to place the cloned variable.
java.lang.CloneNotSupportedException - Not thrown in this base class.Object.clone()
public void configure(java.net.URL base,
java.lang.String source,
java.lang.String text)
throws java.lang.Exception
configure in interface Configurablebase - 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 Configurablepublic java.lang.String getConfigureText()
getConfigureText in interface Configurablepublic java.lang.String getDefaultExpression()
getDefaultExpression in interface SettablesetExpression(String)public java.lang.String getDisplayName()
getDisplayName in interface NameablegetDisplayName in interface SettablegetDisplayName in class NamedObjsetDisplayName(String)public java.lang.String getExpression()
getExpression in interface Settablevalue(),
setExpression(String)public java.lang.String getValueAsString()
getValueAsString in interface SettablegetExpression()public Settable.Visibility getVisibility()
getVisibility in interface SettablesetVisibility(Settable.Visibility)public void removeValueListener(ValueListener listener)
removeValueListener in interface Settablelistener - The listener to remove.addValueListener(ValueListener)public void setDisplayName(java.lang.String name)
setDisplayName in class NamedObjname - A name to present to the user.getDisplayName()
public void setExpression(java.lang.String expression)
throws IllegalActionException
setExpression in interface Settableexpression - 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 Settablevisibility - 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 SettableIllegalActionException - 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 NamedObjoutput - 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 NamedObjdestination - Object to which to propagate the
value.
IllegalActionException - If the value cannot
be propagated.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||