|
||||||||||
| 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.SingletonAttribute
ptolemy.kernel.util.Location
An attribute that represents a location of a node in a schematic.
By default, an instance of this class is not visible in a user interface. This is indicated to the user interface by returning NONE to the getVisibility() method. The location is specified by calling setExpression() with a string that has the form "x,y" or "[x,y]" or "{x,y}", where x and y can be parsed into doubles.
The default location is a two dimensional location with value {0.0, 0.0}. This class can also handle locations with greater than two dimensions.
| Green (cxh) |
| Green (cxh) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
NamedObj.ContainedObjectsIterator |
| Nested classes inherited from class ptolemy.kernel.util.Settable |
Settable.Visibility |
| Field Summary |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Fields inherited from interface ptolemy.kernel.util.Settable |
EXPERT, FULL, NONE, NOT_EDITABLE |
| Constructor Summary | |
Location(NamedObj container,
java.lang.String name)
Construct an attribute with the given container and name. |
|
Location(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. |
java.lang.Object |
clone(Workspace workspace)
Clone the location into the specified workspace. |
void |
exportMoML(java.io.Writer output,
int depth,
java.lang.String name)
Write a MoML description of this object. |
java.lang.String |
getDefaultExpression()
Return the default value of this Settable, if there is one. |
java.lang.String |
getExpression()
Get the value that has been set by setExpression() or by setLocation(), whichever was most recently called, or return an empty string if neither has been called. |
double[] |
getLocation()
Get the location in some cartesian coordinate system. |
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 variable changes. |
void |
setExpression(java.lang.String expression)
Set the value of the attribute by giving some expression. |
void |
setLocation(double[] location)
Set the location in some cartesian coordinate system, and notify the container and any value listeners of the new location. |
void |
setVisibility(Settable.Visibility visibility)
Set the visibility of this attribute. |
java.lang.String |
toString()
Get a description of the class, which is the class name and the location in parentheses. |
void |
validate()
Parse the location specification given by setExpression(), if there has been one, and otherwise set the location to 0.0, 0.0. |
| Methods inherited from class ptolemy.kernel.util.SingletonAttribute |
setContainer |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_getContainedObject, _propagateExistence, getContainer, setName |
| 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 |
| Constructor Detail |
public Location(Workspace workspace)
workspace - The workspace that will list the attribute.
public Location(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container.name - The name of the vertex.
IllegalActionException - If the attribute is not of an
acceptable class for the container.
NameDuplicationException - If the name coincides with
an attribute already in the container.| 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 for the cloned object.
java.lang.CloneNotSupportedException - If the base class throws it.
public void exportMoML(java.io.Writer output,
int depth,
java.lang.String name)
throws java.io.IOException
exportMoML in interface MoMLExportableexportMoML in class NamedObjoutput - The output writer 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 getDefaultExpression()
getDefaultExpression in interface SettablesetExpression(String)public java.lang.String getExpression()
If setExpression(String value) was called, then the return value is exactly what ever was passed in as the argument to setExpression. This means that there is no guarantee that the return value of getExpression() is a well formed Ptolemy array expression.
If setLocation(double[] location) was called, then the return value is a well formed Ptolemy array expression that starts with "{" and ends with "}", for example "{0.0, 0.0}"
getExpression in interface SettablesetExpression(String)public double[] getLocation()
getLocation in interface LocatablesetLocation(double[])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 setExpression(java.lang.String expression)
setExpression in interface Settableexpression - The value of the attribute.getExpression()
public void setLocation(double[] location)
throws IllegalActionException
setLocation in interface Locatablelocation - The location.
IllegalActionException - If throw when attributeChanged()
is called.getLocation()public void setVisibility(Settable.Visibility visibility)
setVisibility in interface Settablevisibility - The visibility of this attribute.getVisibility()public java.lang.String toString()
toString in class NamedObj
public void validate()
throws IllegalActionException
validate in interface SettableIllegalActionException - If the expression is invalid.
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 | |||||||||