YuiRestClient::Widget::Tree - handle a tree in the UI
Copyright 2020 SUSE LLC
SPDX-License-Identifier: FSFAP
QE Yam <qe-yam at suse de>
$self->{tree_system_view}->select($item);
$self->{tree_system_view}->selected_item();
$self->{tree_system_view}->get_selected_node($item);
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
}
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:
* item => the property that we're looking for, eg. property('items').
* path => the path starting with a node
The path parameter is used for recursion in this function.