Class UpdateAnnotations

  • All Implemented Interfaces:
    MoMLFilter

    public class UpdateAnnotations
    extends MoMLFilterSimple
    Update the annotations.

    When this class is registered with the MoMLParser.addMoMLFilter() method, it will cause MoMLParser to add a update annotations from the older style:

     <property name="annotation" class="ptolemy.kernel.util.Attribute">
        <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
        </property>
        <property name="_iconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
              <configure><svg><text x="20" y="20" style="font-size:14; font-family:SansSerif; fill:blue">Create a state machine here (and ports, if needed) and
    create refinements for the states. Each refinement needs a director.
    For hybrid system models, use the CTEmbeddedDirector.</text></svg></configure>
        </property>
        <property name="_location" class="ptolemy.kernel.util.Location" value="75.0, 65.0">
        </property>
        <property name="_controllerFactory" class="ptolemy.vergil.basic.NodeControllerFactory">
        </property>
        <property name="_editorFactory" class="ptolemy.vergil.toolbox.AnnotationEditorFactory">
        </property>
     </property>
     
    to
    
        <property name="annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
            <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Create a state machine here (and ports, if needed) and&#10;create refinements for the states. Each refinement needs a director.&#10;For hybrid system models, use the CTEmbeddedDirector.</text></svg></configure>
            </property>
            <property name="_location" class="ptolemy.kernel.util.Location" value="[75.0, 65.0]">
            </property>
        </property>
     
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Christopher Brooks
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String filterAttributeValue​(NamedObj container, java.lang.String element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String xmlFile)
      Update annotations by removing old annotations and replacing them with new annotation.
      void filterEndElement​(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile)
      Make modifications to the specified container, which is defined in a MoML element with the specified name.
      java.lang.String toString()
      Return a string that describes what the filter does.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • UpdateAnnotations

        public UpdateAnnotations()
    • Method Detail

      • filterAttributeValue

        public java.lang.String filterAttributeValue​(NamedObj container,
                                                     java.lang.String element,
                                                     java.lang.String attributeName,
                                                     java.lang.String attributeValue,
                                                     java.lang.String xmlFile)
        Update annotations by removing old annotations and replacing them with new annotation. If the attributeName is "name" and attributeValue begins with with "annotation", then replace the property with a TextAttribute
        Parameters:
        container - The container for this attribute. in this method.
        element - The XML element name.
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute.
        xmlFile - The file currently being parsed.
        Returns:
        the value of the attributeValue argument.
      • filterEndElement

        public void filterEndElement​(NamedObj container,
                                     java.lang.String elementName,
                                     java.lang.StringBuffer currentCharData,
                                     java.lang.String xmlFile)
                              throws java.lang.Exception
        Make modifications to the specified container, which is defined in a MoML element with the specified name.
        Parameters:
        container - The object created by this element.
        elementName - The element name.
        currentCharData - The character data, which appears only in the doc and configure elements
        xmlFile - The file currently being parsed.
        Throws:
        java.lang.Exception - if there is a problem substituting in the new value.
      • toString

        public java.lang.String toString()
        Return a string that describes what the filter does.
        Specified by:
        toString in interface MoMLFilter
        Overrides:
        toString in class java.lang.Object
        Returns:
        the description of the filter that ends with a newline.