author | Edouard Tisserant <edouard@beremiz.fr> |
Thu, 08 Aug 2024 14:56:13 +0200 | |
changeset 4004 | 19f8192b7d68 |
parent 3685 | 570a738239f4 |
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_jump.ysl2 |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
2 |
|
3241
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
3 |
widget_desc("Jump") { |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
4 |
longdesc |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
5 |
|| |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
6 |
Jump widget brings focus to a different page. Mandatory first argument |
3241
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
7 |
gives name of the page. |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
8 |
|
3596
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
9 |
If first path is pointint to HMI_NODE variable is used as new reference |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
10 |
when jumping to a relative page. |
3241
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
11 |
|
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
12 |
Additional arguments are unordered options: |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
13 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
14 |
- Absolute: force page jump to be not relative even if first path is of type HMI_NODE |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
15 |
|
3597
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
16 |
- name=value: Notify PLC about jump by setting variable with path having same name assigned |
3596
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
17 |
|
3241
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
18 |
"active"+"inactive" labeled elements can be provided and reflect current |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
19 |
page being shown. |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
20 |
|
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
21 |
Exemples: |
3596
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
22 |
|
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
23 |
Relative jump: |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
24 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
25 |
HMI:Jump:RelativePage@/PUMP9 |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
26 |
HMI:Jump:RelativePage@/PUMP9@role=.userrole#role=="admin" |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
27 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
28 |
Absolute jump: |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
29 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
30 |
HMI:Jump:AbsolutePage |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
31 |
HMI:Jump:AbsolutePage@role=.userrole#role=="admin" |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
32 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
33 |
Forced absolute jump: |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
34 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
35 |
HMI:Jump:AbsolutePage:Absolute@/PUMP9 |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
36 |
HMI:Jump:AbsolutePage:Absolute:notify=1@notify=/PUMP9 |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
37 |
|
3597
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
38 |
Jump with feedback |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
39 |
|
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
40 |
HMI:Jump:AbsolutePage:notify=1@notify=.did_jump |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
41 |
|
3241
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
42 |
|| |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
43 |
|
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
44 |
shortdesc > Jump to given page |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
45 |
|
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
46 |
arg name="page" accepts="string" > name of page to jump to |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
47 |
|
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
48 |
path name="reference" count="optional" accepts="HMI_NODE" > reference for relative jump |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
49 |
} |
fe945f1f48b7
SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3232
diff
changeset
|
50 |
|
3232
7bdb766c2a4d
SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3107
diff
changeset
|
51 |
widget_class("Jump") { |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
52 |
|| |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
53 |
activable = false; |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
54 |
frequency = 2; |
3626
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
55 |
target_page_is_current_page = false; |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
56 |
button_beeing_pressed = false; |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
57 |
|
3626
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
58 |
onmouseup(evt) { |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
59 |
svg_root.removeEventListener("pointerup", this.bound_onmouseup, true); |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
60 |
if(this.enable_state) { |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
61 |
const index = |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
62 |
(this.is_relative && this.indexes.length > 0) ? |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
63 |
this.indexes[0] + this.offset : undefined; |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
64 |
this.button_beeing_pressed = false; |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
65 |
this.activity_state = this.target_page_is_current_page || this.button_beeing_pressed; |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
66 |
fading_page_switch(this.args[0], index); |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
67 |
this.notify(); |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
68 |
} |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
69 |
} |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
70 |
|
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
71 |
onmousedown(){ |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
72 |
if(this.enable_state) { |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
73 |
svg_root.addEventListener("pointerup", this.bound_onmouseup, true); |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
74 |
this.button_beeing_pressed = true; |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
75 |
this.activity_state = true; |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
76 |
this.request_animate(); |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
77 |
} |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
78 |
} |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
79 |
|
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
80 |
notify_page_change(page_name, index) { |
3596
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
81 |
// called from animate() |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
82 |
if(this.activable) { |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
83 |
const ref_index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined; |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
84 |
const ref_name = this.args[0]; |
3626
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
85 |
this.target_page_is_current_page = ((ref_name == undefined || ref_name == page_name) && index == ref_index); |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
86 |
this.activity_state = this.target_page_is_current_page || this.button_beeing_pressed; |
3596
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
87 |
// Since called from animate, update activity directly |
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
88 |
if(this.enable_displayed_state && this.has_activity) { |
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
89 |
this.animate_activity(); |
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
90 |
} |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
91 |
} |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
92 |
} |
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
93 |
|| |
2906
3b4a1319da09
SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents:
2903
diff
changeset
|
94 |
} |
3b4a1319da09
SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents:
2903
diff
changeset
|
95 |
|
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
96 |
def "func:is_relative_jump" { |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
97 |
param "widget"; |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
98 |
result "$widget/path and $widget/path[1]/@type='HMI_NODE' and not($widget/arg[position()>1 and @value = 'Absolute'])"; |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
99 |
} |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
100 |
|
3232
7bdb766c2a4d
SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3107
diff
changeset
|
101 |
widget_defs("Jump") { |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
102 |
optional_activable(); |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
103 |
|
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
104 |
const "jump_disability","$has_activity and $has_disability"; |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
105 |
|
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
|
106 |
| init: function() { |
3626
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
107 |
| this.bound_onmouseup = this.onmouseup.bind(this); |
dfcd13683362
SVGHMI: add visible feedback to Jump widget when clicked/touched
Edouard Tisserant
parents:
3597
diff
changeset
|
108 |
| this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
109 |
if "$has_activity" { |
3107
ee0704cc6dc8
SVGHMI: Jump widget: switch to class based declaraion, and add some TODO comments to prepare for jump to relative page being selected through a DropDown widget.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3081
diff
changeset
|
110 |
| this.activable = true; |
2903
881d0248b3ce
SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents:
2902
diff
changeset
|
111 |
} |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
112 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
113 |
> this.is_relative = |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
114 |
choose{ |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
115 |
when "func:is_relative_jump(.)" > true |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
116 |
otherwise > false |
2906
3b4a1319da09
SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents:
2903
diff
changeset
|
117 |
} |
3240
5f756332ada1
SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents:
3107
diff
changeset
|
118 |
> ;\n |
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
|
119 |
| }, |
3240
5f756332ada1
SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents:
3107
diff
changeset
|
120 |
|
3597
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
121 |
| notify: function() { |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
122 |
const "paths","path"; |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
123 |
foreach "arg[position()>1 and contains(@value,'=')]"{ |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
124 |
const "name","substring-before(@value,'=')"; |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
125 |
const "value","substring-after(@value,'=')"; |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
126 |
const "index" foreach "$paths" if "@assign = $name" value "position()-1"; |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
127 |
| // «@value» |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
128 |
| this.apply_hmi_value(«$index», «$value»); |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
129 |
} |
f69c68cffec3
SVGHMI: Add predefined assignments to jump widget to notify PLC or other widgets about jump.
Edouard Tisserant
parents:
3596
diff
changeset
|
130 |
| }, |
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
|
131 |
} |
2901
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
132 |
|
3232
7bdb766c2a4d
SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3107
diff
changeset
|
133 |
widget_page("Jump"){ |
2901
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
134 |
param "page_desc"; |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
135 |
/* jump is considered relative jump if first path points to HMI_NODE |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
136 |
but a jump can be forced Absolute by adding a "Absolute" argument */ |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
137 |
if "func:is_relative_jump(.)" { |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
138 |
/* if relative check that given path is compatible with page's reference path */ |
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
139 |
|
2901
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
140 |
/* when no page name provided, check for same page */ |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
141 |
const "target_page_name" choose { |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
142 |
when "arg" value "arg[1]/@value"; |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
143 |
otherwise value "$page_desc/arg[1]/@value"; |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
144 |
} |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
145 |
const "target_page_path" choose { |
3685
570a738239f4
SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents:
3626
diff
changeset
|
146 |
when "arg" value "$hmi_pages_descs[arg[1]/@value = $target_page_name]/path[not(@assign)]/@value"; |
570a738239f4
SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents:
3626
diff
changeset
|
147 |
otherwise value "$page_desc/path[not(@assign)]/@value"; |
2901
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
148 |
} |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
149 |
|
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
150 |
if "not(func:same_class_paths($target_page_path, path[1]/@value))" |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
151 |
error > Jump id="«@id»" to page "«$target_page_name»" with incompatible path "«path[1]/@value» (must be same class as "«$target_page_path»") |
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
152 |
|
2901
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
153 |
} |
3f5194bba67d
SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents:
2900
diff
changeset
|
154 |
} |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
155 |
|
3595
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
156 |
|
375626e60b63
SVGHMI: rework Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3577
diff
changeset
|
157 |
|
3577
6c7a7b22bec9
IDE+Runtime: fix exception when reconnecting with non-empty trace/force list.
Edouard Tisserant
parents:
3553
diff
changeset
|
158 |
/* TODO: move to detachable pages ysl2 */ |
3512
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
159 |
emit "cssdefs:jump" |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
160 |
|| |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
161 |
.fade-out-page { |
3553
406eb8a13648
SVGHMI: re-organize animate() to ensure that page fade-out is always visible, also make fade-out curve more aggressive to enhance visual feedback.
Edouard Tisserant
parents:
3515
diff
changeset
|
162 |
animation: cubic-bezier(0, 0.8, 0.6, 1) fadeOut 0.6s both; |
3512
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
163 |
} |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
164 |
|
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
165 |
@keyframes fadeOut { |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
166 |
0% { opacity: 1; } |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
167 |
100% { opacity: 0; } |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
168 |
} |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
169 |
|
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
170 |
|| |
fce3d407bb46
SVGHMI: add fading transition to make page switch feel more responsive on slow machines.
Edouard Tisserant
parents:
3242
diff
changeset
|
171 |
|
2943
304e88bae115
SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2942
diff
changeset
|
172 |
emit "declarations:jump" |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
173 |
|| |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
174 |
var jumps_need_update = false; |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
175 |
var jump_history = [[default_page, undefined]]; |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
176 |
|
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
177 |
function update_jumps() { |
3596
9c725829d8f0
SVGHMI: continue rework of Jump widget to cope with Enable Expressions.
Edouard Tisserant
parents:
3595
diff
changeset
|
178 |
// called from animate() |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
179 |
page_desc[current_visible_page].jumps.map(w=>w.notify_page_change(current_visible_page,current_page_index)); |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
180 |
jumps_need_update = false; |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
181 |
}; |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
182 |
|
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
183 |
|| |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2912
diff
changeset
|
184 |