lib/YuiRestClient/App.pm

NAME

YuiRestClient::App - Class to create a UI widget object

COPYRIGHT

Copyright 2021 SUSE LLC

SPDX-License-Identifier: FSFAP

AUTHORS

QE Yam <qe-yam at suse de>

SYNOPSIS

$app = YuiRestClient::App->new({
         port        => $port,
         host        => $host,
         api_version => API_VERSION,
         timeout     => $timeout,
         interval    => $interval});
$app->get_widget_controller()->set_host($yuihost);
$app->get_widget_controller()->set_host($yuiport); 
YuiRestClient::get_app()->check_connection(); 
$self->{btn_guided_setup} = $self->{app}->button({id => 'guided'});       
$self->{ch_autologin} = $self->{app}->checkbox({id => 'autologin'});
$self->{cb_filesystem}       = $self->{app}->combobox({id => '"Y2Partitioner::Widgets::BlkDeviceFilesystem"'});
$self->{isel_keyboard_layout} = $self->{app}->itemselector({id => 'layout_list'});
$self->{lbl_settings_root_part} = $self->{app}->label({label => 'Settings for the Root Partition'});
$self->{menu_btn_add} = $self->{app}->menucollection({label => 'Add...'});
$self->{rb_operating_system} = $self->{app}->radiobutton({id => 'system'});
$self->{txt_overview} = $self->{app}->richtext({id => 'proposal'});
$self->{lst_target_disks} = $self->{app}->selectionbox({
         id => '"Y2Partitioner::Dialogs::PartitionTableClone::DevicesSelector"'
 });
$self->{tbl_available_devices} = $self->{app}->table({id => '"unselected"'});
$self->{tb_password} = $self->{app}->textbox({id => 'pw1'});
$self->{tree_system_view}       = $self->{app}->tree({id => '"Y2Partitioner::Widgets::OverviewTree"'});
$self->{tab_cwm} = $self->{app}->tab({id => '_cwm_tab'});

DESCRIPTION

Overview

This class is a generic representation of the UI widget tree. The class is using the WidgetController class to communicate with the REST-Server and is providing methods to create 'handles' for the various UI elements (buttons, checkboxes, text etc.).

Class and object methods

Class attributes:

{api_version} - The version of the YUI Rest API
{host} - The hostname or IP of the REST server
{port} - The port of the REST server
{timeout} - The timeout for communication with the server
{interval} - Interval time to try to reach the server
{widget_controller} - The instance of the widget controller to communicate with the server

Class methods:

A: Methods for communicating with the REST server

new(%args) - create new app

The argument %args is a hash of named parameters {port}, {host}, {api_version}, {timeout} and {interval}. With this the constructor creates a WidgetController.

get_widget_controller() - Get reference to the widget controller assigned to the instance of app.

get_port() - get port used for the communication with the REST server

get_host() - get name or IP address for communication with REST server

check_connection() - checks if connection to REST server is working

B: Methods for creating references to UI objects

All these methods have in common that the method name describes what kind of UI object is referenced. Every method has an argument $filter which describes the identification of the UI element.

button($filter) - creates reference to a button

checkbox($filter) - creates a reference to a checkbox

combobox($filter) - creates a reference to a combobox

itemselector($filter) - creates a reference to an itemselector

label($filter) - creates a reference to a label

menucollection($filter) - creates a reference to a menucollection

radiobutton($filter) - creates a reference to a radiobutton

richttext($filter) - creates a reference to a richtext

selectionbox($filter) - creates a reference to a selectionbox

table($filter) - creates a reference to a table

textbox($filter) - creates a reference to a textbox

tree($filter) - creates a reference to a tree

tab($filter) - creates a reference to a tab