ptolemy.data.properties
Class PropertyMoMLHandler

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.data.properties.PropertyMoMLHandler
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class PropertyMoMLHandler
extends Attribute

This is an attribute used by the PropertySolver to issue MoML requests and make changes to the model. These changes include addition, update, or deletion of property annotations and display of the property results. This is designed to be contained by an instance of PropertySolver or a subclass of PropertySolver. It contains parameters that allow users to configure the display of the property annotation results.

Since:
Ptolemy II 7.1
Version:
$Id: PropertyMoMLHandler.java 56282 2009-11-24 05:36:56Z cxh $
Author:
Man-Kit Leung
See Also:
Serialized Form
Accepted Rating:
Red (mankit)
Proposed Rating:
Red (mankit)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 Parameter highlight
          Indicate whether the _highlightColor attributes will be set.
 Parameter showText
          Indicate whether the _showInfo attributes will be set.
 
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
PropertyMoMLHandler(NamedObj container, java.lang.String name)
          Construct a PropertyMoMLHandler with the specified container and name.
 
Method Summary
private  java.lang.String _completeHierarchyInMoML(NamedObj namedObj, java.lang.String request)
          Wrap the given MoML request string with extra enclosing tags according to the relation of the specified namedObj to the toplevel context.
private  java.lang.String _getMoMLHighlightString(NamedObj propertyable, Property property)
          Return a MoML request string that create or update the _highlightColor attribute of the given property-able object, according to the given property value.
private  java.lang.String _getMoMLShowInfoString(NamedObj propertyable, Property property)
          Return a MoML request string that creates or updates the _showInfo attribute of the given property-able object, according to the given property value.
private  void _requestChange(java.lang.String moml)
          Create and request an undo-able MoMLChangeRequest for the given MoML string.
 void clearAnnotations()
          Clear every manual annotated constraints associated with the solver use-case.
 void clearDisplay()
          Remove the highlighting and visible annotations for all property-able objects.
 void clearProperties()
          Clear the property annotations of associated with the container solver.
 void highlightProperties()
          Highlight all property-able objects with the specified colors for their property values, if the highlight parameter value is true.
 void showProperties()
          If the value of the showText parameter is set to true, show all property values visually.
 
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 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

showText

public Parameter showText
Indicate whether the _showInfo attributes will be set.


highlight

public Parameter highlight
Indicate whether the _highlightColor attributes will be set.

Constructor Detail

PropertyMoMLHandler

public PropertyMoMLHandler(NamedObj container,
                           java.lang.String name)
                    throws IllegalActionException,
                           NameDuplicationException
Construct a PropertyMoMLHandler with the specified container and name.

Parameters:
container - The container.
name - The name of the PropertyMoMLHandler.
Throws:
IllegalActionException - If the PropertyMoMLHandler is not of an acceptable attribute for the container.
NameDuplicationException - If the name coincides with an attribute already in the container.
Method Detail

clearAnnotations

public void clearAnnotations()
                      throws IllegalActionException
Clear every manual annotated constraints associated with the solver use-case. Each of these constraints is an AnnotationAttribute in the model.

Throws:
IllegalActionException - Thrown if an error occurs when removing the annotation attributes.

clearDisplay

public void clearDisplay()
Remove the highlighting and visible annotations for all property-able objects.


clearProperties

public void clearProperties()
Clear the property annotations of associated with the container solver. This deletes all the trained data, which includes the trained exception attribute, used by regression testing.


highlightProperties

public void highlightProperties()
Highlight all property-able objects with the specified colors for their property values, if the highlight parameter value is true. Otherwise, do nothing.


showProperties

public void showProperties()
If the value of the showText parameter is set to true, show all property values visually. Otherwise, do nothing.


_completeHierarchyInMoML

private java.lang.String _completeHierarchyInMoML(NamedObj namedObj,
                                                  java.lang.String request)
Wrap the given MoML request string with extra enclosing tags according to the relation of the specified namedObj to the toplevel context. This is used to issue a complete MoML request at the toplevel context.

Parameters:
namedObj - The specified namedObj.
request - The given MoML request.

_getMoMLHighlightString

private java.lang.String _getMoMLHighlightString(NamedObj propertyable,
                                                 Property property)
Return a MoML request string that create or update the _highlightColor attribute of the given property-able object, according to the given property value. If the given property is null, this would issue delete request to remove the _highlightColor attribute, if there exists any.

Parameters:
propertyable - The given property-able object.
property - The given property.

_getMoMLShowInfoString

private java.lang.String _getMoMLShowInfoString(NamedObj propertyable,
                                                Property property)
Return a MoML request string that creates or updates the _showInfo attribute of the given property-able object, according to the given property value. If the given property is null, this would issue delete request to remove the _showInfo attribute, if there exists any.

Parameters:
propertyable - The given property-able object.
property - The given property.

_requestChange

private void _requestChange(java.lang.String moml)
Create and request an undo-able MoMLChangeRequest for the given MoML string. The context of the request is set to the toplevel.

Parameters:
moml - The given moml string that contains the change request.