author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Thu, 06 Aug 2020 14:59:04 +0200 | |
branch | svghmi |
changeset 3007 | 360300a8b995 |
parent 2998 | e8f707d99dc3 |
child 3008 | dabad70db1bf |
permissions | -rw-r--r-- |
2883
8e3d130399b0
SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2882
diff
changeset
|
1 |
// widget_display.ysl2 |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
2 |
|
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
3 |
|
2998
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
4 |
template "widget[@type='Display']", mode="widget_class" |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
5 |
|| |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
6 |
class DisplayWidget extends Widget{ |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
7 |
frequency = 5; |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
8 |
dispatch(value) { |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
9 |
this.element.textContent = String(value); |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
10 |
} |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
11 |
} |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
12 |
|| |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
13 |
|
2883
8e3d130399b0
SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2882
diff
changeset
|
14 |
template "widget[@type='Display']", mode="widget_defs" { |
8e3d130399b0
SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2882
diff
changeset
|
15 |
param "hmi_element"; |
2998
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
16 |
if "$hmi_element[not(self::svg:text)]" |
e8f707d99dc3
SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2883
diff
changeset
|
17 |
error > Display Widget id="«$hmi_element/@id»" is not a svg::text element |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
18 |
} |