svghmi/analyse_widget.xslt
changeset 3414 0ff608310312
parent 3410 eac5832a1489
child 3478 c04c6db09eff
child 3506 ca312be56929
equal deleted inserted replaced
3413:2e84a2782295 3414:0ff608310312
    27         <xsl:otherwise>
    27         <xsl:otherwise>
    28           <xsl:value-of select="$args"/>
    28           <xsl:value-of select="$args"/>
    29         </xsl:otherwise>
    29         </xsl:otherwise>
    30       </xsl:choose>
    30       </xsl:choose>
    31     </xsl:variable>
    31     </xsl:variable>
    32     <xsl:variable name="freq" select="substring-after($typefreq,':')"/>
    32     <xsl:variable name="freq" select="substring-after($typefreq,'|')"/>
    33     <xsl:variable name="_type" select="substring-before($typefreq,'|')"/>
    33     <xsl:variable name="_type" select="substring-before($typefreq,'|')"/>
    34     <xsl:variable name="type">
    34     <xsl:variable name="type">
    35       <xsl:choose>
    35       <xsl:choose>
    36         <xsl:when test="$_type">
    36         <xsl:when test="$_type">
    37           <xsl:value-of select="$_type"/>
    37           <xsl:value-of select="$_type"/>
    47           <xsl:value-of select="$id"/>
    47           <xsl:value-of select="$id"/>
    48         </xsl:attribute>
    48         </xsl:attribute>
    49         <xsl:attribute name="type">
    49         <xsl:attribute name="type">
    50           <xsl:value-of select="$type"/>
    50           <xsl:value-of select="$type"/>
    51         </xsl:attribute>
    51         </xsl:attribute>
    52         <xsl:if test="freq">
    52         <xsl:if test="$freq">
    53           <xsl:attribute name="frequency">
    53           <xsl:attribute name="freq">
    54             <xsl:value-of select="$freq"/>
    54             <xsl:value-of select="$freq"/>
    55           </xsl:attribute>
    55           </xsl:attribute>
    56         </xsl:if>
    56         </xsl:if>
    57         <xsl:for-each select="str:split(substring-after($args, ':'), ':')">
    57         <xsl:for-each select="str:split(substring-after($args, ':'), ':')">
    58           <arg>
    58           <arg>
   219     </shortdesc>
   219     </shortdesc>
   220     <path name="value" accepts="HMI_BOOL">
   220     <path name="value" accepts="HMI_BOOL">
   221       <xsl:text>Boolean variable</xsl:text>
   221       <xsl:text>Boolean variable</xsl:text>
   222     </path>
   222     </path>
   223   </xsl:template>
   223   </xsl:template>
       
   224   <xsl:template name="generated_button_class">
       
   225     <xsl:param name="fsm"/>
       
   226     <xsl:text>    frequency = 5;
       
   227 </xsl:text>
       
   228     <xsl:text>    display = "inactive";
       
   229 </xsl:text>
       
   230     <xsl:text>    state = "init";
       
   231 </xsl:text>
       
   232     <xsl:text>    dispatch(value) {
       
   233 </xsl:text>
       
   234     <xsl:apply-templates mode="dispatch_transition" select="$fsm"/>
       
   235     <xsl:text>    }
       
   236 </xsl:text>
       
   237     <xsl:text>    onmouseup(evt) {
       
   238 </xsl:text>
       
   239     <xsl:text>        svg_root.removeEventListener("pointerup", this.bound_onmouseup, true);
       
   240 </xsl:text>
       
   241     <xsl:apply-templates mode="mouse_transition" select="$fsm">
       
   242       <xsl:with-param name="position" select="'up'"/>
       
   243     </xsl:apply-templates>
       
   244     <xsl:text>    }
       
   245 </xsl:text>
       
   246     <xsl:text>    onmousedown(evt) {
       
   247 </xsl:text>
       
   248     <xsl:text>        svg_root.addEventListener("pointerup", this.bound_onmouseup, true);
       
   249 </xsl:text>
       
   250     <xsl:apply-templates mode="mouse_transition" select="$fsm">
       
   251       <xsl:with-param name="position" select="'down'"/>
       
   252     </xsl:apply-templates>
       
   253     <xsl:text>    }
       
   254 </xsl:text>
       
   255     <xsl:apply-templates mode="actions" select="$fsm"/>
       
   256     <xsl:text>    animate(){
       
   257 </xsl:text>
       
   258     <xsl:text>        if (this.active_elt &amp;&amp; this.inactive_elt) {
       
   259 </xsl:text>
       
   260     <xsl:for-each select="str:split('active inactive')">
       
   261       <xsl:text>            if(this.display == "</xsl:text>
       
   262       <xsl:value-of select="."/>
       
   263       <xsl:text>")
       
   264 </xsl:text>
       
   265       <xsl:text>                this.</xsl:text>
       
   266       <xsl:value-of select="."/>
       
   267       <xsl:text>_elt.style.display = "";
       
   268 </xsl:text>
       
   269       <xsl:text>            else
       
   270 </xsl:text>
       
   271       <xsl:text>                this.</xsl:text>
       
   272       <xsl:value-of select="."/>
       
   273       <xsl:text>_elt.style.display = "none";
       
   274 </xsl:text>
       
   275     </xsl:for-each>
       
   276     <xsl:text>        }
       
   277 </xsl:text>
       
   278     <xsl:text>    }
       
   279 </xsl:text>
       
   280     <xsl:text>    init() {
       
   281 </xsl:text>
       
   282     <xsl:text>        this.bound_onmouseup = this.onmouseup.bind(this);
       
   283 </xsl:text>
       
   284     <xsl:text>        this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
       
   285 </xsl:text>
       
   286     <xsl:text>    }
       
   287 </xsl:text>
       
   288   </xsl:template>
   224   <xsl:template match="widget[@type='CircularBar']" mode="widget_desc">
   289   <xsl:template match="widget[@type='CircularBar']" mode="widget_desc">
   225     <type>
   290     <type>
   226       <xsl:value-of select="@type"/>
   291       <xsl:value-of select="@type"/>
   227     </type>
   292     </type>
   228     <longdesc>
   293     <longdesc>