lib/YuiRestClient/Widget/Tree.pm

NAME

YuiRestClient::Widget::Tree - handle a tree in the UI

COPYRIGHT

Copyright © 2020 SUSE LLC

SPDX-License-Identifier: FSFAP

AUTHORS

QE YaST <qa-sle-yast@suse.de>

SYNOPSIS

  $self->{tree_system_view}->select($item);
  $self->{tree_system_view}->selected_item();
  $self->{tree_system_view}->get_selected_node($item);

DESCRIPTION

Overview

Class representing a tree in UI. It can be YTree.

      {
        "class": "YTree",
        "debug_label": "node_0",
        "hstretch": true,
        "hweight": 30,
        "icon_base_path": "",
        "id": "test_id",
        "items": [
          {
            "children": [
              {
                "icon_name": "icon",
                "label": "node1_1"
              },
              {
                "children": [
                  {
                    "label": "node1_2_1"
                  },
                  {
                    "label": "node1_2_2",
                    "selected": true
                  }
                ],
                "icon_name": "icon",
                "label": "node1_2"
              }
            ],
            "icon_name": "icon",
            "label": "node1",
          },
          {
            "icon_name": "icon",
            "label": "node2"
          }
        ],
        "items_count": 2,
        "label": "node_0",
        "notify": true,
        "vstretch": true
      }

Class and object methods

select($path) - selects item that is specified by $path.

The parameter $path is defining the label property of the node in the tree.

selected_item() - returns the path to the selected item

The returned path contains the node labels (separated by "|") in the branch of the tree were the selected item is found. So in the example tree above the method would return "node1|node1_2|node21_2_2"

get_selected_node( %args ) - return path to selected node

Args has 2 named parameters:

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 131:

=over without closing =back