svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 3188 c173452bf894
parent 3187 ba8ff21fd82b
child 3189 0733114a2090
equal deleted inserted replaced
3187:ba8ff21fd82b 3188:c173452bf894
  4420 </xsl:text>
  4420 </xsl:text>
  4421     <xsl:text>         }
  4421     <xsl:text>         }
  4422 </xsl:text>
  4422 </xsl:text>
  4423     <xsl:text>
  4423     <xsl:text>
  4424 </xsl:text>
  4424 </xsl:text>
       
  4425     <xsl:text>         is_inhibited = false;
       
  4426 </xsl:text>
       
  4427     <xsl:text>         alert(msg){
       
  4428 </xsl:text>
       
  4429     <xsl:text>             this.is_inhibited = true;
       
  4430 </xsl:text>
       
  4431     <xsl:text>             this.display = msg;
       
  4432 </xsl:text>
       
  4433     <xsl:text>             setTimeout(() =&gt; this.stopalert(), 1000);
       
  4434 </xsl:text>
       
  4435     <xsl:text>             this.request_animate();
       
  4436 </xsl:text>
       
  4437     <xsl:text>         }
       
  4438 </xsl:text>
       
  4439     <xsl:text>
       
  4440 </xsl:text>
       
  4441     <xsl:text>         stopalert(){
       
  4442 </xsl:text>
       
  4443     <xsl:text>             this.is_inhibited = false;
       
  4444 </xsl:text>
       
  4445     <xsl:text>             this.display = this.last_value;
       
  4446 </xsl:text>
       
  4447     <xsl:text>             this.request_animate();
       
  4448 </xsl:text>
       
  4449     <xsl:text>         }
       
  4450 </xsl:text>
       
  4451     <xsl:text>
       
  4452 </xsl:text>
  4425     <xsl:text>         overshot(new_val, max) {
  4453     <xsl:text>         overshot(new_val, max) {
  4426 </xsl:text>
  4454 </xsl:text>
  4427     <xsl:text>             this.last_display = "max: "+max;
  4455     <xsl:text>             this.alert("max");
  4428 </xsl:text>
       
  4429     <xsl:text>             this.request_animate();
       
  4430 </xsl:text>
  4456 </xsl:text>
  4431     <xsl:text>         }
  4457     <xsl:text>         }
  4432 </xsl:text>
  4458 </xsl:text>
  4433     <xsl:text>
  4459     <xsl:text>
  4434 </xsl:text>
  4460 </xsl:text>
  4435     <xsl:text>         undershot(new_val, min) {
  4461     <xsl:text>         undershot(new_val, min) {
  4436 </xsl:text>
  4462 </xsl:text>
  4437     <xsl:text>             this.last_display = "min: "+min;
  4463     <xsl:text>             this.alert("min");
  4438 </xsl:text>
       
  4439     <xsl:text>             this.request_animate();
       
  4440 </xsl:text>
  4464 </xsl:text>
  4441     <xsl:text>         }
  4465     <xsl:text>         }
  4442 </xsl:text>
  4466 </xsl:text>
  4443     <xsl:text>
  4467     <xsl:text>
  4444 </xsl:text>
  4468 </xsl:text>
  4478     <xsl:text>    dispatch: function(value) {
  4502     <xsl:text>    dispatch: function(value) {
  4479 </xsl:text>
  4503 </xsl:text>
  4480     <xsl:if test="$have_value or $have_edit">
  4504     <xsl:if test="$have_value or $have_edit">
  4481       <xsl:choose>
  4505       <xsl:choose>
  4482         <xsl:when test="count(arg) = 1">
  4506         <xsl:when test="count(arg) = 1">
  4483           <xsl:text>        this.last_display = vsprintf("</xsl:text>
  4507           <xsl:text>        this.last_value = vsprintf("</xsl:text>
  4484           <xsl:value-of select="arg[1]/@value"/>
  4508           <xsl:value-of select="arg[1]/@value"/>
  4485           <xsl:text>", [value]);
  4509           <xsl:text>", [value]);
  4486 </xsl:text>
  4510 </xsl:text>
  4487         </xsl:when>
  4511         </xsl:when>
  4488         <xsl:otherwise>
  4512         <xsl:otherwise>
  4489           <xsl:text>        this.last_display = value;
  4513           <xsl:text>        this.last_value = value;
  4490 </xsl:text>
  4514 </xsl:text>
  4491         </xsl:otherwise>
  4515         </xsl:otherwise>
  4492       </xsl:choose>
  4516       </xsl:choose>
  4493     </xsl:if>
  4517       <xsl:text>        if(!this.is_inhibited){
  4494     <xsl:if test="$have_value">
  4518 </xsl:text>
  4495       <xsl:text>        this.request_animate();
  4519       <xsl:text>            this.display = this.last_value;
       
  4520 </xsl:text>
       
  4521       <xsl:if test="$have_value">
       
  4522         <xsl:text>            this.request_animate();
       
  4523 </xsl:text>
       
  4524       </xsl:if>
       
  4525       <xsl:text>        }
  4496 </xsl:text>
  4526 </xsl:text>
  4497     </xsl:if>
  4527     </xsl:if>
  4498     <xsl:text>    },
  4528     <xsl:text>    },
  4499 </xsl:text>
  4529 </xsl:text>
  4500     <xsl:if test="$have_value">
  4530     <xsl:if test="$have_value">
  4501       <xsl:text>    animate: function(){
  4531       <xsl:text>    animate: function(){
  4502 </xsl:text>
  4532 </xsl:text>
  4503       <xsl:text>        this.value_elt.textContent = String(this.last_display);
  4533       <xsl:text>        this.value_elt.textContent = String(this.display);
  4504 </xsl:text>
  4534 </xsl:text>
  4505       <xsl:text>    },
  4535       <xsl:text>    },
  4506 </xsl:text>
  4536 </xsl:text>
  4507     </xsl:if>
  4537     </xsl:if>
  4508     <xsl:text>    init: function() {
  4538     <xsl:text>    init: function() {
  4510     <xsl:if test="$have_edit">
  4540     <xsl:if test="$have_edit">
  4511       <xsl:text>        this.edit_elt.onclick = () =&gt; edit_value("</xsl:text>
  4541       <xsl:text>        this.edit_elt.onclick = () =&gt; edit_value("</xsl:text>
  4512       <xsl:value-of select="path/@value"/>
  4542       <xsl:value-of select="path/@value"/>
  4513       <xsl:text>", "</xsl:text>
  4543       <xsl:text>", "</xsl:text>
  4514       <xsl:value-of select="path/@type"/>
  4544       <xsl:value-of select="path/@type"/>
  4515       <xsl:text>", this, this.last_display);
  4545       <xsl:text>", this, this.last_value);
  4516 </xsl:text>
  4546 </xsl:text>
  4517       <xsl:if test="$have_value">
  4547       <xsl:if test="$have_value">
  4518         <xsl:text>        this.value_elt.style.pointerEvents = "none";
  4548         <xsl:text>        this.value_elt.style.pointerEvents = "none";
  4519 </xsl:text>
  4549 </xsl:text>
  4520       </xsl:if>
  4550       </xsl:if>