public class JavaScriptThisUpdate extends MoMLFilterSimple
This class will eventually be removed after we have updated the files.
To update a model, try:
$PTII/bin/ptinvoke ptolemy.vergil.basic.imprt.accessor.ReloadAccessors model.xmlTo update all the models that contain JavaScript actors:
# Generate a list of all the text files in the ptII tree, excluding certain directories like vendors. $PTII/adm/bin/ptIItxtfiles <& /tmp/f # Generate a list of all of the .xml files. cat /tmp/f | egrep '.xml$' < /tmp/x # Generate a list of all the .xml files that contain the JavaScript actor. cat /tmp/x | xargs egrep 'ptolemy.actor.lib.jjs.JavaScript' | awk -F ':' '{print $1}' | sort | uniq < /tmp/javascriptx # Reload the accessors on all the .xml files that contain the JavaScript actor, # which as a side effect runs the Backward Compatibility script cat /tmp/jsaccessorx | xargs $PTII/bin/ptinvoke ptolemy.vergil.basic.imprt.accessor.ReloadAccessors
We use ptinvoke
to set the classpath.
ReloadAccessors, opens a model, reloads all the accessors (if any) and saves the model. While opening the model, the BackwardCompatibility MoML filters are run. This class can be one of those filters.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.reflect.Method |
_diff
The ptolemy.util.test.Diff.diff(String, String) method.
|
Constructor and Description |
---|
JavaScriptThisUpdate() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
filterAttributeValue(NamedObj container,
java.lang.String element,
java.lang.String attributeName,
java.lang.String attributeValue,
java.lang.String xmlFile)
Handle parameter name changes.
|
void |
filterEndElement(NamedObj container,
java.lang.String elementName,
java.lang.StringBuffer currentCharData,
java.lang.String xmlFile)
If the container is a property named "script" contained
by the JavaScript actor, then add "this." to certain
function calls.
|
java.lang.String |
toString()
Return a string that describes what the filter does.
|
filterAttributeValue, filterEndElement
protected static java.lang.reflect.Method _diff
public java.lang.String filterAttributeValue(NamedObj container, java.lang.String element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String xmlFile)
container
- The container for XML element.element
- The XML element name.attributeName
- The name of the attribute.attributeValue
- The value of the attribute.xmlFile
- The file currently being parsed.public void filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile) throws java.lang.Exception
container
- The object defined by the element that this
is the end of.elementName
- The element name.currentCharData
- The character data, which appears
only in the doc and configure elementsxmlFile
- The file currently being parsed.java.lang.Exception
- if there is a problem substituting
in the new value.public java.lang.String toString()
toString
in interface MoMLFilter
toString
in class java.lang.Object