Jump widget brings focus to a different page. Mandatory single argument
Optional single path is used as new reference when jumping to a relative
page, it must point to a HMI_NODE.
"active"+"inactive" labeled elements can be provided and reflect current
"disabled" labeled element, if provided, is shown instead of "active" or
"inactive" widget when pointed HMI_NODE is null.
shortdesc > Jump to given page
arg name="page" accepts="string" > name of page to jump to
path name="reference" count="optional" accepts="HMI_NODE" > reference for relative jump
this.active_elt.style.display = "";
this.inactive_elt.style.display = "none";
this.inactive_elt.style.display = "";
this.active_elt.style.display = "none";
this.disabled_elt.style.display = "";
this.inactive_elt.style.display = "none";
this.active_elt.style.display = "none";
this.disabled_elt.style.display = "none";
const name = this.args[0];
/* TODO: in order to allow jumps to page selected through for exemple a dropdown,
support path pointing to local variable whom value
would be an HMI_TREE index and then jump to a relative page not hard-coded in advance */
const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined;
switch_page(name, index);
notify_page_change(page_name, index) {
const ref_index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
const ref_name = this.args[0];
this.active = ((ref_name == undefined || ref_name == page_name) && index == ref_index);
this.disabled = !Number(value);
// TODO: ensure both active and inactive are provided
const "activity" optional_labels("active inactive");
const "have_activity","string-length($activity)>0";
const "disability" optional_labels("disabled");
const "have_disability","$have_activity and string-length($disability)>0";
| this.element.onclick = this.make_on_click();
if "not($have_disability)" {
| this.unsubscribable = true;
when "$have_disability" {
/* check that given path is compatible with page's reference path */
/* TODO: suport local variable containing an HMI_TREE index to jump to a relative page */
/* when no page name provided, check for same page */
const "target_page_name" choose {
when "arg" value "arg[1]/@value";
otherwise value "$page_desc/arg[1]/@value";
const "target_page_path" choose {
when "arg" value "$hmi_pages_descs[arg[1]/@value = $target_page_name]/path[1]/@value";
otherwise value "$page_desc/path[1]/@value";
if "not(func:same_class_paths($target_page_path, path[1]/@value))"
error > Jump id="«@id»" to page "«$target_page_name»" with incompatible path "«path[1]/@value» (must be same class as "«$target_page_path»")
var jumps_need_update = false;
var jump_history = [[default_page, undefined]];
function update_jumps() {
page_desc[current_visible_page].jumps.map(w=>w.notify_page_change(current_visible_page,current_page_index));
jumps_need_update = false;