svghmi/widgets_common.ysl2
branchsvghmi
changeset 2889 4eeed820fd3a
parent 2886 6c82fad8be65
child 2890 ae8063127e95
equal deleted inserted replaced
2888:7beddc62a388 2889:4eeed820fd3a
    15     const "widget", "func:widget(@id)";
    15     const "widget", "func:widget(@id)";
    16     const "eltid","@id";
    16     const "eltid","@id";
    17     |   "«@id»": {
    17     |   "«@id»": {
    18     |     type: "«$widget/@type»",
    18     |     type: "«$widget/@type»",
    19     |     args: [
    19     |     args: [
    20         foreach "$widget/arg"
    20     foreach "$widget/arg"
    21     |         "«@value»"`if "position()!=last()" > ,`
    21     |         "«@value»"`if "position()!=last()" > ,`
    22     |     ],
    22     |     ],
       
    23     |     offset: 0,
    23     |     indexes: [
    24     |     indexes: [
    24     foreach "$widget/path" {
    25     foreach "$widget/path" {
    25         choose {
    26         choose {
    26             when "not(@index)" {
    27             when "not(@index)" {
    27                 warning > Widget «$widget/@type» id="«$eltid»" : No match for path "«@value»" in HMI tree
    28                 warning > Widget «$widget/@type» id="«$eltid»" : No match for path "«@value»" in HMI tree
    32         }
    33         }
    33     }
    34     }
    34     |     ],
    35     |     ],
    35     |     element: id("«@id»"),
    36     |     element: id("«@id»"),
    36     apply "$widget", mode="widget_defs" with "hmi_element",".";
    37     apply "$widget", mode="widget_defs" with "hmi_element",".";
       
    38     apply "$widget", mode="widget_subscribe" with "hmi_element",".";
    37     |   }`if "position()!=last()" > ,`
    39     |   }`if "position()!=last()" > ,`
    38 }
    40 }
    39 
    41 
       
    42 // default : normal subscribing
       
    43 template "widget", mode="widget_subscribe" {
       
    44     |     sub: subscribe,
       
    45     |     unsub: unsubscribe,
       
    46 }
       
    47 // page aren't subscribers
       
    48 template "widget[@type='Page']", mode="widget_subscribe";
    40 
    49 
    41 function "defs_by_labels" {
    50 function "defs_by_labels" {
    42     param "labels","''";
    51     param "labels","''";
    43     param "mandatory","'yes'";
    52     param "mandatory","'yes'";
    44     param "hmi_element";
    53     param "hmi_element";