blob: 5c58dfaa1a5c6e40933f01a61092ad8a1b8be815 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_CLL_UIHandler_WidgetFunctions
//
// Purpose:
// This module contains widget manipulation functions of EPTF_UIHandler_CT.
//
// Module Parameters:
// charstring tsp_EPTF_GUI_Main_Window_WidgetId := "EPTF_Main_Window"; used in
// <f_EPTF_UIHandler_addWindow> creating a new window
// charstring tsp_EPTF_GUI_Main_Toolbar_WidgetId := "EPTF_Main_Toolbar";
// float tsp_EPTF_GUI_Main_Window_Width := 820.0; used in
// <f_EPTF_UIHandler_addWindow> creating a new window
// float tsp_EPTF_GUI_Main_Window_Height := 386.0; used in
// <f_EPTF_UIHandler_addWindow> creating a new window
// charstring tsp_EPTF_GUI_Main_Window_Title := "TTCN constructed window"; used in
// <f_EPTF_UIHandler_addWindow> creating a new window
// charstring tsp_xtdp_listen_addr := "127.0.0.1";
// integer tsp_xtdp_listen_port := 11420;
// charstring tsp_EPTF_savedGUIPrefix := "GUI"; used to create a snapshot
// config file about the GUI
// charstring tsp_EPTF_GUI_DefaultWindow := ""; If it isn't empty, the
// EPTF_UIHandler_CT tries to create a window by this string. It
// can be created by the <f_EPTF_UIHandler_snapshot> and
// <f_EPTF_UIHandler_saveLayout> functions.
// charstring tsp_EPTF_UIHandler_Authmsg := "Enter password" This is the question
// for XTDP authentication that the user of the RuntimeGUI has to answer.
// If it is empty, no authentication performed
// charstring tsp_EPTF_UIHandler_Authresp := ""; This is the expected
// answer for the question <tsp_EPTF_UIHandler_Authmsg> during XTDP
// authentication. If the answer given on RuntimeGUI does not match this
// parameter, the authentication fails and XTDP session will be closed.
// UIHander will enter into headless mode.
// If it is empty, no authentication performed
// float tsp_EPTF_UIHandler_handshakeMaxTimer := 1.0; This is the max handshake
// time for the XDTP protocol. The handshake response should arrive less than
// this time. (See the XTDP protocol module FS for more details)
// float tsp_EPTF_UIHandler_authMaxTimer := 1.0; This is the max authentication time.
// for the XDTP protocol. The authentication response should arrive less than
// this time. (See the XTDP protocol module FS for more details)
// float tsp_EPTF_UIHandler_byeMaxTimer := 1.0; This is the max bye time.
// for the XDTP protocol. The bye response should arrive less than
// this time. (See the XTDP protocol module FS for more details)
// float tsp_EPTF_UIHandler_maxGUIWaitTime := 30.0; The max wait time in the
// init function of the UIhandler (<f_EPTF_UIHandler_init_CT>) to wait
// until Runtime GUI is connected.
//
// Module depends on:
// <XTDPasp_Types>
// <XTDP_PDU_Defs>
// <XUL_XTDL language>
// <EPTF_CLL_UIHandler_MsgDefinitions>
// <EPTF_CLL_UIHandler_Definitions>
// <EPTF_CLL_UIHandler_PrivateFunctions>
// <EPTF_CLL_Base_Definitions>
// <EPTF_CLL_Base_Functions>
// <EPTF_CLL_UIHandler_XTDPTemplateDefinitions>
// <EPTF_CLL_Variable_Definitions>
// <EPTF_CLL_Variable_Functions>
// <EPTF_CLL_UIHandler_ConvertFunctions>
// <EPTF_CLL_Common_Definitions>
// <EPTF_CLL_HashMapStr2Int_Functions>
// <EPTF_CLL_HashMapInt2Int_Functions>
// <EPTF_CLL_Logging_Definitions>
// <EPTF_CLL_Logging_Functions>
// <TCCFileIO_Functions>
// <TCCDateTime_Functions>
// <EPTF_CLL_TransportIPL4_Functions>
// <EPTF_CLL_Transport_CommonDefinitions>
// <EPTF_CLL_Semaphore_Functions>
// <EPTF_CLL_UIHandler_CLIClientDefinitions>
// <EPTF_CLL_UIHandlerCLI_CommandDefinitions>
// <EPTF_CLL_CLI_Functions>
// <EPTF_CLL_CLI_Definitions>
// <Socket_API_Definitions>
// <EPTF_CLL_HashMap_Functions>
//
// Current Owner:
// EFLOATT
//
// Last Review Date:
// 2010-xx-xx
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////////
module EPTF_CLL_UIHandler_WidgetFunctions
// [.objid{ itu_t(0) identified_organization(4) etsi(0)
// identified_organization(127) ericsson(5) testing(0)
// <put further nodes here if needed>}]
{
//=========================================================================
// Import Part
//=========================================================================
import from EPTF_CLL_UIHandler_MsgDefinitions all;
import from EPTF_CLL_UIHandler_Definitions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_UIHandler_XSD_XTDPTemplateDefinitions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_UIHandler_ConvertFunctions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Common_Functions all;
import from EPTF_CLL_HashMapStr2Int_Functions all;
import from EPTF_CLL_HashMapInt2Int_Functions all;
import from EPTF_CLL_Logging_Definitions all;
import from EPTF_CLL_Logging_Functions all;
import from TCCFileIO_Functions all;
import from TCCDateTime_Functions all;
import from TCCConversion_Functions all;
import from EPTF_CLL_TransportIPL4_Functions all;
import from EPTF_CLL_Transport_CommonDefinitions all;
import from EPTF_CLL_TransportMessageBufferManager_Functions all;
import from EPTF_CLL_Semaphore_Functions all;
import from EPTF_CLL_UIHandler_CLIClientDefinitions all;
import from EPTF_CLL_CLI_Functions all;
import from EPTF_CLL_CLI_Definitions all;
import from Socket_API_Definitions all
import from XTDP_EncDecFunctions all;
import from ttcn_ericsson_se_protocolModules_xtdp_xtdl all;
import from ttcn_ericsson_se_protocolModules_xtdp_xtdp all;
import from EPTF_CLL_DataSource_Definitions all;
import from EPTF_CLL_DataSource_Functions all;
import from EPTF_CLL_UIHandler_DS_Definitions all;
import from EPTF_CLL_UIHandler_DS_Functions all;
import from EPTF_CLL_DataSourceClient_Functions all;
import from EPTF_CLL_HashMap_Functions all;
import from EPTF_CLL_StatManager_Functions all;
import from EPTF_CLL_UIHandler_BrowserFunctions all;
import from EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions all;
//=========================================================================
// Module Parameters
//=========================================================================
modulepar {
charstring tsp_EPTF_GUI_Main_Window_WidgetId := "EPTF_Main_Window";
charstring tsp_EPTF_GUI_Main_Toolbar_WidgetId := "EPTF_Main_Toolbar";
charstring tsp_EPTF_GUI_Main_Tabbox_WidgetId := "EPTF_Main_Tabbox";
float tsp_EPTF_GUI_Main_Window_Width := 820.0;
float tsp_EPTF_GUI_Main_Window_Height := 386.0;
charstring tsp_EPTF_GUI_Main_Window_Title := "TTCN constructed window";
charstring tsp_xtdp_listen_addr := "127.0.0.1";
integer tsp_xtdp_listen_port := 11420;
integer tsp_EPTF_UIHandler_udp_port := 3333; // remote port number for pinger port
charstring tsp_EPTF_UIHandler_localPingerAddr := c_ipv4AnyAddr;
integer tsp_EPTF_UIHandler_localPingerPort := c_anyPort; // 0-> let the kernel choose a local port number automatically
charstring tsp_EPTF_savedGUIPrefix := "GUI";
charstring tsp_EPTF_GUI_DefaultWindow := ""; // OUTDATED, remove it from any config
charstring tsp_EPTF_GUI_DefaultWindowXTDL := "";
boolean tsp_EPTF_UIHandler_headlessmode := true;
boolean tsp_EPTF_UIHandler_servermode := false;
charstring tsp_EPTF_UIHandler_Authmsg := "Enter password";
charstring tsp_EPTF_UIHandler_Authresp := "";
float tsp_EPTF_UIHandler_handshakeMaxTimer := 1.0;
float tsp_EPTF_UIHandler_authMaxTimer := 1.0;
float tsp_EPTF_UIHandler_byeMaxTimer := 1.0;
float tsp_EPTF_UIHandler_bufferedXTDP := 0.5;
float tsp_EPTF_UIHandler_connecttimer := 5.0;
float tsp_EPTF_UIHandler_maxWaitTimer := 5.0;
integer tsp_EPTF_UIHandler_CommPortIPL4_minBufferSize := 2000;
boolean tsp_debug_EPTF_UIHandler_Functions := false;
float tsp_EPTF_UIHandler_maxGUIWaitTime := 30.0;
boolean tsp_EPTF_UIHandler_enableBrowserGUI := true;
EPTF_Var_SubscriptionMode tsp_EPTF_UIHandler_subscriptionMode := sampled; // sampled is the default for tsp_EPTF_DataSource_subscriptionMode, with pull widgets on RuntimeGUI do not update
}
friend module EPTF_CLL_UIHandlerVariableUI_Functions, EPTF_CLL_UIHandlerCLI_Functions,EPTF_CLL_UIHandler_XULFunctions;
friend module EPTF_UIHandler_Test_Testcases, EPTF_CLL_UIHandler_BrowserFunctions;
friend module EPTF_UIHandler_Test_Functions;
const charstring cg_ExternalVariableSign := "__ExternalValue";
//=========================================================================
// Public functions
//=========================================================================
group PublicFunctions {
public external function f_EPTF_UIHandler_init_XML();
public external function f_EPTF_UIHandler_cleanup_XML();
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_init_CT
//
// Purpose:
// Initialises the EPTF_UIHandler_CT
//
// Parameters:
// pl_selfName - *in* *charstring* - the name used in the initialization
// of the f_EPTF_Base_CT
// pl_CLI_compRef - *in* <EPTF_CLI_CT> - the CLI to use.
// Default: null (== local CLI ports are disabled)
// pl_connectGUI - *in* *boolean* - default: true. If it is true
// UIHandler will try to connect to the RuntimeGUI and will perform
// the XTDP handshake and authentication. The init function will
// exit after the XTDP session is connected. If the transport connection
// failed but the headless mode is true, the init function will exit
// with XTDP session not established and the UIHandler will enter
// into headless mode.
// pl_windowLayout - *in template* *charstring* - This parameter defines the initial
// gui layout in xml format. Must fit the XTDL.xsd. If it is omit (default value),
// UIHandler gets the <tsp_EPTF_GUI_DefaultWindowXTDL> module parameter, which can
// describe the GUI true. If it contains an empty string, there is no initial GUI.
// pl_prefix - *in* *charstring* - (default:tsp_EPTF_UIHandler_CLIPrefix) -
// common prefix for the UIHandler Command-Line Interface commands
// pl_simulationMode - *in* *boolean* - (default:false) -
// If this parameter is true, UIHandler will be initialized in simulation mode
// pl_simulation_buildDB_file - *in* *charstring* - (default:"") -
// The parameter is definies the file, what will be used to save the database
// or load the database in simulation mode
//
// Return Value:
// -
//
// Errors:
// Error occurs in client mode (i.e. if tsp_EPTF_UIHandler_servermode is false)
// if
// - pl_connectGUI true, headless mode is false, and it is not possible
// to connect to the RuntimeGUI.
// - pl_connectGUI false and headless mode is false
// - pl_connectGUI true but XTDP handshake&authentication is not
// performed in time (during tsp_EPTF_UIHandler_maxGUIWaitTime seconds)
//
// Detailed Comments:
// This function should be called before using the EPTF_UIHandler_CT
// component.
// Currently simulation mode is not supported, so do not change the values of
// the following parameters:
// pl_simulationMode
// pl_simulation_buildDB_file
// To get it (simulation mode) working nonblocking version of the f_EPTF_UIHandler_simulation_getData
// function needs to be implemented.
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_init_CT(
in charstring pl_selfName,
in boolean pl_connectGUI := true,
in template charstring pl_windowLayout := "",
in EPTF_CLI_CT pl_CLI_compRef := null,
in charstring pl_prefix := tsp_EPTF_UIHandler_CLIPrefix,
in boolean pl_simulationMode := false,
in charstring pl_simulation_buildDB_file := "",
in boolean pl_headlessmode := tsp_EPTF_UIHandler_headlessmode,
in boolean pl_servermode := tsp_EPTF_UIHandler_servermode,
in charstring pl_authresp := tsp_EPTF_UIHandler_Authresp )
runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized) {
v_EPTF_UIHandler_simulatonMode := pl_simulationMode;
v_EPTF_UIHandler_simulation_buildDB_file := pl_simulation_buildDB_file;
v_UIHandler_simulation_directContentDB := {};
if(isvalue(pl_windowLayout)){
v_UIHandler_windowLayout := valueof(pl_windowLayout);
v_UIHandler_emptyGUI := false;
}else{
v_UIHandler_windowLayout := "";
v_UIHandler_emptyGUI := true;
}
v_EPTF_UIHandler_createLayoutCallback := refers(f_EPTF_UIHandler_newCreateInitialLayout);
f_EPTF_UIHandler_init_XML();
f_EPTF_UIHandler_initComponent(pl_selfName, pl_CLI_compRef, pl_prefix, pl_headlessmode, pl_servermode, pl_authresp);
f_EPTF_UIHandler_connect(pl_connectGUI);
f_EPTF_UIHandler_simulation_Subscribe2saveDBButton_vars();
if(v_EPTF_UIHandler_simulatonMode == true) {
f_EPTF_UIHandler_simulation_createDBFromFile(pl_simulation_buildDB_file, v_UIHandler_simulation_directContentDB);
var integer vl_directContentDBSize := sizeof(v_UIHandler_simulation_directContentDB);
for(var integer vl_i := 0; vl_i < vl_directContentDBSize; vl_i := vl_i + 1) {
f_EPTF_str2int_HashMap_Insert(v_UIHandler_simulation_varsHashMapId, v_UIHandler_simulation_directContentDB[vl_i].key, vl_i);
f_EPTF_Var_newVar(v_UIHandler_simulation_directContentDB[vl_i].key, v_UIHandler_simulation_directContentDB[vl_i].directContent)
}
}
v_EPTF_UIHandler_WidgetFunctions_XTDP_XSD_filepath := "";
}
}
friend function f_EPTF_UIHandler_initComponent(
in charstring pl_selfName,
in EPTF_CLI_CT pl_CLI_compRef := null,
in charstring pl_prefix := tsp_EPTF_UIHandler_CLIPrefix,
in boolean pl_headlessmode := tsp_EPTF_UIHandler_headlessmode,
in boolean pl_servermode := tsp_EPTF_UIHandler_servermode,
in charstring pl_authresp := tsp_EPTF_UIHandler_Authresp)
runs on EPTF_UIHandler_Private_CT {
v_EPTF_UIHandler_headlessmode := pl_headlessmode;
v_EPTF_UIHandler_servermode := pl_servermode;
v_EPTF_UIHandler_Authresp := pl_authresp;
v_UIHandler_initToGUIClient := false;
v_UIHandler_createGUIRunning := false;
t_UIHandler_initGUIToClientTimer.start;
v_UIHandler_cleanupCalled := false;
v_UIHandler_openSubscriptions := {};
v_UIHandler_subscriptions := {};
v_UIHandler_guiLayoutReady := false;
v_UIHandler_guiItemList := {};
v_UIHandler_tracePointers := {};
v_UIHandler_windowIndex := -1;
//KI - 2013.11.04. - ez kimehetne, most kikotom a hasznalatat
v_UIHandler_GUI_DescriptionDB := {};
v_UIHandler_GUI_DescriptionDB_Idx := -1;
v_UIHandler_nofRunning_processExternalData_handlers := 0;
v_UIHandler_GUIFunctions_nofRunning_processExternalData_handlers := {}; // used to wait for all EPTF_CLL_UIHandler_GUIFunctions.cc[expand_current_node] functions to finish
f_EPTF_HashMap_init_CT (pl_selfName);
v_EPTF_UIHandler_Config_ConnectVarToWidgets := {};
v_handshakeMaxTime := tsp_EPTF_UIHandler_handshakeMaxTimer;
v_handshakeErrorMsg := "";
v_authMaxTime := tsp_EPTF_UIHandler_authMaxTimer;
v_byeMaxTime := tsp_EPTF_UIHandler_byeMaxTimer;
v_UIHandler_byeTimer := -1;
f_EPTF_Var_init_CT(pl_selfName);
f_EPTF_Logging_init_CT(pl_selfName);
f_EPTF_DataSource_init_CT(pl_selfName);
f_EPTF_StatManager_init_CT(pl_selfName);
if(self == pl_CLI_compRef) {
// if I am the CLI: initialize it (with telnet ports enabled):
f_EPTF_CLI_init_CT(pl_selfName)
} else {
// if remote or null CLI is used, disable all telnet ports in the CLI:
f_EPTF_CLI_init_CT(pl_selfName,*,*);
}
// NOTE:
// If pl_CLI_compRef is null: the CLI client will be initialized with self as CLI
// and the commands will be registered also.
// This is because if f_EPTF_UIHandler_CLI_init_CT is called later,
// that will enable the telnet ports, so the commands should be there.
if(null == pl_CLI_compRef){pl_CLI_compRef := self}
f_EPTF_CLI_Client_init_CT(pl_selfName, pl_CLI_compRef)
f_EPTF_UIHandler_CLIClient_init_CT(pl_prefix);
f_EPTF_DataSource_CLI_init_CT(pl_selfName, pl_CLI_compRef);
v_UIHandler_loggingMaskId := f_EPTF_Logging_registerComponentMasks(tsp_EPTF_UIHandler_loggingComponentMask, c_EPTF_UIHandler_loggingEventClasses, EPTF_Logging_CLL);
if(tsp_debug_EPTF_UIHandler_Functions) {
f_EPTF_Logging_enableLocalMask(v_UIHandler_loggingMaskId, c_EPTF_UIHandler_loggingClassIdx_Debug);
} else {
f_EPTF_Logging_disableLocalMask(v_UIHandler_loggingMaskId, c_EPTF_UIHandler_loggingClassIdx_Debug);
}
v_UIHandler_widgetHashMapId := f_EPTF_str2int_HashMap_New(c_EPTF_UIHandler_widgetIdHashMapName);
v_UIHandler_tracePointerHashMapId := f_EPTF_int2int_HashMap_New(c_EPTF_UIHandler_tracePointerHashMapName);
v_UIHandler_subscriptionHashMapId := f_EPTF_str2int_HashMap_New(c_EPTF_UIHandler_subscriptionHashMapName);
v_UIHandler_subscriptionHashMapIdVar := f_EPTF_str2int_HashMap_New(c_EPTF_UIHandler_subscriptionHashMapNameVar);
v_UIHandler_simulation_varsHashMapId := f_EPTF_str2int_HashMap_New(c_EPTF_UIHandler_simulation_varsHashMapName);
f_EPTF_Semaphore_init_CT(pl_selfName);
v_UIHandler_xtdpReceivedMessageSemaphore_r := f_EPTF_Semaphore_new();
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
v_UIHandler_exitButtonPressedSemaphore := f_EPTF_Semaphore_new();
v_UIHandler_progressEnabled := true;
f_EPTF_UIHandler_initProgressBar();
f_EPTF_Transport_init(IPL4, pl_selfName)
//FIXME use the new API
f_EPTF_Transport_registerMsgLenCallback4LGenType(IPL4, refers(f_EPTF_UIHandler_getMsgLen_XTDP), {}, c_EPTF_UIHandler_XTDPType);
f_EPTF_Transport_registerMsgCallback(IPL4, c_EPTF_UIHandler_XTDPType, refers(f_EPTF_UIHandler_HandleMsgs_XTDP), refers(f_EPTF_UIHandler_HandleEvent_XTDP));
f_EPTF_MessageBufferManager_MaxBufferSize_setMinValue(tsp_EPTF_UIHandler_CommPortIPL4_minBufferSize);
f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandler_cleanup_CT));
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("----EPTF_UIHandler 0.8610 INIT DONE----");
}
f_EPTF_DataSourceClient_init_CT(f_EPTF_Base_selfName(), self);
f_EPTF_DataSourceClient_registerData(c_UIHandler_DS_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_UIhandler_DSProcessData), self);
f_EPTF_DataSourceClient_registerDataValue(c_UIHandler_DS_sourceId, f_EPTF_Base_selfName(), refers(f_EPTF_UIHandler_DSProcessDataValue), self);
f_EPTF_DataSourceClient_sendReady(c_UIHandler_DS_sourceId, f_EPTF_Base_selfName());
if(tsp_EPTF_UIHandler_enableBrowserGUI){
f_EPTF_UIHandler_Browser_init_CT( );
}
v_EPTF_UIHandler_Traces_HashmapId := f_EPTF_str2int_HashMap_New("TracesHashMap");
v_UIHandler_initialized := true;
if(f_EPTF_UIHandler_layoutReady()) {
//f_EPTF_UIHandler_createInitialLayout(pl_windowLayout); // initial window is created in internal DB before trying to connect to GUI
if(null != v_EPTF_UIHandler_createLayoutCallback){
v_EPTF_UIHandler_createLayoutCallback.apply();
}
}
f_EPTF_UIHandler_updateOwnProgress("Initializing: Done.");
f_EPTF_Base_waitForCondition(refers(f_EPTF_UIHandler_checkDataSourceReady))
}
private function f_EPTF_UIHandler_checkDataSourceReady()
runs on EPTF_UIHandler_Private_CT return boolean{
var charstring vl_varName := "";
var integer vl_returnVal := f_EPTF_DataSource_checkData(
pl_dataVarName := vl_varName,
pl_source := c_UIHandler_DS_sourceId,
pl_ptcName := "",
pl_element := c_UIHandler_dataElement_progressBar,
pl_params := {});
return vl_returnVal == 0;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateProgress
//
// Purpose:
// Update the value of the dataSource containing the progress information
//
// Parameters:
// pl_progressInfo - *in* *charstring* - the new progress information to show
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// The progress history is updated automatically
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_updateProgress(in charstring pl_progressInfo, in float vl_progressPercent := -1.0) runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized){ return }
var charstring vl_progressPercentStr := "";
if (vl_progressPercent>=0.0) {
vl_progressPercentStr := ": "&int2str(float2int(vl_progressPercent))&"%";
}
f_EPTF_Var_adjustContent(f_EPTF_Var_getId(c_UIHandler_DS_var_prefix&c_UIHandler_dataElement_progressBar),{charstringVal := pl_progressInfo&vl_progressPercentStr});
}
private function f_EPTF_UIHandler_initProgressBar() runs on EPTF_UIHandler_Private_CT {
// create progress bar variable:
var integer vl_progressBar_Idx, vl_progressBarHistory_Idx;
f_EPTF_Var_newCharstring(c_UIHandler_DS_var_prefix&c_UIHandler_dataElement_progressBar,"",vl_progressBar_Idx);
f_EPTF_Var_newCharstring(c_UIHandler_DS_var_prefix&c_UIHandler_dataElement_progressBarHistory,"",vl_progressBarHistory_Idx);
f_EPTF_Var_addPostProcFn(vl_progressBar_Idx,{
refers(f_EPTF_UIHandler_progressBarHistory_PostProc),
{vl_progressBarHistory_Idx}
});
f_EPTF_Var_setSubsCanAdjust(vl_progressBarHistory_Idx,false);
f_EPTF_UIHandler_updateOwnProgress("Initializing...");
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_enableOwnProgress
//
// Purpose:
// Enables UIHandler's own progress information updates
//
// Parameters:
// pl_enableOwnProgress - *in* *boolean* - true: enable, false: disable
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_enableOwnProgress(in boolean pl_enableOwnProgress) runs on EPTF_UIHandler_Private_CT {
v_UIHandler_progressEnabled := pl_enableOwnProgress;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateOwnProgress
//
// Purpose:
// Update the value of the dataSource containing the progress information with the UIHandler's own progress info
//
// Parameters:
// pl_progressInfo - *in* *charstring* - the new progress information to show
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// The progress history is updated automatically
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_updateOwnProgress(in charstring pl_progressInfo, in float vl_progressPercent := -1.0) runs on EPTF_UIHandler_Private_CT {
if (v_UIHandler_progressEnabled) {
f_EPTF_UIHandler_updateProgress(c_UIHandler_DS_sourceId&": "&pl_progressInfo,vl_progressPercent);
}
}
// appends the progressBar var content to the progressBarHistory var:
private function f_EPTF_UIHandler_progressBarHistory_PostProc(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on EPTF_UIHandler_Private_CT {
// content of the progressBar var:
var integer vl_progressBarHistory_Idx := pl_argList[0];
f_EPTF_Var_adjustContent(
vl_progressBarHistory_Idx,
{
charstringVal := f_EPTF_Var_getCharstringValue(vl_progressBarHistory_Idx)&"\n"&f_EPTF_Var_getCharstringValue(pl_idx)
}
);
}
friend function f_EPTF_UIHandler_connect(in boolean pl_connectGUI)
runs on EPTF_UIHandler_Private_CT {
var ConnectionId vl_connId := -1;
var boolean vl_UIHandler_transportConnectionFailed := false;
if (v_EPTF_UIHandler_servermode){
// server mode
f_EPTF_UIHandler_headlessmode();
} else {
// client mode
f_EPTF_Transport_registerMsgCallback(IPL4, c_EPTF_UIHandler_pingerTransport, refers(f_EPTF_UIHandler_pingerReceive));
var Result vl_result
f_EPTF_Transport_listen(IPL4, { udp := {} }, tsp_EPTF_UIHandler_localPingerAddr, tsp_EPTF_UIHandler_localPingerPort, c_EPTF_UIHandler_pingerTransport, vl_result, false)
if (ispresent(vl_result.errorCode) and (vl_result.errorCode != ERROR_TEMPORARILY_UNAVAILABLE)) {
f_EPTF_UIHandler_error("Could not open pinger port: " & log2str(vl_result));
}
v_UIHandler_pingerConnectionId := vl_result.connId;
v_UIHandler_udp_port := tsp_EPTF_UIHandler_udp_port;
// Checks for GUI address that is set by the user.
// If not use the address from module parameter.
if (v_UIHandler_GUI_Host == c_EPTF_UIHandler_Invalid_GUI_Host or
v_UIHandler_GUI_Port == c_EPTF_UIHandler_Invalid_GUI_Port) {
v_UIHandler_GUI_Host := tsp_xtdp_listen_addr;
v_UIHandler_GUI_Port := tsp_xtdp_listen_port;
}
if(pl_connectGUI){
// try to connect to GUI
var EPTF_UIHandler_connectionResult vl_res := f_EPTF_UIHandler_connectAndInitGui(vl_connId);
if(connected != vl_res){
if (v_EPTF_UIHandler_headlessmode) {
// connect to GUI failed -> switch to headless mode
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("initGUI failed, switch to headless mode");
}
f_EPTF_UIHandler_headlessmode();
vl_UIHandler_transportConnectionFailed := vl_res != temporarilyUnavailable;
} else {
// connecting to GUI failed and headless mode not enabled -> stop running
f_EPTF_UIHandler_error("initGUI failed!");
}
}
} else if (v_EPTF_UIHandler_headlessmode) {
// headless mode enabled -> switch to headless mode
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("UIHandler started in headless mode");
}
f_EPTF_UIHandler_headlessmode();
} else {
// uncorrect starrtup configuration: client mode, not to connect to GUI, headless mode disabled -> stop running
f_EPTF_UIHandler_error("Uncorrect UIHandler configuration for startup: client mode, not to connect to GUI, headless mode disabled");
}
}
if (tsp_EPTF_UIHandler_bufferedXTDP != 0.0){
//v_UIHandler_Requestbuffer.data.noNamespaceSchemaLocation := omit;
v_UIHandler_Requestbuffer.data.transactionID := omit;
v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.ackRequested := omit;
f_EPTF_UIHandler_requestBuffer_clear();
t_UIHandler_bufferedXTDP.start(tsp_EPTF_UIHandler_bufferedXTDP);
}
v_UIHandler_def := activate(as_handle_main_EPTF_UIHandler_MgmtIf());
// wait for gui connect (handshake and authentication) if transport is already connected
if ((pl_connectGUI and not v_EPTF_UIHandler_servermode) and not vl_UIHandler_transportConnectionFailed) {
timer t_wait_for_connectGUI := 0.0;
timer t_max_wait_for_connectGUI := tsp_EPTF_UIHandler_maxGUIWaitTime;
t_max_wait_for_connectGUI.start;
t_wait_for_connectGUI.start;
alt {
[v_UIHandler_guiConnected or (vl_connId != -1 and not f_EPTF_UIHandler_isConnectedClientid(vl_connId))] t_wait_for_connectGUI.timeout {
// connection established, or lost
}
[] t_max_wait_for_connectGUI.timeout {
// bugfix_HR17649 - error => warning
f_EPTF_UIHandler_warning("In client mode connecting to the RuntimeGUI on " & v_UIHandler_GUI_Host & ":" & log2str(v_UIHandler_GUI_Port) & " failed: Timeout during handshake&authentication. RuntimeGUI is not responding. Please correct the tsp_xtdp_listen_addr / tsp_xtdp_listen_port parameter(s) or restart the RuntimeGUI! ");
f_EPTF_UIHandler_headlessmode();
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_newCreateInitialLayout
//
// Purpose:
// Create initial layout based on settings
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_newCreateInitialLayout()
runs on EPTF_UIHandler_Private_CT
{
var boolean vl_ret := false;
if(not v_UIHandler_emptyGUI){
// If no window is given neither from parameter nor from tsp, parameter is not given, or contains the default value ->
// create a simple window and a main tabbox
// This is the backward compatible way
if("" == v_UIHandler_windowLayout and "" == tsp_EPTF_GUI_DefaultWindow){
// no window is given -> create a simple window and a main tabbox
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Creating a window and a main tabbox");
}
vl_ret := f_EPTF_UIHandler_addWindow();
vl_ret := vl_ret and f_EPTF_UIHandler_addMainTabbox();
}
else {
if ("" != v_UIHandler_windowLayout) {
// create window given in parameter
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Creating window specified by function parameter: "&log2str(v_UIHandler_windowLayout));
}
f_EPTF_UIHandler_createGUIFromWindow(v_UIHandler_windowLayout);
//vl_wndXul := f_EPTF_UIHandler_XSD_decodeXUL(pl_windowLayout);
}
else if ("" != tsp_EPTF_GUI_DefaultWindow) {
// create window from specified in tsp
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Creating window specified by tsp_EPTF_GUI_DefaultWindowXTDL: "&log2str(tsp_EPTF_GUI_DefaultWindowXTDL));
}
f_EPTF_UIHandler_createGUIFromWindow(tsp_EPTF_GUI_DefaultWindowXTDL);
//vl_wndXul := f_EPTF_UIHandler_XSD_decodeXUL(tsp_EPTF_GUI_DefaultWindow);
}
if (not vl_ret) {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&" failed, could not create initial GUI");
}
}
}
}
}
private function f_EPTF_UIHandler_createGUIFromWindow(in charstring pl_window)
runs on EPTF_UIHandler_Private_CT{
var Widgets vl_widgets := f_EPTF_UIHandler_XSD_decodeXUL(pl_window);
if(not ischosen(vl_widgets.window)){
f_EPTF_UIHandler_error(%definitionId&": The received XUL is invalid, not window or it can not be decoded fully.\n"&
"For further detailes see the log file above.")
}
f_EPTF_UIHandler_createGUI(pl_window);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_cleanup_CT
//
// Purpose:
// Destructs the EPTF_UIHandler_CT
//
// Parameters:
// -
//
// Return Value:
// -
//
// Errors:
// none
//
// Detailed Comments:
// This function mustn't be called directly. You must call f_EPTF_Base_cleanup_CT instead.
///
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_cleanup_CT() runs on EPTF_UIHandler_Private_CT {
// f_EPTF_Logging_debug(true, "v_UIHandler_initialized: "& v_UIHandler_initialized &" v_UIHandler_guiConnected: "& v_UIHandler_guiConnected);
if (v_UIHandler_initialized)
{
v_UIHandler_cleanupCalled := true;
if(t_UIHandler_pingtimer.running) {
t_UIHandler_pingtimer.stop;
}
if(t_UIHandler_initGUIToClientTimer.running) {
t_UIHandler_initGUIToClientTimer.stop;
}
if(v_UIHandler_guiConnected)
{
for (var integer i := 0; i<sizeof(v_UIHandler_GUIClientId); i:= i+1)
{
f_EPTF_UIHandler_closeXTDPSession(v_UIHandler_GUIClientId[i].clientId);
//var Result vl_result
//f_EPTF_Transport_send(IPL4, v_UIHandler_GUIClientId[i], char2oct("bye\r\n"), vl_result, false)
}
}
f_EPTF_Semaphore_delete(v_UIHandler_xtdpReceivedMessageSemaphore_r);
f_EPTF_Semaphore_delete(v_UIHandler_layoutResponseReceivedSemaphore);
f_EPTF_Semaphore_delete(v_UIHandler_exitButtonPressedSemaphore);
v_UIHandler_openSubscriptions := {};
v_UIHandler_subscriptions := {}
f_EPTF_str2int_HashMap_Delete(c_EPTF_UIHandler_subscriptionHashMapName);
f_EPTF_str2int_HashMap_Delete(c_EPTF_UIHandler_subscriptionHashMapNameVar);
f_EPTF_str2int_HashMap_Delete(c_EPTF_UIHandler_simulation_varsHashMapName);
v_UIHandler_subscriptionHashMapId := -1;
v_UIHandler_subscriptionHashMapIdVar := -1;
v_UIHandler_simulation_varsHashMapId := -1;
v_UIHandler_guiItemList := {};
v_UIHandler_windowIndex := -1;
v_UIHandler_initialized := false;
f_EPTF_str2int_HashMap_Delete(c_EPTF_UIHandler_widgetIdHashMapName);
v_UIHandler_widgetHashMapId := -1;
f_EPTF_int2int_HashMap_Delete(c_EPTF_UIHandler_tracePointerHashMapName);
v_UIHandler_tracePointerHashMapId := -1;
v_UIHandler_tracePointers := {};
f_EPTF_str2int_HashMap_DeleteById(v_EPTF_UIHandler_Traces_HashmapId);
v_EPTF_UIHandler_TraceRingBuffers := {};
v_UIHandler_initToGUIClient := false;
v_UIHandler_createGUIRunning := false;
v_EPTF_UIHandler_headlessmode := true;
v_EPTF_UIHandler_servermode := false;
v_EPTF_UIHandler_Authresp := "";
}
// Reset the GUI address because we don't want to affect the
// subsequence UIHandler initializations.
v_UIHandler_GUI_Host := c_EPTF_UIHandler_Invalid_GUI_Host;
v_UIHandler_GUI_Port := c_EPTF_UIHandler_Invalid_GUI_Port;
v_UIHandler_guiConnected := false;
// clearing registered callbacks (also registered callbacks exit if not v_UIHandler_initialized):
//f_EPTF_CommPort_IPL4_setMsgLen4LGenType(null, {}, c_EPTF_UIHandler_XTDPType);
f_EPTF_Transport_registerMsgCallback(IPL4, c_EPTF_UIHandler_XTDPType, null, null);
deactivate(v_UIHandler_def); v_UIHandler_def := null;
// WORKAROUND for some GUI bug, remove it ASAP!
timer t_x := 0.5;t_x.start;t_x.timeout;
if (not v_EPTF_UIHandler_servermode){
var Result vl_result
f_EPTF_Transport_close(IPL4, v_UIHandler_pingerConnectionId, vl_result)
v_UIHandler_pingerConnectionId := -1;
}
f_EPTF_UIHandler_CLIClient_cleanup_CT()
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("----EPTF_UIHandler cleanup DONE----");
}
f_EPTF_UIHandler_cleanup_XML();
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_clearGUI
//
// Purpose:
// Sends a message to user interface via XTDP port to remove
// all the elements and also clears UIHandler's internal DB.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_clearGUI(in boolean pl_clearDb := true) runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized){ return }
f_EPTF_UIHandler_waitForLayoutReady();
// remove all
for(var integer clientindex:=0;clientindex<sizeof(v_UIHandler_GUIClientId);clientindex := clientindex+1){
var ASP_XSD_XTDP vl_msg :={
v_UIHandler_GUIClientId[clientindex].clientId,
{
choice := {
xTDP_RemoveRequests:= {
xTDP_RemoveRequest_list := {
{
requestId := 1,
widgetId := omit
}
}
}
}
}
};
f_EPTF_UIHandler_send_XTDP(vl_msg);
}
if (pl_clearDb) {
// make internal widget DB empty
f_EPTF_UIHandler_clearInternalWidgetDB();
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addWindow
//
// Purpose:
// Tries to add a new window to the RuntimeGUI
//
// Detailed Comments:
// The parameters of the new window can be controlled via
// the tsp_EPTF_GUI_Main_Window_... module parameters
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_addWindow()
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
f_EPTF_UIHandler_waitForLayoutReady();
var Widgets vl_xul := {
window := {
about := omit,
height := tsp_EPTF_GUI_Main_Window_Height,
help := omit,
id := tsp_EPTF_GUI_Main_Window_WidgetId,
orientation := vertical,
title := tsp_EPTF_GUI_Main_Window_Title,
width := tsp_EPTF_GUI_Main_Window_Width,
image_list := {},
embeddedwidgets := {
/* {tabbox := { */
/* id := tsp_EPTF_GUI_Main_Tabbox_WidgetId, */
/* flex := omit, */
/*customclass := omit, */
/* disabled := omit, */
/*disabledongui := omit, */
/* tabs := {}, */
/* tabpanels := {} */
/* } */
/* }, */
embeddedwidget_list := {
/*{
toolbar := {
customclass := omit,
disabled := false,
disabledongui := omit,
id := tsp_EPTF_GUI_Main_Toolbar_WidgetId,
placement := south,
choice_list := {}
}
}*/
}
}
}
};
var boolean vl_dummy := false;
return f_EPTF_UIHandler_XSD_addElementToGui(vl_xul, "", vl_dummy);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addMainTabbox
//
// Purpose:
// Tries to add the main tabbox to the RuntimeGUI
//
// Detailed Comments:
// The id of the tabbox is spesified by
// tsp_EPTF_GUI_Main_Tabbox_WidgetId module parameter
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_addMainTabbox()
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
var boolean vl_succ := f_EPTF_UIHandler_addMainTabpages();
return vl_succ;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addMainTabpages
//
// Purpose:
// Tries to add the main tabbox to the RuntimeGUI
//
// Detailed Comments:
// The id of the tabbox is spesified by
// tsp_EPTF_GUI_Main_Tabbox_WidgetId module parameter
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_addMainTabpages()
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
f_EPTF_UIHandler_waitForLayoutReady();
var Widgets vl_xul := {
tabpages := {
//In case of named fields the compiler won't warn if
//there are uninitializad elements
/*customclass :=*/ omit,
/*disabled :=*/ omit,
/*disabledongui :=*/ omit,
/*flex :=*/ omit,
/*id :=*/ tsp_EPTF_GUI_Main_Tabbox_WidgetId,
/*layout :=*/ omit,
/*tabpage :=*/ { { } }
}
};
var boolean vl_dummy:=false;
return f_EPTF_UIHandler_XSD_addElementToGui(vl_xul, tsp_EPTF_GUI_Main_Window_WidgetId, vl_dummy);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeElementFromGui
//
// Purpose:
// Remove an element from the GUI.
//
// Parameters:
// pl_widgetId - *in* *EPTF_UIHandler_WidgetIdString* - element to be removed
// pl_sendToRTG - *in* *boolean* - if true: request is sent to runtime GUI, otherwise not
//
// Return Value:
// Returns the result of f_EPTF_UIHandler_removeWidgetRecByIdx.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_removeElementFromGui_old(in EPTF_UIHandler_WidgetIdString pl_widgetId, in boolean pl_sendToRTG := true, in boolean pl_appendTo_GUI_DescriptionDB := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
if(pl_appendTo_GUI_DescriptionDB) {
v_UIHandler_GUI_DescriptionDB[sizeof(v_UIHandler_GUI_DescriptionDB)] := {pl_widgetId, "removed"};
}
f_EPTF_UIHandler_waitForLayoutReady();
var integer vl_idx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetId);
if(-1 == vl_idx){
f_EPTF_UIHandler_warning("There is no widget with name "&pl_widgetId&" to remove!");
return false;
}
//remove the element from the GUI
if (pl_sendToRTG) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRemoveElementFromGUI(pl_widgetId));
}
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
f_EPTF_UIHandler_Browser_reportGUIChanged(pl_widgetId);
}
//remove it and its children from the widgetlist and the connectionlist
return f_EPTF_UIHandler_removeWidgetRecByIdx(vl_idx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeElementFromGui
//
// Purpose:
// Remove an element from the GUI.
//
// Parameters:
// pl_widgetId - *in* *EPTF_UIHandler_WidgetIdString* - element to be removed
// pl_sendToRTG - *in* *boolean* - if true: request is sent to runtime GUI, otherwise not
//
// Return Value:
// Returns the result of f_EPTF_UIHandler_removeWidgetRecByIdx.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_removeElementFromGui(in EPTF_UIHandler_WidgetIdString pl_widgetId, in boolean pl_sendToRTG := true, in boolean pl_appendTo_GUI_DescriptionDB := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
var boolean vl_ret := true;
if(pl_appendTo_GUI_DescriptionDB) {
v_UIHandler_GUI_DescriptionDB[sizeof(v_UIHandler_GUI_DescriptionDB)] := {pl_widgetId, "removed"};
}
f_EPTF_UIHandler_waitForLayoutReady();
var integer vl_idx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetId);
if(-1 == vl_idx){
f_EPTF_UIHandler_warning("There is no widget with name "&pl_widgetId&" to remove!");
return false;
}
//remove the element from the GUI
if (pl_sendToRTG) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRemoveElementFromGUI(pl_widgetId));
}
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
f_EPTF_UIHandler_Browser_reportGUIChanged(pl_widgetId);
}
//remove it and its children from the widgetlist and the connectionlist
vl_ret := f_EPTF_UIHandler_removeWidgetRecByIdx(vl_idx)
if(vl_ret == true) {
// Remove it from document
vl_ret := f_EPTF_UIHandler_removeXML(pl_widgetId);
}
return vl_ret;
}
public function f_EPTF_UIHandler_printAllXMLfor_Tests( )
runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized){ return }
f_EPTF_UIHandler_printAllXML();
return;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeElementFromGuiByIdx
//
// Purpose:
// Remove an element from the GUI.
//
// Parameters:
// pl_widgetIdx - *in* *integer* - element to be removed
// pl_sendToRTG - *in* *boolean* - if true: request is sent to runtime GUI, otherwise not
//
// Return Value:
// Returns the result of f_EPTF_UIHandler_removeWidgetRecByIdx.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_removeElementFromGuiByIdx(in integer pl_widgetIdx, in boolean pl_sendToRTG := true, in boolean pl_appendTo_GUI_DescriptionDB := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
var charstring vl_widgetId := v_UIHandler_guiItemList[pl_widgetIdx].id;
if(pl_appendTo_GUI_DescriptionDB) {
v_UIHandler_GUI_DescriptionDB[sizeof(v_UIHandler_GUI_DescriptionDB)] := {vl_widgetId, "removed"};
}
f_EPTF_UIHandler_waitForLayoutReady();
if(-1 == pl_widgetIdx){
f_EPTF_UIHandler_warning("There is no widget with name "&vl_widgetId&" to remove!");
return false;
}
//remove the element from the GUI
if (pl_sendToRTG) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRemoveElementFromGUI(vl_widgetId));
}
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
f_EPTF_UIHandler_Browser_reportGUIChanged(vl_widgetId, pl_widgetIdx);
}
//remove it and its children from the widgetlist and the connectionlist
return f_EPTF_UIHandler_removeWidgetRecByIdx(pl_widgetIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_snapshot
//
// Purpose:
// Makes a snapshot of the GUI as a charstring.
//
// Return Value:
// The returned charstring describes a XUL. It can be saved with
// <f_EPTF_UIHandler_saveLayout> to a config file.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_snapshot()
runs on EPTF_UIHandler_Private_CT
return charstring{
if (not v_UIHandler_initialized){ return "" }
f_EPTF_UIHandler_waitForLayoutReady();
var charstring vl_layout := "";
if(v_UIHandler_guiConnected)
{
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_layoutRequest);
if(f_EPTF_Semaphore_waitForUnlock(v_UIHandler_layoutResponseReceivedSemaphore, tsp_EPTF_UIHandler_maxWaitTimer))
{
f_EPTF_UIHandler_warning("Timer timeout! No layout response received!");
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
return vl_layout;
}
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
//f_EPTF_Semaphore_lock(v_UIHandler_layoutResponseReceivedSemaphore);
vl_layout := f_EPTF_UIHandler_XSD_encodeXUL(v_UIHandler_receivedMessage.choice.xTDP_LayoutResponse.widgets);
}else{
var Widgets vl_xul;
f_EPTF_UIHandler_buildXUL(vl_xul);
vl_layout := f_EPTF_UIHandler_XSD_encodeXUL(vl_xul)
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
return vl_layout;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_snapshotWindow
//
// Purpose:
// Makes a snapshot of the GUI's root widget (windowelem) as a charstring.
//
// Return Value:
// The returned charstring describes a XUL that can be passed to
// the runtime GUI as a command line parameter if saved as a file.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_snapshotWindow()
runs on EPTF_UIHandler_Private_CT
return charstring{
if (not v_UIHandler_initialized){ return "" }
f_EPTF_UIHandler_waitForLayoutReady();
var charstring vl_layout := "";
if(v_UIHandler_guiConnected)
{
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_layoutRequest);
if(f_EPTF_Semaphore_waitForUnlock(v_UIHandler_layoutResponseReceivedSemaphore, tsp_EPTF_UIHandler_maxWaitTimer))
{
f_EPTF_UIHandler_warning("Timer timeout! No layout response received!");
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
return vl_layout;
}
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
//f_EPTF_Semaphore_lock(v_UIHandler_layoutResponseReceivedSemaphore);
if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_LayoutResponse.widgets.window)) {
vl_layout := f_EPTF_UIHandler_XSD_encodeWindowXUL(v_UIHandler_receivedMessage.choice.xTDP_LayoutResponse.widgets.window);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Unexpected XTDP LayoutResponse (not window)!");
}
}else{
var Widgets vl_xul;
f_EPTF_UIHandler_buildXUL(vl_xul);
if(ischosen(vl_xul.window)) {
vl_layout := f_EPTF_UIHandler_XSD_encodeWindowXUL(vl_xul.window);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Unexpected layout (not window)!");
}
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
return vl_layout;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_encodeXUL
//
// Purpose:
// Encodes a XUL record to its charstring representation
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XSD_encodeXUL(in Widgets pl_widgets)
return charstring{
var octetstring vl_ret := enc_Widgets(pl_widgets);
return oct2char(vl_ret)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_encodeWindowXUL
//
// Purpose:
// Encodes a XUL Window record to its charstring representation
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XSD_encodeWindowXUL(in Window pl_windowelem)
return charstring{
var octetstring vl_ret := enc_Window(pl_windowelem);
return oct2char(vl_ret)
}
public external function dec_Widgets (in octetstring p_oct, out Widgets p_widgets) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
public external function enc_Widgets (in Widgets p_widgets) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
public external function enc_Window (in Window p_windowelem) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_encodeXULEm
//
// Purpose:
// Encodes an Embedded XUL record to its charstring representation
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XSD_encodeXULEm(in Embeddedwidget pl_widgets)
return charstring{
var octetstring vl_ret := enc_EmbeddedWidget(pl_widgets);
return oct2char(vl_ret)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_preprocessAliasXUL
//
// Purpose:
// Preprocess alias items in XUL charstring
//
///////////////////////////////////////////////////////////
// 02.04.2012 made for first version of externalvalue
// handling. not dropped becouse it will be useful once.
type record EPTF_UIHandler_alias {
charstring fromStr,
charstring toStr
};
type record of EPTF_UIHandler_alias EPTF_UIHandler_aliasList;
public function f_EPTF_UIHandler_preprocessAliasXUL(in charstring pl_xul)
runs on EPTF_UIHandler_Private_CT return charstring {
var EPTF_UIHandler_aliasList vl_aliasList:= {/*{ fromStr := "externalvalue", toStr := "iterator" }*/};
var charstring vl_preprocessed := pl_xul;
if(0 < sizeof(vl_aliasList)) {
for (var integer vl_idx := 0; vl_idx < sizeof(vl_aliasList); vl_idx := vl_idx + 1) {
var charstring vl_startFromValue := "<"&vl_aliasList[vl_idx].fromStr;
var charstring vl_startToValue := "<"&vl_aliasList[vl_idx].toStr;
var charstring vl_endFromValue := "</"&vl_aliasList[vl_idx].fromStr;
var charstring vl_endToValue := "</"&vl_aliasList[vl_idx].toStr;
// replace start tag
vl_preprocessed := pl_xul;
var charstring vl_tempStr:= pl_xul;
var charstring vl_LoverStr := f_putInLowercase(pl_xul), vl_tempLowerStr:= vl_LoverStr;
var integer vl_i := f_strstr(vl_LoverStr,vl_startFromValue);
while (vl_i!=-1) {
vl_preprocessed :=
substr(vl_tempStr,0,vl_i)&vl_startToValue&
substr(vl_tempStr,vl_i+lengthof(vl_startFromValue),
lengthof(vl_tempStr)-vl_i-lengthof(vl_startFromValue));
vl_LoverStr := substr(vl_tempLowerStr,0,vl_i)&vl_startToValue&
substr(vl_tempLowerStr,vl_i+lengthof(vl_startFromValue),
lengthof(vl_tempLowerStr)-vl_i-lengthof(vl_startFromValue));
//continue from saved pointer offset with the length of replacement string
vl_i := vl_i+lengthof(vl_startToValue);
vl_tempStr := vl_preprocessed;
vl_tempLowerStr := vl_LoverStr;
vl_i := f_strstr(vl_LoverStr,vl_startFromValue,vl_i);
}
// replace end tag
vl_tempStr:= vl_preprocessed;
vl_tempLowerStr:= vl_LoverStr;
vl_i := f_strstr(vl_LoverStr,vl_endFromValue);
while (vl_i!=-1) {
vl_preprocessed :=
substr(vl_tempStr,0,vl_i)&vl_endToValue&
substr(vl_tempStr,vl_i+lengthof(vl_endFromValue),
lengthof(vl_tempStr)-vl_i-lengthof(vl_endFromValue));
vl_LoverStr := substr(vl_tempLowerStr,0,vl_i)&vl_endToValue&
substr(vl_tempLowerStr,vl_i+lengthof(vl_endFromValue),
lengthof(vl_tempLowerStr)-vl_i-lengthof(vl_endFromValue));
//continue from saved pointer offset with the length of replacement string
vl_i := vl_i+lengthof(vl_endToValue);
vl_tempStr := vl_preprocessed;
vl_tempLowerStr := vl_LoverStr;
vl_i := f_strstr(vl_LoverStr,vl_endFromValue,vl_i);
}
}
}
return vl_preprocessed;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_decodeXULEm
//
// Purpose:
// Decodes a XUL record to its charstring representation
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XSD_decodeXULEm(in charstring pl_widgets)
return Embeddedwidget{
var Embeddedwidget vl_ret;
var integer vl_dummy;
vl_dummy := dec_EmbeddedWidget(char2oct(pl_widgets), vl_ret);
return vl_ret;
}
private external function dec_EmbeddedWidget (in octetstring p_oct, out Embeddedwidget p_widgets) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_EmbeddedWidget (in Embeddedwidget p_widgets) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_decodeXUL
//
// Purpose:
// Decodes a XUL record to its charstring representation
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XSD_decodeXUL(in charstring pl_widgets)
runs on EPTF_UIHandler_Private_CT
return Widgets{
var Widgets vl_ret;
var integer vl_retval;
vl_retval := dec_Widgets(char2oct(pl_widgets), vl_ret);
if(0 != vl_retval){
f_EPTF_UIHandler_error(%definitionId&": The received XML is invalid, it can not be decoded fully.\n"&
"For further detailes see the log file above.")
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_saveLayout
//
// Purpose:
// Saves the parameter charstring as a window layout.
//
// Detailed Comments:
// The layout of the window can be retreived with the function
// <f_EPTF_UIHandler_snapshot>.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_saveLayout(in charstring pl_layout)
runs on EPTF_UIHandler_Private_CT{
f_EPTF_UIHandler_waitForLayoutReady();
var charstring vl_currentConfig := "\n// saved by EPTF GUI\n\n[MODULE_PARAMETERS]\n\ntsp_EPTF_GUI_DefaultWindow := """ & f_EPTF_UIHandler_convertLayout(pl_layout) & """";
var charstring vl_FileName := f_getTimeFormatted(f_time(),tsp_EPTF_savedGUIPrefix & "_%d%m%Y_%H_%M.cfg");
var integer vl_file := f_FIO_open_trunc_wronly(vl_FileName);
if(-1 != vl_file){
if(-1 == f_FIO_write_text(vl_file, vl_currentConfig)){
f_EPTF_UIHandler_warning("Couldn't write file "&vl_FileName&".");
var integer int := f_FIO_close(vl_file);
if (int == -1){
f_EPTF_UIHandler_warning("Could not close the file!");
}
// f_EPTF_Base_stop();
}else{
var integer int := f_FIO_close(vl_file);
if (int == -1){
f_EPTF_UIHandler_warning("Could not close the file!");
}
}
}else{
f_EPTF_UIHandler_warning("Couldn't open file "&vl_FileName&" for writing.");
// f_EPTF_Base_stop();
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_logAll
//
// Purpose:
// Logs all internal variables in EPTF_UIHandler_CT.
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_logAll() runs on EPTF_UIHandler_Private_CT {
log("------Content of EPTF_UIHandler_CT: -------");
//log("v_UIHandler_CLI_initialized: ", v_UIHandler_CLI_initialized);
log("v_UIHandler_initialized: ", v_UIHandler_initialized);
log("v_UIHandler_lastRequest: ", v_UIHandler_lastRequest);
log("v_UIHandler_guiConnected: ",v_UIHandler_guiConnected);
log("v_UIHandler_windowLayout: ", v_UIHandler_windowLayout);
log("v_UIHandler_guiLayoutReady: ", v_UIHandler_guiLayoutReady);
log("v_UIHandler_guiItemList: ",v_UIHandler_guiItemList);
log("t_UIHandler_pingtimer: ",t_UIHandler_pingtimer);
log("v_UIHandler_succpingcounter: ",v_UIHandler_succpingcounter);
log("v_UIHandler_pingcounter", v_UIHandler_pingcounter);
log("v_UIHandler_prevpingcounter: ", v_UIHandler_prevpingcounter);
log("v_UIHandler_def: ",v_UIHandler_def);
log("v_UIHandler_openSubscriptions: ",v_UIHandler_openSubscriptions);
log("v_UIHandler_subscriptions: ", v_UIHandler_subscriptions);
log("v_UIHandler_windowIndex: ",v_UIHandler_windowIndex);
log("v_UIHandler_GUIClientId: ",v_UIHandler_GUIClientId);
log("v_UIHandler_lastRowId: ",v_UIHandler_lastRowId);
log("v_UIHandler_subscriptInProcess: ", v_UIHandler_subscriptInProcess);
log("t_UIHandler_bufferedXTDP: ",t_UIHandler_bufferedXTDP );
log("t_UIHandler_initGUIToClientTimer: ",t_UIHandler_initGUIToClientTimer );
log("------Finished Content of EPTF_UIHandler_CT -------");
}//f_
public function f_EPTF_UIHandler_logWidgetDB(in boolean pl_verbose := false)
runs on EPTF_UIHandler_Private_CT
return charstring{
if (not v_UIHandler_initialized){ return "" }
var charstring vl_log := ""
for ( var integer i := 0, s := sizeof(v_UIHandler_guiItemList); i < s ; i := i+1 ){
f_EPTF_UIHandler_log2strWidgetRec(i,vl_log, pl_verbose)
vl_log := vl_log & "\n";
}
return vl_log;
}
public function f_EPTF_UIHandler_log2strWidgetRec(
in integer pl_recIdx,
inout charstring pl_ret,
in boolean pl_verbose := false)
runs on EPTF_UIHandler_Private_CT{
if (not v_UIHandler_initialized){ return }
pl_ret := pl_ret&"Idx:\t"&log2str(pl_recIdx)&
"\nID:\t"&v_UIHandler_guiItemList[pl_recIdx].id&
"\nType:\t"&log2str(v_UIHandler_guiItemList[pl_recIdx].widgetType)
if(pl_verbose){
pl_ret := pl_ret & "\nData type\t"&log2str(v_UIHandler_guiItemList[pl_recIdx].widgetDataType)
}
pl_ret := pl_ret & "\nParent:\t"&log2str(v_UIHandler_guiItemList[pl_recIdx].parentIdx)&
"\nChildren:\t";
for ( var integer j:=0, sc := sizeof(v_UIHandler_guiItemList[pl_recIdx].children); j < sc ; j := j+1 ){
pl_ret := pl_ret & int2str(v_UIHandler_guiItemList[pl_recIdx].children[j])&", ";
}
if(pl_verbose){
pl_ret := pl_ret & log2str(v_UIHandler_guiItemList[pl_recIdx].widgetData);
}
//Widgets XULformat optional
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_GUIConnected
//
// Purpose:
// Returns whether the GUI is connected (authenticated)
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_GUIConnected() runs on EPTF_UIHandler_Private_CT return boolean {
return v_UIHandler_guiConnected
}
public function f_EPTF_UIHandler_initialized() runs on EPTF_UIHandler_Private_CT return boolean {
return v_UIHandler_initialized;
}//f_
friend function f_EPTF_UIHandler_guiItemList() runs on EPTF_UIHandler_Private_CT return EPTF_UIHandler_GuiItemRecList {
return v_UIHandler_guiItemList;
}
friend function f_EPTF_UIHandler_openSubscriptions() runs on EPTF_UIHandler_Private_CT return EPTF_UIHandler_OpenSubscriptions {
return v_UIHandler_openSubscriptions;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_exitButtonPressed
//
// Purpose:
// Handles the pressing of the exit button. Only for TESTING purposes!
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_exitButtonPressed(in float pl_timeout := tsp_EPTF_UIHandler_maxWaitTimer) runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized){ return }
{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Waiting for the exit button to be pressed.");
}
if(f_EPTF_Semaphore_waitForUnlock(v_UIHandler_exitButtonPressedSemaphore, pl_timeout))
{
f_EPTF_UIHandler_warning(%definitionId&": Timer timeout! Exit button was not pressed!");
}
v_UIHandler_exitButtonPressedSemaphore := f_EPTF_Semaphore_new();
//f_EPTF_Semaphore_lock(v_UIHandler_exitButtonPressedSemaphore);
};
}
} // group PublicFunctions
//=========================================================================
// Private functions
//=========================================================================
group PrivateFunctions {
private function f_EPTF_UIHandler_requestBuffer_clear()
runs on EPTF_UIHandler_Private_CT
{
v_UIHandler_RequestbufferIsEmpty := true;
v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list := { c_UIHandler_XSD_emptyXTDPRequest };
}
private function f_EPTF_UIHandler_requestBuffer_size()
runs on EPTF_UIHandler_Private_CT
return integer
{
if (v_UIHandler_RequestbufferIsEmpty) {
return 0;
} else {
return sizeof(v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list);
}
}
private function f_EPTF_UIHandler_requestBuffer_add(in ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Request pl_request)
runs on EPTF_UIHandler_Private_CT
{
var integer i := 0;
if (not v_UIHandler_RequestbufferIsEmpty) {
i := sizeof(v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list);
}
v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list[i] := pl_request;
v_UIHandler_RequestbufferIsEmpty := false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_convertLayout
//
// Purpose:
// Converts the charstring retreived by the <f_EPTF_UIHandler_snapshot>
// function to a storeable format. (Changes the ", \n and \ characters.)
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_convertLayout(in charstring pl_layout)
runs on EPTF_UIHandler_Private_CT
return charstring{
var charstring vl_ret := "";
var integer vl_len := lengthof(pl_layout);
for(var integer vl_i := 0; vl_i < vl_len; vl_i := vl_i + 1){
select(substr(pl_layout,vl_i,1)){
case(""""){ vl_ret := vl_ret & "\\""";}
case("\n"){ vl_ret := vl_ret & "\\n";}
case("\\"){ vl_ret := vl_ret & "\\\\";}
case else {vl_ret := vl_ret & pl_layout[vl_i];}
}
}
return vl_ret;
}
// ///////////////////////////////////////////////////////////
// // Function: f_EPTF_UIHandler_saveXul
// //
// // Purpose:
// // Saves the parameter charstring as a window layout.
// //
// // Detailed Comments:
// // The layout of the window can be retreived with the function
// // <f_EPTF_UIHandler_snapshot>.
// ///////////////////////////////////////////////////////////
// private function f_EPTF_UIHandler_saveXul(in Widgets pl_xul)
// runs on EPTF_UIHandler_Private_CT{
// var charstring vl_layout := f_EPTF_UIHandler_XSD_encodeXUL(pl_xul);
//// var charstring vl_currentConfig := f_EPTF_UIHandler_convertLayout(vl_layout);
// var charstring vl_FileName := f_getTimeFormatted(f_time(),tsp_EPTF_savedGUIPrefix & "_%d%m%Y_%H_%M.xml");
// var integer vl_file := f_FIO_open_trunc_wronly(vl_FileName);
// if(-1 != vl_file){
//// if(-1 == f_FIO_write_text(vl_file, vl_currentConfig)){
// if(-1 == f_FIO_write_text(vl_file, vl_layout)){
// f_EPTF_UIHandler_warning("Couldn't write file "&vl_FileName&".");
// var integer vl_dummy := f_FIO_close(vl_file);
// if (vl_dummy == -1){
// f_EPTF_UIHandler_warning("Could not close the file!");
// }
// // f_EPTF_Base_stop();
// }else{
// var integer vl_dummy := f_FIO_close(vl_file);
// if (vl_dummy == -1){
// f_EPTF_UIHandler_warning("Could not close the file!");
// }
// }
// }else{
// f_EPTF_UIHandler_warning("Couldn't open file "&vl_FileName&" for writing.");
// // f_EPTF_Base_stop();
// }
// }
//
// ///////////////////////////////////////////////////////////
// // Function: f_EPTF_UIHandler_saveWidgets
// //
// // Purpose:
// // Saves content of the GUI database.
// //
// // Detailed Comments:
// // -
// ///////////////////////////////////////////////////////////
// private function f_EPTF_UIHandler_saveWidgets()
// runs on EPTF_UIHandler_Private_CT{
//
// var charstring vl_widget_info := "";
// var integer limit := sizeof(v_UIHandler_guiItemList);
// for (var integer i := 0; i < limit ; i := i+1 )
// {
// vl_widget_info := vl_widget_info&"\n"&int2str(i)&" widget= "&log2str(v_UIHandler_guiItemList[i]);
// }
//
// var charstring vl_FileName := f_getTimeFormatted(f_time(),"widgetList" & "_%d%m%Y_%H_%M.xml");
// var integer vl_file := f_FIO_open_trunc_wronly(vl_FileName);
// if(-1 != vl_file){
//// if(-1 == f_FIO_write_text(vl_file, vl_currentConfig)){
// if(-1 == f_FIO_write_text(vl_file, vl_widget_info)){
// f_EPTF_UIHandler_warning("Couldn't write file "&vl_FileName&".");
// var integer vl_dummy := f_FIO_close(vl_file);
// if (vl_dummy == -1){
// f_EPTF_UIHandler_warning("Could not close the file!");
// }
// // f_EPTF_Base_stop();
// }else{
// var integer vl_dummy := f_FIO_close(vl_file);
// if (vl_dummy == -1){
// f_EPTF_UIHandler_warning("Could not close the file!");
// }
// }
// }else{
// f_EPTF_UIHandler_warning("Couldn't open file "&vl_FileName&" for writing.");
// // f_EPTF_Base_stop();
// }
// }
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_revertLayout
//
// Purpose:
// Restores the charstring converted by the <f_EPTF_UIHandler_convertLayout>
// to a charstring that can be given to
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_revertLayout(in charstring pl_layout)
runs on EPTF_UIHandler_Private_CT
return charstring{
var charstring vl_ret := "";
var integer vl_len := lengthof(pl_layout);
for(var integer vl_i := 0; vl_i < vl_len; vl_i := vl_i + 1){
if("\\" == substr(pl_layout,vl_i,1) and vl_i < vl_len-1){
select(substr(pl_layout,vl_i+1,1)){
case(""""){
vl_ret := vl_ret & """";
vl_i := vl_i + 1;
}
case("n"){
vl_ret := vl_ret & "\n";
vl_i := vl_i + 1;
}
case("\\"){
vl_ret := vl_ret & "\\";
vl_i := vl_i + 1;
}
case else {
f_EPTF_UIHandler_warning("Invalid \\ character in layout string at "&int2str(vl_i));
}
}
}else{
vl_ret := vl_ret & pl_layout[vl_i];
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_send_XTDP
//
// Purpose:
// function to send a message to user interface via XTDP port
//
// Parameters:
// pl_msg - *in* *template ASP_XTDP* - XTDP message template ONLY one message!
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_send_XTDP(in template ASP_XSD_XTDP pl_msg) runs on EPTF_UIHandler_Private_CT
{
if (v_UIHandler_guiConnected)
{
v_UIHandler_lastRequest := v_UIHandler_lastRequest + 1;
pl_msg.data.transactionID := v_UIHandler_lastRequest;
if(ischosen(pl_msg.data.choice.xTDP_Requests))
{
pl_msg.data.choice.xTDP_Requests.xTDP_Request_list[0].requestId := v_UIHandler_lastRequest;
if (tsp_EPTF_UIHandler_bufferedXTDP != 0.0)
{
v_UIHandler_Requestbuffer.client_id := omit;
for (var integer i := 0; i < sizeof(pl_msg.data.choice.xTDP_Requests.xTDP_Request_list); i := i + 1)
{
// v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list[sizeof(v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list)] :=
// valueof(pl_msg.data.choice.xTDP_Requests.xTDP_Request_list[i]);
f_EPTF_UIHandler_requestBuffer_add(valueof(pl_msg.data.choice.xTDP_Requests.xTDP_Request_list[i]));
}
}
}
else if (ischosen(pl_msg.data.choice.xTDP_Responses))
{
pl_msg.data.choice.xTDP_Responses.xTDP_Response_list[0].requestId := v_UIHandler_lastRequest;
}
else if (ischosen(pl_msg.data.choice.xTDP_AddRequests))
{
pl_msg.data.choice.xTDP_AddRequests.xTDP_AddRequest_list[0].requestId := v_UIHandler_lastRequest;
}
else if (ischosen(pl_msg.data.choice.xTDP_RemoveRequests))
{
pl_msg.data.choice.xTDP_RemoveRequests.xTDP_RemoveRequest_list[0].requestId := v_UIHandler_lastRequest;
}
else if (ischosen(pl_msg.data.choice.xTDP_LayoutRequest))
{
//pl_msg.data.choice.xTDP_LayoutRequest.requestId := v_UIHandler_lastRequest;
}
else if (ischosen(pl_msg.data.choice.xTDP_LayoutResponse))
{
//pl_msg.data.choice.xTDP_LayoutResponse.requestId := v_UIHandler_lastRequest;
}
else if (ischosen(pl_msg.data.choice.xTDP_AuthChallenge) or ischosen(pl_msg.data.choice.xTDP_AuthResponse))
{
}
else
{
f_EPTF_UIHandler_warning("Unknown XTDP message to send!");
return;
}
if(tsp_EPTF_UIHandler_bufferedXTDP == 0.0 or ( tsp_EPTF_UIHandler_bufferedXTDP != 0.0 and not ischosen(pl_msg.data.choice.xTDP_Requests)))
{
for(var integer i := 0; i < sizeof(v_UIHandler_GUIClientId); i := i + 1)
{
var Result vl_result
f_EPTF_Transport_send(
IPL4, v_UIHandler_GUIClientId[i].clientId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(valueof(pl_msg.data))), vl_result, false)
}
}
}
}
///////////////////////////////////////////////////////////
// Templates: t_UIHandler_Authmsg
//
// Purpose:
// Send template for authenticating the GUI
//
// Parameters:
// pl_client -- the GUI client
//
///////////////////////////////////////////////////////////
/*private template ASP_XTDP t_UIHandler_Authmsg(in integer pl_clientid) := {
pl_clientid,
{omit,
{xtdp_AuthChallenge := tsp_EPTF_UIHandler_Authmsg}
}
}
///////////////////////////////////////////////////////////
// Templates: t_UIHandler_Authresp
//
// Purpose:
// Receinving template for authenticating the GUI
//
///////////////////////////////////////////////////////////
private template ASP_XTDP t_UIHandler_Authresp := {
*,
{omit,
{xtdp_AuthResponse := ?}
}
}
*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_authclient
//
// Purpose:
// Authenticates the client.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_authclient(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT return boolean{
if (tsp_EPTF_UIHandler_Authmsg=="" or v_EPTF_UIHandler_Authresp == "") {
// no authentication needed
f_EPTF_UIHandler_setClientAuthenticationSuccessful(pl_clientid);
return true;
}
v_UIHandler_lastRequest := v_UIHandler_lastRequest +1;
var integer vl_UIHandler_authResponseReceivedSemaphore := f_EPTF_Semaphore_new();
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend :=
{
vl_UIHandler_authResponseReceivedSemaphore+1000*v_UIHandler_lastRequest,
{xTDP_AuthChallenge := tsp_EPTF_UIHandler_Authmsg}
}
var Result vl_result
f_EPTF_Transport_send(IPL4, pl_clientid, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
if(f_EPTF_Semaphore_waitForUnlock(vl_UIHandler_authResponseReceivedSemaphore, v_authMaxTime))
{
f_EPTF_UIHandler_warning(%definitionId&": Timer timeout! No auth response received!");
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
return false;
}
//f_EPTF_Semaphore_lock(v_UIHandler_authResponseReceivedSemaphore);
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
if(v_UIHandler_receivedMessage.choice.xTDP_AuthResponse == v_EPTF_UIHandler_Authresp)
{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Authentication successful for client: "&log2str(pl_clientid));
}
f_EPTF_UIHandler_setClientAuthenticationSuccessful(pl_clientid);
return true;
}
else
{
f_EPTF_UIHandler_warning("Authentication failed for client: "&log2str(pl_clientid));
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_headlessmode
//
// Purpose:
// Sets the enviroment for the headless mode
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_headlessmode() runs on EPTF_UIHandler_Private_CT{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("******** HeadlessMode*******");
}
if (not v_EPTF_UIHandler_servermode){
v_UIHandler_pingcounter := 0;
v_UIHandler_prevpingcounter := 0;
v_UIHandler_succpingcounter := 0;
if(not t_UIHandler_pingtimer.running) {
t_UIHandler_pingtimer.start;
}
} else {
f_EPTF_UIHandler_startserverxtdp();
}
v_UIHandler_guiConnected := false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_headlessmodeover
//
// Purpose:
// Restores the enviroment returning back from headless mode
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_headlessmodeover() runs on EPTF_UIHandler_Private_CT{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("*********HeadlessModeOVER********")
}
if (not v_EPTF_UIHandler_servermode){
if (t_UIHandler_pingtimer.running) {
t_UIHandler_pingtimer.stop;
}
v_UIHandler_pingcounter := 0;
v_UIHandler_prevpingcounter := 0;
v_UIHandler_succpingcounter := 0;
var ConnectionId vl_connId;
f_EPTF_UIHandler_connectAndInitGui(vl_connId);
//In case of v_EPTF_UIHandler_servermode, the f_EPTF_UIHandler_connectAndInitGui
//simply returns true
//} else {
// if (not f_EPTF_UIHandler_connectAndInitGui()){
// f_EPTF_UIHandler_error("Failed to initialize the GUI!");
// }
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_sendSubscAck
//
// Purpose:
// Sends acknowladgement message about a succesfully completed subscription note
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_sendSubscAck(
in integer pl_requestId,
in integer pl_varIdx,
in EPTF_Var_CT pl_sender,
in boolean pl_ack := true)
runs on EPTF_UIHandler_Private_CT {
v_UIHandler_subscriptInProcess := false;
var EPTF_UIHandler_WidgetMsg vl_EPTF_CLL_UISubscMgmtMsg := {
subscribeAck := {
requestId := pl_requestId,
varIdx := pl_varIdx}};
EPTF_adminPort_CP.send(vl_EPTF_CLL_UISubscMgmtMsg) to pl_sender
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_sendSubscNAck
//
// Purpose:
// Sends an refusion message about a subscription note
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_sendSubscNAck(
in integer pl_requestId,
in EPTF_Var_CT pl_sender)
runs on EPTF_UIHandler_Private_CT {
v_UIHandler_subscriptInProcess := false;
var EPTF_UIHandler_WidgetMsg vl_EPTF_CLL_UISubscMgmtMsg := {
subscribeNAck := {
requestId := pl_requestId,
varIdx := -1
}
};
EPTF_adminPort_CP.send(vl_EPTF_CLL_UISubscMgmtMsg) to pl_sender;
}
///////////////////////////////////////////////////////////
// Group: EPTF_SubscriptionAdministrationFunctions
///////////////////////////////////////////////////////////
group EPTF_SubscriptionAdministrationFunctions{
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_newSubscription
//
// Purpose:
// Appends an EPTF_UIHandler_OpenSubscription record to the <EPTF_UIHandler_OpenSubscriptions> list.
//
// Parameters:
// pl_subscription - *in* *EPTF_UIHandler_OpenSubscription* - The record to append.
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_newSubscription(in EPTF_UIHandler_OpenSubscription pl_subscription)
runs on EPTF_UIHandler_Private_CT
{
var integer vl_newIdx := sizeof(v_UIHandler_openSubscriptions);
v_UIHandler_openSubscriptions[vl_newIdx] := pl_subscription;
f_EPTF_UIHandler_addSubscription(pl_subscription.varIdx, vl_newIdx);
if (pl_subscription.providedParamName != "") {
f_EPTF_str2int_HashMap_Insert(v_UIHandler_subscriptionHashMapIdVar, pl_subscription.providedParamName, pl_subscription.varIdx);
}
if (pl_subscription.widgetId != "") {
f_EPTF_str2int_HashMap_Insert(v_UIHandler_subscriptionHashMapId, pl_subscription.widgetId, vl_newIdx);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getSubscriptionsByVarIdx
//
// Purpose:
// Retrieves a list of open subscriptions that are affected by the specified variable.
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getSubscriptionsByVarIdx(in integer pl_varIdx, out EPTF_UIHandler_OpenSubscriptions pl_ret)
runs on EPTF_UIHandler_Private_CT
return boolean{
var EPTF_IntegerList vl_subs := f_EPTF_UIHandler_getSubscriptions(pl_varIdx);
pl_ret := {};
for(var integer vl_i := 0; vl_i < sizeof(vl_subs); vl_i := vl_i+1){
pl_ret[sizeof(pl_ret)] := v_UIHandler_openSubscriptions[vl_subs[vl_i]];
}
return sizeof(pl_ret) > 0;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getSubscriptionIdxByWidgetId
//
// Return Value:
// The index of the open subscription that contains the specified widgetId or -1.
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(in EPTF_UIHandler_WidgetIdString pl_widgetId)
runs on EPTF_UIHandler_Private_CT
return integer{
if("" == pl_widgetId){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": No subscription belongs to empty ID!");
}
return -1;
}
// find id in subscription hashmap
var integer vl_idx;
if (f_EPTF_str2int_HashMap_Find(v_UIHandler_subscriptionHashMapId, pl_widgetId, vl_idx)) {
return vl_idx;
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getVarIdxByProvidedVarName
//
// Return Value:
// The index of the open subscription that contains the
// specified client variable name.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getVarIdxByProvidedVarName(in charstring pl_varName)
runs on EPTF_UIHandler_Private_CT
return integer{
if("" == pl_varName){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": No subscription belongs to empty variable name!");
}
return -1;
}
// find id in subscription hashmap
var integer vl_idx;
if (f_EPTF_str2int_HashMap_Find(v_UIHandler_subscriptionHashMapIdVar, pl_varName, vl_idx)) {
return vl_idx;
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addSubscription
//
// Purpose:
// Adds a subscription item to a variable
//
// Parameters:
// pl_idx - *in* *integer* - the idx of the EPTF_Var
// pl_subsIdx - *in* *integer* - subscription identifier index
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_addSubscription(in integer pl_idx, in integer pl_subsIdx)
runs on EPTF_UIHandler_Private_CT
{
if(sizeof(v_UIHandler_subscriptions) <= pl_idx or not isbound(v_UIHandler_subscriptions[pl_idx])) {
v_UIHandler_subscriptions[pl_idx] := {};
}
v_UIHandler_subscriptions[pl_idx][sizeof(v_UIHandler_subscriptions[pl_idx])] := pl_subsIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeSubscription
//
// Purpose:
// Removes a subscription item from a variable
//
// Parameters:
// pl_idx - *in* *integer* - the idx of the EPTF_Var
// pl_subsIdx - *in* *integer* - subscription identifier index
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_removeSubscription(in integer pl_idx, in integer pl_subsIdx)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Base_assert(%definitionId&": not a local subscription.",
sizeof(v_UIHandler_subscriptions) > pl_idx and isbound(v_UIHandler_subscriptions[pl_idx]));
var integer vl_subIdx := -1;
for (var integer i := 0; i < sizeof(v_UIHandler_subscriptions[pl_idx]); i := i + 1)
{
if (v_UIHandler_subscriptions[pl_idx][i] == pl_subsIdx)
{
vl_subIdx := i;
break;
}
}
if (vl_subIdx != -1)
{
var EPTF_IntegerList vl_newSubs := {};
for (var integer i := 0; i < sizeof(v_UIHandler_subscriptions[pl_idx]); i := i + 1)
{
if (vl_subIdx != i) { vl_newSubs[sizeof(vl_newSubs)] := v_UIHandler_subscriptions[pl_idx][i]; }
}
v_UIHandler_subscriptions[pl_idx] := vl_newSubs;
return;
}
f_EPTF_UIHandler_warning(log2str("The variable: ", f_EPTF_Var_getName(pl_idx), " has no subscription: ", pl_subsIdx));
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getSubscriptions
//
// Purpose:
// Gets the subscription indices of a variable
//
// Parameters:
// pl_idx - *in* *integer* - the idx of the EPTF_Var
//
// Return Value:
// <EPTF_IntegerList> - the list of subscripton indices of the variable
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getSubscriptions(in integer pl_idx)
runs on EPTF_UIHandler_Private_CT return EPTF_IntegerList
{
if (sizeof(v_UIHandler_subscriptions) <= pl_idx or
not isbound(v_UIHandler_subscriptions[pl_idx])) {
return {};
}
return v_UIHandler_subscriptions[pl_idx];
}
} //EPTF_SubscriptionAdministrationFunctions group
///////////////////////////////////////////////////////////
// Group: EPTF_WidgetAdministrationFunctions
///////////////////////////////////////////////////////////
group EPTF_WidgetAdministrationFunctions{
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_widgetTypeFromId
//
// Purpose:
// Gets the type of a widget
// Detailed Comments:
// There are two main cases:
// the widget ID describes a cell of a tree in form "name of the tree".[row].[column], or
// the ID is the widget's own ID
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_widgetTypeFromId(
in EPTF_UIHandler_WidgetIdString pl_id,
inout EPTF_UIHandler_OpenSubscription pl_subs)
runs on EPTF_UIHandler_Private_CT
return boolean{
// cehck if id refers a table cell in format "treeId.[row].[col]"
var integer vl_row, vl_col;
var EPTF_UIHandler_WidgetIdString vl_treeId;
if (f_EPTF_UIHandler_isTreeCellIdFormat(pl_id, vl_treeId, vl_row, vl_col)) {
var EPTF_UIHandler_GuiItemRec widgetRec;
if(f_EPTF_UIHandler_getWidgetRec(vl_treeId, widgetRec)){
if(vl_col <= sizeof(widgetRec.widgetData.treeData.columns)){
pl_subs.widgetType := wtTreecell;
pl_subs.widgetDataType := v_UIHandler_guiItemList[widgetRec.widgetData.treeData.columns[vl_col]].widgetDataType;
return true;
}
}
}else{
var EPTF_UIHandler_GuiItemRec widgetRec;
if(f_EPTF_UIHandler_getWidgetRec(pl_id, widgetRec)){
pl_subs.widgetType := widgetRec.widgetType;
//The cell also contains widgetDataType
pl_subs.widgetDataType := widgetRec.widgetDataType;
return true;
}
}
return false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_checkSubscriptCompatibility
// Purpose:
// Checks whether the subscriptable variable and the widget
// are compatible
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_checkSubscriptCompatibility(
in EPTF_UIHandler_WidgetIdString pl_widgetid,
in integer pl_varIdx,
in EPTF_Var_DirectContent pl_currentContent := {unknownVal:={omit}})
runs on EPTF_UIHandler_Private_CT
return boolean{
var integer vl_index := f_EPTF_UIHandler_widgetRecIndex(pl_widgetid);
if (vl_index==-1) {
f_EPTF_UIHandler_error("The specified '"&pl_widgetid&"' widget can not be connected to variable["&f_EPTF_Var_getName(pl_varIdx)&"]: widget not found!");
return false;
}
var EPTF_Var_DirectContent vl_currentContent := pl_currentContent;
var boolean vl_retval;
var boolean vl_checkReverse := false;
if (ischosen(vl_currentContent.unknownVal)) {
f_EPTF_Var_getContent(pl_varIdx,vl_currentContent);
}
select(v_UIHandler_guiItemList[vl_index].widgetType){
case(wtWindow, // nothing to check NOW
wtTabbox,
wtTabs,
wtTab,
wtTabpanels,
wtTabpanel,
wtTabpages,
wtTabpage,
wtTree,
wtTreecols,
wtTreecol,
wtTreechildren,
wtTreeitem,
wtTreerow,
wtHbox,
wtLabel,
wtSpacer,
wtChart,
wtTraceList,
wtToolbar,
wtToolbarbuttons,
wtSeparator,
wtListbox,
wtListitem,
wtNumericalwidget,
wtMenulist,
wtMenuitem,
wtDistributionchart,
wtIntervallimits,
wtValuelist,
wtImage,
wtUnknown){
vl_retval := true;
}
case(wtTreecell){
vl_checkReverse := true;
select(v_UIHandler_guiItemList[vl_index].widgetDataType){
case(checkBox){vl_retval := ischosen(vl_currentContent.boolVal)}
case(toggleButton){vl_retval := ischosen(vl_currentContent.boolVal)}
case(floatField){vl_retval := ischosen(vl_currentContent.floatVal)}
case(pushButton, integerField){vl_retval := ischosen(vl_currentContent.intVal)}
case(string){ vl_retval := ischosen(vl_currentContent.charstringVal)
or ischosen(vl_currentContent.floatVal)
or ischosen(vl_currentContent.intVal)
/* string forever */
or ischosen(vl_currentContent.bitstringVal) or ischosen(vl_currentContent.hexstringVal) or ischosen(vl_currentContent.octetstringVal)
or ischosen(vl_currentContent.boolVal)
or ischosen(vl_currentContent.statusLEDVal)
or ischosen(vl_currentContent.integerlistVal) or ischosen(vl_currentContent.floatlistVal) or ischosen(vl_currentContent.charstringlistVal)
}
case(statusLED){vl_retval := ischosen(vl_currentContent.statusLEDVal)
/* its not equal, because type without are make errror on runtime gui if returned with text,
text but better if this equal this time just no returned text on request
and (ispresent(vl_currentContent.statusLEDVal.text)==false or vl_currentContent.statusLEDVal.text == "") */; }
case(statusLEDWithText){vl_retval := ischosen(vl_currentContent.statusLEDVal)}
case else { }
}
}
case (wtButton){
vl_retval := ischosen(vl_currentContent.intVal);
}
case (wtPushbutton){
vl_retval := ischosen(vl_currentContent.intVal);
}
case(wtTextbox){vl_retval := true; } // string forever
case(wtHtmlcode){vl_retval := true; } // string forever
case(wtTrace){
vl_retval := (ischosen(vl_currentContent.floatVal) or ischosen(vl_currentContent.intVal));
}
case (wtToolbarbutton, wtTogglebutton){
vl_retval := ischosen(vl_currentContent.boolVal);
}
case else {
vl_retval := true; // all other are true now
}
}
if(isbound(vl_retval)==false) {
f_EPTF_UIHandler_error("The specified '"&pl_widgetid&"' widget with data("&log2str(v_UIHandler_guiItemList[vl_index])&") not match to variable["&f_EPTF_Var_getName(pl_varIdx)&"]: type incompatibility!");
} else if(vl_retval == false) {
f_EPTF_UIHandler_error("The specified '"&pl_widgetid&"' widget with data("&log2str(v_UIHandler_guiItemList[vl_index])&") can not be connected to variable["&f_EPTF_Var_getName(pl_varIdx)&"]: type incompatibility!");
}
else {
if(vl_checkReverse == true and ispresent( v_UIHandler_guiItemList[vl_index].widgetDataType)) {
vl_retval := f_EPTF_UIHandler_checkVariableCompatibility(vl_currentContent, v_UIHandler_guiItemList[vl_index].widgetDataType);
}
if(vl_retval == false) {
f_EPTF_UIHandler_error("The specified variable["&f_EPTF_Var_getName(pl_varIdx)&"] can not be connected to specified '"&pl_widgetid&"' widget with data("&log2str(v_UIHandler_guiItemList[vl_index])&"): type incompatibility!");
}
}
return vl_retval;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_checkVariableCompatibility
// Purpose:
// Checks whether the the requeted variable and the widget
// type are compatible
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_checkVariableCompatibility(
in EPTF_Var_DirectContent pl_currentContent,
in Widgettype pl_currentwidgetDataType)
runs on EPTF_UIHandler_Private_CT
return boolean{
var boolean vl_retval := false;
if(ischosen(pl_currentContent.intVal)) {
vl_retval := (pl_currentwidgetDataType == integerField)
or (pl_currentwidgetDataType == pushButton)
or (pl_currentwidgetDataType == trace)
or (pl_currentwidgetDataType == string); // string forever
}
else
if(ischosen(pl_currentContent.floatVal)) {
vl_retval := (pl_currentwidgetDataType == floatField)
or (pl_currentwidgetDataType == string); // string forever
}
else
if(ischosen(pl_currentContent.charstringVal)) {
vl_retval := (pl_currentwidgetDataType == string)
or (pl_currentwidgetDataType == image);
}
else
if(ischosen(pl_currentContent.bitstringVal) or ischosen(pl_currentContent.hexstringVal) or ischosen(pl_currentContent.octetstringVal)) {
vl_retval := (pl_currentwidgetDataType == string);
}
else
if(ischosen(pl_currentContent.boolVal)) {
vl_retval := (pl_currentwidgetDataType == checkBox)
or (pl_currentwidgetDataType == toggleButton)
or (pl_currentwidgetDataType == string); // string forever
}
else
if(ischosen(pl_currentContent.statusLEDVal)) {
vl_retval := (pl_currentwidgetDataType == statusLED)
or (pl_currentwidgetDataType == statusLEDWithText)
or (pl_currentwidgetDataType == string); // string forever
}
else
if(ischosen(pl_currentContent.integerlistVal) or ischosen(pl_currentContent.floatlistVal) or ischosen(pl_currentContent.charstringlistVal)) {
vl_retval := (pl_currentwidgetDataType == valueList)
or (pl_currentwidgetDataType == string); // string forever
}
// If not matched
if(vl_retval == false) {
vl_retval := (pl_currentwidgetDataType == image)
or (pl_currentwidgetDataType == none_);
}
return vl_retval;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_handleSubscriptNote
// Purpose:
// Handles te subscription note message
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_handleSubscriptNote(
in EPTF_UIHandler_SubscribeNoteMsg pl_msg,
in EPTF_Var_CT pl_sender)
runs on EPTF_UIHandler_Private_CT {
v_UIHandler_subscriptInProcess := true;
var EPTF_UIHandler_OpenSubscription vl_subs := c_UIHandler_defOpenSubscription;
var integer vl_varIdx := -1;
if(ispresent(pl_msg.destParamName) and "" != pl_msg.destParamName){
//we must create a new variable and subscribe it to a provided param
//check if it already exists
if(not f_EPTF_Var_checkName(pl_msg.destParamName,vl_varIdx)) // i.e. vl_varIdx != -1
{
f_EPTF_UIHandler_warning("CLL_UIHandler: the destination variable already exists: " & pl_msg.destParamName);
f_EPTF_UIHandler_sendSubscNAck(pl_msg.messageId, pl_sender);
return;
}
//log("DEBUG: ","------- subscribeRemote ------- ",pl_msg.providedParamName);
//In case of error the remote variable stops the test
f_EPTF_Var_subscribeRemote(
pl_msg.remoteCompRef,
pl_msg.providedParamName,
pl_msg.subsMode,
vl_varIdx,
pl_msg.destParamName,
pl_msg.refreshRate);
f_EPTF_Var_addPostProcFn(vl_varIdx, {refers(f_EPTF_UIHandler_refreshVar),{}});
// FIXME: test
// FIXME: This should be put back if old gui build using SubsCanAdjust is working:
//f_EPTF_Var_addSubsCanAdjustNotifyFn(vl_varIdx, {refers(f_EPTF_UIHandler_updateDisableStateByVarIdx), {}});
}else{
//There is no destParamName, so it's an ealrier subscription
//Get the index of the variable
vl_varIdx := f_EPTF_UIHandler_getVarIdxByProvidedVarName(pl_msg.providedParamName);
if(-1 == vl_varIdx){
f_EPTF_UIHandler_warning("CLL_UIHandler: there is no subscription to the variable: " & pl_msg.providedParamName);
f_EPTF_UIHandler_sendSubscNAck(pl_msg.messageId, pl_sender);
return;
}
}
if(ispresent(pl_msg.widgetId)){
if (f_EPTF_UIHandler_Config_connectToWidget(pl_msg.widgetId,vl_varIdx,pl_msg.remoteCompRef,pl_msg.providedParamName)) {
// FIXME: This should be put back if old gui build using SubsCanAdjust is working:
//f_EPTF_UIHandler_updateDisableStateByVarIdx(vl_varIdx, {});
f_EPTF_UIHandler_sendSubscAck(pl_msg.messageId, vl_varIdx, pl_sender);
} else {
f_EPTF_UIHandler_sendSubscNAck(pl_msg.messageId, pl_sender);
}
return;
} else {
vl_subs.widgetId := "";
}
vl_subs.provider := pl_msg.remoteCompRef;
vl_subs.varIdx := vl_varIdx;
vl_subs.providedParamName:=pl_msg.providedParamName;
//FIXME!!!Check compatibility
f_EPTF_UIHandler_newSubscription(vl_subs);
f_EPTF_UIHandler_sendSubscAck(pl_msg.messageId, vl_varIdx, pl_sender);
if(ispresent(pl_msg.widgetId)){
f_EPTF_UIHandler_refreshWidget(vl_subs, true);
// FIXME: This should be put back if old gui build using SubsCanAdjust is working:
//f_EPTF_UIHandler_updateDisableStateByVarIdx(vl_varIdx, {});
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_refreshVar
//
// Purpose:
// Postproc. The component refreshes the content of the GUI
// when the content of the variable changes
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_refreshVar(in integer pl_idx, in EPTF_IntegerList pl_argList)
runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized) {
return;
}
var EPTF_UIHandler_OpenSubscriptions vl_subsList;
if (not f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_idx, vl_subsList)){
f_EPTF_UIHandler_warning("The subscriptionlist is empty for this variable!");
}
for(var integer vl_i := 0; vl_i < sizeof(vl_subsList); vl_i := vl_i+1){
//Put the received value to the screen. It can differ from the typed value.
//log("DEBUG: ","---- postproc - ",vl_subsList[vl_i].widgetId, " - ", v_EPTF_Vars[vl_subsList[vl_i].varIdx].content.direct);
f_EPTF_UIHandler_refreshWidget(vl_subsList[vl_i]);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeWidgetFromSubscription
// Purpose:
// Clears the widgetId member of the open subscription associated
// with the specified widget.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_removeWidgetFromSubscription(in EPTF_UIHandler_WidgetIdString pl_widgetId)
runs on EPTF_UIHandler_Private_CT
return boolean{
var integer vl_idx := f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(pl_widgetId);
if(-1 == vl_idx){
return false;
}
f_EPTF_str2int_HashMap_Erase(v_UIHandler_subscriptionHashMapId, pl_widgetId);
v_UIHandler_openSubscriptions[vl_idx].widgetId := "";
return true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeIdFromIdList
// Purpose:
// Removes an integer from an integer list.
//
// Return Value:
// A new list of integers without gaps and the specified integer.
//
// Detailed Comments:
// The function handles only unique integers.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_removeIdFromIdList(in EPTF_IntegerList pl_in, in integer pl_idx)
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
var integer vl_i := 0;
while(vl_i < sizeof(pl_in)){
if(pl_in[vl_i] != pl_idx){
vl_ret[sizeof(vl_ret)] := pl_in[vl_i];
}
vl_i := vl_i + 1;
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addIdx2IdxList
// Purpose:
// Simply append an integer to an integer list.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_addIdx2IdxList(inout EPTF_IntegerList pl_in, in integer pl_idx){
pl_in[sizeof(pl_in)] := pl_idx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_insertIdx2IdxList
// Purpose:
// Insert a new integer into an integer list in a specific index
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_insertIdx2IdxList(inout EPTF_IntegerList pl_in, in integer pl_idx, in integer pl_value){
for ( var integer i := sizeof(pl_in)-1; i >= pl_idx ; i := i-1 ) {
pl_in[i+1] := pl_in[i];
}
pl_in[pl_idx] := pl_value;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_IdxListContains
// Return Value:
// True if the integerlist contains the specified value.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_IdxListContains(in EPTF_IntegerList pl_in, in integer pl_idx)
return boolean{
for(var integer vl_i := 0; vl_i < sizeof(pl_in); vl_i := vl_i + 1){
if(pl_in[vl_i] == pl_idx){return true;}
}
return false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_parentColOfCell
// Purpose:
// Retrieves the GUI index of the column into which the cell is placed
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_parentColOfCell(in integer pl_parent)
runs on EPTF_UIHandler_Private_CT
return integer{
if(-1 == pl_parent){return -1;}
var integer vl_i := pl_parent;
while(vl_i != -1 and v_UIHandler_guiItemList[vl_i].widgetType != wtTreecol){
vl_i := v_UIHandler_guiItemList[vl_i].parentIdx;
}
if(vl_i != -1 and v_UIHandler_guiItemList[vl_i].widgetType == wtTreecol){
return vl_i;
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addWidgetRec
// Purpose:
// Adds the specified record about a widget to the list
// of the widgets.
//
// Return Value:
// The index of the new record if succes, or -1
//
// Detailed Comments:
// If there is already a widget with the same id with the
// same type under the same parent, the function returns
// the index of the previous widget, and sets the pl_widgetExists to true.
// If pl_indexInParent parameter is given (not -1), widgetrec is placed
// to that position in parents' childrenlist.
// This is needed for tree column insertion.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_addWidgetRec(
in EPTF_UIHandler_GuiItemRec pl_widgetRec,
inout boolean pl_widgetExists/*,
in integer pl_indexInParent := -1*/)
runs on EPTF_UIHandler_Private_CT
return integer{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": "&log2str(pl_widgetRec));
}
pl_widgetExists := false;
//Checking the index of the parent item. Less than 0 is valid for the main window.
if(pl_widgetRec.parentIdx> sizeof(v_UIHandler_guiItemList) or
(pl_widgetRec.parentIdx < 0 and (pl_widgetRec.widgetType != wtWindow))){
f_EPTF_UIHandler_warning("Invalid parent index for the widget "&pl_widgetRec.id&".");
return -1;
}
//If the parent widget from the pl_widgetRec.parentIdx is a tabpages, then pl_widgetRec.widgetType can only be a tabpage,
//else warning and return -1
if( ((pl_widgetRec.parentIdx > -1) and pl_widgetRec.widgetType != wtTabpage and pl_widgetRec.widgetType != wtMetaIterator) and v_UIHandler_guiItemList[pl_widgetRec.parentIdx].widgetType == wtTabpages){
f_EPTF_UIHandler_warning("Under a tabpages widget only widgets with type tabpage is allowed: "&pl_widgetRec.id&".");
return -1;
}
var boolean vl_xuldisabled := false;
if(ispresent(pl_widgetRec.xuldisabled)){
vl_xuldisabled := pl_widgetRec.xuldisabled;
}
var EPTF_UIHandler_GuiItemRec vl_newRec := {
id := pl_widgetRec.id,
widgetType := pl_widgetRec.widgetType,
widgetDataType := pl_widgetRec.widgetDataType,
parentIdx := pl_widgetRec.parentIdx,
children := {},
widgetData := pl_widgetRec.widgetData,
XULformat := pl_widgetRec.XULformat,
xuldisabled := vl_xuldisabled
};
//Checking ID
var integer vl_idx;
var boolean vl_isexisting := (pl_widgetRec.id != "" and f_EPTF_str2int_HashMap_Find(v_UIHandler_widgetHashMapId, pl_widgetRec.id, vl_idx));
var integer vl_prevIdx := -1;
if(pl_widgetRec.XULformat != omit and ischosen(pl_widgetRec.XULformat.treecell)){
var Treecell vl_treecell := pl_widgetRec.XULformat.treecell;
vl_treecell.id := omit;
vl_prevIdx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetRec.id, f_EPTF_UIHandler_deleteChildrenFromTreecell(vl_treecell));
} else {
vl_prevIdx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetRec.id);
}
if(vl_isexisting == true){ // old -1 != vl_prevIdx
f_EPTF_UIHandler_setWidgetOriginalDisabled(vl_prevIdx); // Set original [xul] disabled state
if(v_UIHandler_customGUIProcess){
f_EPTF_UIHandler_error(%definitionId&": Duplicate widget ID: "& pl_widgetRec.id&"\nThe GUI descriptor is: "&log2str("v_UIHandler_widgetslist"));
}else{
var integer vl_row, vl_col;
var EPTF_UIHandler_WidgetIdString vl_treeId;
if (not f_EPTF_UIHandler_isTreeCellIdFormat(pl_widgetRec.id, vl_treeId, vl_row, vl_col)){
pl_widgetExists := true;
}
if(v_UIHandler_guiItemList[vl_prevIdx].widgetType != pl_widgetRec.widgetType or
v_UIHandler_guiItemList[vl_prevIdx].parentIdx != pl_widgetRec.parentIdx){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Duplicate widget ID: "& pl_widgetRec.id);
}
return -1;
}else{
//There is a similar widget
return vl_prevIdx;
}
}
}
if(-1 == vl_prevIdx){
var integer vl_newIdx := sizeof(v_UIHandler_guiItemList);
v_UIHandler_guiItemList[vl_newIdx] := vl_newRec;
if(vl_newRec.widgetType != wtMetaIterator) {
if( v_UIHandler_actualParentIdxIsFilled == false) {
//window's parent is -1, but getNonMeta gives 0 back, because window has 0 id
if(vl_newRec.widgetType != wtWindow){
v_UIHandler_actualParentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(vl_newIdx);
} else {
v_UIHandler_actualParentIdx := pl_widgetRec.parentIdx;
}
v_UIHandler_actualParentIdxIsFilled := true
v_UIHandler_widgetIdxList[sizeof(v_UIHandler_widgetIdxList)] := vl_newIdx;
} else if( v_UIHandler_actualParentIdx == f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(vl_newIdx) or
/*because tabpagelist: put all tabpagelist element, if same it has parent as the first tabpage element*/
( v_UIHandler_actualParentIdx != -1 and vl_newRec.widgetType == wtTabpage and
f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(v_UIHandler_guiItemList[vl_newIdx].parentIdx) ==
f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(v_UIHandler_guiItemList[v_UIHandler_actualParentIdx].parentIdx)
)
) {
v_UIHandler_widgetIdxList[sizeof(v_UIHandler_widgetIdxList)] := vl_newIdx;
}
}
// add widget id to the widgetId map
if (vl_newRec.id != "") {
f_EPTF_str2int_HashMap_Insert(v_UIHandler_widgetHashMapId, vl_newRec.id, vl_newIdx);
}
//Add to its parent's childrenlist
if(-1 != vl_newRec.parentIdx){
//if (pl_indexInParent <0) {
v_UIHandler_guiItemList[vl_newRec.parentIdx].children[sizeof(v_UIHandler_guiItemList[vl_newRec.parentIdx].children)] := vl_newIdx;
//}
//else {
// f_EPTF_UIHandler_insertIdx2IdxList(v_UIHandler_guiItemList[vl_newRec.parentIdx].children, pl_indexInParent, vl_newIdx);
// }
}
f_EPTF_UIHandler_setWidgetOriginalDisabled(vl_newIdx); // Set original [xul] disabled state
return vl_newIdx;
} else {
return vl_prevIdx;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeWidgetRecByName
// Purpose:
// Removes the specified record about a widget from the list
// of the widgets. See <f_EPTF_UIHandler_removeWidgetRecByIdx>.
//
// Return Value:
// True if succes, false otherwise.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_removeWidgetRecByName(in EPTF_UIHandler_WidgetIdString pl_widgetId)
runs on EPTF_UIHandler_Private_CT
return boolean{
var integer vl_recIdx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetId);
if(-1 == vl_recIdx){
return false;
}
return f_EPTF_UIHandler_removeWidgetRecByIdx(vl_recIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_removeWidgetRecByIdx
// Purpose:
// Removes the specified record about a widget from the list
// of the widgets.
//
// Return Value:
// True if succes, false otherwise.
//
// Detailed Comments:
// Removes also the children of the widget from the list.
// Removes the index of the widget too from the children's list
// of the parent of the specified widget.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_removeWidgetRecByIdx(in integer pl_recIdx)
runs on EPTF_UIHandler_Private_CT
return boolean {
f_EPTF_Base_assert(%definitionId&": Boundary check failed - invalid widget record index",
pl_recIdx >= 0 and pl_recIdx < sizeof(v_UIHandler_guiItemList));
var boolean vl_ret := true;
//Check if there was an open connection
var integer vl_connIdx := f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(v_UIHandler_guiItemList[pl_recIdx].id);
if(-1 != vl_connIdx){
f_EPTF_str2int_HashMap_Erase(v_UIHandler_subscriptionHashMapId, v_UIHandler_openSubscriptions[vl_connIdx].widgetId);
v_UIHandler_openSubscriptions[vl_connIdx].widgetId := "";
}
//parse children
var EPTF_IntegerList vl_children := v_UIHandler_guiItemList[pl_recIdx].children;
for(var integer vl_i := 0; vl_i < sizeof(vl_children); vl_i := vl_i + 1){
if(vl_children[vl_i]> -1){
vl_ret := vl_ret and f_EPTF_UIHandler_removeWidgetRecByIdx(vl_children[vl_i]);
}
}
//remove from the childlist of its parent
if(-1 != v_UIHandler_guiItemList[pl_recIdx].parentIdx){
v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_recIdx].parentIdx].children :=
f_EPTF_UIHandler_removeIdFromIdList(v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_recIdx].parentIdx].children,pl_recIdx);
}
// delete widgetId from hashmap
if (v_UIHandler_guiItemList[pl_recIdx].id != "") {
f_EPTF_str2int_HashMap_Erase(v_UIHandler_widgetHashMapId, v_UIHandler_guiItemList[pl_recIdx].id);
}
//clear record
v_UIHandler_guiItemList[pl_recIdx] := c_UIHandler_emptyGUIItem;
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_widgetRecIndex
// Return Value:
// The index of the <EPTF_UIHandler_GuiItemRec> that describes the
// specified widget, or -1.
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_widgetRecIndex(
in EPTF_UIHandler_WidgetIdString pl_id, //The ID of the widget
in Treecell pl_treecell := {omit, omit, omit, omit, omit, omit, omit, omit}
)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_idx := 0;
// check if empty id
if("" == pl_id){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": widgetRecIndex with empty ID!");
}
return -1;
}
// try to find id in internal database
if (f_EPTF_str2int_HashMap_Find(v_UIHandler_widgetHashMapId, pl_id, vl_idx)) {
return vl_idx;
}
// // check if id refers a table cell in format "treeId.[row].[col]"
// var integer vl_row, vl_col;
// var EPTF_UIHandler_WidgetIdString vl_treeId;
// if (f_EPTF_UIHandler_isTreeCellIdFormat(pl_id, vl_treeId, vl_row, vl_col)) {
// if (f_EPTF_str2int_HashMap_Find(v_UIHandler_widgetHashMapId, vl_treeId, vl_idx) and
// v_UIHandler_guiItemList[vl_idx].widgetType == wtTree)
// {
// var integer vl_colNum := sizeof(v_UIHandler_guiItemList[vl_idx].widgetData.treeData.columns);
// if (vl_col < vl_colNum) {
// var EPTF_UIHandler_GuiItemRec vl_newRec := {
// pl_id,
// wtTreecell,
// v_UIHandler_guiItemList[v_UIHandler_guiItemList[vl_idx].widgetData.treeData.columns[vl_col]].widgetDataType,
// vl_idx,
// {},
// {cellData := {v_UIHandler_guiItemList[vl_idx].widgetData.treeData.columns[vl_col], omit}},
// { treecell := pl_treecell}};
// var integer vl_newIdx := sizeof(v_UIHandler_guiItemList);
// v_UIHandler_guiItemList[vl_newIdx] := vl_newRec;
// if (vl_newRec.id != "") {
// f_EPTF_str2int_HashMap_Insert(v_UIHandler_widgetHashMapId, vl_newRec.id, vl_newIdx);
// }
// f_EPTF_UIHandler_setWidgetOriginalDisabled(vl_newIdx); // Set original [xul] disabled state
// //Add to its parent's childrenlist
// if(-1 != vl_newRec.parentIdx){
// v_UIHandler_guiItemList[vl_newRec.parentIdx].children[sizeof(v_UIHandler_guiItemList[vl_newRec.parentIdx].children)] := vl_newIdx;
// }
// return vl_newIdx;
// }
// }
// }
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_isTreeCellIdFormat
//
// Purpose:
// Private function to check whether a widgetId is given in specail table cell format (treeId.[row].[column]),
// and gives back treeId, row, column if possible
// Parameters:
// pl_widgetRec - *out* EPTF_UIHandler_GuiItemRec - The <EPTF_UIHandler_GuiItemRec> that describes the specified widget
// pl_id - *in* EPTF_UIHandler_WidgetIdString - The input widget Id string
// pl_treeId - *out* EPTF_UIHandler_WidgetIdString - The id of the table
// pl_row - *out* integer pl_row - The row number of the cell
// pl_col - *out* integer - The column number of the cell
// Return Value:
// True if widgetId is in special format, false otherwise
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_isTreeCellIdFormat(
in EPTF_UIHandler_WidgetIdString pl_id,
out EPTF_UIHandler_WidgetIdString pl_treeId,
out integer pl_row,
out integer pl_col )
return boolean {
// this function matches pattern "*.[0-9]+.[0-9]+" but without using the unefficient regexp
// reset out parameters
pl_treeId := "";
pl_row := 0;
pl_col := 0;
var integer i := lengthof(pl_id)-1, vl_limiterIdx1 := -1, vl_limiterIdx2 := -1;
// check last char is a number
if ( char2int(pl_id[i])<char2int("0") or char2int(pl_id[i])>char2int("9") ) {
return false;
}
// find first '.' from back in Id
for (i := i-1; pl_id[i] != "." and i>=3; i := i-1) {
if (char2int(pl_id[i])<char2int("0") or char2int(pl_id[i])>char2int("9")) {
return false;
}
}
if (i<3) {
return false;
}
vl_limiterIdx1 := i;
// check next char is a number
i := i-1;
if ( char2int(pl_id[i])<char2int("0") or char2int(pl_id[i])>char2int("9") ) {
return false;
}
// find second '.' from back in Id
for (i := i-1; pl_id[i] != "." and i>=1; i := i-1) {
if (char2int(pl_id[i])<char2int("0") or char2int(pl_id[i])>char2int("9")) {
return false;
}
}
if (i<1) {
return false;
}
vl_limiterIdx2 := i;
// obtain column number
pl_col := str2int(substr(pl_id, vl_limiterIdx1+1, lengthof(pl_id)-vl_limiterIdx1-1));
// obtain row number
pl_row := str2int(substr(pl_id, vl_limiterIdx2 + 1, vl_limiterIdx1 - vl_limiterIdx2 - 1));
// obtain tree id
pl_treeId := substr(pl_id, 0, vl_limiterIdx2);
return true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getWidgetRec
// Parameters:
// pl_widgetRec - *out* EPTF_UIHandler_GuiItemRec - The <EPTF_UIHandler_GuiItemRec> that describes the specified widget
//
// Return Value:
// True if success, false otherwise.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getWidgetRec(
in EPTF_UIHandler_WidgetIdString pl_widgetId,
out EPTF_UIHandler_GuiItemRec pl_widgetRec)
runs on EPTF_UIHandler_Private_CT
return boolean{
var integer vl_idx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetId);
pl_widgetRec := c_UIHandler_emptyGUIItem;
if(-1 < vl_idx){
pl_widgetRec := v_UIHandler_guiItemList[vl_idx];
return true;
}
return false;
}
} //EPTF_WidgetAdministrationFunctions group
///////////////////////////////////////////////////////////
// Group: EPTF_WidgetAddInternalFunctions
///////////////////////////////////////////////////////////
group EPTF_WidgetAddInternalFunctions{
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addElementToTree
//
// Purpose:
// Private function to look through a Tree when adding an column or item or row or cell to it.
//
// Parameters:
// pl_parentWidgetId *integer*
// pl_xul *XTDP_XML_Tag*
// pl_currentTree <Tree>
//
// Return Value:
// *boolean*
//
// Errors:
// none
//
// Detailed Comments:
// Returns true if pl_xul has been added to pl_currentTree.
//
///////////////////////////////////////////////////////////
/*private function f_EPTF_UIHandler_addElementToTree(
in EPTF_UIHandler_WidgetIdString pl_parentWidgetId,
in Widgets pl_xul,
inout ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tree pl_currentTree)
runs on EPTF_UIHandler_Private_CT
return boolean {
if(pl_currentTree.id == pl_parentWidgetId) {
// init the one-and-only treeitem (treechildren[0]):
if(sizeof(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list) == 0) {
pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list := {};
}
select( true )
{
case (ischosen (pl_xul.treecol)) {
pl_currentTree.treecols.treecolgroups.treecolgroup_list[sizeof(pl_currentTree.treecols.treecolgroups.treecolgroup_list)].treecol := pl_xul.treecol;
return true;
}
case (ischosen (pl_xul.treecols)) {
for(var integer col := 0; col < sizeof(pl_xul.treecols.treecolgroups.treecolgroup_list); col := col + 1) {
if(ischosen(pl_xul.treecols.treecolgroups.treecolgroup_list[col].treecol)){
pl_currentTree.treecols.treecolgroups.treecolgroup_list[sizeof(pl_currentTree.treecols.treecolgroups.treecolgroup_list)].treecol := pl_xul.treecols.treecolgroups.treecolgroup_list[col].treecol;
}else{
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_xul.treecols.treecolgroups.treecolgroup_list[col]));
return false;
}
}
return true;
}
case (ischosen (pl_xul.treerow)) {
pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[sizeof(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)].treerow := pl_xul.treerow;
return true;
}
case (ischosen (pl_xul.treecell)) {
var integer vl_rowCount := 0;
if(isbound(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)){
vl_rowCount := sizeof(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list);
}
var integer vl_cellCount := 0;
if(isbound(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_rowCount].treerow.treecellgroups.treecellgroup_list)){
vl_cellCount := sizeof(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_rowCount].treerow.treecellgroups.treecellgroup_list);
}
// add the cell to the last row's cells
pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_rowCount].treerow.treecellgroups.treecellgroup_list[vl_cellCount].treecell := pl_xul.treecell;
return true;
}
case (ischosen (pl_xul.treeitem)) {
// add each row to the one-and-only treeitem (treechildren.treeitemgroup_list[0]):
for(var integer i := 0; i < sizeof(pl_xul.treeitem.treerowgroups.treerowgroup_list); i := i + 1) {
if(ischosen(pl_xul.treeitem.treerowgroups.treerowgroup_list[i].treerow)){
pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[sizeof(pl_currentTree.treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)].treerow := pl_xul.treeitem.treerowgroups.treerowgroup_list[i].treerow;
}else{
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_xul.treeitem.treerowgroups.treerowgroup_list[i]));
return false;
}
}
return true;
}
case else
{
}
}
}
return false;
}*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addElementToHbox
//
// Purpose:
// Private function to look through a Hbox when adding a widget.
//
// Parameters:
// pl_parentWidgetId *integer*
// pl_xul *XTDP_XML_Tag*
// pl_currentHbox *Tabbox
//
// Return Value:
// *boolean*
//
// Errors:
// none
//
// Detailed Comments:
// Returns true if pl_xul has been added to pl_currentHbox or a widget inside.
//
///////////////////////////////////////////////////////////
/*private function f_EPTF_UIHandler_addElementToHbox(
in EPTF_UIHandler_WidgetIdString pl_parentWidgetId,
in Widgets pl_xul,
inout ttcn_ericsson_se_protocolModules_xtdp_xtdl.Hbox pl_currentHbox)
runs on EPTF_UIHandler_Private_CT
return boolean {
if(pl_currentHbox.id == pl_parentWidgetId) {
var integer vl_index := sizeof(pl_currentHbox.embeddedwidgets.embeddedwidget_list);
if (ischosen (pl_xul.tabbox)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].tabbox := pl_xul.tabbox; return true;
} else if (ischosen (pl_xul.tree)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].tree := pl_xul.tree; return true;
} else if (ischosen (pl_xul.hbox)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].hbox := pl_xul.hbox; return true;
} else if (ischosen (pl_xul.label_)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].label_ := pl_xul.label_; return true;
} else if (ischosen (pl_xul.spacer)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].spacer := pl_xul.spacer; return true;
} else if (ischosen (pl_xul.button)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].button := pl_xul.button; return true;
} else if (ischosen (pl_xul.textbox)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].textbox := pl_xul.textbox; return true;
} else if (ischosen (pl_xul.pushbutton)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].pushbutton := pl_xul.pushbutton; return true;
} else if (ischosen (pl_xul.togglebutton)) {
pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_index].togglebutton := pl_xul.togglebutton; return true;
} else { return false; }
} else {
var boolean ok := false;
for(var integer vl_i := 0; vl_i < sizeof(pl_currentHbox.embeddedwidgets.embeddedwidget_list); vl_i := vl_i + 1) {
if(ischosen(pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_i].tabbox)) {
ok := f_EPTF_UIHandler_addElementToTabbox(pl_parentWidgetId, pl_xul, pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_i].tabbox);
} else if(ischosen(pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_i].tree)) {
ok := f_EPTF_UIHandler_addElementToTree(pl_parentWidgetId, pl_xul, pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_i].tree);
} else if(ischosen(pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_i].hbox)) {
ok := f_EPTF_UIHandler_addElementToHbox(pl_parentWidgetId, pl_xul, pl_currentHbox.embeddedwidgets.embeddedwidget_list[vl_i].hbox);
}
if(ok) {
return ok;
}
}
}
return false;
}*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromXul
//
// Purpose:
// before sending XTDP_AddRequests out this function appends all widgetIds
// from request to string list of current runtime GUI widgetIds
//
// Parameters:
// pl_xul - *in* *Widgets* - union type of possible gui items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
//
// Return Value:
// -
//
// Errors:
// none
//
// Detailed Comments:
// NOTE: This is the interface function to all list append functions below.
// These functions have been created according to the data structure described in XUL_XSD.asn.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromXul (
inout Widgets pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
select(pl_xul){
//FIXME ischosen?
// iterator in appendAllWidgetIdsFromXul
/*case({iterator := ?}) {
return f_EPTF_UIHandler_Config_processIterator(pl_xul.iterator, pl_widgetsOut, pl_parentIdx, pl_widgetExists);
}*/
case({window := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromWindow(pl_xul.window, pl_widgetExists);
}
case({tabpages := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTabpages(pl_xul.tabpages, pl_parentIdx, pl_widgetExists);
}
case({tabpage := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTabpage(pl_xul.tabpage, pl_parentIdx, pl_widgetExists);
}
case({tree := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTree(pl_xul.tree, pl_parentIdx, pl_widgetExists);
}
case({treecols := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols(pl_xul.treecols.treecolgroups.treecolgroup_list, pl_parentIdx, pl_widgetExists);
}
case({treecol := ?}) {
return -1 != f_EPTF_UIHandler_appendTreecol(pl_xul.treecol, pl_parentIdx, pl_widgetExists);
}
case({treechildren := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups(pl_xul.treechildren.treeitemgroups.treeitemgroup_list, pl_parentIdx, pl_widgetExists);
}
case({treeitem := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups(pl_xul.treeitem.treerowgroups.treerowgroup_list, pl_parentIdx, pl_widgetExists);
}
case({treerow := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(pl_xul.treerow.treecellgroups.treecellgroup_list, pl_parentIdx, pl_widgetExists);
}
case({treecell := ?}) {
return f_EPTF_UIHandler_appendCell(pl_xul.treecell, pl_parentIdx, pl_widgetExists, sizeof(v_UIHandler_guiItemList[pl_parentIdx].widgetData.treeData.columns)-1);
}
case({hbox := ?}) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromHbox(pl_xul.hbox, pl_parentIdx, pl_widgetExists);
}
case({label_ := ?}) {
return f_EPTF_UIHandler_appendLabel(pl_xul.label_, pl_parentIdx, pl_widgetExists);
}
case({spacer := ?}) {
return f_EPTF_UIHandler_appendSpacer(pl_xul.spacer, pl_parentIdx, pl_widgetExists);
}
case({button := ?}) {
return f_EPTF_UIHandler_appendButton(pl_xul.button, pl_parentIdx, pl_widgetExists);
}
case({textbox := ?}) {
return f_EPTF_UIHandler_appendTextbox(pl_xul.textbox, pl_parentIdx, pl_widgetExists);
}
case({chart := ?}) {
return f_EPTF_UIHandler_appendChart(pl_xul.chart, pl_parentIdx, pl_widgetExists);
}
case({trace := ?}) {
return f_EPTF_UIHandler_appendTrace(pl_xul.trace, pl_parentIdx, pl_widgetExists);
}
case({toolbar := ?}) {
return f_EPTF_UIHandler_appendToolbar(pl_xul.toolbar, pl_parentIdx, pl_widgetExists);
}
case({toolbarbutton := ?}) {
return f_EPTF_UIHandler_appendToolbarbutton(pl_xul.toolbarbutton, pl_parentIdx, pl_widgetExists);
}
case({toolbarelements := ?}) {
var boolean vl_ret := true;
for(var integer vl_i := 0; vl_i < sizeof(pl_xul.toolbarelements.toolbarelement_list);vl_i := vl_i + 1){
if(ischosen(pl_xul.toolbarelements.toolbarelement_list[vl_i].choice.toolbarbutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendToolbarbutton(pl_xul.toolbarelements.toolbarelement_list[vl_i].choice.toolbarbutton, pl_parentIdx, pl_widgetExists);
}else if(ischosen(pl_xul.toolbarelements.toolbarelement_list[vl_i].choice.separator)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendSeparator(pl_xul.toolbarelements.toolbarelement_list[vl_i].choice.separator, pl_parentIdx, pl_widgetExists);
}else{
f_EPTF_UIHandler_warning("Unhandled widgettype as a toolbarelement!");
}
}
return vl_ret;
}
case({tracelist := ?}) {
var boolean vl_ret := true;
for(var integer vl_i := 0; vl_i < sizeof(pl_xul.tracelist.trace_list);vl_i := vl_i + 1){
vl_ret := vl_ret and f_EPTF_UIHandler_appendTrace(pl_xul.tracelist.trace_list[vl_i], pl_parentIdx, pl_widgetExists);
}
return vl_ret;
}
case({listbox := ?}) {
return f_EPTF_UIHandler_appendListbox(pl_xul.listbox, pl_parentIdx, pl_widgetExists);
}
case({listitem := ?}) {
return f_EPTF_UIHandler_appendListitem(pl_xul.listitem, pl_parentIdx, pl_widgetExists);
}
case({numericalwidget := ?}) {
return f_EPTF_UIHandler_appendNumericalwidget(pl_xul.numericalwidget, pl_parentIdx, pl_widgetExists);
}
case({menulist := ?}) {
return f_EPTF_UIHandler_appendMenulist(pl_xul.menulist, pl_parentIdx, pl_widgetExists);
}
case({menuitem := ?}) {
return f_EPTF_UIHandler_appendMenuitem(pl_xul.menuitem, pl_parentIdx, pl_widgetExists);
}
case ({distributionchart := ?}){
return f_EPTF_UIHandler_appendDistributionchart(pl_xul.distributionchart, pl_parentIdx, pl_widgetExists);
}
case ({valuelist := ?}){
return f_EPTF_UIHandler_appendValuelist(pl_xul.valuelist, pl_parentIdx, pl_widgetExists);
}
case ({image := ?}){
return f_EPTF_UIHandler_appendImage(pl_xul.image, pl_parentIdx, pl_widgetExists);
}
case({pushbutton := ?}) {
return f_EPTF_UIHandler_appendPushbutton(pl_xul.pushbutton, pl_parentIdx, pl_widgetExists);
}
case({togglebutton := ?}) {
return f_EPTF_UIHandler_appendTogglebutton(pl_xul.togglebutton, pl_parentIdx, pl_widgetExists);
}
case({htmlcode := ?}) {
return f_EPTF_UIHandler_appendHtmlcode(pl_xul.htmlcode, pl_parentIdx, pl_widgetExists);
}
case({separator := ?}) {
return f_EPTF_UIHandler_appendSeparator(pl_xul.separator, pl_parentIdx, pl_widgetExists);
}
case else {
f_EPTF_UIHandler_warning("Unhandled widget type in f_EPTF_UIHandler_appendAllWidgetIdsFromXul!");
return false;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromWindow
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_window - *in* *Windowtype*
//
// Return Value:
// Windowtype
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromWindow(in Windowtype pl_window)
return Windowtype {
var Windowtype ret := pl_window;
ret.embeddedwidgets.embeddedwidget_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromTree
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Tree*
//
// Return Value:
// Tree
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromTree(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tree pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tree {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tree ret := pl_xul;
ret.treecols.treecolgroups.treecolgroup_list := {};
ret.treechildren.treeitemgroups.treeitemgroup_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromTabpages
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Tabpages*
//
// Return Value:
// Tabpages
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromTabpages(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpages pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpages {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpages ret := pl_xul;
ret.tabpagegroups.tabpagegroup_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromHbox
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Hbox*
//
// Return Value:
// Hbox
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromHbox(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Hbox pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Hbox {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Hbox ret := pl_xul;
ret.embeddedwidgets.embeddedwidget_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromChart
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Chart*
//
// Return Value:
// Chart
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromChart(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Chart pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Chart {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Chart ret := pl_xul;
ret.tracegroups.tracegroup_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromToolbar
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Toolbar*
//
// Return Value:
// Toolbar
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromToolbar(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbar pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbar {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbar ret := pl_xul;
ret.choice_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromListbox
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Listbox*
//
// Return Value:
// Listbox
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromListbox(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listbox pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listbox {
pl_xul.externaldata := omit;
pl_xul.listitemgroups.listitemgroup_list := {};
return pl_xul;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenFromMenulist
//
// Purpose:
// Deletes the childrens from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Menulist*
//
// Return Value:
// Menulist
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromMenulist(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menulist pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menulist {
pl_xul.externaldata := omit;
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menulist ret := pl_xul;
ret.menupopup.choice.menuitemgroups.menuitemgroup_list := {};
return ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_deleteChildrenDistributionchart
//
// Purpose:
// Deletes the children from the widget given in XUL format
//
// Parameters:
// pl_xul - *in* *Distributionchart*
//
// Return Value:
// Distributionchart
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_deleteChildrenFromDistributionchart(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Distributionchart pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Distributionchart {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Distributionchart ret := pl_xul;
ret.externaldatagroups.externaldatagroup_list := {};
return ret;
}
// The others are just the Identity
private function f_EPTF_UIHandler_deleteChildrenFromMenuitem(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menuitem pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menuitem {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menuitem ret := pl_xul;
return ret;
}
private function f_EPTF_UIHandler_deleteChildrenFromNumericalwidget(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Numericalwidget pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Numericalwidget {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromTreecell(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treecell pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treecell {
//var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treecell ret := pl_xul;
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromListitem(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listitem pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listitem {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listitem ret := pl_xul;
return ret;
}
private function f_EPTF_UIHandler_deleteChildrenFromTreerow(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treerow pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treerow {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treerow ret := pl_xul;
return ret;
}
private function f_EPTF_UIHandler_deleteChildrenFromTabpage(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpage pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpage {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpage ret := pl_xul;
ret.embeddedwidgets := {{}};
return ret;
}
private function f_EPTF_UIHandler_deleteChildrenFromLabel(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Label pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Label {
// if externaldata present then ->
if(ispresent(pl_xul.externaldata)) {
// add customclass to notify the LoadMain.xsl that the content of this label can change (search for "dynamic updatable label" in xsl)
if (ispresent(pl_xul.customclass) and pl_xul.customclass!="") {
pl_xul.customclass := "HasExternalData "&pl_xul.customclass;
} else {
pl_xul.customclass := "HasExternalData";
}
}
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromSpacer(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Spacer pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Spacer {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Spacer ret := pl_xul;
return ret;
}
private function f_EPTF_UIHandler_deleteChildrenFromButton(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Button pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Button {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromTextbox(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Textbox pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Textbox {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromTrace(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Trace pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Trace {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromToolbarbutton(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbarbutton pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbarbutton {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromSeparator(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Separator pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Separator {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Separator ret := pl_xul;
return ret;
}
private function f_EPTF_UIHandler_deleteChildrenFromPushbutton(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Pushbutton pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Pushbutton {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromTogglebutton(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Togglebutton pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Togglebutton {
pl_xul.externaldata := omit;
return pl_xul;
}
private function f_EPTF_UIHandler_deleteChildrenFromHtmlcode(in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Htmlcode pl_xul)
return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Htmlcode {
pl_xul.externaldata := omit;
return pl_xul;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_anywidget
//
// Purpose:
// Casting function from XTDP_XML_Tag to AnyWidget
//
// Parameters:
// pl_xul - *in* *XTDP_XML_Tag* - union type of possible gui items
//
// Return Value:
// AnyWidget - an union of some gui items
//
// Errors:
// Unhandled widgettype
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
/* private function f_EPTF_UIHandler_anywidget(in Widgets pl_xul, inout boolean pl_succ)
runs on EPTF_UIHandler_Private_CT
return AnyWidget {
pl_succ := true;
select(pl_xul){
case ({tabbox := ?}) {
return {tabbox := pl_xul.tabbox};
}
case ({tree := ?}) {
return {tree := pl_xul.tree};
}
case ({hbox := ?}) {
return {hbox := pl_xul.hbox};
}
case ({label_ := ?}) {
return {textlabel := pl_xul.label_};
}
case ({spacer := ?}) {
return {spacer := pl_xul.spacer};
}
case ({button := ?}) {
return {button := pl_xul.button};
}
case ({textbox := ?}) {
return {textbox := pl_xul.textbox};
}
case ({chart := ?}) {
return {chart := pl_xul.chart};
}
case ({toolbar := ?}) {
return {toolbar := pl_xul.toolbar};
}
case ({toolbarbutton := ?}) {
return {toolbarbutton := pl_xul.toolbarbutton};
}
case ({listbox := ?}) {
return {listbox := pl_xul.listbox};
}
case ({numericalwidget := ?}) {
return {numericalwidget := pl_xul.numericalwidget};
}
case ({menulist := ?}) {
return {menulist := pl_xul.menulist};
}
case ({distributionchart := ?}) {
return {distributionchart := pl_xul.distributionchart};
}
case ({image := ?}) {
//f_EPTF_UIHandler_debug("f_EPTF_UIHandler_anywidget: image found, skip it");
pl_succ := false;
return {spacer := {0.0,omit}}; // a dummy widget - omit can not be used
}
case else{
f_EPTF_UIHandler_debug("Unhandled widget in f_EPTF_UIHandler_anywidget: " & log2str(pl_xul));
pl_succ := false;
return {spacer := {0.0,omit}}; // a dummy widget - omit can not be used
}
}
// control will never go here, but we need these because of gcc
pl_succ := false;
return {spacer := {0.0,omit}};
}*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Widgets
//
// Purpose:
// Casting function from XTDP_XML_Tag to AnyWidget
//
// Parameters:
// pl_xul - *in* *XTDP_XML_Tag* - union type of possible gui items
// pl_returnWidget - *out* *Embeddedwidget* - AnyWidget - an union of some gui items
//
// Errors:
// Unhandled widgettype
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Widgets(in Widgets pl_xul,
inout boolean pl_succ,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Embeddedwidget pl_widgets)
runs on EPTF_UIHandler_Private_CT
// return ttcn_ericsson_se_protocolModules_xtdp_xtdl.Embeddedwidget
{
pl_succ := true;
//FIXME Is not faster the ischosen?
if (ischosen(pl_xul.tabpages)) {
pl_widgets := {tabpages := pl_xul.tabpages};
return;
}
else if (ischosen(pl_xul.tree)) {
pl_widgets := {tree := pl_xul.tree};
return;
}
else if (ischosen(pl_xul.hbox)) {
pl_widgets := {hbox := pl_xul.hbox};
return;
}
else if (ischosen(pl_xul.label_)) {
pl_widgets := {label_ := pl_xul.label_};
return;
}
else if (ischosen(pl_xul.spacer)) {
pl_widgets := {spacer := pl_xul.spacer};
return;
}
else if (ischosen(pl_xul.button)) {
pl_widgets := {button := pl_xul.button};
return;
}
else if (ischosen(pl_xul.textbox)) {
pl_widgets := {textbox := pl_xul.textbox};
return;
}
else if (ischosen(pl_xul.chart)) {
pl_widgets := {chart := pl_xul.chart};
return;
}
else if (ischosen(pl_xul.toolbar)) {
pl_widgets := {toolbar := pl_xul.toolbar};
return;
}
else if (ischosen(pl_xul.listbox)) {
pl_widgets := {listbox := pl_xul.listbox};
return;
}
else if (ischosen(pl_xul.numericalwidget)) {
pl_widgets := {numericalwidget := pl_xul.numericalwidget};
return;
}
else if (ischosen(pl_xul.menulist)) {
pl_widgets := {menulist := pl_xul.menulist};
return;
}
else if (ischosen(pl_xul.distributionchart)) {
pl_widgets := {distributionchart := pl_xul.distributionchart};
return;
}
else if (ischosen(pl_xul.image)) {
//f_EPTF_UIHandler_debug("f_EPTF_UIHandler_anywidget: image found, skip it");
pl_succ := false;
pl_widgets := {spacer := {0.0,omit}}; // a dummy widget - omit can not be used
return;
}
else if (ischosen(pl_xul.pushbutton)) {
pl_widgets := {pushbutton := pl_xul.pushbutton};
return;
}
else if (ischosen(pl_xul.togglebutton)) {
pl_widgets := {togglebutton := pl_xul.togglebutton};
return;
}
else if (ischosen(pl_xul.htmlcode)) {
pl_widgets := {htmlcode := pl_xul.htmlcode};
return;
} else {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Unhandled widget: " & log2str(pl_xul));
}
pl_succ := false;
pl_widgets := {spacer := {0.0,omit}}; // a dummy widget - omit can not be used
return;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_widgetList
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to WidgetList
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
//
// Return Value:
// WidgetList - a list of some gui items
//
// Errors:
// none
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
/* private function f_EPTF_UIHandler_widgetList(in EPTF_UIHandler_WidgetsList pl_xuls)
runs on EPTF_UIHandler_Private_CT
return WidgetList {
var WidgetList wl:={};
var AnyWidget aw;
var boolean succ := true;
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
aw := f_EPTF_UIHandler_anywidget(pl_xuls[i], succ);
if(succ){
wl[sizeof(wl)] := aw;
}
}
return wl;
}
*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_embeddedwidgets
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to WidgetList
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// wl - *out* *ttcn_ericsson_se_protocolModules_xtdp_xtdl.Embeddedwidgets* - a list of some gui items
//
// Errors:
// none
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_embeddedwidgets(
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Embeddedwidgets wl)
runs on EPTF_UIHandler_Private_CT {
wl := {{}};
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Embeddedwidget aw;
var boolean succ := true;
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Embeddedwidgets vl_embedded;
f_EPTF_UIHandler_embeddedwidgets(v_xuls_metaIteratorChildren,vl_embedded);
wl.embeddedwidget_list := wl.embeddedwidget_list & vl_embedded.embeddedwidget_list;
} else {
f_EPTF_UIHandler_Widgets(pl_xuls[i], succ, aw);
if(succ){
wl.embeddedwidget_list[sizeof(wl.embeddedwidget_list)] := aw;
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_tabpagegroups
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to WidgetList
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// wl - *out* *ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpagegroups* - a list of some gui items
//
// Errors:
// none
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_tabpagegroups(
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpagegroups wl)
runs on EPTF_UIHandler_Private_CT {
wl := {{}};
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpagegroups aw;
var boolean succ := true;
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tabpagegroups vl_embedded;
f_EPTF_UIHandler_tabpagegroups(v_xuls_metaIteratorChildren,vl_embedded);
wl.tabpagegroup_list := wl.tabpagegroup_list & vl_embedded.tabpagegroup_list;
} else if (ischosen(pl_xuls[i].tabpage)) {
wl.tabpagegroup_list[sizeof(wl.tabpagegroup_list)].tabpage := pl_xuls[i].tabpage;
} else {
//FIXME extra check
//f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_xuls[i]));
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_TraceList
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to TraceList
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// pl_tracelist - *out* *TraceList*
//
// Errors:
// none
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_TraceList(
in integer pl_index,
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tracegroups pl_wl)
runs on EPTF_UIHandler_Private_CT{
pl_wl := {{}};
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tracelist vl_tracelist:={ /*trace_list :=*/ {} };
var EPTF_IntegerList vl_nonMetaChildrens := f_EPTF_UIHandler_getNonMetaChildren(pl_index);
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].trace)){
var integer vl_i := sizeof(vl_tracelist.trace_list);
vl_tracelist.trace_list[vl_i] := pl_xuls[i].trace;
pl_wl.tracegroup_list[vl_i].trace := vl_tracelist.trace_list[vl_i];
var integer vl_tracePointer;
if (not f_EPTF_int2int_HashMap_Find(v_UIHandler_tracePointerHashMapId, vl_nonMetaChildrens[i], vl_tracePointer)){
continue;
}
if ( sizeof(pl_xuls[i].trace.choice_list) < pl_xuls[i].trace.maxPoints) {
continue;
}
var integer vl_currTraceID := v_UIHandler_tracePointers[vl_tracePointer];
for (var integer j:=0; j<sizeof(pl_xuls[i].trace.choice_list); j:=j+1) {
vl_tracelist.trace_list[vl_i].choice_list[j] := pl_xuls[i].trace.choice_list[vl_currTraceID];
vl_currTraceID := vl_currTraceID + 1;
if (vl_currTraceID==sizeof(pl_xuls[i].trace.choice_list)) {
vl_currTraceID := 0;
}
}
//update it
pl_wl.tracegroup_list[vl_i].trace := vl_tracelist.trace_list[vl_i];
} else if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Tracegroups vl_embedded;
f_EPTF_UIHandler_TraceList(pl_index,v_xuls_metaIteratorChildren,vl_embedded);
// Insert into both list (pl_wl.tracegroup_list and vl_tracelist.trace_list)
for(var integer vl_idx:=0; vl_idx<sizeof(vl_embedded.tracegroup_list);vl_idx:=vl_idx+1) {
var integer vl_i := sizeof(vl_tracelist.trace_list);
vl_tracelist.trace_list[vl_i] := vl_embedded.tracegroup_list[vl_idx].trace;
pl_wl.tracegroup_list[vl_i].trace := vl_tracelist.trace_list[vl_i]
}
}else{
//FIXME extra check
//f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_xuls[i]));
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Toolbarelements
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to Toolbarelements
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// pl_toolbe - *out* *Toolbarelements*
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Toolbarelements(
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbarelements pl_toolbe)
runs on EPTF_UIHandler_Private_CT{
pl_toolbe:={
/*toolbarelement_list :=*/ {}
};
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].toolbarbutton)){
pl_toolbe.toolbarelement_list[sizeof(pl_toolbe.toolbarelement_list)].choice.toolbarbutton := pl_xuls[i].toolbarbutton;
} else if (ischosen(pl_xuls[i].pushbutton)){
pl_toolbe.toolbarelement_list[sizeof(pl_toolbe.toolbarelement_list)].choice.pushbutton := pl_xuls[i].pushbutton;
} else if (ischosen(pl_xuls[i].togglebutton)){
pl_toolbe.toolbarelement_list[sizeof(pl_toolbe.toolbarelement_list)].choice.togglebutton := pl_xuls[i].togglebutton;
} else if (ischosen(pl_xuls[i].separator)){
pl_toolbe.toolbarelement_list[sizeof(pl_toolbe.toolbarelement_list)].choice.separator := pl_xuls[i].separator;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Treecols
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to Treecols
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
//
// Return Value:
// Treecols
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Treecols(
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treecols pl_cols)
runs on EPTF_UIHandler_Private_CT{
pl_cols:={
/*treecolgroup_list :=*/ {{}}
};
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].treecol)){
pl_cols.treecolgroups.treecolgroup_list[sizeof(pl_cols.treecolgroups.treecolgroup_list)].treecol := pl_xuls[i].treecol;
} else if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treecols vl_embedded;
f_EPTF_UIHandler_Treecols(v_xuls_metaIteratorChildren,vl_embedded);
pl_cols.treecolgroups.treecolgroup_list := pl_cols.treecolgroups.treecolgroup_list & vl_embedded.treecolgroups.treecolgroup_list;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getTreeIdx
//
// Purpose:
// Gives back the current tree's id from e.g. a treerowid
//
// Parameters:
// pl_childIdx - *in* *integer* - widgetid, whose tree parent is to be found
//
// Return Value:
// Tree widget id.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getTreeIdx(in integer pl_childIdx)
runs on EPTF_UIHandler_Private_CT return integer {
var integer vl_nonMetaParentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(pl_childIdx);
if(v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetType != wtTree){
return f_EPTF_UIHandler_getTreeIdx(v_UIHandler_guiItemList[vl_nonMetaParentIdx].parentIdx );
// vl_data := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData;
}
return vl_nonMetaParentIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_treechildren
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to Treechildren
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
//
// Return Value:
// Treechildren
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_treechildren(
in EPTF_UIHandler_WidgetsList pl_xuls,
in integer pl_cols,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treechildren pl_children,
in integer pl_parentWidgetIdx,
inout integer pl_row)
runs on EPTF_UIHandler_Private_CT
{
var integer vl_nonMetaParentIdx := f_EPTF_UIHandler_getTreeIdx(pl_parentWidgetIdx);
var integer vl_columns := sizeof(v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns);
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list:={};
var integer vl_cellCounter := 0;
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].treecell)) {
var integer vl_row := 0;
if (vl_columns != 0) {
vl_row := vl_cellCounter / vl_columns;
}
var integer vl_cellIdxInRow := vl_cellCounter-vl_row*vl_columns;
//sizeof(pl_children.treeitemgroups.treeitemgroup_list[sizeof(pl_children.treeitemgroups.treeitemgroup_list)].treeitem.treerowgroups.treerowgroup_list[vl_row].treerow.treecellgroups.treecellgroup_list);
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_row].treerow.treecellgroups.treecellgroup_list[vl_cellIdxInRow].treecell := pl_xuls[i].treecell;
vl_cellCounter := vl_cellCounter + 1;
} else if(ischosen(pl_xuls[i].treechildren)) {
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list :=
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list & pl_xuls[i].treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list;
pl_row := pl_row + sizeof(pl_xuls[i].treechildren.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)
} else if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treechildren vl_embedded;
f_EPTF_UIHandler_treechildren(v_xuls_metaIteratorChildren, pl_cols,vl_embedded,pl_parentWidgetIdx, pl_row);
if (v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.iteratorUnionType == treecelliterator) {
if (sizeof(vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)>0) {
var integer vl_row := sizeof(pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)-1;
if (vl_row<0) {
vl_row := 0;
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_row] := {treerow:={{{}}}}
}
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_row].treerow.treecellgroups.treecellgroup_list :=
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[vl_row].treerow.treecellgroups.treecellgroup_list
& vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[0].treerow.treecellgroups.treecellgroup_list;
}
} else {
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list :=
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list
& vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list;
}
var integer vl_nofNewCells := 0;
if (sizeof(vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)>0) {
vl_nofNewCells := sizeof(vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[0].treerow.treecellgroups.treecellgroup_list);
}
vl_cellCounter := vl_cellCounter + vl_nofNewCells;
} else if (ischosen(pl_xuls[i].treerow)) {
var integer vl_treeIdx := -1;
var integer vl_parentIdx := pl_parentWidgetIdx;
while(vl_treeIdx == -1 and vl_parentIdx != -1){
if(v_UIHandler_guiItemList[vl_parentIdx].widgetType == wtTree){
vl_treeIdx := vl_parentIdx;
} else {
vl_parentIdx := v_UIHandler_guiItemList[vl_parentIdx].parentIdx;
}
}
var integer vl_treerowIdx := -1;
if(vl_treeIdx == -1){
f_EPTF_UIHandler_warning(%definitionId&": The tree of the treerow has not been found! " & log2str(pl_xuls[i]) );
break;
} else {
var integer vl_dummy := -1;
vl_treerowIdx := f_EPTF_UIHandler_TreeRowIdxInATree(pl_row, vl_treeIdx, vl_dummy );
if(vl_treerowIdx == -1){
f_EPTF_UIHandler_warning(%definitionId&": The treerow has not been found in the database for the tree: " & log2str(v_UIHandler_guiItemList[vl_treeIdx].id) );
break;
}
}
var EPTF_UIHandler_WidgetsList v_xuls_treerowChildren := {};
pl_row := pl_row + 1;
if(sizeof(v_UIHandler_guiItemList[vl_treerowIdx].children) > 0){
for(var integer vl_treerowchildrenIdx := 0; vl_treerowchildrenIdx < sizeof(v_UIHandler_guiItemList[vl_treerowIdx].children); vl_treerowchildrenIdx := vl_treerowchildrenIdx + 1){
if(v_UIHandler_guiItemList[v_UIHandler_guiItemList[vl_treerowIdx].children[vl_treerowchildrenIdx]].widgetType == wtTreecell){
vl_cellCounter := vl_cellCounter + 1;
v_xuls_treerowChildren := v_xuls_treerowChildren & { v_UIHandler_guiItemList[v_UIHandler_guiItemList[vl_treerowIdx].children[vl_treerowchildrenIdx]].XULformat };
} else {
var EPTF_UIHandler_WidgetsList v_xuls_treerowChildrenPlus := {};
f_EPTF_UIHandler_buildchildrenXULs(v_UIHandler_guiItemList[vl_treerowIdx].children[vl_treerowchildrenIdx], v_xuls_treerowChildrenPlus);
for(var integer vl_l := 0; vl_l < sizeof(v_xuls_treerowChildrenPlus); vl_l := vl_l + 1){
v_xuls_treerowChildren[sizeof(v_xuls_treerowChildren)] := v_xuls_treerowChildrenPlus[vl_l];
}
}
}
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Treechildren vl_embedded;
f_EPTF_UIHandler_treechildren(v_xuls_treerowChildren, pl_cols,vl_embedded,vl_treerowIdx, pl_row);
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list :=
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list
& vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list;
var integer vl_nofNewCells := 0;
if (sizeof(vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)>0) {
vl_nofNewCells := sizeof(vl_embedded.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[0].treerow.treecellgroups.treecellgroup_list);
}
vl_cellCounter := vl_cellCounter + vl_nofNewCells;
} else {
//empty row
pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list[sizeof(pl_children.treeitemgroups.treeitemgroup_list[0].treeitem.treerowgroups.treerowgroup_list)].treerow
:= pl_xuls[i].treerow;
}
} else if (ischosen(pl_xuls[i].treecol)) {
//Nothing to do
} else {
f_EPTF_UIHandler_warning(%definitionId&": Not handled widgettype! " & log2str(pl_xuls[i]) );
}
}
return;
}
private function f_EPTF_UIHandler_TreeRowIdxInATree(
in integer pl_rowToFind,
in integer pl_parentIdx,
inout integer pl_countTreeRow
)
runs on EPTF_UIHandler_Private_CT return integer{
var integer vl_treerowIdx := -1;
for(var integer vl_i := 0; vl_i < sizeof(v_UIHandler_guiItemList[pl_parentIdx].children); vl_i := vl_i + 1){
if(v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_parentIdx].children[vl_i]].widgetType == wtTreerow){
pl_countTreeRow := pl_countTreeRow + 1;
} else {
vl_treerowIdx := f_EPTF_UIHandler_TreeRowIdxInATree(pl_rowToFind, v_UIHandler_guiItemList[pl_parentIdx].children[vl_i], pl_countTreeRow);
}
if(pl_countTreeRow >= pl_rowToFind){
if(vl_treerowIdx == -1){
vl_treerowIdx := v_UIHandler_guiItemList[pl_parentIdx].children[vl_i];
}
break;
}
}
return vl_treerowIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Listitems
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to Listitems
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// pl_tcs - *out* *Listbox.listitemgroups.listitemgroup_list* - Listitems
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Listitems(
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listitemgroups pl_wl)
runs on EPTF_UIHandler_Private_CT {
pl_wl:={{}};
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].listitem)){
pl_wl.listitemgroup_list[sizeof(pl_wl.listitemgroup_list)].listitem := pl_xuls[i].listitem;
} else if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Listitemgroups vl_embedded;
f_EPTF_UIHandler_Listitems(v_xuls_metaIteratorChildren,vl_embedded);
pl_wl.listitemgroup_list := pl_wl.listitemgroup_list & vl_embedded.listitemgroup_list;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Menuitems
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to Menuitems
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// pl_tcs - *out* *ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menupopup* - Menuitems
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Menupopup(
in EPTF_UIHandler_WidgetsList pl_xuls,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menupopup pl_tcs)
runs on EPTF_UIHandler_Private_CT {
pl_tcs:={
///*iteratordata :=*/ omit,
/*menuitem_list :=*/ choice := {menuitemgroups:= {{}}}
};
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].menuitem)){
pl_tcs.choice.menuitemgroups.menuitemgroup_list[sizeof(pl_tcs.choice.menuitemgroups.menuitemgroup_list)].menuitem := pl_xuls[i].menuitem;
} else if (ischosen(pl_xuls[i].metaiterator)) {
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_widgetRecIndex(f_EPTF_UIHandler_unichar2charstring(pl_xuls[i].metaiterator.id));
var EPTF_UIHandler_WidgetsList v_xuls_metaIteratorChildren;
f_EPTF_UIHandler_buildchildrenXULs(vl_metaIteratorIdx, v_xuls_metaIteratorChildren);
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Menupopup vl_embedded;
f_EPTF_UIHandler_Menupopup(v_xuls_metaIteratorChildren,vl_embedded);
pl_tcs.choice.menuitemgroups.menuitemgroup_list := pl_tcs.choice.menuitemgroups.menuitemgroup_list & vl_embedded.choice.menuitemgroups.menuitemgroup_list;
}
}
}
type record of Valuelist Value_list_list;
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Valuelists
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to ValueLists
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
// pl_tcs - *out* *Distributionchart.valuelist_list* - DistributionchartValuelists
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Valuelists(
in EPTF_UIHandler_WidgetsList pl_xuls,
out Value_list_list pl_tcs)
runs on EPTF_UIHandler_Private_CT {
pl_tcs:={};
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].valuelist)){
pl_tcs[sizeof(pl_tcs)] := pl_xuls[i].valuelist;
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Intervallimits
//
// Purpose:
// Creates an Intervallimits structure from a stored intervallimits GUI item
//
// Parameters:
// pl_index - *in* *integer* - index of intervallimits in the GUI item list
// pl_limits - *out* *Intervallimits* - Intervallimitslist
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Intervallimits(
in integer pl_index,
out ttcn_ericsson_se_protocolModules_xtdp_xtdl.Intervallimits pl_limits)
runs on EPTF_UIHandler_Private_CT {
f_EPTF_Base_assert(%definitionId & ": Invalid index: " & int2str(pl_index), pl_index > -1 and pl_index < sizeof(v_UIHandler_guiItemList));
f_EPTF_Base_assert(%definitionId & ": Invalid widget type: ", v_UIHandler_guiItemList[pl_index].widgetType == wtIntervallimits);
pl_limits:={
//omit,
v_UIHandler_guiItemList[pl_index].id,
{ value_list := {} }
};
for (var integer i:=0; i<sizeof(v_UIHandler_guiItemList[pl_index].widgetData.distChartData.intervallimits); i:=i+1) {
pl_limits.choice.value_list[i] := v_UIHandler_guiItemList[pl_index].widgetData.distChartData.intervallimits[i];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Distributionchart
//
// Purpose:
// Creates an Intervallimits structure from a stored intervallimits GUI item
//
// Parameters:
// pl_index - *in* *integer* - index of intervallimits in the GUI item list
// pl_limits - *out* *Intervallimits* - Intervallimitslist
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Distributionchart(
in integer pl_index,
inout ttcn_ericsson_se_protocolModules_xtdp_xtdl.Distributionchart pl_distributionchart)
runs on EPTF_UIHandler_Private_CT {
f_EPTF_Base_assert(%definitionId & ": Invalid index: " & int2str(pl_index), pl_index > -1 and pl_index < sizeof(v_UIHandler_guiItemList));
//f_EPTF_Base_assert(%definitionId & ": Invalid widget type: ", v_UIHandler_guiItemList[pl_index].widgetType == wtDistributionchart);
var Widgets vl_xul;
if (sizeof(pl_distributionchart.externaldatagroups.externaldatagroup_list)==0) {
pl_distributionchart.externaldatagroups.externaldatagroup_list[0].intervallimits := {"",{value_list:= {} }};
pl_distributionchart.externaldatagroups.externaldatagroup_list[1].valuelist_list := {};
}
var integer vl_size := sizeof(v_UIHandler_guiItemList[pl_index].children);
for(var integer i := 0; i<vl_size; i := i + 1){
select(v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_index].children[i]].widgetType){
case(wtIntervallimits){
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Intervallimits vl_intervallimits_new;
f_EPTF_UIHandler_Intervallimits(v_UIHandler_guiItemList[pl_index].children[i], vl_intervallimits_new);
pl_distributionchart.externaldatagroups.externaldatagroup_list[0].intervallimits.id := vl_intervallimits_new.id;
pl_distributionchart.externaldatagroups.externaldatagroup_list[0].intervallimits.choice.value_list := pl_distributionchart.externaldatagroups.externaldatagroup_list[0].intervallimits.choice.value_list & vl_intervallimits_new.choice.value_list;
}
case(wtValuelist){
vl_xul := v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_index].children[i]].XULformat;
vl_xul.valuelist.externaldata := omit;
pl_distributionchart.externaldatagroups.externaldatagroup_list[1].valuelist_list[sizeof(pl_distributionchart.externaldatagroups.externaldatagroup_list[1].valuelist_list)] := vl_xul.valuelist;
}
case(wtMetaIterator) {
f_EPTF_UIHandler_Distributionchart(v_UIHandler_guiItemList[pl_index].children[i],pl_distributionchart);
}
case else {
f_EPTF_Base_assert(%definitionId & ": Invalid widget type: " & log2str(v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_index].children[i]].widgetType), false);
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_ImageList
//
// Purpose:
// Casting function from EPTF_UIHandler_XTDP_XML_TagList to ImageList
//
// Parameters:
// pl_xul - *in* *EPTF_UIHandler_XTDP_XML_TagList* - union type of possible gui items
//
// Return Value:
// DistributionchartValuelists
///////////////////////////////////////////////////////////
/* private function f_EPTF_UIHandler_ImageList(in EPTF_UIHandler_XTDP_XML_TagList pl_xuls) runs on EPTF_UIHandler_Private_CT
return ImageList {
var ImageList tcs:={};
for (var integer i:=0;i<sizeof(pl_xuls);i:=i+1){
if (ischosen(pl_xuls[i].xtdp_image)){
tcs[sizeof(tcs)] := pl_xuls[i].xtdp_image;
}
}
return tcs;
}*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_buildchildrenXUL
//
// Purpose:
// Builds a tree, that is supposed to be the given widget's children.
//
// Parameters:
// pl_index - *in* <integer> - index in GuiRecItem
// pl_xul - *out* <Widgets> - XTDP_XML_Tag
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_buildchildrenXUL(
in integer pl_index,
out Widgets pl_xul,
in boolean pl_processMetaIterator := false)
runs on EPTF_UIHandler_Private_CT
{
//action("***f_EPTF_UIHandler_buildchildrenXUL: v_UIHandler_guiItemList[",pl_index,"]", v_UIHandler_guiItemList[pl_index]);
// SJZ 2012.11.20 Kill all externaldata from the outgoing xul (if new parameter tells so),
//CR_TR00019705 as the XULformat contains externaldatas and gui does not want to get it,
// make a children recursively: produce the children and with typeselection, place it childrens
pl_xul := {separator := { id := "This in an unknown widget!" } };
var EPTF_UIHandler_WidgetsList v_xuls := {};
if (not ispresent(v_UIHandler_guiItemList[pl_index].XULformat)) {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": XUL format ommitted, ignoring this subtree!");
}
} else {
pl_xul := v_UIHandler_guiItemList[pl_index].XULformat;
f_EPTF_UIHandler_buildchildrenXULs(pl_index, v_xuls, pl_processMetaIterator);
}
select(v_UIHandler_guiItemList[pl_index].widgetType){
case(wtWindow){
f_EPTF_UIHandler_warning(%definitionId&": Too many windows present in database!");
}
case (wtTabpages){
f_EPTF_UIHandler_tabpagegroups(v_xuls,pl_xul.tabpages.tabpagegroups);
}
case (wtTabpage) {
f_EPTF_UIHandler_embeddedwidgets(v_xuls, pl_xul.tabpage.embeddedwidgets);
}
case (wtHbox){
f_EPTF_UIHandler_embeddedwidgets(v_xuls, pl_xul.hbox.embeddedwidgets);
}
case (wtChart){
f_EPTF_UIHandler_TraceList(pl_index, v_xuls, pl_xul.chart.tracegroups);
}
case (wtToolbar) {
var ttcn_ericsson_se_protocolModules_xtdp_xtdl.Toolbarelements toolbarElements;
f_EPTF_UIHandler_Toolbarelements(v_xuls, toolbarElements);
// v_xul.toolbar.toolbarelements :=
for (var integer i := 0; i < sizeof(toolbarElements.toolbarelement_list); i := i + 1) {
if (ischosen(toolbarElements.toolbarelement_list[i].choice.toolbarbutton)) {
pl_xul.toolbar.choice_list[i].toolbarbutton := toolbarElements.toolbarelement_list[i].choice.toolbarbutton;
} else if (ischosen(toolbarElements.toolbarelement_list[i].choice.pushbutton)) {
pl_xul.toolbar.choice_list[i].pushbutton := toolbarElements.toolbarelement_list[i].choice.pushbutton;
} else if (ischosen(toolbarElements.toolbarelement_list[i].choice.togglebutton)) {
pl_xul.toolbar.choice_list[i].togglebutton := toolbarElements.toolbarelement_list[i].choice.togglebutton;
}else {
pl_xul.toolbar.choice_list[i].separator := toolbarElements.toolbarelement_list[i].choice.separator;
}
}
}
case (wtTree){
f_EPTF_UIHandler_Treecols(v_xuls, pl_xul.tree.treecols);
var integer vl_dummy := 0;
f_EPTF_UIHandler_treechildren(v_xuls, sizeof(pl_xul.tree.treecols.treecolgroups.treecolgroup_list),pl_xul.tree.treechildren, pl_index, vl_dummy);
}
case (wtListbox){
f_EPTF_UIHandler_Listitems(v_xuls, pl_xul.listbox.listitemgroups);
}
case (wtMenulist){
f_EPTF_UIHandler_Menupopup(v_xuls, pl_xul.menulist.menupopup);
}
case (wtDistributionchart){
f_EPTF_UIHandler_Distributionchart(pl_index, pl_xul.distributionchart);
}
case (wtMetaIterator) {
// if metaiterator is kept, it will be replaced inside f_EPTF_UIHandler_treechildren, f_EPTF_UIHandler_Listitems etc under the other cases
}
case else{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": This widget has no children: "&log2str(v_UIHandler_guiItemList[pl_index]));
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_buildchildrenXULs
//
// Purpose:
// Builds a list of the given widget's childrens
//
// Parameters:
// pl_index - *in* <integer> - index in GuiRecItem
// pl_xuls - *out* <EPTF_UIHandler_WidgetsList>
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_buildchildrenXULs(
in integer pl_index,
out EPTF_UIHandler_WidgetsList pl_xuls,
in boolean pl_processMetaIterator := false)
runs on EPTF_UIHandler_Private_CT {
pl_xuls := {};
if(pl_processMetaIterator) {
var EPTF_IntegerList vl_nonMetaChildren := f_EPTF_UIHandler_getNonMetaChildren(pl_index);
for (var integer i:=0;i<sizeof(vl_nonMetaChildren);i:=i+1){
f_EPTF_UIHandler_buildchildrenXUL(vl_nonMetaChildren[i], pl_xuls[i], true);
}
}
else {
for (var integer i:=0;i<sizeof(v_UIHandler_guiItemList[pl_index].children);i:=i+1){
f_EPTF_UIHandler_buildchildrenXUL(v_UIHandler_guiItemList[pl_index].children[i], pl_xuls[i]);
}
}
//action("***DONE processing children of v_UIHandler_guiItemList[",pl_index,"]: ", v_UIHandler_guiItemList[pl_index]);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_buildXUL
//
// Purpose:
// Builds the whole XUL tree, that describes the layout of the GUI.
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_buildXUL(
out Widgets pl_xul,
in boolean pl_imageNeeded := true)
runs on EPTF_UIHandler_Private_CT {
// ONLY ONE WINDOW SUPPORTED, THAT CONAINS ALL THE WIDGETS.
if (0 == sizeof(v_UIHandler_guiItemList))
{
f_EPTF_UIHandler_error("No window in GuiItemList!");
}
pl_xul := v_UIHandler_guiItemList[v_UIHandler_windowIndex].XULformat;
var EPTF_UIHandler_WidgetsList xuls;
f_EPTF_UIHandler_buildchildrenXULs(v_UIHandler_windowIndex, xuls);
f_EPTF_UIHandler_embeddedwidgets(xuls, pl_xul.window.embeddedwidgets);
if(pl_imageNeeded){
for ( var integer i := 0; i < sizeof(xuls) ; i := i+1 )
{
if (ischosen(xuls[i].image)) {
var boolean vl_idx := false;
for ( var integer j := 0; j < sizeof(pl_xul.window.image_list) ; j := j+1 )
{
if(pl_xul.window.image_list[j].id == xuls[i].image.id){vl_idx := true;}
}
if(not vl_idx){
pl_xul.window.image_list[sizeof(pl_xul.window.image_list)] := xuls[i].image;
}
}
}
} else {
pl_xul.window.image_list := {}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromWindow
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_window - *inout* *Windowtype* - possible window items (tabbox, hbox)
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromWindow(
inout Windowtype pl_window,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean {
pl_widgetExists := false;
if (pl_window.id == "") {
return false;
}
pl_window.id := f_EPTF_UIHandler_setWidgetID(pl_window.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_window.id);
v_UIHandler_windowIndex := f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtWindow,
omit,
-1,
{},
omit,
{window := f_EPTF_UIHandler_deleteChildrenFromWindow(pl_window)}, false},pl_widgetExists);
if(-1 == v_UIHandler_windowIndex){
return false;
}
var boolean bool:=true;
for ( var integer i := 0; i < sizeof(pl_window.image_list) ; i := i+1 ) {
bool := f_EPTF_UIHandler_appendImage(pl_window.image_list[i], v_UIHandler_windowIndex, pl_widgetExists)
}
if (0 != sizeof(pl_window.embeddedwidgets.embeddedwidget_list) ) {
bool := f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(pl_window.embeddedwidgets, v_UIHandler_windowIndex,pl_widgetExists);
}
return bool;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromWidgetList
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widgets and their children to the GUI item list
//
// Parameters:
// pl_widgets - *in* *WidgetList* - possible widgetList items (tabbox, tree, hbox, textlabel, spacer, button, textbox)
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
//
// Return Value:
// -
//
// Errors:
// none
//
// Detailed Comments:
// Check when a new widget type has been added
//
///////////////////////////////////////////////////////////
/* private function f_EPTF_UIHandler_appendAllWidgetIdsFromWidgetList(
in EPTF_UIHandler_WidgetList pl_widgets,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var boolean vl_ret := true;
var integer maxIndex := sizeof(pl_widgets);
for (var integer vl_i:=0; (vl_i < maxIndex) and vl_ret; vl_i := vl_i+1 ) {
select(pl_widgets[vl_i]){
case ({tabbox := ?}){
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTabbox(pl_widgets[vl_i].tabbox, pl_parentIdx, pl_widgetExists);
}
case ({tree := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTree(pl_widgets[vl_i].tree, pl_parentIdx, pl_widgetExists);
}
case ({hbox := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromHbox(pl_widgets[vl_i].hbox, pl_parentIdx, pl_widgetExists);
}
case ({label_ := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendLabel(pl_widgets[vl_i].label_,pl_parentIdx, pl_widgetExists);
}
case ({spacer := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendSpacer(pl_widgets[vl_i].spacer,pl_parentIdx, pl_widgetExists);
}
case ({button := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendButton(pl_widgets[vl_i].button,pl_parentIdx, pl_widgetExists);
}
case ({textbox := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendTextbox(pl_widgets[vl_i].textbox,pl_parentIdx, pl_widgetExists);
}
case( {chart := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendChart(pl_widgets[vl_i].chart,pl_parentIdx, pl_widgetExists);
}
case({toolbar := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendToolbar(pl_widgets[vl_i].toolbar,pl_parentIdx, pl_widgetExists);
}
case({toolbarbutton := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendToolbarbutton(pl_widgets[vl_i].toolbarbutton,pl_parentIdx, pl_widgetExists);
}
case({listbox := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendListbox(pl_widgets[vl_i].listbox,pl_parentIdx, pl_widgetExists);
}
case({numericalwidget := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendNumericalwidget(pl_widgets[vl_i].numericalwidget,pl_parentIdx, pl_widgetExists);
}
case({menulist := ?}) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendMenulist(pl_widgets[vl_i].menulist,pl_parentIdx, pl_widgetExists);
}
case ({distributionchart := ?}){
vl_ret := vl_ret and f_EPTF_UIHandler_appendDistributionchart(pl_widgets[vl_i].distributionchart,pl_parentIdx, pl_widgetExists);
}
case else {
f_EPTF_UIHandler_warning("Unhandled widget type!");
// f_EPTF_Base_stop();
}
}
}
return vl_ret;
}*/
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widgets and their children to the GUI item list
//
// Parameters:
// pl_widgets - *in* *WidgetList* - possible widgetList items (tabbox, tree, hbox, textlabel, spacer, button, textbox)
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
//
// Return Value:
// -
//
// Errors:
// none
//
// Detailed Comments:
// Check when a new widget type has been added
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(
in Embeddedwidgets pl_widgets,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var boolean vl_ret := true;
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": In widgets incoming: " & log2str(pl_widgets));
}
var integer vl_embeddedwidget_list_size := sizeof(pl_widgets.embeddedwidget_list);
for(var integer vl_i:=0; vl_i < vl_embeddedwidget_list_size and vl_ret; vl_i := vl_i + 1){
if(ischosen(pl_widgets.embeddedwidget_list[vl_i].iterator)) {
vl_ret := vl_ret and f_EPTF_UIHandler_Config_processIterator( pl_widgets.embeddedwidget_list[vl_i], pl_parentIdx, true, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].externalvalue)) {
vl_ret := vl_ret and f_EPTF_UIHandler_Config_processIterator( pl_widgets.embeddedwidget_list[vl_i], pl_parentIdx, true, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].tabpages)){
//vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTabbox(pl_widgets.embeddedwidget_list[vl_i].tabbox, pl_parentIdx, pl_widgetExists);
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTabpages(pl_widgets.embeddedwidget_list[vl_i].tabpages, pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].tree)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTree(pl_widgets.embeddedwidget_list[vl_i].tree, pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].hbox)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromHbox(pl_widgets.embeddedwidget_list[vl_i].hbox, pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].label_)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendLabel(pl_widgets.embeddedwidget_list[vl_i].label_,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].spacer)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendSpacer(pl_widgets.embeddedwidget_list[vl_i].spacer,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].button)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendButton(pl_widgets.embeddedwidget_list[vl_i].button,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].textbox)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendTextbox(pl_widgets.embeddedwidget_list[vl_i].textbox,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].chart)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendChart(pl_widgets.embeddedwidget_list[vl_i].chart,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].toolbar)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendToolbar(pl_widgets.embeddedwidget_list[vl_i].toolbar,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].listbox)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendListbox(pl_widgets.embeddedwidget_list[vl_i].listbox,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].numericalwidget)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendNumericalwidget(pl_widgets.embeddedwidget_list[vl_i].numericalwidget,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].menulist)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendMenulist(pl_widgets.embeddedwidget_list[vl_i].menulist,pl_parentIdx, pl_widgetExists);
}
else if (ischosen(pl_widgets.embeddedwidget_list[vl_i].distributionchart)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendDistributionchart(pl_widgets.embeddedwidget_list[vl_i].distributionchart,pl_parentIdx, pl_widgetExists);
}
else if (ischosen(pl_widgets.embeddedwidget_list[vl_i].pushbutton)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendPushbutton(pl_widgets.embeddedwidget_list[vl_i].pushbutton,pl_parentIdx, pl_widgetExists);
}
else if (ischosen(pl_widgets.embeddedwidget_list[vl_i].togglebutton)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendTogglebutton(pl_widgets.embeddedwidget_list[vl_i].togglebutton,pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_widgets.embeddedwidget_list[vl_i].htmlcode)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendHtmlcode(pl_widgets.embeddedwidget_list[vl_i].htmlcode,pl_parentIdx, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Unhandled widget type!");
// f_EPTF_Base_stop();
}
}
return vl_ret;
}
//To make WidgetId optional
type record XULWidgetId{
universal charstring widgetId optional
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XULWidgetId2charstr
//
// Purpose:
// Converts a widget ID to a charstring
//
// Detailed Comments:
// In the XUL structures the widget ID is universal charstring. It must be changed to charstring.
// There are cases when the ID of widgets is optional. In order to handle easier it
// has to be changed to an empty string.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XULWidgetId2charstr(in XULWidgetId pl_id)
return charstring{
if(ispresent(pl_id.widgetId)){
if (lengthof(pl_id.widgetId)==0) {return ""}
return f_EPTF_UIHandler_unichar2charstring(pl_id.widgetId);
}else{
return "";
}
}
friend function f_EPTF_UIHandler_unichar2charstring(in universal charstring pl_uni)
return charstring{
var charstring vl_char := "";
for (var integer vl_i:= 0;vl_i<lengthof(pl_uni);vl_i:=vl_i+1)
{
vl_char := vl_char & int2char(unichar2int(pl_uni[vl_i]));
}
return vl_char
}
friend function f_EPTF_UIHandler_setWidgetID(in template universal charstring pl_id)
runs on EPTF_UIHandler_Private_CT
return universal charstring{
if(not isvalue(pl_id) or 0 == lengthof(pl_id)){
return f_EPTF_UIHandler_getrandomid();
}
var integer vl_idx;
var boolean vl_isexisting := (valueof(pl_id) != "" and f_EPTF_str2int_HashMap_Find(v_UIHandler_widgetHashMapId, f_EPTF_UIHandler_unichar2charstring(valueof(pl_id)), vl_idx));
if(vl_isexisting == true){ // old -1 != vl_prevIdx
if(v_UIHandler_customGUIProcess){
//: need to handle in XML process
//if(v_UIHandler_iteratorChangeInProgress == true){
var charstring vl_storeOrigId := f_EPTF_UIHandler_unichar2charstring(valueof(pl_id));
//generaljunk idt.
var universal charstring vl_unichar := f_EPTF_UIHandler_getrandomid();
f_EPTF_UIHandler_warning(%definitionId&": Wrong widget ID: "& vl_storeOrigId & ". It is already in use. The new widget created by an iterator is renamed to: " & f_EPTF_UIHandler_unichar2charstring(vl_unichar) &". In order to avoid any problems please rename the widget in your customgui xml file.");
return vl_unichar;
// }
}
}
return valueof(pl_id);
}
//Gets the widgetId
friend function f_EPTF_UIHandler_getWidgetID(in Widgets pl_widget, out charstring pl_widgetId)
runs on EPTF_UIHandler_Private_CT
return boolean{
if(ischosen(pl_widget.window)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.window.id);
return true;
}
else if(ischosen(pl_widget.iterator )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.iterator.id);
return true;
}
else if(ischosen(pl_widget.externalvalue )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.externalvalue.id);
return true;
}
else if(ischosen(pl_widget.treecol )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.treecol.id);
return true;
}
else if(ischosen(pl_widget.treecell )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.treecell.id);
return true;
}
else if(ischosen(pl_widget.trace )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.trace.id);
return true;
}
else if(ischosen(pl_widget.toolbarbutton )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.toolbarbutton.id);
return true;
}
else if(ischosen(pl_widget.tabpage )) {
if(ispresent(pl_widget.tabpage.id)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.tabpage.id);
} else {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(f_EPTF_UIHandler_getrandomid());
}
return true;
}
else if(ischosen(pl_widget.listitem )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.listitem.id);
return true;
}
else if(ischosen(pl_widget.menuitem )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.menuitem.id);
return true;
}
else if(ischosen(pl_widget.distributionchart )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.distributionchart.id);
return true;
}
else if(ischosen(pl_widget.valuelist )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.valuelist.id);
return true;
}
else if(ischosen(pl_widget.image )) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.image.id);
return true;
}
else if(ischosen(pl_widget.tabpages)){
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.tabpages.id);
return true;
}
else if(ischosen(pl_widget.tree)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.tree.id);
return true;
}
else if(ischosen(pl_widget.hbox)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.hbox.id);
return true;
}
else if(ischosen(pl_widget.label_)) {
if(ispresent(pl_widget.label_.id) and pl_widget.label_.id != omit) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.label_.id);
} else {
pl_widgetId := "";
}
return true;
}
else if(ischosen(pl_widget.spacer)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.spacer.id);
return true;
}
else if(ischosen(pl_widget.button)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.button.id);
return true;
}
else if(ischosen(pl_widget.textbox)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.textbox.id);
return true;
}
else if(ischosen(pl_widget.chart)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.chart.id);
return true;
}
else if(ischosen(pl_widget.toolbar)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.toolbar.id);
return true;
}
else if(ischosen(pl_widget.listbox)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.listbox.id);
return true;
}
else if(ischosen(pl_widget.numericalwidget)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.numericalwidget.id);
return true;
}
else if(ischosen(pl_widget.menulist)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.menulist.id);
return true;
}
else if (ischosen(pl_widget.distributionchart)){
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.distributionchart.id);
return true;
}
else if (ischosen(pl_widget.pushbutton)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.pushbutton.id);
return true;
}
else if (ischosen(pl_widget.togglebutton)) {
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.togglebutton.id);
return true;
}
else if(ischosen(pl_widget.treerow )) {
pl_widgetId := "";
return true;
}
else if(ischosen(pl_widget.toolbarelements )) {
pl_widgetId := "";
return true;
}
else if(ischosen(pl_widget.tracelist )) {
pl_widgetId := "";
return true;
}
else if(ischosen(pl_widget.treecols )) {
pl_widgetId := "";
return true;
}
else if(ischosen(pl_widget.treechildren )) {
pl_widgetId := "";
return true;
}
else if(ischosen(pl_widget.treeitem )) {
pl_widgetId := "";
return true;
}
else if(ischosen(pl_widget.separator )) {
if(ispresent(pl_widget.separator.id)){
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.separator.id);
} else {
pl_widgetId := "";
}
return true;
}
else if(ischosen(pl_widget.htmlcode )) {
if(ispresent(pl_widget.htmlcode.id)){
pl_widgetId := f_EPTF_UIHandler_unichar2charstring(pl_widget.htmlcode.id);
} else {
pl_widgetId := "";
}
return true;
} else {
f_EPTF_UIHandler_warning(%definitionId&": Unhandled widget type! : "&log2str(pl_widget));
// f_EPTF_Base_stop();
}
return false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getrandomid
//
// Purpose:
// Returns a generated unique widget ID. See also <c_EPTF_UIHandler_widgetIdPrefix>
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getrandomid(in boolean pl_notVisible := false)
runs on EPTF_UIHandler_Private_CT
return universal charstring {
var charstring vl_id;
if(pl_notVisible){
vl_id := c_EPTF_UIHandler_notVisibleWidgetIdPrefix & int2str(v_EPTF_UIHandler_generatedNotVisibleIdCounter);
v_EPTF_UIHandler_generatedNotVisibleIdCounter := v_EPTF_UIHandler_generatedNotVisibleIdCounter + 1;
} else {
vl_id := c_EPTF_UIHandler_widgetIdPrefix & int2str(v_EPTF_UIHandler_generatedIdCounter);
v_EPTF_UIHandler_generatedIdCounter := v_EPTF_UIHandler_generatedIdCounter + 1;
}
return vl_id;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTabpages
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_tabpages - *in* *Tabpages* - possible tabpages items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTabpages(
inout Tabpages pl_tabpages,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_tabpages.id := f_EPTF_UIHandler_setWidgetID(pl_tabpages.id)
var charstring tabpagesid := f_EPTF_UIHandler_unichar2charstring(pl_tabpages.id)
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
tabpagesid,
wtTabpages,
omit,
pl_parentIdx,
{},
omit,
{tabpages := f_EPTF_UIHandler_deleteChildrenFromTabpages(pl_tabpages)}, false}, pl_widgetExists);
if(-1 != vl_idx){
// Call children...
//******************************************************************
return f_EPTF_UIHandler_appendAllWidgetIdsFromTabpagegroup_list(pl_tabpages.tabpagegroups.tabpagegroup_list, vl_idx, pl_widgetExists)
}
return false;
}
private type union EPTF_UIHandler_TabpanelsParentId{
integer tabBoxIdx,
//integer tabIdxInTabs,
integer tabIdx
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTabpages
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_tabpages - *in* <Tabpages> - possible tabpages items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTabpagegroup_list(
inout Tabpagegroups.tabpagegroup_list pl_tabpagegroup_list,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean {
pl_widgetExists := false;
var boolean vl_ret := true;
//var EPTF_UIHandler_HandledWidgetType vl_parentType := v_UIHandler_guiItemList[pl_parentIdx].widgetType;
var integer i:=0;
var integer vl_tabpagegroup_list_size := sizeof(pl_tabpagegroup_list);
while ( isbound(pl_tabpagegroup_list) and (i < vl_tabpagegroup_list_size) and vl_ret )
{
if (ischosen(pl_tabpagegroup_list[i].tabpage)){
//: GIKXLZ, vl_ret change
f_EPTF_UIHandler_appendAllWidgetIdsFromTabpage(pl_tabpagegroup_list[i].tabpage, pl_parentIdx, pl_widgetExists);
}
else if (ischosen(pl_tabpagegroup_list[i].iterator)){
f_EPTF_UIHandler_Config_processTabpageiterator(pl_tabpagegroup_list[i], pl_parentIdx, true, pl_widgetExists)
}
else if (ischosen(pl_tabpagegroup_list[i].externalvalue)){
f_EPTF_UIHandler_Config_processTabpageiterator(pl_tabpagegroup_list[i], pl_parentIdx, true, pl_widgetExists)
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_tabpagegroup_list[i]));
vl_ret := false;
}
i := i + 1;
} //for
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromExternaldatagroup_list
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_tabpages - *in* <Tabpages> - possible tabpages items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromExternaldatagroup_list(
in Externaldatagroups.externaldatagroup_list pl_externaldatagroup_list,
in integer pl_parentIdx,
inout boolean pl_widgetExists,
inout Distributionchart pl_xul)
runs on EPTF_UIHandler_Private_CT
return boolean {
pl_widgetExists := false;
var boolean vl_ret := true;
var integer vl_treeitems_size := sizeof(pl_externaldatagroup_list);
for(var integer i := 0; i < vl_treeitems_size and vl_ret; i := i + 1 ){
if (ischosen(pl_externaldatagroup_list[i].valuelist_list)){
for(var integer j := 0; j <sizeof(pl_externaldatagroup_list[i].valuelist_list); j := j + 1) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendValuelist(pl_externaldatagroup_list[i].valuelist_list[j], pl_parentIdx, pl_widgetExists);
//pl_xul.valuelist_list[sizeof(pl_xul.valuelist_list)] := pl_externaldatagroup_list[i].valuelist_list[j];
}
}
else if (ischosen(pl_externaldatagroup_list[i].iterator)){
f_EPTF_UIHandler_Config_processValueListiterator(pl_externaldatagroup_list[i], pl_xul, pl_parentIdx, true, pl_widgetExists)
}
else if (ischosen(pl_externaldatagroup_list[i].externalvalue)){
f_EPTF_UIHandler_Config_processValueListiterator(pl_externaldatagroup_list[i], pl_xul, pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_Base_assert(%definitionId & ": Invalid element to be added: " & log2str(pl_externaldatagroup_list[i]), false);
vl_ret := false;
}
} //for
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTabpage
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_tabpage - *in* <Tabpage> - possible tabpage items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTabpage(
inout Tabpage pl_tabpage,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean {
pl_widgetExists := false;
var boolean vl_ret := true;
var integer vl_tabPage_id;
if(v_UIHandler_guiItemList[pl_parentIdx].widgetType == wtTabpage) {
v_UIHandler_guiItemList[pl_parentIdx].XULformat.tabpage.maxheight := pl_tabpage.maxheight;
v_UIHandler_guiItemList[pl_parentIdx].XULformat.tabpage.orientation := pl_tabpage.orientation;
var Embeddedwidgets e_widgets := pl_tabpage.embeddedwidgets;
pl_tabpage := v_UIHandler_guiItemList[pl_parentIdx].XULformat.tabpage;
pl_tabpage.embeddedwidgets := e_widgets;
vl_tabPage_id := pl_parentIdx;
if (0 != sizeof(pl_tabpage.embeddedwidgets.embeddedwidget_list )) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(pl_tabpage.embeddedwidgets, vl_tabPage_id, pl_widgetExists);
}
} else if( v_UIHandler_guiItemList[pl_parentIdx].widgetType == wtWindow){
vl_tabPage_id := f_EPTF_UIHandler_appendTabPage(pl_tabpage, pl_parentIdx, pl_widgetExists);
if (0 != sizeof(pl_tabpage.embeddedwidgets.embeddedwidget_list )) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(pl_tabpage.embeddedwidgets, pl_parentIdx, pl_widgetExists);
}
} else {
vl_tabPage_id := f_EPTF_UIHandler_appendTabPage(pl_tabpage, pl_parentIdx, pl_widgetExists);
if (0 != sizeof(pl_tabpage.embeddedwidgets.embeddedwidget_list )) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(pl_tabpage.embeddedwidgets, vl_tabPage_id, pl_widgetExists);
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTree
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widgets and their children to the GUI item list
//
// Parameters:
// pl_tree - *in* <Tree> - possible tree items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTree(
in Tree pl_tree,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": "&log2str(pl_tree));
}
pl_widgetExists := false;
var boolean vl_ret := false;
var Tree vl_xtdpTree := f_EPTF_UIHandler_deleteChildrenFromTree(pl_tree);
vl_xtdpTree.rows := 0.0; // initially tree doesn't have rows in the counter. This counter is incremented in f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups
pl_tree.id := f_EPTF_UIHandler_setWidgetID(pl_tree.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec(
{
/*id*/ f_EPTF_UIHandler_unichar2charstring(pl_tree.id),
/*widgetType*/wtTree,
/*widgetDataType*/omit,
/*parentIdx*/pl_parentIdx,
/*children*/{},
/*widgetData*/{treeData := {{},0}},
/*XULformat*/{tree := vl_xtdpTree},
/*xuldisabled*/false
},
pl_widgetExists);
if(-1 != vl_idx ){
// Calling children...
if(f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols(pl_tree.treecols.treecolgroups.treecolgroup_list, vl_idx, pl_widgetExists)){
//Treechildren
vl_ret := f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups(pl_tree.treechildren.treeitemgroups.treeitemgroup_list, vl_idx, pl_widgetExists);
// if not enough row is defined, append empty rows to the tree
var integer vl_rowNum := 0;
if(ispresent(pl_tree.rows)) {
vl_rowNum := float2int(pl_tree.rows);
}
for (var integer i:= float2int(v_UIHandler_guiItemList[vl_idx].XULformat.tree.rows); i<vl_rowNum; i := i+1) {
var Treerow vl_UIHandler_XSD_emptyTreeRow := c_UIHandler_XSD_emptyTreeRow;
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(vl_UIHandler_XSD_emptyTreeRow.treecellgroups.treecellgroup_list, vl_idx, pl_widgetExists);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Empty row added to tree since not enough rows specified");
}
}
//if(float2int(v_UIHandler_guiItemList[vl_idx].XULformat.tree.rows)<vl_rowNum){
v_UIHandler_guiItemList[vl_idx].XULformat.tree.rows := int2float(vl_rowNum);
//}
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendTreecol
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_col - *in* <Treecol> - tree column item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendTreecol(
in Treecol pl_col,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return integer{
pl_widgetExists := false;
pl_col.id := f_EPTF_UIHandler_setWidgetID(pl_col.id);
pl_col.id := f_EPTF_UIHandler_setWidgetID(pl_col.id);
var charstring tid := f_EPTF_UIHandler_unichar2charstring(pl_col.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec(
{
tid,
wtTreecol,
pl_col.widgetType,
pl_parentIdx,
{},
omit,
{treecol := pl_col},
false
},
pl_widgetExists
//It has no reason. The default value appends to the end.
/*,
sizeof(v_UIHandler_guiItemList[pl_parentIdx].widgetData.treeData.columns)*/
);
if(-1 != vl_idx){
var integer vl_nonMetaParentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(pl_parentIdx);
f_EPTF_UIHandler_addIdx2IdxList(v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns, vl_idx);
// add new empty cell to the end of every row
var integer vl_rowNum := float2int(v_UIHandler_guiItemList[vl_nonMetaParentIdx].XULformat.tree.rows);
//var integer vl_colNum := sizeof(v_UIHandler_guiItemList[pl_parentIdx].widgetData.treeData.columns);
var EPTF_UIHandler_GuiItemRec vl_emptyCell := {
"",
wtTreecell,
pl_col.widgetType,
pl_parentIdx,
{},
{cellData := {vl_idx,omit}},
{treecell := c_UIHandler_XSD_emptyTreeCell},
false
}
var integer vl_cellIdx;
var boolean vl_dummy;
var integer vl_col := sizeof(v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns)-1;
for ( var integer i := 0; i < vl_rowNum ; i := i+1 ) {
// create emplty cell with proper id and insert to its own place
vl_emptyCell.id := f_EPTF_UIHandler_unichar2charstring(f_EPTF_UIHandler_getrandomid());
vl_emptyCell.XULformat.treecell.id := vl_emptyCell.id;
vl_cellIdx := f_EPTF_UIHandler_addWidgetRec(vl_emptyCell, vl_dummy/*, i * vl_colNum + vl_colNum - 1 + vl_colNum*/);
v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells + 1;
}
// FIXME
// if(vl_col > 0){
// //rearrange the childrenList in the tree
// var EPTF_IntegerList vl_newChildrenList := {};
// var integer vl_nofChildren := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells;
// vl_col := vl_col +1;
// var integer vl_ptr1 := -1; //it goes from the start
// var integer vl_ptr2 := vl_nofChildren - vl_rowNum - 2; //it goes from the new column
// var integer vl_ptr3 := vl_ptr1;
// for ( var integer i := 0; i < vl_nofChildren ; i := i+1 )
// {
// if (i mod vl_col == vl_col-1) {
// vl_ptr2 := vl_ptr2 + 1;
// vl_ptr3 := vl_ptr2;
// } else {
// vl_ptr1:= vl_ptr1 +1;
// vl_ptr3 := vl_ptr1;
// }
// vl_newChildrenList[i] := v_UIHandler_guiItemList[vl_nonMetaParentIdx].children[vl_ptr3];
// }
// v_UIHandler_guiItemList[vl_nonMetaParentIdx].children := vl_newChildrenList;
// }
}
return vl_idx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_cols - *in* <Treecols> - possible tree coloumn items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols(
inout Treecolgroups.treecolgroup_list pl_cols,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var boolean vl_ret := true;
var integer vl_cols_size := sizeof(pl_cols);
for (var integer i:=0; i < vl_cols_size and vl_ret; i := i+ 1 ){
if (ischosen(pl_cols[i].treecol)){
vl_ret := vl_ret and (-1 != f_EPTF_UIHandler_appendTreecol(pl_cols[i].treecol, pl_parentIdx, pl_widgetExists));
}
else if (ischosen(pl_cols[i].iterator)){
f_EPTF_UIHandler_Config_processTreecoliterator(pl_cols[i], pl_parentIdx, true, pl_widgetExists);
//The iterator processed and replaced with its represented data.
//Let's process them. Therefore don't increment the position
}
else if (ischosen(pl_cols[i].externalvalue)){
f_EPTF_UIHandler_Config_processTreecoliterator(pl_cols[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_cols[i]));
vl_ret := false;
}
} //for
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_list - *in* <Treechildren> - possible tree items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups(
in Treeitemgroups.treeitemgroup_list pl_treeitems,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": "&log2str(pl_treeitems))
}
pl_widgetExists := false;
var boolean vl_ret := true;
var integer vl_treeitems_size := sizeof(pl_treeitems);
for(var integer i := 0; i < vl_treeitems_size and vl_ret; i := i + 1 ){
if (ischosen(pl_treeitems[i].treeitem)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups(pl_treeitems[i].treeitem.treerowgroups.treerowgroup_list, pl_parentIdx, pl_widgetExists);
}
else if (ischosen(pl_treeitems[i].iterator)){
f_EPTF_UIHandler_Config_processTreeItemiterator(pl_treeitems[i], pl_parentIdx, true, pl_widgetExists);
}
else if (ischosen(pl_treeitems[i].externalvalue)){
f_EPTF_UIHandler_Config_processTreeItemiterator(pl_treeitems[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_treeitems[i]));
vl_ret := false;
}
} //for
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups
//
// Purpose:
// before sending XTDP_AddRequests out this function appends Treeitem typed widgetIds
// from request to string list of current runtime GUI widgetIds
//
// Parameters:
// pl_treeitem - *in* <Treeitem> - possible tree items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups(
inout Treerowgroups.treerowgroup_list pl_treerowgroups,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var integer vl_nonMetaParentIdx := f_EPTF_UIHandler_getTreeIdx(pl_parentIdx);
var integer vl_treedataColumns := sizeof(v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns);
var boolean vl_ret := true;
var integer pl_treerowgroups_size := sizeof(pl_treerowgroups);
for(var integer i := 0; i < pl_treerowgroups_size and vl_ret; i := i + 1 ){
if (ischosen(pl_treerowgroups[i].treerow)){
var integer vl_treerowIdx := f_EPTF_UIHandler_appendTreeRow(pl_parentIdx, pl_widgetExists);
vl_ret := vl_ret and f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(pl_treerowgroups[i].treerow.treecellgroups.treecellgroup_list, vl_treerowIdx, pl_widgetExists);
// increment rowsize of tree
if(ispresent(v_UIHandler_guiItemList[vl_nonMetaParentIdx].XULformat.tree.rows)) {
v_UIHandler_guiItemList[vl_nonMetaParentIdx].XULformat.tree.rows := v_UIHandler_guiItemList[vl_nonMetaParentIdx].XULformat.tree.rows + 1.0;
} else {
v_UIHandler_guiItemList[vl_nonMetaParentIdx].XULformat.tree.rows := 1.0;
}
}
else if (ischosen(pl_treerowgroups[i].iterator)){
f_EPTF_UIHandler_Config_processTreerowiterator(pl_treerowgroups[i], pl_parentIdx, true, pl_widgetExists);
}
else if (ischosen(pl_treerowgroups[i].externalvalue)){
f_EPTF_UIHandler_Config_processTreerowiterator(pl_treerowgroups[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_Base_assert(%definitionId&": Invalid element to be added: "&log2str(pl_treerowgroups[i]),false);
vl_ret := false;
}
} //for
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendCell
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_treecell - *in* <Treecell> - possible tree items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
// pl_columnsIdx - *in* *integer* the idx of the column in v_UIHandler_guiItemList[pl_parentIdx].widgetData.treeData.columns.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendCell(
inout Treecell pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists,
in integer pl_columnsIdx
) runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
//Check the column count
var integer vl_nonMetaParentIdx := f_EPTF_UIHandler_getTreeIdx(pl_parentIdx);
var integer vl_treedataColumns := sizeof(v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns);
if(0 == vl_treedataColumns){
f_EPTF_UIHandler_warning("There are no columns in the tree!");
return false;
}
if(vl_treedataColumns<= pl_columnsIdx){
f_EPTF_UIHandler_error("There are less columns ("&
int2str(vl_treedataColumns)&
")in the tree '"&
v_UIHandler_guiItemList[vl_nonMetaParentIdx].id&"' than cells.");
return false;
}
//get the row idx from the tree xulformat
//var integer vl_currentRow := float2int(v_UIHandler_guiItemList[pl_parentIdx].XULformat.tree.rows);
var integer vl_colIdx := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns[pl_columnsIdx];
var charstring tid;
if(ispresent(pl_xul.id)){
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
tid := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
}else{
tid := "";
}
if (tid == ""){
var integer vl_row := 0;
if (vl_treedataColumns != 0) {
vl_row := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells / vl_treedataColumns;
}
tid := f_EPTF_UIHandler_unichar2charstring(f_EPTF_UIHandler_getrandomid());
pl_xul.id := tid;
}
var boolean vl_ret := -1 != f_EPTF_UIHandler_addWidgetRec({
tid,
wtTreecell,
v_UIHandler_guiItemList[vl_colIdx].widgetDataType,
pl_parentIdx,
{},
{cellData := {vl_colIdx, omit}},
{treecell := f_EPTF_UIHandler_deleteChildrenFromTreecell(pl_xul)}, false},
pl_widgetExists);
if (vl_ret) {
v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells + 1;
}
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, tid);
pl_xul.externaldata := omit;
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_treerow - *in* <Treerow> - possible tree row items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(
in Treecellgroups.treecellgroup_list pl_treecellgroups,
in integer pl_parentIdx,
inout boolean pl_widgetExists,
in boolean pl_appendCells := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var boolean vl_ret := true;
var integer vl_nonMetaParentIdx := f_EPTF_UIHandler_getTreeIdx(pl_parentIdx);
var EPTF_IntegerList vl_cols := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.columns;
var integer vl_nofCells := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells;
// return if too much cell is given in the row
//vl_rowsize := sizeof(pl_treecellgroups.treecellgroup_list);
// iterate through the treerow and add cells to internal database
var integer vl_treecellgroups_size := sizeof(pl_treecellgroups);
for(var integer i := 0; i < vl_treecellgroups_size and vl_ret; i := i + 1 ){
if (ischosen(pl_treecellgroups[i].treecell)){
//Cells
var integer vl_sizeOfSibling := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells;
var integer vl_columnsIdx := vl_sizeOfSibling mod sizeof(vl_cols);
vl_ret := vl_ret and f_EPTF_UIHandler_appendCell(pl_treecellgroups[i].treecell, pl_parentIdx, pl_widgetExists, vl_columnsIdx)
}
else if (ischosen(pl_treecellgroups[i].iterator)){
f_EPTF_UIHandler_Config_processTreecelliterator(pl_treecellgroups[i], pl_parentIdx, true, pl_widgetExists);
//The iterator processed and replaced with its represented data.
//Let's process them. Therefore don't increment the position
}
else if (ischosen(pl_treecellgroups[i].externalvalue)){
f_EPTF_UIHandler_Config_processTreecelliterator(pl_treecellgroups[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_treecellgroups[i]));
vl_ret := false;
}
} //while
//Check the processed cellcount
var integer vl_nofCellsNew := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells;
var integer vl_rowsize := vl_nofCellsNew-vl_nofCells;
if(vl_rowsize > sizeof(vl_cols)){
f_EPTF_UIHandler_warning("There are more cells in the row than columns in the tree.");
return false;
}
//FIXME: AUTOMATIC CELL APPEND REMOVED
// if(pl_appendCells){
// // add empty cells to the row if not enough is given
// var integer vl_row := 0;
// var integer vl_columns := sizeof(vl_cols);
// if (vl_columns != 0) {
// vl_row := v_UIHandler_guiItemList[vl_nonMetaParentIdx].widgetData.treeData.nofCells / vl_columns;
// }
// for (var integer i := vl_rowsize; i < vl_columns and vl_ret; i := i+1) {
// var Treecell vl_emptyCell := c_UIHandler_XSD_emptyTreeCell;
// vl_emptyCell.id := v_UIHandler_guiItemList[vl_nonMetaParentIdx].id&"."&int2str(vl_row)&"."&int2str(i);
// vl_ret := vl_ret and f_EPTF_UIHandler_appendCell(vl_emptyCell, pl_parentIdx, pl_widgetExists, i);
// //pl_list[i].treecell := c_UIHandler_XSD_emptyTreeCell;
// }
// // increment rowsize of tree
// //v_UIHandler_guiItemList[pl_parentIdx].XULformat.tree.rows := v_UIHandler_guiItemList[pl_parentIdx].XULformat.tree.rows + 1.0;
// }
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendAllWidgetIdsFromHbox
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_hbox - *in* <Hbox> - possible Hbox items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendAllWidgetIdsFromHbox(
inout Hbox pl_hbox,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": pl_hbox"&log2str(pl_hbox)&
"\npl_parentIdx: "&log2str(pl_parentIdx));
}
// log("DEBUG: ","--- f_EPTF_UIHandler_appendAllWidgetIdsFromHbox", pl_hbox);
pl_widgetExists := false;
pl_hbox.id := f_EPTF_UIHandler_setWidgetID(pl_hbox.id);
var charstring hboxid := f_EPTF_UIHandler_unichar2charstring(pl_hbox.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
hboxid,
wtHbox,
omit,
pl_parentIdx,
{},
omit,
{hbox := f_EPTF_UIHandler_deleteChildrenFromHbox(pl_hbox)}, false}, pl_widgetExists);
// Calling children...
if (0 < sizeof(pl_hbox.embeddedwidgets.embeddedwidget_list) and (-1 != vl_idx)) {
return f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(pl_hbox.embeddedwidgets, vl_idx, pl_widgetExists);
}
return -1 != vl_idx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendTabPage
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_tabpage - *in* <Tabpage> - possible Tabpage items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendTabPage(
inout Tabpage pl_tabpage,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return integer{
pl_widgetExists := false;
pl_tabpage.id := f_EPTF_UIHandler_setWidgetID(pl_tabpage.id)
return f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_tabpage.id),
wtTabpage,
omit,
pl_parentIdx,
{},
omit,
{tabpage := f_EPTF_UIHandler_deleteChildrenFromTabpage(pl_tabpage)}, false}, pl_widgetExists);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendLabel
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_label - *in* <Label> - possible Label items
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendLabel(
in Label pl_label,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
if(not isbound(pl_label.id) or pl_label.id == omit or 0 == lengthof(pl_label.id)){
pl_label.id := f_EPTF_UIHandler_getrandomid();
}
pl_label.id := f_EPTF_UIHandler_setWidgetID(pl_label.id);
var charstring labelid := f_EPTF_UIHandler_unichar2charstring(pl_label.id);
var boolean vl_ret := -1 != f_EPTF_UIHandler_addWidgetRec({
labelid,
wtLabel,
omit,
pl_parentIdx,
{},
omit,
{label_ := f_EPTF_UIHandler_deleteChildrenFromLabel(pl_label)}, false}, pl_widgetExists);
if(ispresent(pl_label.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_label.externaldata, labelid);
pl_label.externaldata := omit;
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendSpacer
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Spacer> - possible Spacer item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendSpacer(
inout Spacer pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring spacerid := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
return -1 != f_EPTF_UIHandler_addWidgetRec({
spacerid,
wtSpacer,
omit,
pl_parentIdx,
{},
omit,
{spacer := f_EPTF_UIHandler_deleteChildrenFromSpacer(pl_xul)}, false}, pl_widgetExists);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendButton
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Button> - possible Button item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendButton(
inout Button pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
var boolean vl_ret := -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtButton,
omit,
pl_parentIdx,
{},
omit,
{button := f_EPTF_UIHandler_deleteChildrenFromButton(pl_xul)}, false}, pl_widgetExists);
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendPushbutton
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Pushbutton> - possible Pushbutton item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendPushbutton(
inout Pushbutton pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtPushbutton,
omit,
pl_parentIdx,
{},
omit,
{pushbutton := f_EPTF_UIHandler_deleteChildrenFromPushbutton(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendTogglebutton
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Togglebutton> - possible Togglebutton item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendTogglebutton(
inout Togglebutton pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtTogglebutton,
omit,
pl_parentIdx,
{},
omit,
{togglebutton := f_EPTF_UIHandler_deleteChildrenFromTogglebutton(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendTextbox
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Textbox> - possible Textbox item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendTextbox(
inout Textbox pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtTextbox,
omit,
pl_parentIdx,
{},
omit,
{textbox := f_EPTF_UIHandler_deleteChildrenFromTextbox(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendHtmlcode
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Htmlcode> - possible Htmlcode item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendHtmlcode(
inout Htmlcode pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtHtmlcode,
omit,
pl_parentIdx,
{},
omit,
{htmlcode := f_EPTF_UIHandler_deleteChildrenFromHtmlcode(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendChart
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Chart> - possible Chart item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendChart(
inout Chart pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtChart,
omit,
pl_parentIdx,
{},
omit,
{chart := f_EPTF_UIHandler_deleteChildrenFromChart(pl_xul)}, false}, pl_widgetExists)
if(-1 < vl_idx){
return f_EPTF_UIHandler_Config_processTracegroups(pl_xul.tracegroups.tracegroup_list, vl_idx, pl_widgetExists);
}
return false;
}
private function f_EPTF_UIHandler_Config_processTracegroups(
in Tracegroups.tracegroup_list pl_tracegroups,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
var boolean vl_ret := true;
var integer pl_tracegroups_size := sizeof(pl_tracegroups);
for(var integer i := 0; i < pl_tracegroups_size and vl_ret; i := i + 1 ){
if (ischosen(pl_tracegroups[i].trace)) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendTrace(pl_tracegroups[i].trace, pl_parentIdx, pl_widgetExists);
}
else if ( ischosen(pl_tracegroups[i].iterator) ){
f_EPTF_UIHandler_Config_processTraceiterator(pl_tracegroups[i], pl_parentIdx, true, pl_widgetExists);
}
else if ( ischosen(pl_tracegroups[i].externalvalue) ){
f_EPTF_UIHandler_Config_processTraceiterator(pl_tracegroups[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_tracegroups[i]));
vl_ret := false;
}
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Result : " & log2str(pl_tracegroups));
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendTrace
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Trace> - possible Trace item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendTrace(
inout Trace pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtTrace,
omit,
pl_parentIdx,
{},
omit,
{trace := f_EPTF_UIHandler_deleteChildrenFromTrace(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendToolbar
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Toolbar> - possible Toolbar item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendToolbar(
inout Toolbar pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtToolbar,
omit,
pl_parentIdx,
{},
omit,
{toolbar := f_EPTF_UIHandler_deleteChildrenFromToolbar(pl_xul)}, false}, pl_widgetExists);
if(-1 < vl_idx){
var boolean vl_ret := true;
for(var integer vl_i := 0; vl_i < sizeof(pl_xul.choice_list);vl_i := vl_i + 1){
if(ischosen(pl_xul.choice_list[vl_i].toolbarbutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendToolbarbutton(pl_xul.choice_list[vl_i].toolbarbutton, vl_idx, pl_widgetExists);
}
else if(ischosen(pl_xul.choice_list[vl_i].pushbutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendPushbutton(pl_xul.choice_list[vl_i].pushbutton, vl_idx, pl_widgetExists);
}
else if(ischosen(pl_xul.choice_list[vl_i].togglebutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendTogglebutton(pl_xul.choice_list[vl_i].togglebutton, vl_idx, pl_widgetExists);
} else {
vl_ret := vl_ret and f_EPTF_UIHandler_appendSeparator(pl_xul.choice_list[vl_i].separator, vl_idx, pl_widgetExists);
}
}
return vl_ret;
}
return false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendToolbarelements
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Toolbarelements> - possible Toolbar item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendToolbarelements(
inout Toolbarelements pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
var boolean vl_ret := true;
for(var integer vl_i := 0; vl_i < sizeof(pl_xul.toolbarelement_list);vl_i := vl_i + 1){
if (ischosen(pl_xul.toolbarelement_list[vl_i].choice.toolbarbutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendToolbarbutton(pl_xul.toolbarelement_list[vl_i].choice.toolbarbutton, pl_parentIdx, pl_widgetExists);
}
else if (ischosen(pl_xul.toolbarelement_list[vl_i].choice.togglebutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendTogglebutton(pl_xul.toolbarelement_list[vl_i].choice.togglebutton, pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_xul.toolbarelement_list[vl_i].choice.separator)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendSeparator(pl_xul.toolbarelement_list[vl_i].choice.separator, pl_parentIdx, pl_widgetExists);
}
else if(ischosen(pl_xul.toolbarelement_list[vl_i].choice.pushbutton)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendPushbutton(pl_xul.toolbarelement_list[vl_i].choice.pushbutton, pl_parentIdx, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning("Unhandled widgettype as a toolbarelement!");
}
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendToolbarbutton
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Toolbarbutton> - possible Toolbarbutton item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendToolbarbutton(
inout Toolbarbutton pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtToolbarbutton,
omit,
pl_parentIdx,
{},
omit,
{toolbarbutton := f_EPTF_UIHandler_deleteChildrenFromToolbarbutton(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
private function f_EPTF_UIHandler_appendListbox(
inout Listbox pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtListbox,
omit,
pl_parentIdx,
{},
omit,
{listbox := f_EPTF_UIHandler_deleteChildrenFromListbox(pl_xul)}, false}, pl_widgetExists)
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, f_EPTF_UIHandler_unichar2charstring(pl_xul.id));
pl_xul.externaldata := omit;
}
if(-1 < vl_idx){
return f_EPTF_UIHandler_Config_processListitemgroups(pl_xul.listitemgroups.listitemgroup_list, vl_idx, pl_widgetExists)
}
return false;
}
private function f_EPTF_UIHandler_Config_processListitemgroups(
inout Listitemgroups.listitemgroup_list pl_listitems,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
var boolean vl_ret := true;
var integer vl_listitems_size := sizeof(pl_listitems);
for(var integer i := 0; i < vl_listitems_size and vl_ret; i := i + 1 ){
if ( ischosen(pl_listitems[i].listitem) ){
vl_ret := vl_ret and f_EPTF_UIHandler_appendListitem(pl_listitems[i].listitem, pl_parentIdx, pl_widgetExists);
}
else if ( ischosen(pl_listitems[i].iterator) ){
f_EPTF_UIHandler_Config_processListitemiterator(pl_listitems[i], pl_parentIdx, true, pl_widgetExists);
}
else if ( ischosen(pl_listitems[i].externalvalue) ){
f_EPTF_UIHandler_Config_processListitemiterator(pl_listitems[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_listitems[i]));
vl_ret := false;
}
}
return vl_ret;
}
private function f_EPTF_UIHandler_appendListitem(
inout Listitem pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
return -1 != f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtListitem,
omit,
pl_parentIdx,
{},
omit,
{listitem := f_EPTF_UIHandler_deleteChildrenFromListitem(pl_xul)}, false}, pl_widgetExists);
}
private function f_EPTF_UIHandler_appendNumericalwidget(
inout Numericalwidget pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var template Widgettype vt_widgetType;
select( pl_xul.widgetType )
{
case ( floatField )//Note: floatField of Numericalwidgettype
{
vt_widgetType := floatField //Note: floatField of Widgettype
}
case (integerField)
{
vt_widgetType := integerField //Note: integerField of Widgettype
}
case else
{
vt_widgetType := omit
}
}
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
if( -1 != f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtNumericalwidget,
valueof(vt_widgetType),
pl_parentIdx,
{},
omit,
{numericalwidget := f_EPTF_UIHandler_deleteChildrenFromNumericalwidget(pl_xul)}, false}, pl_widgetExists)){
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return true;
}else{
return false;
}
}
private function f_EPTF_UIHandler_appendMenulist(
inout Menulist pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtMenulist,
omit,
pl_parentIdx,
{},
omit,
{menulist := f_EPTF_UIHandler_deleteChildrenFromMenulist(pl_xul)}, false}, pl_widgetExists)
if(-1 < vl_idx ){
var boolean vl_ret;
if(ispresent(pl_xul.menupopup.choice.menuitemgroups)){
vl_ret := f_EPTF_UIHandler_appendMenuitemGroups(pl_xul.menupopup.choice.menuitemgroups.menuitemgroup_list, vl_idx, pl_widgetExists);
} else {
if(ispresent(pl_xul.menupopup.choice.externaldata_list)){
if(sizeof(pl_xul.menupopup.choice.externaldata_list) == 1){
var Menuitemgroups.menuitemgroup_list vl_menuitemgroupList;
// : what is this: f_EPTF_UIHandler_appendMenuitemGroupsFromExternalData ?
vl_ret := f_EPTF_UIHandler_appendMenuitemGroupsFromExternalData(vl_menuitemgroupList,vl_id, pl_xul.menupopup.choice.externaldata_list[0], vl_idx, pl_widgetExists);
vl_ret := f_EPTF_UIHandler_appendMenuitemGroups(vl_menuitemgroupList, vl_idx, pl_widgetExists);
pl_xul.menupopup.choice := { menuitemgroups := { vl_menuitemgroupList } }
} else {
f_EPTF_UIHandler_warning(%definitionId&": Only one externaldata is allowed: "&log2str(pl_xul.menupopup));
vl_ret := false;
}
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_xul.menupopup));
vl_ret := false;
}
}
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, vl_id);
pl_xul.externaldata := omit;
}
return vl_ret;
}
return false;
}
private function f_EPTF_UIHandler_appendMenuitemGroups(
inout Menuitemgroups.menuitemgroup_list pl_menuitems,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
var boolean vl_ret := true;
var integer vl_menuitems_size := sizeof(pl_menuitems);
for(var integer i := 0; i < vl_menuitems_size and vl_ret; i := i + 1 ){
if ( ischosen(pl_menuitems[i].menuitem) ){
vl_ret := vl_ret and f_EPTF_UIHandler_appendMenuitem(pl_menuitems[i].menuitem, pl_parentIdx, pl_widgetExists);
}
else if ( ischosen(pl_menuitems[i].iterator) ){
f_EPTF_UIHandler_Config_processMenuitemiterator(pl_menuitems[i], pl_parentIdx, true, pl_widgetExists);
}
else if ( ischosen(pl_menuitems[i].externalvalue) ){
f_EPTF_UIHandler_Config_processMenuitemiterator(pl_menuitems[i], pl_parentIdx, true, pl_widgetExists);
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_menuitems[i]));
vl_ret := false;
}
}
return vl_ret;
}
private function f_EPTF_UIHandler_appendMenuitemGroupsFromExternalData(
out Menuitemgroups.menuitemgroup_list pl_xul,
in charstring pl_widgetId, //menulist id
inout Datadescription pl_datadescription,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_xul := {};
var boolean vl_bool:=false;
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Started on : " & log2str(pl_datadescription));
}
// Ask the UIHandler about the datasource, then send him the question.
var EPTF_DataSource_Params vl_dataparamList:= {};
var charstring vl_varName := "";
if(ispresent(pl_datadescription.params)){
for(var integer i := 0; i < sizeof(pl_datadescription.params.dataparam_list); i := i + 1 ){
var integer vl_dataParamsSize := sizeof(vl_dataparamList);
vl_dataparamList[vl_dataParamsSize].paramName := f_unichar2charstr(pl_datadescription.params.dataparam_list[i].name); // FIXME
vl_dataparamList[vl_dataParamsSize].paramValue := f_unichar2charstr(pl_datadescription.params.dataparam_list[i].value_);
}
}
var charstring vl_source := f_unichar2charstr(pl_datadescription.source);
var charstring vl_ptcname := "";
if(ispresent(pl_datadescription.ptcname)){ vl_ptcname := f_unichar2charstr(pl_datadescription.ptcname)}
var charstring vl_element := f_unichar2charstr(pl_datadescription.element);
var EPTF_UIHandler_GuiItemRec vl_widgetRec;
var EPTF_Var_DirectContent vl_defaultValue;
f_EPTF_UIHandler_getWidgetRec(pl_widgetId, vl_widgetRec)
f_EPTF_UIhandler_simulation_getDefaultValue(vl_widgetRec, vl_defaultValue);
if(f_EPTF_UIHandler_simulation_getData( vl_varName,
vl_source,
vl_ptcname,
vl_element,
vl_dataparamList,
-,
-,
vl_defaultValue ) == 0 ){
var integer vl_varId := f_EPTF_Var_getId(vl_varName);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": widgetId: " & log2str(pl_widgetId) & " varId: " & log2str(vl_varId));
}
var EPTF_Var_DirectContent vl_currentContent;
f_EPTF_Var_getContent(vl_varId, vl_currentContent);
for (var integer i:=0; i<sizeof(vl_currentContent.charstringlistVal); i:=i+1) {
pl_xul[i].menuitem.id := pl_widgetId & "." & vl_currentContent.charstringlistVal[i];
pl_xul[i].menuitem.label_ := vl_currentContent.charstringlistVal[i];
pl_xul[i].menuitem.selected := false;
pl_xul[i].menuitem.externaldata := omit;
}
var integer vl_idx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetId);
f_EPTF_Var_addPostProcFn(vl_varId, {refers(f_EPTF_UIHandler_updateMenulistItemsFromExternaldata), {vl_idx}});
vl_bool := true;
} else {
f_EPTF_UIHandler_error(%definitionId&": Configuration error : Invalid dataSource parameters: \n"&
"\nSource: "&vl_source&
"\nPTC : "&vl_ptcname &
"\nData Name : " &vl_element&
"\nParams:" & log2str(vl_dataparamList)&
"\nCheck the warnings above for more info.");
}
return vl_bool;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateMenulistItemsFromExternaldata
//
// Purpose:
//
//
// Parameters:
// pl_idx - *in* *integer* - EPTF Variable index
// pl_argList - *in* <EPTF_IntegerList> - argument list - widgetRecIdx for the menulist
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
function f_EPTF_UIHandler_updateMenulistItemsFromExternaldata(in integer pl_idx, in EPTF_IntegerList pl_argList)
runs on EPTF_UIHandler_Private_CT
{
if(v_UIHandler_createGUIRunning){
var integer vl_sizeof_postPonedPostProc := sizeof(v_UIHandler_postponedPostProcDB);
var boolean vl_found := false;
for (var integer i:=0; i< vl_sizeof_postPonedPostProc; i:=i+1) {
if(v_UIHandler_postponedPostProcDB[i].idx == pl_idx and v_UIHandler_postponedPostProcDB[i].argList == pl_argList){
vl_found := true;
}
}
if(not vl_found){
v_UIHandler_postponedPostProcDB[sizeof(v_UIHandler_postponedPostProcDB)] := {pl_idx, pl_argList};
}
return;
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("Update menu items from variable : " & log2str(pl_idx) & " args: " & log2str(pl_argList));
}
var integer vl_size := sizeof(v_UIHandler_guiItemList[pl_argList[0]].children)
var EPTF_CharstringList vl_list;
for (var integer i:=0; i<vl_size; i:=i+1) {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("Remove menuitems from menulist: " & log2str(v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_argList[0]].children[i]].id));
}
vl_list[i] := v_UIHandler_guiItemList[v_UIHandler_guiItemList[pl_argList[0]].children[i]].id;
}
for (var integer i:=0; i<vl_size; i:=i+1) {
f_EPTF_UIHandler_removeElementFromGui(vl_list[i]);
}
var integer vl_subsIdx := f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(v_UIHandler_guiItemList[pl_argList[0]].id);
if(-1 != vl_subsIdx){
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(v_UIHandler_openSubscriptions[vl_subsIdx].varIdx, vl_content);
if(ischosen(vl_content.charstringVal)){
vl_content := {charstringVal := ""};
} else if(ischosen(vl_content.intVal)){
vl_content := {intVal := 0};
} else {
vl_content := {charstringVal := ""};
}
f_EPTF_Var_adjustContent(v_UIHandler_openSubscriptions[vl_subsIdx].varIdx, vl_content);
} else {
f_EPTF_UIHandler_warning(%definitionId&": No variable is added to the widget: "&log2str(v_UIHandler_guiItemList[pl_argList[0]].id));
}
var EPTF_Var_DirectContent vl_currentContent;
f_EPTF_Var_getContent(pl_idx, vl_currentContent);
var Menuitemgroups.menuitemgroup_list vl_menuitemgroupList := {};
for (var integer i:=0; i<sizeof(vl_currentContent.charstringlistVal); i:=i+1) {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("Add menuitem to menulist: " & log2str(vl_currentContent.charstringlistVal[i]));
}
vl_menuitemgroupList[i].menuitem.id := v_UIHandler_guiItemList[pl_argList[0]].id & "." & vl_currentContent.charstringlistVal[i];
vl_menuitemgroupList[i].menuitem.label_ := vl_currentContent.charstringlistVal[i];
vl_menuitemgroupList[i].menuitem.selected := false;
vl_menuitemgroupList[i].menuitem.externaldata := omit;
}
var boolean vl_widgetExists;
var boolean vl_ret := f_EPTF_UIHandler_appendMenuitemGroups(vl_menuitemgroupList, pl_argList[0], vl_widgetExists);
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
f_EPTF_UIHandler_Browser_reportGUIChanged(v_UIHandler_guiItemList[pl_argList[0]].id);
}
for (var integer i:=0; i<sizeof(vl_currentContent.charstringlistVal); i:=i+1) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleAddElementToGUI(v_UIHandler_guiItemList[pl_argList[0]].id, { menuitem := vl_menuitemgroupList[i].menuitem}));
}
if(vl_ret == false){
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(vl_menuitemgroupList));
}
}
private function f_EPTF_UIHandler_appendMenuitem(
inout Menuitem pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
return -1 != f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtMenuitem,
omit,
pl_parentIdx,
{},
omit,
{menuitem := f_EPTF_UIHandler_deleteChildrenFromMenuitem(pl_xul)}, false}, pl_widgetExists);
}
private function f_EPTF_UIHandler_appendDistributionchart(
inout Distributionchart pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(pl_xul.id);
var integer vl_idx := f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtDistributionchart,
omit,
pl_parentIdx,
{},
omit,
{distributionchart := f_EPTF_UIHandler_deleteChildrenFromDistributionchart(pl_xul)}, false}, pl_widgetExists)
if(-1 < vl_idx and not pl_widgetExists){
var boolean vl_ret := true;
var integer i:=0;
while ( isbound(pl_xul.externaldatagroups.externaldatagroup_list) and (i < sizeof(pl_xul.externaldatagroups.externaldatagroup_list)) and vl_ret )
{
if (ischosen(pl_xul.externaldatagroups.externaldatagroup_list[i].intervallimits)){
vl_ret := vl_ret and f_EPTF_UIHandler_appendIntervallimits(pl_xul.externaldatagroups.externaldatagroup_list[i].intervallimits, vl_idx, pl_widgetExists);
}
else if (ischosen(pl_xul.externaldatagroups.externaldatagroup_list[i].valuelist_list)){
for(var integer j := 0; j <sizeof(pl_xul.externaldatagroups.externaldatagroup_list[i].valuelist_list); j := j + 1) {
vl_ret := vl_ret and f_EPTF_UIHandler_appendValuelist(pl_xul.externaldatagroups.externaldatagroup_list[i].valuelist_list[j], vl_idx, pl_widgetExists);
}
}
else if (ischosen(pl_xul.externaldatagroups.externaldatagroup_list[i].iterator)){
f_EPTF_UIHandler_Config_processValueListiterator(pl_xul.externaldatagroups.externaldatagroup_list[i], pl_xul, vl_idx, true, pl_widgetExists)
}
else if (ischosen(pl_xul.externaldatagroups.externaldatagroup_list[i].externalvalue)){
f_EPTF_UIHandler_Config_processValueListiterator(pl_xul.externaldatagroups.externaldatagroup_list[i], pl_xul, vl_idx, true, pl_widgetExists)
} else {
f_EPTF_UIHandler_warning(%definitionId&": Invalid element to be added: "&log2str(pl_xul.externaldatagroups.externaldatagroup_list[i]));
vl_ret := false;
}
i := i + 1;
}
var integer vl_size := sizeof(pl_xul.externaldatagroups.externaldatagroup_list);
for(var integer j := 0; j < vl_size; j := j + 1){
if(ischosen(pl_xul.externaldatagroups.externaldatagroup_list[j].intervallimits)){
var Externaldatagroup temp:= pl_xul.externaldatagroups.externaldatagroup_list[0];
pl_xul.externaldatagroups.externaldatagroup_list[0] := pl_xul.externaldatagroups.externaldatagroup_list[j];
pl_xul.externaldatagroups.externaldatagroup_list[j] := temp;
}
}
return vl_ret;
}
return false;
}
private function f_EPTF_UIHandler_appendIntervallimits(
inout Intervallimits pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
var EPTF_FloatList vl_floatList := {};
if(ispresent(pl_xul.choice.value_list)){
for ( var integer i := 0; i < sizeof(pl_xul.choice.value_list) ; i := i+1 ) {
vl_floatList[i] := pl_xul.choice.value_list[i];
}
}
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var integer vl_exit:= f_EPTF_UIHandler_addWidgetRec({
/*id*/ f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
/*widgetType*/ wtIntervallimits,
/*widgetDataType*/ omit,
/*parentIdx*/ pl_parentIdx,
/*children*/ {},
/*widgetData*/ {distChartData := {intervallimits := vl_floatList}},
/*XULformat*/ omit,
/*xuldisabled*/ false}, pl_widgetExists);
if(ispresent(pl_xul.choice.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.choice.externaldata, f_EPTF_UIHandler_unichar2charstring(pl_xul.id));
pl_xul.choice.externaldata := {};
}
return -1 != vl_exit;
}
private function f_EPTF_UIHandler_appendValuelist(
inout Valuelist pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
var Valuelist vl_xul := pl_xul;
vl_xul.externaldata := omit;
var integer vl_exit:= f_EPTF_UIHandler_addWidgetRec({
/*id*/ f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
/*widgetType*/ wtValuelist,
/*widgetDataType*/ omit,
/*parentIdx*/ pl_parentIdx,
/*children*/ {},
/*widgetData*/ omit,
/*XULformat*/ {valuelist := vl_xul}, // external data removed from vl_xul
/*xuldisabled*/ false}, pl_widgetExists);
if(ispresent(pl_xul.externaldata)){
f_EPTF_UIHandler_Config_processExternalData(pl_xul.externaldata, f_EPTF_UIHandler_unichar2charstring(pl_xul.id));
pl_xul.externaldata := omit;
}
return -1 != vl_exit;
}
private function f_EPTF_UIHandler_appendImage(
inout Image pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
return -1 != f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtImage,
omit,
pl_parentIdx,
{},
omit,
{image := pl_xul}, false}, pl_widgetExists);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendSeparator
//
// Purpose:
// before sending XTDP_AddRequests out this function appends the described widget and its children to the GUI item list
//
// Parameters:
// pl_xul - *in* <Separator> - possible Separator item
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendSeparator(
in ttcn_ericsson_se_protocolModules_xtdp_xtdl.Separator pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
pl_xul.id := f_EPTF_UIHandler_setWidgetID(pl_xul.id);
return -1 != f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(pl_xul.id),
wtSeparator,
omit,
pl_parentIdx,
{},
omit,
{separator := f_EPTF_UIHandler_deleteChildrenFromSeparator(pl_xul)}, false}, pl_widgetExists);
}
} //EPTF_WidgetAddInternalFunctions group
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_requestLayout
//
// Purpose:
// Sends a layoutRequest message to the RuntimeGUI and
// builds the database of the widgets by the response
//
// Detailed Comments:
// It should be called only once, after connecting to a GUI
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_requestLayout()
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_layoutRequest);
var boolean vl_widgetExists := false;
if(f_EPTF_Semaphore_waitForUnlock(v_UIHandler_layoutResponseReceivedSemaphore, tsp_EPTF_UIHandler_maxWaitTimer))
{
f_EPTF_UIHandler_warning("Timer timeout! No layout response received!");
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
return false;
}
v_UIHandler_layoutResponseReceivedSemaphore := f_EPTF_Semaphore_new();
//f_EPTF_Semaphore_lock(v_UIHandler_layoutResponseReceivedSemaphore);
if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_LayoutResponse.widgets.window))
{
if(not f_EPTF_UIHandler_appendAllWidgetIdsFromXul(v_UIHandler_receivedMessage.choice.xTDP_LayoutResponse.widgets, v_UIHandler_windowIndex, vl_widgetExists))
{
f_EPTF_UIHandler_warning("There was an error during processing the layout response.");
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
return false;
}
}
else
{
f_EPTF_UIHandler_warning("Unexpected XTDP LayoutResponse (not xtdp_window)!");
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
return true;
}
type enumerated EPTF_UIHandler_connectionResult
{
connected(0),
connectFailed,
temporarilyUnavailable
};
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_connectAndInitGui
//
// Purpose:
// function to connect to GUI
//
// Parameters:
// -
//
// Return Value:
// boolean
//
// Errors:
// Common error possibilities
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_connectAndInitGui(out ConnectionId pl_clientId)
runs on EPTF_UIHandler_Private_CT
return EPTF_UIHandler_connectionResult
{
pl_clientId := -1;
if(v_EPTF_UIHandler_servermode){
return connected;
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("****ConnectGUI****");
}
if (v_UIHandler_guiConnected) {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("****ConnectGUI: already connected****");
}
return connected;
}
var Result vl_result
f_EPTF_Transport_connect(
IPL4, {tcp := {}}, c_ipv4AnyAddr, c_anyPort, v_UIHandler_GUI_Host, v_UIHandler_GUI_Port, c_EPTF_UIHandler_XTDPType, vl_result, true)
if(ispresent(vl_result.connId))
{
pl_clientId := vl_result.connId;
if(-1 == vl_result.connId)
{
f_EPTF_UIHandler_warning("----- CLL_UIHandler connecting to GUI failed ----");
//f_EPTF_Base_stopAll();
f_EPTF_UIHandler_headlessmode();
return connectFailed;
} else if (ispresent(vl_result.errorCode) and vl_result.errorCode==ERROR_TEMPORARILY_UNAVAILABLE) {
f_EPTF_UIHandler_headlessmode();
return temporarilyUnavailable;
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&log2str("***Connected on socket: ", vl_result.connId));
}
// I am XTDP-session server => nothing to do here:
// var charstring vl_handshakeError:=f_EPTF_UIHandler_handshake(vl_result.connId);
// if (vl_handshakeError!="") {
// // handshake unsuccessful
// return false;
// }
// if (not f_EPTF_UIHandler_authclient(vl_result.connId))
// {
// f_EPTF_UIHandler_closeXTDPSession(vl_result.connId);
// return false;
// }
f_EPTF_UIHandler_addclientid(vl_result.connId);
// v_UIHandler_guiConnected := true;
return connected;
}
else
{
f_EPTF_UIHandler_warning(log2str("----- CLL_UIHandler Unsuccessful attempt to connect. You can set the IP address and port with the module pars. tsp_xtdp_listen_addr:tsp_xtdp_listen_port Client address:",v_UIHandler_GUI_Host,":", v_UIHandler_GUI_Port," with answer: ", vl_result));
f_EPTF_UIHandler_headlessmode();
//f_EPTF_Base_stopAll();
return connectFailed;
}
}
private function f_EPTF_UIHandler_closeXTDPSession(in integer pl_clientId) runs on EPTF_UIHandler_Private_CT {
var Result vl_result
if (f_EPTF_UIHandler_getClientHandshakeSuccessful(pl_clientId)) {
// only close session if handshake was successful
v_UIHandler_lastRequest := v_UIHandler_lastRequest +1;
v_UIHandler_byeTimer := f_EPTF_Semaphore_new();
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend :=
{
v_UIHandler_byeTimer+1000*v_UIHandler_lastRequest,
{xTDP_Bye := ""}
}
f_EPTF_Transport_send(IPL4, pl_clientId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
//f_EPTF_Transport_send(IPL4, pl_clientId, char2oct("bye\r\n"), vl_result, false);
if (f_EPTF_Semaphore_waitForUnlock(v_UIHandler_byeTimer,v_byeMaxTime)) {
// max wait time expired before response received:
//v_byeErrorMsg := "Error: UIHandler: Communication error: No response received for Handshake request"
f_EPTF_UIHandler_warning("Communication error: No response received for Bye message");
}
v_UIHandler_byeTimer := -1;
}
f_EPTF_UIHandler_delclientid(pl_clientId);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": XTDP session is closed for client: "&log2str(pl_clientId));
}
if (sizeof(v_UIHandler_GUIClientId) == 0)
{
f_EPTF_UIHandler_headlessmode();
}
f_EPTF_Transport_close(IPL4, pl_clientId, vl_result)
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getGUIAddrPorts
//
// Purpose:
// function to get address, port and reconnect port of the GUI to connect.
//
// Parameters:
// pl_host - *out* *charstring* - the hostname of the GUI
// pl_port - *out* *integer* - the port number of then GUI
// pl_reconnectPort - *out* *integer* - the reconnect port number of then GUI
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_getGUIAddrPorts(out charstring pl_host, out integer pl_port, out integer pl_reconnectPort)
runs on EPTF_UIHandler_Private_CT {
pl_host := v_UIHandler_GUI_Host;
pl_port := v_UIHandler_GUI_Port;
pl_reconnectPort := v_UIHandler_udp_port;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_setGUIAddrPorts
//
// Purpose:
// function to set address , port and reconnect port of the GUI to connect.
//
// Parameters:
// pl_host - *in* *charstring* - optional - the hostname of the GUI
// pl_port - *in* *integer* - optional - the port number of then GUI
// pl_reconnectPort - *in* *integer* - optional - the reconnect port number of then GUI
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// Gives an opportunity to set the address of the GUI from code
// beside the tsp way. It must be called after the f_EPTF_UIhandler_init_CT.
// It will close the connections and make way to have new connections.
// If neither of the pl_host and the pl_port parameters are given, all connection are closed and no GUI
// connection is allowed until this function is called again.
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_setGUIAddrPorts(in charstring pl_host := "", in integer pl_port := -1, in integer pl_reconnectPort := -1)
runs on EPTF_UIHandler_Private_CT {
if (not v_UIHandler_initialized){ return }
var ConnectionId vl_connId := -1;
var boolean vl_UIHandler_transportConnectionFailed := false;
var boolean v_UIHandler_guiConnectedWasTrue := false;
if(v_UIHandler_guiConnected == true){
for (var integer i := 0; i<sizeof(v_UIHandler_GUIClientId); i:= i+1)
{
f_EPTF_UIHandler_closeXTDPSession(v_UIHandler_GUIClientId[i].clientId);
//var Result vl_result
//f_EPTF_Transport_send(IPL4, v_UIHandler_GUIClientId[i], char2oct("bye\r\n"), vl_result, false)
}
v_UIHandler_guiConnectedWasTrue := true;
}
if(pl_reconnectPort > -1){
f_EPTF_UIHandler_setGuiReconnectPort( pl_reconnectPort );
}
if(pl_host == "" and pl_port == -1){
v_UIHandler_GUI_Host := pl_host;
v_UIHandler_GUI_Port := pl_port;
f_EPTF_UIHandler_warning(%definitionId&": Neither of the pl_host and the pl_port parameters is used! Please specify at least one. Until this, all connections are closed and the GUI is not able to connect to the application! ");
return;
}
if(pl_host != ""){
v_UIHandler_GUI_Host := pl_host;
}
if(pl_port > -1){
v_UIHandler_GUI_Port := pl_port;
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": The following values are set: " & pl_host &":" & log2str(pl_port));
}
if(v_UIHandler_guiConnectedWasTrue == true){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Trying to make the connection. ");
}
var EPTF_UIHandler_connectionResult vl_res := f_EPTF_UIHandler_connectAndInitGui(vl_connId);
if(connected != vl_res){
if (v_EPTF_UIHandler_headlessmode) {
// connect to GUI failed -> switch to headless mode
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("initGUI failed, switch to headless mode");
}
f_EPTF_UIHandler_headlessmode();
vl_UIHandler_transportConnectionFailed := vl_res != temporarilyUnavailable;
} else {
// connecting to GUI failed and headless mode not enabled -> stop running
f_EPTF_UIHandler_error("initGUI failed!");
}
}
} else if (v_EPTF_UIHandler_headlessmode) {
// headless mode enabled -> switch to headless mode
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug("UIHandler started in headless mode");
}
f_EPTF_UIHandler_headlessmode();
} else {
// uncorrect starrtup configuration: client mode, not to connect to GUI, headless mode disabled -> stop running
f_EPTF_UIHandler_error("Uncorrect UIHandler configuration for startup: client mode, not to connect to GUI, headless mode disabled");
}
if ((v_UIHandler_guiConnected and not v_EPTF_UIHandler_servermode) and not vl_UIHandler_transportConnectionFailed) {
timer t_wait_for_connectGUI := 0.0;
timer t_max_wait_for_connectGUI := tsp_EPTF_UIHandler_maxGUIWaitTime;
t_max_wait_for_connectGUI.start;
t_wait_for_connectGUI.start;
alt {
[v_UIHandler_guiConnected or (vl_connId != -1 and not f_EPTF_UIHandler_isConnectedClientid(vl_connId))] t_wait_for_connectGUI.timeout {
// connection established, or lost
}
[] t_max_wait_for_connectGUI.timeout {
f_EPTF_UIHandler_error("In client mode connecting to GUI on " & v_UIHandler_GUI_Host & ":" & log2str(v_UIHandler_GUI_Port) & " failed: Timeout during handshake&authentication. Please correct the tsp_xtdp_listen_addr / tsp_xtdp_listen_port parameter(s) in order to be able to connect to the RuntimeGUI! ");
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_setGuiReconnectPort
//
// Purpose:
// function to set the port of the GUI to reconnect.
//
// Parameters:
// pl_reconnectPort - *in* *integer* - the reconnect port number of then GUI
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// Gives an opportunity to set the reconnect port of the GUI from code
// beside the tsp way. It must be called after the f_EPTF_UIhandler_init_CT.
// If no parameter is given or the port is negative, reconnection of the GUI is disabled
// until the f_EPTF_UIHandler_setPingerPort() function is called again.
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_setGuiReconnectPort( in integer pl_reconnectPort := -1)
runs on EPTF_UIHandler_Private_CT {
if(pl_reconnectPort < 0){
f_EPTF_UIHandler_warning(%definitionId&": Pinger port is deactivated, reconnection of the GUI is disabled!");
}
v_UIHandler_udp_port := pl_reconnectPort;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_setGuiHostPort
//
// Purpose:
// function to set address of the GUI to connect.
//
// Parameters:
// pl_host - *in* *charstring* the hostname of the GUI
// pl_port - *in* *integer* the port number of then GUI
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// Gives an opportunity to set the address of the GUI from code
// beside the tsp way. It must be called before the f_EPTF_UIhandler_init_CT
// to take effect.
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_setGuiHostPort(in charstring pl_host, in integer pl_port)
runs on EPTF_UIHandler_Private_CT {
v_UIHandler_GUI_Host := pl_host;
v_UIHandler_GUI_Port := pl_port;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_startserverxtdp
//
// Purpose:
// function to start the XTDP port as server.
//
// Parameters:
// -
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_startserverxtdp() runs on EPTF_UIHandler_Private_CT
{
var Result vl_result
f_EPTF_Transport_listen(
IPL4, {tcp := {}}, c_ipv4AnyAddr, v_UIHandler_GUI_Port, c_EPTF_UIHandler_XTDPType, vl_result, true)
if(ispresent(vl_result.connId))
{
// v_connectionDB.connList[sizeof(v_connectionDB.connList)] := {vl_result.connId};
}
else
{
f_EPTF_UIHandler_warning(log2str("Unsuccessful attempt to listen with answer: ", vl_result)); // kell f_EPTF_Base_stop();?
}
}
private function f_EPTF_UIHandler_initguitoclient(in integer pl_clientid, in boolean pl_shadowedGui := false) runs on EPTF_UIHandler_Private_CT{
if(v_UIHandler_createGUIRunning){
//If createGUI is happening right now, we postpone the runtimegui init until creategui is done
v_UIHandler_initToGUIClient := true;
v_UIHandler_initGUIToClientList[sizeof(v_UIHandler_initGUIToClientList)] := {pl_clientid, pl_shadowedGui}
} else {
//No createGUI is happening right now, we do our job
f_EPTF_UIHandler_initGuiToClientInner(pl_clientid, pl_shadowedGui);
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleInitGUIToClient
//
// Purpose:
// -
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleInitGUIToClient() runs on EPTF_UIHandler_Private_CT {
[]t_UIHandler_initGUIToClientTimer.timeout{
for(var integer vl_i := 0; vl_i < sizeof(v_UIHandler_initGUIToClientList); vl_i:=vl_i+1){
f_EPTF_UIHandler_initGuiToClientInner( v_UIHandler_initGUIToClientList[vl_i].pl_clientid, v_UIHandler_initGUIToClientList[vl_i].pl_shadowedGui)
}
v_UIHandler_initGUIToClientList := {};
t_UIHandler_initGUIToClientTimer.start;
v_UIHandler_initToGUIClient := false;
repeat;
}
}
private function f_EPTF_UIHandler_initGuiToClientInner(in integer pl_clientid, in boolean pl_shadowedGui := false) runs on EPTF_UIHandler_Private_CT{
//This piece of code can run only in case of v_UIHandler_createGUIRunning == false and v_UIHandler_initToGUIClient == true with a 0.0 timer
v_UIHandler_lastRequest := v_UIHandler_lastRequest +1;
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend :=
{
transactionID := v_UIHandler_lastRequest,
choice :=
{
xTDP_RemoveRequests:=
{
xTDP_RemoveRequest_list := {
{
requestId := 1,
widgetId := omit
}
}
}
}
}
var Result vl_result
f_EPTF_Transport_send(IPL4, pl_clientid, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
if (0 < sizeof(v_UIHandler_guiItemList))
{
var Widgets layout;
f_EPTF_UIHandler_buildXUL(layout);
if (pl_shadowedGui) {
layout.window.title := layout.window.title & " - Shadowed GUI -";
}
v_UIHandler_lastRequest := v_UIHandler_lastRequest +1;
vl_messageToSend :=
{
transactionID := v_UIHandler_lastRequest,
choice :=
{
xTDP_AddRequests :=
{
xTDP_AddRequest_list := {
{
requestId := 2,
parentWidgetId := omit,
widgets := layout
}
}
}
}
}
f_EPTF_Transport_send(IPL4, pl_clientid, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
}
v_UIHandler_guiLayoutReady := true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateguilist_refreshwidget
//
// Purpose:
// At a widgetrefresh, it refreshes the inner database too.
//
// Parameters:
// pl_widgetid - *in* <charstring> - Id of the widget
// pl_arg - *in* <charstring> - the new value
//
// Return Value:
// -
//
// Errors:
// none
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_updateguilist_refreshwidget(
in charstring pl_widgetid,
in EPTF_Var_DirectContent pl_dcontent)
runs on EPTF_UIHandler_Private_CT{
// if headless mode is not enabled don't refresh internal database
if (not v_EPTF_UIHandler_headlessmode) {
return;
}
var integer vl_index := f_EPTF_UIHandler_widgetRecIndex(pl_widgetid);
if (vl_index==-1) {
return;
}
select (v_UIHandler_guiItemList[vl_index].widgetType) {
case(wtTextbox){
var charstring pl_arg := f_EPTF_Var_directContent2str(pl_dcontent);
v_UIHandler_guiItemList[vl_index].XULformat.textbox.value_ := pl_arg;
}
case(wtHtmlcode){
var charstring pl_arg := f_EPTF_Var_directContent2str(pl_dcontent);
v_UIHandler_guiItemList[vl_index].XULformat.htmlcode.value_ := pl_arg;
}
case (wtTreecell){
var charstring pl_arg := f_EPTF_Var_directContent2str(pl_dcontent);
select( v_UIHandler_guiItemList[vl_index].widgetDataType )
{
case ( statusLED )
{
// Cut the text part if statusLED requested
var integer vl_i:=f_strstr(pl_arg,"]");
if(0<vl_i) {
pl_arg := substr(pl_arg,0,vl_i+1);
}
v_UIHandler_guiItemList[vl_index].XULformat.treecell.label_ := pl_arg;
}
case ( pushButton ){
//nothing to refresh
}
case else
{
v_UIHandler_guiItemList[vl_index].XULformat.treecell.label_ := pl_arg;
}
}
}
case (wtLabel){
var charstring pl_arg := f_EPTF_Var_directContent2str(pl_dcontent);
v_UIHandler_guiItemList[vl_index].XULformat.label_.value_ := pl_arg;
}
case (wtListbox){
var charstring pl_arg := f_EPTF_Var_directContent2str(pl_dcontent);
var EPTF_IntegerList vl_children := f_EPTF_UIHandler_getNonMetaChildren(vl_index);
for (var integer i:=0;i<sizeof(vl_children);i:=i+1){
if (v_UIHandler_guiItemList[vl_children[i]].XULformat.listitem.label_ == pl_arg){
v_UIHandler_guiItemList[vl_children[i]].XULformat.listitem.selected := true;
} else {
v_UIHandler_guiItemList[vl_children[i]].XULformat.listitem.selected := false;
}
}
}
case (wtMenulist){
var charstring pl_arg := f_EPTF_Var_directContent2str(pl_dcontent);
var EPTF_IntegerList vl_children := f_EPTF_UIHandler_getNonMetaChildren(vl_index);
if (v_UIHandler_guiItemList[vl_index].XULformat.menulist.label_ == pl_arg or pl_arg==""){ // menulabel selected
for (var integer i:=0;i<sizeof(vl_children);i:=i+1){
v_UIHandler_guiItemList[vl_children[i]].XULformat.menuitem.selected := false;
}
return;
}
var boolean menuselected := false;
for (var integer i:=0;i<sizeof(vl_children);i:=i+1){ // test if menuitem selected
if (v_UIHandler_guiItemList[vl_children[i]].XULformat.menuitem.label_ == pl_arg){
v_UIHandler_guiItemList[vl_children[i]].XULformat.menuitem.selected := true;
menuselected := true;
} else {
v_UIHandler_guiItemList[vl_children[i]].XULformat.menuitem.selected := false;
}
}
if (not menuselected and v_UIHandler_guiItemList[vl_index].XULformat.menulist.editable == true){// if not menuitem nor menulabel,than its a menulabel change
v_UIHandler_guiItemList[vl_index].XULformat.menulist.label_ := pl_arg;
}
}
case (wtNumericalwidget){
var float pl_arg := 0.0;
if(ischosen(pl_dcontent.intVal)){ // integerField
pl_arg := int2float(pl_dcontent.intVal);
} else if(ischosen(pl_dcontent.floatVal)) { //floatField
pl_arg := pl_dcontent.floatVal;
} else {return;}
v_UIHandler_guiItemList[vl_index].XULformat.numericalwidget.value_ := pl_arg;
}
case (wtValuelist){
if (ischosen(pl_dcontent.integerlistVal)){
v_UIHandler_guiItemList[vl_index].XULformat.valuelist.value_list := {};
for (var integer i := 0;i<sizeof(pl_dcontent.integerlistVal);i:=i+1){
v_UIHandler_guiItemList[vl_index].XULformat.valuelist.value_list[i] := pl_dcontent.integerlistVal[i];
}
}
}
case (wtIntervallimits){
if (ischosen(pl_dcontent.floatlistVal)){
v_UIHandler_guiItemList[vl_index].widgetData.distChartData.intervallimits := {};
for (var integer i := 0;i<sizeof(pl_dcontent.floatlistVal);i:=i+1){
v_UIHandler_guiItemList[vl_index].widgetData.distChartData.intervallimits[i] := pl_dcontent.floatlistVal[i];
}
}
}
case else { }
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_refreshWidget
//
// Purpose:
// Refreshes the content specified by the subscription
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_refreshWidget(in EPTF_UIHandler_OpenSubscription pl_subs, in boolean pl_init := false,
in EPTF_Var_DirectContent pl_currentContent := {unknownVal:={omit}})
runs on EPTF_UIHandler_Private_CT {
if (pl_subs.widgetId == "") {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Widget with empty ID cannot be refreshed!");
}
return;
}
var EPTF_Var_TimeLine vl_timeLine;
f_EPTF_Var_getTimeLine(pl_subs.varIdx,vl_timeLine);
if(0 == vl_timeLine.size and not
(pl_init or f_EPTF_Var_checkSubscriptionMode(pl_subs.varIdx,realtime))){
return;
}
var EPTF_Var_DirectContent vl_currentContent;
if(pl_init or f_EPTF_Var_checkSubscriptionMode(pl_subs.varIdx,realtime)){
if (ischosen(pl_currentContent.unknownVal)) {
f_EPTF_Var_getContent(pl_subs.varIdx,vl_currentContent);
} else {
vl_currentContent := pl_currentContent;
}
}else{
vl_currentContent := vl_timeLine.timeLineData[vl_timeLine.size-1].content;
}
select(pl_subs.widgetType){
case(wtTrace){
// create timeLine from current content (if timeLine is not available because of realTime subscription)
var integer vl_iCount := vl_timeLine.size;
if (vl_iCount == 0) {
vl_iCount := 1;
vl_timeLine.size := 1;
vl_timeLine.timeLineData := {
{
timestamp := f_EPTF_Base_getAbsTimeInSecs(),
content := vl_currentContent
}
};
}
if(0 < vl_iCount){ //Because of init
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Requests vl_requests := {omit, {c_UIHandler_XSD_emptyXTDPRequest}};
var integer vl_size := 0;
for(var integer vl_iTl := 0; vl_iTl < vl_iCount; vl_iTl := vl_iTl + 1){
var charstring vl_stringVal;
if (ischosen(vl_timeLine.timeLineData[vl_iTl].content.floatVal)) {
vl_stringVal := float2str(vl_timeLine.timeLineData[vl_iTl].content.floatVal);
} else if (ischosen(vl_timeLine.timeLineData[vl_iTl].content.intVal)) {
vl_stringVal:= int2str(vl_timeLine.timeLineData[vl_iTl].content.intVal);
}
// ekovist 2012.03.09. - HO88979: EPTF CLL UIHandler: dynamic tc error in case of wrong datasource type used in xml
if(isbound(vl_stringVal)) {
var charstring vl_timelinepoint:= float2str(vl_timeLine.timeLineData[vl_iTl].timestamp) & "/"& vl_stringVal;
v_UIHandler_lastRequest := v_UIHandler_lastRequest + 1;
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Request vl_request := valueof(ts_ASP_XTDP_traceItem(
v_UIHandler_lastRequest,
pl_subs.widgetId,
vl_timelinepoint
));
vl_requests.xTDP_Request_list[vl_size] := vl_request;
vl_size := vl_size + 1;
}
else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" widget can not be connected to variable (invalid type: required FLOAT or INT)!" );
}
}
if (vl_iCount > 0 and vl_size>0){
var integer vl_tracePointer;
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(pl_subs.widgetId);
if(-1 < vl_widgetIdx) {
if (not f_EPTF_int2int_HashMap_Find(v_UIHandler_tracePointerHashMapId, vl_widgetIdx, vl_tracePointer)){
vl_tracePointer := sizeof(v_UIHandler_tracePointers);
f_EPTF_int2int_HashMap_Insert(v_UIHandler_tracePointerHashMapId, vl_widgetIdx, vl_tracePointer);
v_UIHandler_tracePointers[vl_tracePointer] := 0;
}
var integer vl_currTraceID := v_UIHandler_tracePointers[vl_tracePointer];
v_UIHandler_guiItemList[vl_widgetIdx].XULformat.trace.choice_list[vl_currTraceID].xy_value.x :=
vl_timeLine.timeLineData[vl_iCount-1].timestamp;
if (ischosen(vl_timeLine.timeLineData[vl_iCount-1].content.floatVal)) {
v_UIHandler_guiItemList[vl_widgetIdx].XULformat.trace.choice_list[vl_currTraceID].xy_value.y :=
vl_timeLine.timeLineData[vl_iCount-1].content.floatVal;
} else if (ischosen(vl_timeLine.timeLineData[vl_iCount-1].content.intVal)) {
v_UIHandler_guiItemList[vl_widgetIdx].XULformat.trace.choice_list[vl_currTraceID].xy_value.y :=
int2float(vl_timeLine.timeLineData[vl_iCount-1].content.intVal);
} else {
v_UIHandler_guiItemList[vl_widgetIdx].XULformat.trace.choice_list[vl_currTraceID].xy_value.y := 0.0;
}
vl_currTraceID := vl_currTraceID + 1;
if (vl_currTraceID == v_UIHandler_guiItemList[vl_widgetIdx].XULformat.trace.maxPoints) {
vl_currTraceID := 0;
}
v_UIHandler_tracePointers[vl_tracePointer] := vl_currTraceID;
}
else {
f_EPTF_UIHandler_warning("There is no widget with name "&pl_subs.widgetId&" to refresh!");
}
}
if (vl_size>0){
for(var integer clientindex:=0;clientindex<sizeof(v_UIHandler_GUIClientId);clientindex := clientindex+1){
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_sendTimeline(v_UIHandler_GUIClientId[clientindex].clientId,vl_requests));
}
}
}
}
case(wtTreecell){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
if(ispresent(pl_subs.widgetDataType)) { // HN57133: case omit moved to else-branch
select(pl_subs.widgetDataType){
case(checkBox){
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToChkBox(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
case(toggleButton){
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToTgglButton(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
case(floatField){
if (ischosen(vl_currentContent.floatVal)) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToFlt(pl_subs.widgetId, vl_currentContent.floatVal));
} else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" TREECELL widget can not be connected to variable (invalid type: required FLOAT)!" );
}
}
case(integerField){
if (ischosen(vl_currentContent.intVal)) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToInt(pl_subs.widgetId, vl_currentContent.intVal));
} else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" TREECELL widget can not be connected to variable (invalid type: required INT)!" );
}
}
case(pushButton){
//EGBOZIE: Pushbutton is not update-able!
//f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToStr(pl_subs.widgetId,
//f_EPTF_Var_directContent2str(vl_currentContent)));
}
case(statusLED){
if (ischosen(vl_currentContent.statusLEDVal)) {
var charstring vl_statusLedTxt := f_EPTF_Var_directContent2str(vl_currentContent);
// Cut the text part if statusLED requested
var integer vl_i:=f_strstr(vl_statusLedTxt,"]");
if(0<vl_i) {
vl_statusLedTxt := substr(vl_statusLedTxt,0,vl_i+1);
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToLed(pl_subs.widgetId, vl_statusLedTxt ));
} else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" TREECELL widget can not be connected to variable (invalid type: required STATUSLED)!" );
}
}
case(statusLEDWithText){
if (ischosen(vl_currentContent.statusLEDVal)) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToLedWithText(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
} else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" TREECELL widget can not be connected to variable (invalid type: required STATUSLED)!" );
}
}
case(string){ // case omit -> else
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToStr(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
case else { }
}
} else {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToStr(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
}
case (wtValuelist){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
if (ischosen(vl_currentContent.integerlistVal)){
var XTDP_Actions.choice.put.argument_list csl := {""};
for (var integer i:=0; i<sizeof(vl_currentContent.integerlistVal);i:=i+1){
csl[i] := int2str(vl_currentContent.integerlistVal[i])
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueTovalueList(pl_subs.widgetId,
csl));
}
}
case (wtListbox){
var integer index := f_EPTF_UIHandler_widgetRecIndex(pl_subs.widgetId);
if (index != -1 and v_UIHandler_guiItemList[index].XULformat.listbox.seltype == multiple){
var XTDP_Actions.choice.put.argument_list csl := {""};
if (ischosen(vl_currentContent.integerlistVal)){
var EPTF_IntegerList vl_children := f_EPTF_UIHandler_getNonMetaChildren(index);
for (var integer i:=0;i<sizeof(vl_currentContent.integerlistVal);i:=i+1){
//Here the f_EPTF_UIHandler_XULWidgetId2charstr is used simply to convert ustr to charstring
csl[i]:= f_EPTF_UIHandler_XULWidgetId2charstr({v_UIHandler_guiItemList[vl_children[vl_currentContent.integerlistVal[i]]].XULformat.listitem.label_})
}
for (var integer i:=0; i<sizeof(csl);i:=i+1){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
{charstringVal := unichar2char(csl[i])});
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueTovalueList(pl_subs.widgetId,
csl));
}
} else{
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToStr(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
}
case (wtNumericalwidget){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
select( pl_subs.widgetDataType )
{
case ( integerField)
{
if (ischosen(vl_currentContent.intVal)) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToNumericalwidget(pl_subs.widgetId,
int2str(vl_currentContent.intVal)));
} else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" NUMERICAL widget can not be connected to variable (invalid type: required INT)!" );
}
}
case ( floatField)
{
if (ischosen(vl_currentContent.floatVal)) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToNumericalwidget(pl_subs.widgetId,
float2str(vl_currentContent.floatVal)));
} else {
f_EPTF_UIHandler_error("The specified "&pl_subs.widgetId&" NUMERICAL widget can not be connected to variable (invalid type: required FLOAT)!" );
}
}
case else
{//impossible, just in case
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToNumericalwidget(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
}
}
case (wtButton){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
//eistfal: Pushbutton is not update-able!
//f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToStr(pl_subs.widgetId,
//f_EPTF_Var_directContent2str(vl_currentContent)));
// #eistfal: toggleButton is update-able, how to perform it?
}
case (wtPushbutton){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
}
case (wtTogglebutton){
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
}
case else{ // connectd to single string variable
//Default data handling
f_EPTF_UIHandler_updateguilist_refreshwidget(pl_subs.widgetId,
vl_currentContent);
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleRqPutValueToStr(pl_subs.widgetId,
f_EPTF_Var_directContent2str(vl_currentContent)));
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_parseGuiParam
//
// Purpose:
// Parses a value as it is set by user on the GUI,
// stores it in the connected variable
//
// Parameters:
// pl_widgetID - *in* *EPTF_UIHandler_WidgetIdString* - widgetID to identify param
// pl_arglist - *in* <EPTF_CharstringList> - new value to set
//
// Detailed Comments:
// Uses <f_EPTF_UIHandler_parseParamValue> function
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_parseGuiParam(in EPTF_UIHandler_WidgetIdString pl_widgetID, in EPTF_CharstringList pl_arglist)
runs on EPTF_UIHandler_Private_CT
{
var charstring vl_argument := "";
if (sizeof(pl_arglist)!=0) {
vl_argument := pl_arglist[0];
}
// look up param based on widgetID
var integer vl_paramIdx := f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(pl_widgetID);
if (-1 == vl_paramIdx) {
f_EPTF_UIHandler_warning(%definitionId&" Warning : there's no subscription to widgetID ("& pl_widgetID & ") referred by GUI");
//f_EPTF_Base_stop();
return;
}
if(wtButton == v_UIHandler_openSubscriptions[vl_paramIdx].widgetType
or wtPushbutton == v_UIHandler_openSubscriptions[vl_paramIdx].widgetType
or (wtTreecell == v_UIHandler_openSubscriptions[vl_paramIdx].widgetType
and ispresent(v_UIHandler_openSubscriptions[vl_paramIdx].widgetDataType)
and v_UIHandler_openSubscriptions[vl_paramIdx].widgetDataType == pushButton)
){
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(v_UIHandler_openSubscriptions[vl_paramIdx].varIdx, vl_content);
if(ischosen(vl_content.intVal)){
vl_content.intVal := vl_content.intVal + 1;
f_EPTF_Var_adjustContent(v_UIHandler_openSubscriptions[vl_paramIdx].varIdx, vl_content);
} else {
f_EPTF_Var_refreshContent(v_UIHandler_openSubscriptions[vl_paramIdx].varIdx);
}
} else if(wtListbox == v_UIHandler_openSubscriptions[vl_paramIdx].widgetType){
var integer recindex := f_EPTF_UIHandler_widgetRecIndex(v_UIHandler_openSubscriptions[vl_paramIdx].widgetId);
if (recindex != -1 and v_UIHandler_guiItemList[recindex].XULformat.listbox.seltype == multiple){
//var EPTF_UIHandler_XTDP_XML_TagList listitems := {};
var integer k :=0
var EPTF_IntegerList intlist := {};
var EPTF_IntegerList vl_children := f_EPTF_UIHandler_getNonMetaChildren(recindex);
for (var integer i:=0;i<sizeof(vl_children);i:=i+1){
if (k<sizeof(pl_arglist) and v_UIHandler_guiItemList[vl_children[i]].XULformat.listitem.label_ ==
pl_arglist[k]){
k:=k+1;
intlist[sizeof(intlist)] := i;
}
}
f_EPTF_Var_adjustContent(v_UIHandler_openSubscriptions[vl_paramIdx].varIdx, {integerlistVal := intlist});
}
}else{
if(not f_EPTF_UIHandler_parseParamValue(v_UIHandler_openSubscriptions[vl_paramIdx].varIdx,vl_argument)){
f_EPTF_UIHandler_refreshWidget(v_UIHandler_openSubscriptions[vl_paramIdx]);
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleErrorResp(9999, vl_argument, requestor, illegalArgument, "ERROR: illegal input value at " & f_EPTF_Var_getName(v_UIHandler_openSubscriptions[vl_paramIdx].varIdx)));
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updatesubscriptionsguilist
//
// Purpose:
// Refreshes the content of the widgets connected to the specified variable.
//
// Parameters:
// pl_varIdx - *in* *integer - The index of the variable.
// pl_dcontent - *in* *EPTF_Var_DirectContent* - The new content.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_updatesubscriptionsguilist(
in integer pl_varIdx,
in EPTF_Var_DirectContent pl_dcontent)
runs on EPTF_UIHandler_Private_CT {
var EPTF_UIHandler_OpenSubscriptions vl_subs;
if(f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_varIdx, vl_subs)){
for(var integer vl_i := 0; vl_i < sizeof(vl_subs); vl_i := vl_i + 1){
f_EPTF_UIHandler_updateguilist_refreshwidget(vl_subs[vl_i].widgetId,
pl_dcontent);
// f_EPTF_Var_directContent2str(pl_dcontent));
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_adjustContentResponseHandler
//
// Purpose:
// Response handler callback function for Variable adjustContent.
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_adjustContentResponseHandler(
in integer pl_idx,
in EPTF_Var_DirectContent pl_content,
in boolean pl_result,
in EPTF_IntegerList pl_argList) runs on EPTF_UIHandler_Private_CT
{
if(not pl_result) { // guard function returned false
var EPTF_UIHandler_OpenSubscriptions vl_subs;
if(f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_idx, vl_subs)){
for(var integer i := 0; i < sizeof(vl_subs); i := i + 1) {
f_EPTF_UIHandler_refreshWidget(vl_subs[i],-,pl_content);
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_parseParamValue
//
// Purpose:
// Parses a charstring value and
// stores it in the specified variable
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_parseParamValue(
in integer pl_varIdx,
in charstring pl_argument)
runs on EPTF_UIHandler_Private_CT
return boolean{
var EPTF_Var vl_parsedArgument;
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(pl_varIdx, vl_content);
var boolean vl_ret := false;
if (ischosen(vl_content.intVal)){
var charstring vl_arg := f_EPTF_UIHandler_str2Integer(pl_argument);
if(vl_arg != "") {
vl_parsedArgument.content.direct.intVal := str2int(vl_arg);
// detect user typos
//if ((vl_parsedArgument.content.direct.intVal != 0) or (vl_arg == "0"))
{ // store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
}
else if (ischosen(vl_content.integerlistVal))
{
// parse it
vl_parsedArgument.content.direct.integerlistVal := f_EPTF_UIHandler_str2IntegerList(pl_argument);
// detect user typos
if ((sizeof(vl_parsedArgument.content.direct.integerlistVal) != 0) or (regexp(pl_argument, "\\s#(,)([0-9]+)\\s#(,)", 0) == ""))
{
// no typo, argument ok
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
else if (ischosen(vl_content.floatlistVal))
{
// parse it
vl_parsedArgument.content.direct.floatlistVal := f_EPTF_UIHandler_str2FloatList(pl_argument);
// detect user typos
if (sizeof(vl_parsedArgument.content.direct.floatlistVal) != 0) //: a regexp should be here??
{
// no typo, argument ok
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
else if (ischosen(vl_content.octetstringVal))
{
// detect user typos
if (regexp(pl_argument, "\\s#(,)([0-9a-fA-F]+)\\s#(,)", 0) != "")
{
// check if the length of pl_argument is odd
var charstring vl_convertedOS := regexp(pl_argument, "\\s#(,)([0-9a-fA-F]+)\\s#(,)", 0);
if ((lengthof(vl_convertedOS) mod 2) != 0) { vl_convertedOS := "0" & vl_convertedOS };
vl_parsedArgument.content.direct.octetstringVal := str2oct(vl_convertedOS);
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
else if (ischosen(vl_content.floatVal))
{
// detect user typos
if (regexp(pl_argument, c_EPTF_CLI_floatNumber, 0) != "")
{
vl_parsedArgument.content.direct.floatVal := str2float(pl_argument);
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
else if (ischosen(vl_content.boolVal))
{
vl_parsedArgument.content.direct.boolVal := f_EPTF_UIHandler_str2bool(pl_argument);
// store
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
else if (ischosen(vl_content.bitstringVal))
{
// detect user typos
if (regexp(pl_argument, "\\s#(,)([01]+)\\s#(,)", 0) != "")
{
vl_parsedArgument.content.direct.bitstringVal := str2bit(pl_argument);
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
else if (ischosen(vl_content.hexstringVal))
{
// detect user typos
if (regexp(pl_argument, "\\s#(,)([0-9a-fA-F]+)\\s#(,)", 0) != "")
{
vl_parsedArgument.content.direct.hexstringVal := str2hex(pl_argument);
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
else if (ischosen(vl_content.charstringVal))
{
vl_parsedArgument.content.direct.charstringVal := pl_argument;
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct,
{refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
else if (ischosen(vl_content.statusLEDVal))
{
// parse statusled string
const charstring cl_ledStart := "[led:";
const charstring cl_ledEnd := "]";
var charstring vl_ledColor := f_substr_token(pl_argument,cl_ledStart,cl_ledEnd);
var charstring vl_withText := "";
var EPTF_LEDColors vl_color;
if(vl_ledColor != "") {
var charstring vl_ledStr := cl_ledStart&vl_ledColor&cl_ledEnd;
var integer vl_i:=f_strstr(pl_argument,vl_ledStr);
if(vl_i==0) {
vl_withText := substr(pl_argument, lengthof(vl_ledStr), (lengthof(pl_argument)-lengthof(vl_ledStr)));
select(vl_ledColor) {
case ("blue"){ vl_color := led_blue;}
case ("black"){ vl_color := led_black;}
case ("yellow"){ vl_color := led_yellow;}
case ("green"){ vl_color := led_green;}
case ("red"){ vl_color := led_red;}
}
if(isbound(vl_color)==true) {
if(vl_withText == "") {
vl_parsedArgument.content.direct.statusLEDVal := {color:=vl_color, text:= omit };
}
else {
vl_parsedArgument.content.direct.statusLEDVal := {color:=vl_color, text:= vl_withText };
}
// store
f_EPTF_UIHandler_updatesubscriptionsguilist(pl_varIdx, vl_parsedArgument.content.direct);
f_EPTF_Var_adjustContent(pl_varIdx, vl_parsedArgument.content.direct, {refers(f_EPTF_UIHandler_adjustContentResponseHandler), {}});
vl_ret := true;
}
}
}
}
else{
f_EPTF_UIHandler_warning("Invalid value type!");
//f_EPTF_Base_stop();
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_setWidgetOriginalDisabled
//
// Purpose:
// Set oroginal enabled state of the widget in the list of GUI items
//
// Parameters:
// pl_i - *in* *integer* the idx of the widget in the gui items' list
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_setWidgetOriginalDisabled(in integer pl_i)
runs on EPTF_UIHandler_Private_CT
return boolean
{
if (pl_i == -1){return false;}
v_UIHandler_guiItemList[pl_i].xuldisabled := false; // always setup
if (v_UIHandler_guiItemList[pl_i].widgetType == wtTabpages){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.tabpages.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.tabpages.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTabpage){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.tabpage.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.tabpage.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.hbox.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.hbox.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTree){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.tree.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.tree.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecol){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.treecol.disabledongui)){
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.treecol.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecell){
// cell editable info not present in XUL -> after headless mode enabled cell could become disabled
// workaround: enabling a cell enables the whole column
// get treecol's widgetIdx
var integer vl_colIdx := v_UIHandler_guiItemList[pl_i].widgetData.cellData.colIdx;
// set treecol editable
if(ispresent(v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.disabledongui)){
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.disabledongui;
} else {
v_UIHandler_guiItemList[pl_i].xuldisabled := false;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtLabel){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.label_.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.label_.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtButton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.button.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.button.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTextbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtNumericalwidget){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtChart){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.chart.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.chart.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtDistributionchart){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.distributionchart.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.distributionchart.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtToolbar){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.toolbar.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.toolbar.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtToolbarbutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.toolbarbutton.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.toolbarbutton.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtListbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtMenulist){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtPushbutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTogglebutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabledongui;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHtmlcode){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabledongui)) {
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabledongui;
}
}
return(v_UIHandler_guiItemList[pl_i].xuldisabled);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateguilist_enablewidget
//
// Purpose:
// Sets the enabled state of the widget in the list of GUI items to enabled
//
// Parameters:
// pl_i - *in* *integer* the idx of the widget in the gui items' list
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_updateguilist_enablewidget(in integer pl_i) runs on EPTF_UIHandler_Private_CT {
if (pl_i == -1){return;}
// If disabled in xul -> just return
if(not ispresent(v_UIHandler_guiItemList[pl_i].xuldisabled)){
var boolean vl_enabled := f_EPTF_UIHandler_setWidgetOriginalDisabled(pl_i);
}
// If disabled on XML ->
if(v_UIHandler_guiItemList[pl_i].xuldisabled == true){
return;
}
if (v_UIHandler_guiItemList[pl_i].widgetType == wtButton){
v_UIHandler_guiItemList[pl_i].XULformat.button.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTabpages){
v_UIHandler_guiItemList[pl_i].XULformat.tabpages.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTree){
v_UIHandler_guiItemList[pl_i].XULformat.tree.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecol){
v_UIHandler_guiItemList[pl_i].XULformat.treecol.editable := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecell){
// cell editable info not present in XUL -> after headless mode enabled cell could become disabled
// workaround: enabling a cell enables the whole column
// get treecol's widgetIdx
// var integer vl_colIdx := v_UIHandler_guiItemList[pl_i].widgetData.cellData.colIdx;
// set treecol editable
// v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.editable := true;
var integer vl_colIdx := v_UIHandler_guiItemList[pl_i].widgetData.cellData.colIdx;
// set treecol editable
if(0<= vl_colIdx and ispresent(v_UIHandler_guiItemList[vl_colIdx].xuldisabled)) {
// If disabled on XML
v_UIHandler_guiItemList[pl_i].xuldisabled := v_UIHandler_guiItemList[vl_colIdx].xuldisabled;
} else {
v_UIHandler_guiItemList[pl_i].xuldisabled := false;
}
v_UIHandler_guiItemList[pl_i].widgetData.cellData.editable := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHbox){
v_UIHandler_guiItemList[pl_i].XULformat.hbox.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtLabel){
v_UIHandler_guiItemList[pl_i].XULformat.label_.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTextbox){
v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtChart){
v_UIHandler_guiItemList[pl_i].XULformat.chart.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtListbox){
v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtNumericalwidget){
v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtMenulist){
v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtDistributionchart){
v_UIHandler_guiItemList[pl_i].XULformat.distributionchart.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtPushbutton){
v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTogglebutton){
v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabled := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHtmlcode){
v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabled := false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateguilist_disablewidget
//
// Purpose:
// Sets the enabled state of the widget in the list of GUI items to disabled
//
// Parameters:
// pl_i - *in* *integer* the idx of the widget in the gui items' list
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_updateguilist_disablewidget(in integer pl_i) runs on EPTF_UIHandler_Private_CT {
if (pl_i == -1) {return;}
if (v_UIHandler_guiItemList[pl_i].widgetType == wtButton){
v_UIHandler_guiItemList[pl_i].XULformat.button.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTabpages){
v_UIHandler_guiItemList[pl_i].XULformat.tabpages.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTree){
v_UIHandler_guiItemList[pl_i].XULformat.tree.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecol){
v_UIHandler_guiItemList[pl_i].XULformat.treecol.editable := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecell){
v_UIHandler_guiItemList[pl_i].widgetData.cellData.editable := false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHbox){
v_UIHandler_guiItemList[pl_i].XULformat.hbox.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtLabel){
v_UIHandler_guiItemList[pl_i].XULformat.label_.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTextbox){
v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtChart){
v_UIHandler_guiItemList[pl_i].XULformat.chart.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtListbox){
v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtNumericalwidget){
v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtMenulist){
v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtDistributionchart){
v_UIHandler_guiItemList[pl_i].XULformat.distributionchart.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtPushbutton){
v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTogglebutton){
v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabled := true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHtmlcode){
v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabled := true;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_isWidgetEnabled
//
// Purpose:
// Gets the enabled state of the widget in the list of GUI items
//
// Parameters:
// pl_i - *in* *integer* the idx of the widget in the gui items' list
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_isWidgetEnabled(in integer pl_i)
runs on EPTF_UIHandler_Private_CT
return boolean
{
if (pl_i == -1){return false;}
// If disabled on XML
if(v_UIHandler_guiItemList[pl_i].xuldisabled == true){ return false; }
if (v_UIHandler_guiItemList[pl_i].widgetType == wtButton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.button.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.button.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecol){
if(v_UIHandler_guiItemList[pl_i].XULformat.treecol.widgetType == statusLED or
v_UIHandler_guiItemList[pl_i].XULformat.treecol.widgetType == statusLEDWithText) {
return false;
}
return v_UIHandler_guiItemList[pl_i].XULformat.treecol.editable;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecell){
// cell editable info not present in XUL -> after headless mode enabled cell could become disabled
// workaround: enabling a cell enables the whole column
// get treecol's widgetIdx
if(ispresent(v_UIHandler_guiItemList[pl_i].widgetData.cellData.editable)) {
return v_UIHandler_guiItemList[pl_i].widgetData.cellData.editable;
}
var integer vl_colIdx := v_UIHandler_guiItemList[pl_i].widgetData.cellData.colIdx;
// set treecol editable
if(v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.widgetType == statusLED or
v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.widgetType == statusLEDWithText) {
return false;
}
return (not ispresent(v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.editable)) or
v_UIHandler_guiItemList[vl_colIdx].XULformat.treecol.editable;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTextbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.textbox.readonly)
and v_UIHandler_guiItemList[pl_i].XULformat.textbox.readonly) { return false; }
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtListbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtNumericalwidget){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.readonly)
and v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.readonly) { return false; }
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtMenulist){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtPushbutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTogglebutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabled;
} else {
return true;
}
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHtmlcode){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabled)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabled;
} else {
return true;
}
}
/* else if (v_UIHandler_guiItemList[pl_i].widgetType == wtDistributionchart){
return false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTabbox){
return false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTree){
return false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHbox){
return false;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtLabel){
return false; // text labels are never editable on the GUI
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtChart){
return false;
}*/else { return false; }
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_isWidgetUninitialisedOrDisabled
//
// Purpose:
// Gets the unitialised or disabled state of the widget in the list of GUI items
//
// Parameters:
// pl_i - *in* *integer* the idx of the widget in the gui items' list
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_isWidgetUninitialisedOrDisabled(in integer pl_i)
runs on EPTF_UIHandler_Private_CT
return boolean
{
if (pl_i == -1){return false;}
if (v_UIHandler_guiItemList[pl_i].widgetType == wtButton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.button.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.button.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecol){
if(v_UIHandler_guiItemList[pl_i].XULformat.treecol.widgetType == statusLED or
v_UIHandler_guiItemList[pl_i].XULformat.treecol.widgetType == statusLEDWithText) {
return true;
}
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.treecol.editable)) {
return not v_UIHandler_guiItemList[pl_i].XULformat.treecol.editable;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTreecell){
if(ispresent(v_UIHandler_guiItemList[pl_i].widgetData.cellData.editable)) {
return not v_UIHandler_guiItemList[pl_i].widgetData.cellData.editable;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTextbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.textbox.readonly)
and v_UIHandler_guiItemList[pl_i].XULformat.textbox.readonly) {
return true;
}
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.textbox.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtListbox){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.listbox.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtNumericalwidget){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.readonly)
and v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.readonly) {
return true;
}
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.numericalwidget.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtMenulist){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.menulist.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtPushbutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.pushbutton.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtTogglebutton){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.togglebutton.disabled;
}
return true;
} else if (v_UIHandler_guiItemList[pl_i].widgetType == wtHtmlcode){
if(ispresent(v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabled)) {
return v_UIHandler_guiItemList[pl_i].XULformat.htmlcode.disabled;
}
return true;
}
else { return true; }
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_isGuiVarEditable
//
// Purpose:
// Gets the enabled state of a GUI variable
//
// Parameters:
// pl_varIdx - *in* *integer* the idx of the GUI variable
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_isGuiVarEditable(in integer pl_varIdx)
runs on EPTF_UIHandler_Private_CT
return boolean
{
var EPTF_UIHandler_OpenSubscriptions vl_subs := {};
if(f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_varIdx, vl_subs)) {
for(var integer i:=0;i<sizeof(vl_subs);i:=i+1) {
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(vl_subs[i].widgetId);
if(vl_widgetIdx != -1 and f_EPTF_UIHandler_isWidgetEnabled(vl_widgetIdx)) { return true; }
}
return false;
} else {
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_handleEnableWidgetByIdx
//
// Purpose:
// Handles the EnableWidgetByIdx and DisableWidgetByIdx messages
//
// Parameters:
// pl_msg - *in* *EPTF_UIHandler_AdminEnableWidgetByIdx* - the message that specifies the widget
// pl_enable - *in* *boolean* - Describes what to do. Enable or disable.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_handleEnableWidgetByIdx(
in EPTF_UIHandler_AdminEnableWidgetByIdx pl_msg,
in boolean pl_enable)
runs on EPTF_UIHandler_Private_CT {
var EPTF_UIHandler_OpenSubscriptions vl_subs;
if(f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_msg.index, vl_subs)){
for(var integer vl_i := 0; vl_i < sizeof(vl_subs); vl_i := vl_i + 1){
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(vl_subs[vl_i].widgetId);
if(-1 == vl_widgetIdx){
f_EPTF_UIHandler_warning("The variable index is invalid!");
EPTF_adminPort_CP.send(
t_UIHandler_AdminEnableWidgetNAck(pl_msg.messageID)) to vl_subs[vl_i].provider;
return;
}
if(pl_enable){
f_EPTF_Base_assert(%definitionId&": Invalid widget id: "&vl_subs[vl_i].widgetId, vl_widgetIdx > -1);
f_EPTF_UIHandler_updateguilist_enablewidget(vl_widgetIdx);
}else{
f_EPTF_Base_assert(%definitionId&": Invalid widget id: "&vl_subs[vl_i].widgetId, vl_widgetIdx > -1);
f_EPTF_UIHandler_updateguilist_disablewidget(vl_widgetIdx);
}
// check here
if(f_EPTF_UIHandler_isWidgetEnabled(vl_widgetIdx) == true){
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_enableWidget(vl_subs[vl_i].widgetId));
}else{
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_disableWidget(vl_subs[vl_i].widgetId));
}
EPTF_adminPort_CP.send(
t_UIHandler_AdminEnableWidgetAck(pl_msg.messageID))to vl_subs[vl_i].provider;
}
}
}
//=========================================================================
// Altsteps
//=========================================================================
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_pingGUI
//
// Purpose:
// In headless mode, it transmits UDP pings and
// receives, validates the answers
///////////////////////////////////////////////////////////
private altstep as_UIHandler_pingGUI() runs on EPTF_UIHandler_Private_CT {
[]t_UIHandler_pingtimer.timeout{
var Result vl_result
f_EPTF_Transport_sendTo(
IPL4,
v_UIHandler_pingerConnectionId,
v_UIHandler_GUI_Host,
v_UIHandler_udp_port,
char2oct("This is UIHandler: " & int2str(v_UIHandler_pingcounter)),
vl_result,
false)
v_UIHandler_pingcounter := v_UIHandler_pingcounter + 1;
if (v_UIHandler_pingcounter == 2147483646) {v_UIHandler_pingcounter := 2;v_UIHandler_prevpingcounter := 0;v_UIHandler_succpingcounter:=0;}
t_UIHandler_pingtimer.start;
repeat;
}
}
//FIXME Use new API
function f_EPTF_UIHandler_pingerReceive(
in EPTF_Transport_TransportType pl_transportType,
in ConnectionId pl_connId,
in HostName pl_remHost,
in PortNumber pl_remPort,
in HostName pl_locHost,
in PortNumber pl_locPort,
in ProtoTuple pl_proto,
in integer pl_userData,
in octetstring pl_msg)
runs on EPTF_UIHandler_Private_CT
{
if (not v_UIHandler_initialized) {
return;
}
if(not match(pl_msg, '47554920726573706F6E73653A*'O)) {
return;
}
if (v_UIHandler_prevpingcounter == v_UIHandler_pingcounter - 2) {
v_UIHandler_succpingcounter := v_UIHandler_succpingcounter + 1;
} else {v_UIHandler_succpingcounter := 0;}
v_UIHandler_prevpingcounter := v_UIHandler_pingcounter - 1;
if (v_UIHandler_succpingcounter == 3) {
f_EPTF_UIHandler_headlessmodeover();
}
}
///////////////////////////////////////////////////////////
// Function: f_UIHandler_setHandshakeMaxTime
//
// Purpose:
// Sets the XTDP handshake timeout
//
// Parameters:
// pl_maxTime - *in* *float* - the time of the XTDP handshake timeout in seconds. Default: 1.0
///////////////////////////////////////////////////////////
public function f_UIHandler_setHandshakeMaxTime(in float pl_maxTime := 1.0) runs on EPTF_UIHandler_Private_CT {
v_handshakeMaxTime := pl_maxTime;
}
///////////////////////////////////////////////////////////
// Function: f_UIHandler_setByeMaxTime
//
// Purpose:
// Sets the XTDP bye timeout
//
// Parameters:
// pl_maxTime - *in* *float* - the time of the XTDP bye timeout in seconds. Default: 1.0
///////////////////////////////////////////////////////////
public function f_UIHandler_setByeMaxTime(in float pl_maxTime := 1.0) runs on EPTF_UIHandler_Private_CT {
v_byeMaxTime := pl_maxTime;
}
///////////////////////////////////////////////////////////
// Function: f_UIHandler_setAuthMaxTime
//
// Purpose:
// Sets the XTDP authentication timeout
//
// Parameters:
// pl_maxTime - *in* *float* - the time of the XTDP authentication timeout in seconds. Default: 1.0
///////////////////////////////////////////////////////////
public function f_UIHandler_setAuthMaxTime(in float pl_maxTime := 1.0) runs on EPTF_UIHandler_Private_CT {
v_authMaxTime := pl_maxTime;
}
/////////////////////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_WidgetFunctions_setXTDP_XSDFilepath
//
// Purpose:
// This function sets the the UIHandler XTDP XSD file path.
// If its not empty string the CreateGUI validate the XML with it.
//
// Parameters:
// pl_filepath - *in* <charstring> - the file path
//
// Return Value:
// -
//
/////////////////////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_WidgetFunctions_setXTDP_XSDFilepath(in charstring pl_filepath)
runs on EPTF_UIHandler_Private_CT{
v_EPTF_UIHandler_WidgetFunctions_XTDP_XSD_filepath := pl_filepath;
}
/////////////////////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_WidgetFunctions_getXTDP_XSDFilepath
//
// Purpose:
// This function returns with the UIHandler XTDP XSD file path.
//
// Parameters:
// -
//
// Return Value:
// *charstring* - the filepath
//
/////////////////////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_WidgetFunctions_getXTDP_XSDFilepath()
runs on EPTF_UIHandler_Private_CT return charstring{
return v_EPTF_UIHandler_WidgetFunctions_XTDP_XSD_filepath;
}
const float c_EPTF_UIHandler_xtdpMyVersion := 1.0;
const float c_EPTF_UIHandler_xtdlMyVersion := 1.0;
// returns the error message ("" if success)
private function f_EPTF_UIHandler_handshake(in integer pl_guiClientId) runs on EPTF_UIHandler_Private_CT return charstring {
v_UIHandler_lastRequest := v_UIHandler_lastRequest + 1;
var integer vl_handshakeTimer := f_EPTF_Semaphore_new();
var Result vl_result
f_EPTF_Transport_send(
IPL4,
pl_guiClientId,//v_UIHandler_GUIClientId[i],
f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message:{
transactionID := vl_handshakeTimer+1000*v_UIHandler_lastRequest,
choice := { xTDP_HandshakeRequest := {
xtdpRequiredVersion := c_EPTF_UIHandler_xtdpMyVersion,
xtdlRequiredVersion := c_EPTF_UIHandler_xtdlMyVersion,
xtdpMyVersion := c_EPTF_UIHandler_xtdpMyVersion,
xtdlMyVersion := c_EPTF_UIHandler_xtdlMyVersion
,elem_list := {}
}}
})),
vl_result,
false
);
v_handshakeErrorMsg := "";
if (f_EPTF_Semaphore_waitForUnlock(vl_handshakeTimer,v_handshakeMaxTime)) {
// max wait time expired before response received:
v_handshakeErrorMsg := "Error: UIHandler: Communication error: No response received for Handshake request"
}
if (v_handshakeErrorMsg!="") {
f_EPTF_UIHandler_warning("XTDP Handshake failed for client "&log2str(pl_guiClientId)&". Closing XTDP session. Handshake result: "&v_handshakeErrorMsg);
f_EPTF_UIHandler_closeXTDPSession(pl_guiClientId);
// handshake unsuccessful
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
return v_handshakeErrorMsg;
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleSubscriptNote
//
// Purpose:
// Calls the f_EPTF_UIHandler_handleSubscriptNote
// when receives a subscription note
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleSubscriptNote() runs on EPTF_UIHandler_Private_CT {
var EPTF_UIHandler_WidgetMsg vl_EPTF_CLL_UISubscMgmtMsg;
var EPTF_Var_CT vl_EPTF_CLL_UISubscMgmtMsg_sender;
[] EPTF_adminPort_CP.receive({subscribeNoteMsg := ?}) -> value vl_EPTF_CLL_UISubscMgmtMsg sender vl_EPTF_CLL_UISubscMgmtMsg_sender {
f_EPTF_UIHandler_handleSubscriptNote(vl_EPTF_CLL_UISubscMgmtMsg.subscribeNoteMsg,vl_EPTF_CLL_UISubscMgmtMsg_sender);
}
}
private altstep as_UIHandler_bufferedXTDP() runs on EPTF_UIHandler_Private_CT
{
[]t_UIHandler_bufferedXTDP.timeout
{
// if (sizeof(v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list) != 0)
if (f_EPTF_UIHandler_requestBuffer_size() != 0)
{
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1)
{
// v_UIHandler_Requestbuffer.client_id := v_UIHandler_GUIClientId[i];
if (v_UIHandler_guiConnected)
{
var Result vl_result
f_EPTF_Transport_send(IPL4, v_UIHandler_GUIClientId[i].clientId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(v_UIHandler_Requestbuffer.data)), vl_result, false)
}
}
// v_UIHandler_Requestbuffer.data.choice.xTDP_Requests.xTDP_Request_list := {};
f_EPTF_UIHandler_requestBuffer_clear();
}
t_UIHandler_bufferedXTDP.start(tsp_EPTF_UIHandler_bufferedXTDP);
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleSubscriptNote
//
// Purpose:
// The main altstep of the component
///////////////////////////////////////////////////////////
private altstep as_handle_main_EPTF_UIHandler_MgmtIf() runs on EPTF_UIHandler_Private_CT {
[/*not v_UIHandler_subscriptInProcess*/] as_UIHandler_handleSubscriptNote(){repeat;};
[not v_UIHandler_guiConnected and not v_EPTF_UIHandler_servermode] as_UIHandler_pingGUI(){repeat;}
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleEnableWidget(){repeat;};
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleDisableWidget(){repeat;};
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleSetFocusToWidget(){repeat;};
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleaddElementToGUI(){repeat;};
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleCreateGUI(){repeat;};
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleremoveElementFromGUI(){repeat;};
[f_EPTF_UIHandler_layoutReady()] as_UIHandler_handleWidgetExists(){repeat;};
[tsp_EPTF_UIHandler_bufferedXTDP != 0.0] as_UIHandler_bufferedXTDP(){repeat;};
[not v_UIHandler_createGUIRunning and v_UIHandler_initToGUIClient] as_UIHandler_handleInitGUIToClient(){repeat;}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleEnableWidget
//
// Purpose:
// Altstep that handles enableWidget messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives enableWidget requests, sends XTDP-enable-widget
// message to GUI if connected
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleEnableWidget() runs on EPTF_UIHandler_Private_CT {
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminEnableWidgetByIdx(?,?))
-> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp {
f_EPTF_UIHandler_handleEnableWidgetByIdx(vl_EPTF_msg_tmp.enableWidgetByIdx, true);
repeat;
}
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminEnableWidgetByWidgetName(?,?)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp {
var EPTF_UIHandler_WidgetIdString vl_widgetName := vl_EPTF_msg_tmp.enableWidgetByWidgetName.widgetName;
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(vl_widgetName);
if(-1 < vl_widgetIdx) {
f_EPTF_UIHandler_updateguilist_enablewidget(vl_widgetIdx);
if (vl_widgetName == "") {
f_EPTF_UIHandler_warning("CLL_UIHandler: the widget name is empty in as_UIHandler_handleEnableWidget()");
EPTF_adminPort_CP.send(t_UIHandler_AdminEnableWidgetNAck(vl_EPTF_msg_tmp.enableWidgetByWidgetName.messageID)) to v_UIHandler_address_tmp;
}
}
else {
f_EPTF_UIHandler_warning("CLL_UIHandler: here is no widget with name "&vl_widgetName&" in as_UIHandler_handleEnableWidget()");
EPTF_adminPort_CP.send(t_UIHandler_AdminEnableWidgetNAck(vl_EPTF_msg_tmp.enableWidgetByWidgetName.messageID)) to v_UIHandler_address_tmp;
}
if (v_UIHandler_guiConnected) {
// check here
if(f_EPTF_UIHandler_isWidgetEnabled(vl_widgetIdx) == true){
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_enableWidget(vl_widgetName));
} else {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_disableWidget(vl_widgetName));
}
}
EPTF_adminPort_CP.send(t_UIHandler_AdminEnableWidgetAck(vl_EPTF_msg_tmp.enableWidgetByWidgetName.messageID)) to v_UIHandler_address_tmp;
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleDisableWidget
//
// Purpose:
// Altstep that handles disableWidget messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives disableWidget requests, sends XTDP-disable-widget
// message to GUI if connected
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleDisableWidget() runs on EPTF_UIHandler_Private_CT {
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminDisableWidgetByIdx(?,?)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp {
f_EPTF_UIHandler_handleEnableWidgetByIdx(vl_EPTF_msg_tmp.enableWidgetByIdx, false);
repeat;
}
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminDisableWidgetByWidgetName(?,?)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp {
var EPTF_UIHandler_WidgetIdString vl_widgetName := vl_EPTF_msg_tmp.disableWidgetByWidgetName.widgetName;
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(vl_widgetName);
f_EPTF_UIHandler_updateguilist_disablewidget(vl_widgetIdx);
if(-1 < vl_widgetIdx) {
if (vl_widgetName == "") {
f_EPTF_UIHandler_warning("CLL_UIHandler: the widget name is empty in as_UIHandler_handleDisableWidget()");
EPTF_adminPort_CP.send(t_UIHandler_AdminDisableWidgetNAck(vl_EPTF_msg_tmp.disableWidgetByWidgetName.messageID)) to v_UIHandler_address_tmp;
}
} else {
f_EPTF_UIHandler_warning("CLL_UIHandler: here is no widget with name "&vl_widgetName&" in as_UIHandler_handleDisableWidget()");
EPTF_adminPort_CP.send(t_UIHandler_AdminDisableWidgetNAck(vl_EPTF_msg_tmp.disableWidgetByWidgetName.messageID)) to v_UIHandler_address_tmp;
}
if (v_UIHandler_guiConnected) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_disableWidget(vl_widgetName));
}
EPTF_adminPort_CP.send(t_UIHandler_AdminDisableWidgetAck(vl_EPTF_msg_tmp.disableWidgetByWidgetName.messageID)) to v_UIHandler_address_tmp;
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleSetFocusToWidget
//
// Purpose:
// Altstep that handles setFocusToWidget messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives setFocusToWidget requests, sends XTDP-setfocus-widget
// message to GUI if connected
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleSetFocusToWidget() runs on EPTF_UIHandler_Private_CT {
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminSetFocusToWidget(?,?,*)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp {
var EPTF_UIHandler_WidgetIdString vl_widgetName := vl_EPTF_msg_tmp.setFocusToWidget.widgetName;
if (vl_widgetName == "") {
f_EPTF_UIHandler_warning("CLL_UIHandler: the widget name is empty in as_UIHandler_handleSetFocusToWidget()");
EPTF_adminPort_CP.send(t_UIHandler_AdminSetFocusToWidgetNAck(vl_EPTF_msg_tmp.setFocusToWidget.messageID)) to v_UIHandler_address_tmp;
}
if (v_UIHandler_guiConnected) {
if (not(ispresent(vl_EPTF_msg_tmp.setFocusToWidget.tabIndex))) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_setFocusToWidget(vl_widgetName));
}
else {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_setFocusToTab(vl_widgetName, vl_EPTF_msg_tmp.setFocusToWidget.tabIndex));
}
EPTF_adminPort_CP.send(t_UIHandler_AdminSetFocusToWidgetAck(vl_EPTF_msg_tmp.setFocusToWidget.messageID)) to v_UIHandler_address_tmp;
}
if(tsp_EPTF_UIHandler_enableBrowserGUI){
if(v_EPTF_UIHandler_Browser_activateWidgetIds != ""){
v_EPTF_UIHandler_Browser_activateWidgetIds := v_EPTF_UIHandler_Browser_activateWidgetIds & "," & vl_widgetName;
} else {
v_EPTF_UIHandler_Browser_activateWidgetIds := vl_widgetName;
}
}
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleaddElementToGUI
//
// Purpose:
// Altstep that handles addElementToGUI messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives addElementToGUI requests, sends XTDP-AddRequests
// message to GUI if connected
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleaddElementToGUI() runs on EPTF_UIHandler_Private_CT
{
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
var boolean vl_widgetExists := false;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminAddElementToGUI(*, ?, ?/*, ?*/)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp
{
if (f_EPTF_UIHandler_XSD_addElementToGui(vl_EPTF_msg_tmp.addElementToGUI.xul, vl_EPTF_msg_tmp.addElementToGUI.parentWidgetId, vl_widgetExists))
{ //send ack
EPTF_adminPort_CP.send(t_UIHandler_AdminAddElementToGUIAck(
vl_EPTF_msg_tmp.addElementToGUI.messageID,
vl_widgetExists)) to v_UIHandler_address_tmp;
} else
{ //send nack
EPTF_adminPort_CP.send(t_UIHandler_AdminAddElementToGUINAck(vl_EPTF_msg_tmp.addElementToGUI.messageID/*,
vl_EPTF_msg_tmp.addElementToGUI.replyRoutingIds*/)) to v_UIHandler_address_tmp;
}
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleCreateGUI
//
// Purpose:
// Altstep that handles CreateGUI messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives createGUI requests, and calls createGui
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleCreateGUI() runs on EPTF_UIHandler_Private_CT
{
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminCreateGUI(*, ?, ?/*, ?*/)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp
{
if (f_EPTF_UIHandler_createGUI(vl_EPTF_msg_tmp.createGUI.xul, vl_EPTF_msg_tmp.createGUI.parentWidgetId))
{ //send ack
EPTF_adminPort_CP.send(t_UIHandler_AdminCreateGUIAck(vl_EPTF_msg_tmp.createGUI.messageID)) to v_UIHandler_address_tmp;
} else
{ //send nack
EPTF_adminPort_CP.send(t_UIHandler_AdminCreateGUINAck(vl_EPTF_msg_tmp.createGUI.messageID)) to v_UIHandler_address_tmp;
}
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleremoveElementFromGUI
//
// Purpose:
// Altstep that handles removeElementFromGUI messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives removeElementFromGUI requests, sends XTDP-RemoveRequests
// message to GUI if connected
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleremoveElementFromGUI() runs on EPTF_UIHandler_Private_CT
{
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminRemoveElementFromGUI(?,?)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp
{
if (f_EPTF_UIHandler_removeElementFromGui(vl_EPTF_msg_tmp.removeElementFromGUI.widgetId))
{//send ack
EPTF_adminPort_CP.send(t_UIHandler_AdminRemoveElementFromGUIAck(vl_EPTF_msg_tmp.removeElementFromGUI.widgetId/*,
vl_EPTF_msg_tmp.removeElementFromGUI.replyRoutingIds*/)) to v_UIHandler_address_tmp;
} else
{//send nack
EPTF_adminPort_CP.send(t_UIHandler_AdminRemoveElementFromGUINAck(vl_EPTF_msg_tmp.removeElementFromGUI.widgetId/*,
vl_EPTF_msg_tmp.removeElementFromGUI.replyRoutingIds*/)) to v_UIHandler_address_tmp;
}
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_handleWidgetExists
//
// Purpose:
// Altstep that handles widgetExists messages at CLL_UIHandler interface.
//
// Errors:
// none
//
// Detailed Comments:
// As altstep receives widgetExists requests it checks the given widget
// in UI handler's internal database
///////////////////////////////////////////////////////////
private altstep as_UIHandler_handleWidgetExists() runs on EPTF_UIHandler_Private_CT
{
var EPTF_UIHandler_WidgetMsg vl_EPTF_msg_tmp;
[] EPTF_adminPort_CP.receive(t_UIHandler_AdminWidgetExists(*,*)) -> value vl_EPTF_msg_tmp sender v_UIHandler_address_tmp
{
var EPTF_UIHandler_GuiItemRec vl_rec;
if(not f_EPTF_UIHandler_getWidgetRec(vl_EPTF_msg_tmp.widgetExists.widgetName, vl_rec)){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": f_EPTF_UIHandler_getwidgetrec failed!");
}
}
EPTF_adminPort_CP.send(
t_UIHandler_AdminWidgetExistsResp(
vl_EPTF_msg_tmp.widgetExists.widgetName,
vl_EPTF_msg_tmp.widgetExists.messageID,
vl_rec.widgetType)) to v_UIHandler_address_tmp;
}
}
private function f_EPTF_UIHandler_addclientid(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT{
if (f_EPTF_UIHandler_isConnectedClientid(pl_clientid)) {
return;
}
var integer vl_clientIdx := sizeof(v_UIHandler_GUIClientId);
v_UIHandler_GUIClientId[vl_clientIdx] := c_EPTF_UIHandler_GUIClientData;
v_UIHandler_GUIClientId[vl_clientIdx].clientId := pl_clientid;
}
private function f_EPTF_UIHandler_setClientHandshakeSuccessful(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT{
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1){
if (v_UIHandler_GUIClientId[i].clientId == pl_clientid){
v_UIHandler_GUIClientId[i].handshakeSuccessful := true;
return;
}
}
}
private function f_EPTF_UIHandler_getClientHandshakeSuccessful(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT return boolean {
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1){
if (v_UIHandler_GUIClientId[i].clientId == pl_clientid){
return v_UIHandler_GUIClientId[i].handshakeSuccessful;
}
}
return false;
}
private function f_EPTF_UIHandler_setClientAuthenticationSuccessful(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT{
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1){
if (v_UIHandler_GUIClientId[i].clientId == pl_clientid){
v_UIHandler_GUIClientId[i].authenticationSuccessful := true;
return;
}
}
}
private function f_EPTF_UIHandler_getClientAuthenticationSuccessful(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT return boolean {
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1){
if (v_UIHandler_GUIClientId[i].clientId == pl_clientid){
return v_UIHandler_GUIClientId[i].authenticationSuccessful;
}
}
return false;
}
private function f_EPTF_UIHandler_delclientid(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT{
var EPTF_UIHandler_GUIClientDataList list := {};
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1){
if (v_UIHandler_GUIClientId[i].clientId != pl_clientid){
list[sizeof(list)] := v_UIHandler_GUIClientId[i];
}
}
v_UIHandler_GUIClientId := list;
}
private function f_EPTF_UIHandler_isConnectedClientid(in integer pl_clientid) runs on EPTF_UIHandler_Private_CT return boolean {
for (var integer i:=0;i<sizeof(v_UIHandler_GUIClientId);i:=i+1){
if (v_UIHandler_GUIClientId[i].clientId == pl_clientid){
return true;
}
}
return false;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_clearTracePointersDB
//
// Purpose:
// Clear trace pointer database
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_clearTracePointersDB() runs on EPTF_UIHandler_Private_CT {
//Empty the pointer list
v_UIHandler_tracePointers := {};
f_EPTF_int2int_HashMap_Clear(v_UIHandler_tracePointerHashMapId);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_clearInternalWidgetDB
//
// Purpose:
// Clear internal widget database
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_clearInternalWidgetDB() runs on EPTF_UIHandler_Private_CT {
//Empty the widget list
//FIXME: v_EPTF_UIHandler_Config_ConnectVarToWidgets:={} : unsubscribe?
var integer vl_i, vl_subsIdx:=-1, vl_size:=sizeof(v_UIHandler_guiItemList);
for(vl_i:=0; vl_i < vl_size; vl_i:=vl_i+1)
{
vl_subsIdx := f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(v_UIHandler_guiItemList[vl_i].id);
if(vl_subsIdx > -1){
f_EPTF_Var_unsubscribe(v_UIHandler_openSubscriptions[vl_subsIdx].varIdx);
}
}
v_EPTF_UIHandler_Config_ConnectVarToWidgets := {};
v_UIHandler_guiItemList := {};
f_EPTF_str2int_HashMap_Clear(v_UIHandler_widgetHashMapId);
//There is no window
v_UIHandler_windowIndex := -1;
// we must not close variable connections because of headless mode
f_EPTF_UIHandler_clearTracePointersDB();
}
group Logging {
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_error
//
// Purpose:
// Function to log an error from UIHandler feature.
//
// Parameters:
// - pl_message - *in* *charstring* - the message to log
//
// Return Value:
// -
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_error(in charstring pl_message)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Logging_error(true, tsp_EPTF_UIHandler_loggingComponentMask&": "&pl_message);
f_EPTF_Base_stopAll();
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_warning
//
// Purpose:
// Function to log a warning from UIHandler feature.
//
// Parameters:
// - pl_message - *in* *charstring* - the message to log
//
// Return Value:
// -
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_warning(in @lazy charstring pl_message)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Logging_warningV2(pl_message, v_UIHandler_loggingMaskId, {c_EPTF_UIHandler_loggingClassIdx_Warning});
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_debug
//
// Purpose:
// Function to log a debug message from UIHandler feature.
//
// Parameters:
// - pl_message - *in* *charstring* - the message to log
//
// Return Value:
// -
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_debug(in @lazy charstring pl_message)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Logging_debugV2(pl_message, v_UIHandler_loggingMaskId, {c_EPTF_UIHandler_loggingClassIdx_Debug});
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_debugEnabled
//
// Purpose:
// Function to check if debug is enabled for UIHandler
//
// Parameters:
// -
//
// Return Value:
// *boolean* - true if debug enalbed
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_debugEnabled()
runs on EPTF_UIHandler_Private_CT
return boolean
{
return f_EPTF_Logging_isEnabled(v_UIHandler_loggingMaskId, c_EPTF_UIHandler_loggingClassIdx_Debug);
}
} // group Logging
group Transport
{
private function f_EPTF_UIHandler_getWidgetFromXTDPAction(
in XTDP_Actions pl_action,
out template XTDP_Widget pl_retWidget){
if (ischosen(pl_action.choice.get)) {
pl_retWidget := pl_action.choice.get.widget;
}
else if (ischosen(pl_action.choice.put)) {
pl_retWidget := pl_action.choice.put.widget;
}
else if (ischosen(pl_action.choice.increase)) {
pl_retWidget := pl_action.choice.increase.widget;
}
else if (ischosen(pl_action.choice.decrease)) {
pl_retWidget := pl_action.choice.decrease.widget;
}
else if (ischosen(pl_action.choice.enable)) {
pl_retWidget := pl_action.choice.enable.widget;
}
else if (ischosen(pl_action.choice.disable)) {
pl_retWidget := pl_action.choice.disable.widget;
}
else if (ischosen(pl_action.choice.setfocus)) {
pl_retWidget := pl_action.choice.setfocus.widget;
}
else if (ischosen(pl_action.choice.gettooltip)) {
pl_retWidget := pl_action.choice.gettooltip.widget;
}
else if (ischosen(pl_action.choice.settooltip)) {
pl_retWidget := pl_action.choice.settooltip.widget;
}
else if (ischosen(pl_action.choice.replaceimage)) {
pl_retWidget := pl_action.choice.replaceimage.widget;
} else {
pl_retWidget := omit;
}
}
private function f_EPTF_UIHandler_getArgumentListFromXTDPAction(in XTDP_Actions pl_action) return EPTF_CharstringList {
var EPTF_CharstringList vl_result := {};
if (ischosen(pl_action.choice.put)) {
for (var integer i:=0; i<sizeof(pl_action.choice.put.argument_list); i:=i+1) {
vl_result[i] := unichar2char(pl_action.choice.put.argument_list[i]);
}
return vl_result;
}
if (ischosen(pl_action.choice.increase)) {
for (var integer i:=0; i<sizeof(pl_action.choice.increase.argument_list); i:=i+1) {
vl_result[i] := unichar2char(pl_action.choice.increase.argument_list[i]);
}
return vl_result;
}
if (ischosen(pl_action.choice.decrease)) {
for (var integer i:=0; i<sizeof(pl_action.choice.decrease.argument_list); i:=i+1) {
vl_result[i] := unichar2char(pl_action.choice.decrease.argument_list[i]);
}
return vl_result;
}
if (ischosen(pl_action.choice.settooltip)) {
for (var integer i:=0; i<sizeof(pl_action.choice.settooltip.argument_list); i:=i+1) {
vl_result[i] := unichar2char(pl_action.choice.settooltip.argument_list[i]);
}
return vl_result;
}
if (ischosen(pl_action.choice.replaceimage)) {
for (var integer i:=0; i<sizeof(pl_action.choice.replaceimage.argument_list); i:=i+1) {
vl_result[i] := unichar2char(pl_action.choice.replaceimage.argument_list[i]);
}
return vl_result;
}
return vl_result;
}
///////////////////////////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_HandleMsgs_XTDP
//
// Purpose:
// Handles incoming XTDP messages.
//
// Detailed comments:
// Calls the registered call-back function.
///////////////////////////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_HandleMsgs_XTDP(
in EPTF_Transport_TransportType pl_transportType,
in ConnectionId pl_connId,
in HostName pl_remHost,
in PortNumber pl_remPort,
in HostName pl_locHost,
in PortNumber pl_locPort,
in ProtoTuple pl_proto,
in integer pl_userData,
in octetstring pl_msg)
runs on EPTF_UIHandler_Private_CT
{
if (not v_UIHandler_initialized) {
return;
}
if (v_UIHandler_cleanupCalled) {
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
} else {
// threadsafe:
f_EPTF_Semaphore_waitForUnlock(v_UIHandler_xtdpReceivedMessageSemaphore_r,pl_autoDeleteSemaphore:=false);
f_EPTF_Semaphore_lock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
var integer vl_connId := pl_connId;
var integer vl_succ := XTDP_EncDecFunctions.dec_XTDP_Message(f_EPTF_UIHandler_getRawMsg_XTDP(pl_msg), v_UIHandler_receivedMessage);
//action(%definitionId&":v_UIHandler_receivedMessage: ", v_UIHandler_receivedMessage);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Message arrived for client "&log2str(vl_connId)&": "&log2str(v_UIHandler_receivedMessage));
}
if (v_UIHandler_cleanupCalled) {
if(not ischosen(v_UIHandler_receivedMessage.choice.xTDP_Bye)) {
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Message arrived during cleanup: Message dropped");
}
return;
}
}
// drop messages that come before handshake or authentication:
if(not ischosen(v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest)) {
// handshake is required:
if (not f_EPTF_UIHandler_getClientHandshakeSuccessful(vl_connId)) {
// there was no successful handshake
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Message arrived for client "&log2str(vl_connId)&" before successful handshake. Message dropped: "&log2str(v_UIHandler_receivedMessage));
}
return;
}
}
if(not ischosen(v_UIHandler_receivedMessage.choice.xTDP_AuthResponse)
and not ischosen(v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest)
and not ischosen(v_UIHandler_receivedMessage.choice.xTDP_Bye)) {
// authentication is required:
if (not f_EPTF_UIHandler_getClientAuthenticationSuccessful(vl_connId)) {
// there was no successful authentication
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Message arrived for client "&log2str(vl_connId)&" before successful authentication. Message dropped: "&log2str(v_UIHandler_receivedMessage));
}
return;
}
}
if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_Requests))
{
if(match(v_UIHandler_receivedMessage.choice.xTDP_Requests, tr_XTDP_Requests_exitTTCNButtonPressed))
{
f_EPTF_Semaphore_unlock(v_UIHandler_exitButtonPressedSemaphore);
}
if(match(v_UIHandler_receivedMessage.choice.xTDP_Requests, tr_XTDP_Requests_widgetModification(?, ?)))
{
const ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend :=
{
// noNamespaceSchemaLocation := "XTDP-Message.xsd",
transactionID := omit,
choice :=
{
xTDP_Responses :=
{
xTDP_Response_list := {
{
requestId := 1,
responseCode := error_,
argument := omit,
errorSource := omit,
errorCode := omit,
errorMessage := "Modification is not possible on a shadowed GUI!"
}
}
}
}
}
if (v_UIHandler_GUIClientId[0].clientId != vl_connId)
{
var Result vl_result
f_EPTF_Transport_send(IPL4, vl_connId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
}
else
{
var template XTDP_Widget vl_widget
f_EPTF_UIHandler_getWidgetFromXTDPAction(v_UIHandler_receivedMessage.choice.xTDP_Requests.xTDP_Request_list[0].action_, vl_widget);
var EPTF_UIHandler_WidgetIdString vl_wID := "";
if (isvalue(vl_widget)) {
vl_wID := f_EPTF_UIHandler_XULWidgetId2charstr({valueof(vl_widget.widgetId)});
}
var EPTF_CharstringList vl_template_XTDP_Actions_choice_put_argument_list := f_EPTF_UIHandler_getArgumentListFromXTDPAction(v_UIHandler_receivedMessage.choice.xTDP_Requests.xTDP_Request_list[0].action_);
f_EPTF_UIHandler_parseGuiParam(vl_wID, vl_template_XTDP_Actions_choice_put_argument_list);
}
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_Responses))
{
if(match(v_UIHandler_receivedMessage.choice.xTDP_Responses, tr_XTDP_Responses_singleSuccessResp))
{
// no response needed
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_LayoutResponse))
{
f_EPTF_Semaphore_unlock(v_UIHandler_layoutResponseReceivedSemaphore);
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_Outcome))
{
if (v_UIHandler_receivedMessage.transactionID!=omit) {
var integer vl_semaphoreId := v_UIHandler_receivedMessage.transactionID rem 1000;
if (f_EPTF_Semaphore_isLocked(vl_semaphoreId)) {
f_EPTF_Semaphore_unlock(vl_semaphoreId);
if (v_UIHandler_receivedMessage.choice.xTDP_Outcome.responseCode == error_) {
v_handshakeErrorMsg := "Error: UIHandler: Version compatibility check failure during handshake procedure: "&log2str(v_UIHandler_receivedMessage.choice.xTDP_Outcome);
}
}
}
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest))
{
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend := {
transactionID := v_UIHandler_receivedMessage.transactionID,
choice := {
xTDP_Outcome := {
responseCode := success,
errorCode_list := {
},
errorMessage := omit
,elem_list := {}
}
}
}
if (
v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest.xtdpRequiredVersion != c_EPTF_UIHandler_xtdpMyVersion
or v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest.xtdlRequiredVersion != c_EPTF_UIHandler_xtdlMyVersion
) {
// version mismatch
vl_messageToSend := {
transactionID := v_UIHandler_receivedMessage.transactionID,
choice := {
xTDP_Outcome := {
responseCode := error_,
errorCode_list := {
},
errorMessage := "Version mismatch detected during handshake. Suppored XTDP/XDTL versions: "
&log2str(c_EPTF_UIHandler_xtdpMyVersion)&"/"&log2str(c_EPTF_UIHandler_xtdlMyVersion)
,elem_list := {}
}
}
}
// add error codes:
if (v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest.xtdpRequiredVersion != c_EPTF_UIHandler_xtdpMyVersion) {
vl_messageToSend.choice.xTDP_Outcome.errorCode_list := vl_messageToSend.choice.xTDP_Outcome.errorCode_list & {xtdpIncompatibleVersion};
}
if (v_UIHandler_receivedMessage.choice.xTDP_HandshakeRequest.xtdlRequiredVersion != c_EPTF_UIHandler_xtdlMyVersion) {
vl_messageToSend.choice.xTDP_Outcome.errorCode_list := vl_messageToSend.choice.xTDP_Outcome.errorCode_list & {xtdlIncompatibleVersion};
}
} else {
// successful handshake
f_EPTF_UIHandler_setClientHandshakeSuccessful(vl_connId);
}
//send response:
var Result vl_result;
f_EPTF_Transport_send(IPL4, vl_connId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false);
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
// start authentication if handshake successful:
if (vl_messageToSend.choice.xTDP_Outcome.responseCode != success
or not f_EPTF_UIHandler_authclient(vl_connId))
{
f_EPTF_UIHandler_closeXTDPSession(vl_connId);
} else {
// successful handshake and authentication
v_UIHandler_guiConnected := true;
if(sizeof(v_UIHandler_GUIClientId)==1 and sizeof(v_UIHandler_guiItemList) == 0)
{
// master GUI is up (first time)
if("" != v_UIHandler_windowLayout or "" != tsp_EPTF_GUI_DefaultWindow or v_EPTF_UIHandler_headlessmode){
// send my layout to GUI
if (v_EPTF_UIHandler_headlessmode == false and not v_UIHandler_guiLayoutReady) {
// reset layout to initial
f_EPTF_UIHandler_clearGUI();
//f_EPTF_UIHandler_createInitialLayout(v_UIHandler_windowLayout);
if(null != v_EPTF_UIHandler_createLayoutCallback){
v_EPTF_UIHandler_createLayoutCallback.apply( );
}
v_UIHandler_guiLayoutReady := true;
} else {
// use current layout
f_EPTF_UIHandler_initguitoclient(vl_connId);
}
} else {
//get layout from GUI
if (not v_UIHandler_guiLayoutReady) {
// init layout from GUI
f_EPTF_UIHandler_clearInternalWidgetDB();
if(not f_EPTF_UIHandler_requestLayout()){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": f_EPTF_UIHandler_requestlayout failed!");
}
}
v_UIHandler_guiLayoutReady := true;
} else {
// use current layout (Original Master GUI was closed and then restarted)
f_EPTF_UIHandler_initguitoclient(vl_connId);
}
}
}
else
{
// slave GUI-s will contain the copy of master
// restarted master GUI will contain current layout
if (sizeof(v_UIHandler_GUIClientId)==1 and sizeof(v_UIHandler_guiItemList) != 0){
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Master GUI restarted. Sending current layout...");
}
f_EPTF_UIHandler_initguitoclient(vl_connId);
} else {
f_EPTF_UIHandler_initguitoclient(vl_connId,true); // Shadowed GUI
}
}
}
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_AuthChallenge))
{
// send response
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend :=
{
// noNamespaceSchemaLocation := "XTDP-Message.xsd",
transactionID := v_UIHandler_receivedMessage.transactionID,
choice := {
xTDP_AuthResponse := v_EPTF_UIHandler_Authresp
}
}
var Result vl_result;
f_EPTF_Transport_send(IPL4, vl_connId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_AuthResponse))
{
if (v_UIHandler_receivedMessage.transactionID!=omit) {
var integer vl_semaphoreId := v_UIHandler_receivedMessage.transactionID rem 1000;
if (f_EPTF_Semaphore_isLocked(vl_semaphoreId)) {
f_EPTF_Semaphore_unlock(vl_semaphoreId);
}
}
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_Bye))
{
if (v_UIHandler_receivedMessage.transactionID!=omit) {
var integer vl_semaphoreId := v_UIHandler_receivedMessage.transactionID rem 1000;
if (v_UIHandler_byeTimer == vl_semaphoreId) {
// response to my bye msg
f_EPTF_Semaphore_unlock(vl_semaphoreId);
return;
}
}
//send bye response:
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend :=
{
// noNamespaceSchemaLocation := "XTDP-Message.xsd",
transactionID := v_UIHandler_receivedMessage.transactionID,
choice := {
xTDP_Bye := ""
}
}
var Result vl_result;
f_EPTF_Transport_send(IPL4, vl_connId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
// restart semaphore timer if it is running:
if (f_EPTF_Semaphore_isLocked(v_UIHandler_byeTimer)) {
// semaphore is locked => timer is running
// increase semaphore lock until restarted timer expires:
timer t_semaphoreWait := v_byeMaxTime;
t_semaphoreWait.start;
f_EPTF_Semaphore_increaseLock(v_UIHandler_byeTimer);
t_semaphoreWait.timeout;
f_EPTF_Semaphore_decreaseLock(v_UIHandler_byeTimer);
}
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
else if(ischosen(v_UIHandler_receivedMessage.choice.xTDP_ARResponses))
{
//FIXME:
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
else
{
f_EPTF_UIHandler_warning("Unexpected XTDP message received: "&log2str(v_UIHandler_receivedMessage));
// send unsupported procedure response:
var ttcn_ericsson_se_protocolModules_xtdp_xtdp.XTDP_Message vl_messageToSend := {
transactionID := v_UIHandler_receivedMessage.transactionID,
choice := {
xTDP_Outcome := {
responseCode := error_,
errorCode_list := {
procedureUnsupported
},
errorMessage := omit
,elem_list := {}
}
}
}
var Result vl_result;
f_EPTF_Transport_send(IPL4, vl_connId, f_EPTF_UIHandler_appendLength_XTDP(XTDP_EncDecFunctions.enc_XTDP_Message(vl_messageToSend)), vl_result, false)
f_EPTF_Semaphore_unlock(v_UIHandler_xtdpReceivedMessageSemaphore_r);
}
}
friend function f_EPTF_UIHandler_layoutReady() runs on EPTF_UIHandler_Private_CT return boolean {
if (v_UIHandler_windowLayout != "" or v_EPTF_UIHandler_headlessmode == true) {
return true;
} else {
return v_UIHandler_guiLayoutReady;
}
}
friend function f_EPTF_UIHandler_waitForLayoutReady() runs on EPTF_UIHandler_Private_CT {
if (f_EPTF_UIHandler_layoutReady()) {
return;
}
timer t_waitForLayoutReady := 0.0;
t_waitForLayoutReady.start;
alt {
[f_EPTF_UIHandler_layoutReady()] t_waitForLayoutReady.timeout {
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_HandleEvent_XTDP
//
// Purpose:
// The event handler function.
//
// Detailed Comments:
// Calls the registered call-back function.
///////////////////////////////////////////////////////////////////////////////
function f_EPTF_UIHandler_HandleEvent_XTDP(
in EPTF_Transport_TransportType pl_transportType,
in ConnectionId pl_connId,
in PortEvent pl_event)
runs on EPTF_UIHandler_Private_CT
{
if (not v_UIHandler_initialized) {
return;
}
//action(%definitionId&": XTDP event received: ",pl_event);
if(ischosen(pl_event.connOpened))
{
// I am XTDP-session server. Always!!! => wait for handshake request => nothing to do here
// var charstring vl_handshakeError:=f_EPTF_UIHandler_handshake(v_EPTF_CommPort_IPL4_incomingMessage.asp_Event.connOpened.connId);
// if (vl_handshakeError!="") {
// // handshake unsuccessful
// return;
// }
//
// if (not f_EPTF_UIHandler_authclient(v_EPTF_CommPort_IPL4_incomingMessage.asp_Event.connOpened.connId))
// {
// f_EPTF_UIHandler_closeXTDPSession(v_EPTF_CommPort_IPL4_incomingMessage.asp_Event.connOpened.connId);
// return;
// }
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&log2str(": GUI connected: ", pl_event.connOpened.connId));
}
f_EPTF_UIHandler_addclientid(pl_event.connOpened.connId);
// v_UIHandler_guiConnected := true;
// if(sizeof(v_UIHandler_GUIClientId)==1)
// {
// f_EPTF_UIHandler_headlessmodeover();
// }
// else
// {
// f_EPTF_UIHandler_initguitoclient(pl_event.connOpened.connId);
// }
}
else if(ischosen(pl_event.connClosed))
{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Transport is closed for client: "&log2str(pl_event.connClosed.connId));
}
//if(v_EPTF_UIHandler_headlessmode)
//{
f_EPTF_UIHandler_delclientid(pl_event.connClosed.connId);
if (f_EPTF_Semaphore_isLocked(v_UIHandler_byeTimer)) {
f_EPTF_Semaphore_unlock(v_UIHandler_byeTimer)
}
if (sizeof(v_UIHandler_GUIClientId) == 0)
{
f_EPTF_UIHandler_headlessmode();
}
//}
}
else if(ischosen(pl_event.result))
{
if(pl_event.result.errorCode == ERROR_AVAILABLE)
{
v_EPTF_CommPort_IPL4_incomingMessage.asp_Event := pl_event; // Artifact artf195095 : CLL - faulty IPl4 event handler?
f_EPTF_TransportIPL4_defaultConnResultEventHandler();
// I am XTDP-session server. Always!!! => wait for handshake request => nothing to do here
if (not f_EPTF_UIHandler_isConnectedClientid(pl_event.result.connId)) {
// // Handshake handling:
// var charstring vl_handshakeError:=f_EPTF_UIHandler_handshake(v_EPTF_CommPort_IPL4_incomingMessage.asp_Event.result.connId);
// if (vl_handshakeError!="") {
// // handshake unsuccessful
// return;
// }
//
// if (not f_EPTF_UIHandler_authclient(pl_event.result.connId))
// {
// f_EPTF_UIHandler_closeXTDPSession(pl_event.result.connId);
// return;
// }
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&log2str(": GUI connected: ", pl_event.result.connId));
}
f_EPTF_UIHandler_addclientid(pl_event.result.connId);
// v_UIHandler_guiConnected := true;
// f_EPTF_UIHandler_headlessmodeover();
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getMsgLen_XTDP
//
// Purpose:
// Function to get the length of the received XTDP message
//
// Parameters:
// stream - *in octetstring* - The received message
// args - *in* - <ro_integer> - Function arguments
//
// Return Value:
// integer - the length of the received message
//
///////////////////////////////////////////////////////////
function f_EPTF_UIHandler_getMsgLen_XTDP
(
in EPTF_Transport_TransportType pl_transportType,
in octetstring pl_stream,
inout EPTF_IntegerList pl_args
)
return integer
{
if (lengthof(pl_stream)<4)
{
return -1
}
else
{
return oct2int(substr(pl_stream,0, 4))
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getRawMsg_XTDP
//
// Purpose:
// Function to get the raw XTDP message without the length
//
// Parameters:
// stream - *in octetstring* - The received message
//
// Return Value:
// octetstring - raw XTDP message
//
///////////////////////////////////////////////////////////
function f_EPTF_UIHandler_getRawMsg_XTDP(in octetstring stream) return octetstring
{
if (lengthof(stream) <4) {
return ''O
} else {
return substr(stream,4, lengthof(stream)-4)
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendLength_XTDP
//
// Purpose:
// Function to append the length to the encoded XTDP message
//
// Parameters:
// stream - *in octetstring* - The received message
//
// Return Value:
// octetstring - raw XTDP message
//
///////////////////////////////////////////////////////////
function f_EPTF_UIHandler_appendLength_XTDP(in octetstring stream) return octetstring
{
return int2oct(lengthof(stream)+4,4) & stream
}
} //group Transport funstions
group simulation {
private function f_EPTF_UIHandler_simulation_getData(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName := "",
in charstring pl_element,
in EPTF_DataSource_Params pl_params := {},
in EPTF_Var_SubscriptionMode pl_subscriptionMode := tsp_EPTF_UIHandler_subscriptionMode,
in integer pl_refreshRate := tsp_EPTF_DataSource_refreshRate,
in EPTF_Var_DirectContent vl_defaultValue
) runs on EPTF_UIHandler_Private_CT return integer {
var integer vl_getDataResult := f_EPTF_DataSource_getData(pl_dataVarName, pl_source, pl_ptcName, pl_element, pl_params, pl_subscriptionMode, pl_refreshRate);
if(vl_getDataResult == 0) {
if(v_EPTF_UIHandler_simulation_buildDB_file != "") {
var integer vl_simulationDBIdx;
var charstring vl_simulation_id := "";
var integer vl_params_size := sizeof(pl_params);
for(var integer i := 0; i < vl_params_size; i := i + 1 ){
vl_simulation_id := vl_simulation_id & "." & pl_params[i].paramName;
vl_simulation_id := vl_simulation_id & "." & pl_params[i].paramValue;
}
vl_simulation_id:= "simulation." & pl_source & "." & pl_ptcName & "." & pl_element & "." & vl_simulation_id;
if(not f_EPTF_str2int_HashMap_Find(v_UIHandler_simulation_varsHashMapId, vl_simulation_id, vl_simulationDBIdx)) {
var integer vl_directContentDB_size := sizeof(v_UIHandler_simulation_directContentDB);
var integer vl_varId := f_EPTF_Var_getId(pl_dataVarName);
var EPTF_Var_DirectContent vl_currentContent;
f_EPTF_Var_getContent(vl_varId, vl_currentContent);
v_UIHandler_simulation_directContentDB[vl_directContentDB_size].directContent := vl_currentContent;
v_UIHandler_simulation_directContentDB[vl_directContentDB_size].key := vl_simulation_id;
f_EPTF_str2int_HashMap_Insert(v_UIHandler_simulation_varsHashMapId, vl_simulation_id, vl_directContentDB_size);
}
}
return vl_getDataResult;
} else if(v_EPTF_UIHandler_simulatonMode) {
//get the data from DB
if(f_EPTF_UIHandler_simulation_getDataFromDB(pl_dataVarName, pl_source, pl_ptcName, pl_element, pl_params) == 0) {
return 0;
} else { //create random data to simulate
pl_dataVarName := log2str(vl_defaultValue);
if(f_EPTF_Var_getId(pl_dataVarName) == -1) {
f_EPTF_Var_newVar(log2str(vl_defaultValue), vl_defaultValue)
}
return 0;
}
} else {
return vl_getDataResult;
}
}
private function f_EPTF_UIhandler_simulation_getCondition(
out boolean pl_conditionValue,
in charstring pl_source,
in charstring pl_ptcName := "",
in charstring pl_method,
in EPTF_DataSource_Params pl_params := {}
) runs on EPTF_UIHandler_Private_CT return integer {
var integer vl_getDataResult := f_EPTF_DataSource_getCondition(pl_conditionValue, pl_source, pl_ptcName, pl_method, pl_params);
var charstring pl_dataVarName := "";
if(vl_getDataResult == 0) {
if(v_EPTF_UIHandler_simulation_buildDB_file != "") {
var integer vl_simulationDBIdx;
var charstring vl_simulation_id := "";
var integer vl_params_size := sizeof(pl_params);
for(var integer i := 0; i < vl_params_size; i := i + 1 ){
vl_simulation_id := vl_simulation_id & "." & pl_params[i].paramName;
vl_simulation_id := vl_simulation_id & "." & pl_params[i].paramValue;
}
vl_simulation_id:= "simulation." & pl_source & "." & pl_ptcName & "." & "condition" & "." & vl_simulation_id;
if(not f_EPTF_str2int_HashMap_Find(v_UIHandler_simulation_varsHashMapId, vl_simulation_id, vl_simulationDBIdx)) {
var integer vl_directContentDB_size := sizeof(v_UIHandler_simulation_directContentDB);
var integer vl_varId;
f_EPTF_Var_newBool(vl_simulation_id, pl_conditionValue, vl_varId)
var EPTF_Var_DirectContent vl_currentContent;
f_EPTF_Var_getContent(vl_varId, vl_currentContent);
v_UIHandler_simulation_directContentDB[vl_directContentDB_size].directContent := vl_currentContent;
v_UIHandler_simulation_directContentDB[vl_directContentDB_size].key := vl_simulation_id;
f_EPTF_str2int_HashMap_Insert(v_UIHandler_simulation_varsHashMapId, vl_simulation_id, vl_directContentDB_size);
}
}
return vl_getDataResult;
} else if(v_EPTF_UIHandler_simulatonMode) {
//get the data from DB
if(f_EPTF_UIHandler_simulation_getDataFromDB(pl_dataVarName, pl_source, pl_ptcName, "condition", pl_params) == 0) {
var integer vl_varId := f_EPTF_Var_getId(pl_dataVarName);
pl_conditionValue := f_EPTF_Var_getBoolValue(vl_varId);
return 0;
} else { //create random data to simulate?
pl_conditionValue := true;
return 0;
}
} else {
return vl_getDataResult;
}
}
private function f_EPTF_UIhandler_simulation_getDefaultValue(in EPTF_UIHandler_GuiItemRec pl_widgetRec, out EPTF_Var_DirectContent vl_defaultValue) {
if(ispresent(pl_widgetRec.widgetDataType)) {
if(pl_widgetRec.widgetDataType == checkBox) {
vl_defaultValue := { boolVal := true };
} else if(pl_widgetRec.widgetDataType == floatField) {
vl_defaultValue := { floatVal := 1.1 };
// NOT SUPPORTED:
//} else if(pl_widgetRec.widgetDataType == image) {
// vl_defaultValue := { intVal := 1 };
} else if(pl_widgetRec.widgetDataType == integerField) {
vl_defaultValue := { intVal := 1 };
} else if(pl_widgetRec.widgetDataType == none_) {
vl_defaultValue := { charstringVal := "my_value" };
} else if(pl_widgetRec.widgetDataType == pushButton) {
vl_defaultValue := { intVal := 1 };
} else if(pl_widgetRec.widgetDataType == statusLED) {
vl_defaultValue := { statusLEDVal := { led_black, "my_led" } };
} else if(pl_widgetRec.widgetDataType == statusLEDWithText) {
vl_defaultValue := { statusLEDVal := { led_black, "my_led" } };
} else if(pl_widgetRec.widgetDataType == string) {
vl_defaultValue := { charstringVal := "my_string" };
} else if(pl_widgetRec.widgetDataType == toggleButton) {
vl_defaultValue := { boolVal := true };
} else if(pl_widgetRec.widgetDataType == trace) {
vl_defaultValue := { floatVal := 1.1 };
// NOT SUPPORTED:
//} else if(pl_widgetRec.widgetDataType == valueList) {
// vl_defaultValue := { intVal := 1 };
}
} else {
vl_defaultValue := { charstringVal := "omit"};
}
}
///////////////////////////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_simulation_Subscribe2saveDBButton_vars
//
// Purpose:
// Subscribe variable to saveDB button and adds test management
// post processing functions
//
// Parameters:
// -
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_simulation_Subscribe2saveDBButton_vars() runs on EPTF_UIHandler_Private_CT {
var integer vl_idx;
f_EPTF_Var_newInt(
c_EPTF_UIHandler_simulation_saveDBToFile, 0, vl_idx);
f_EPTF_Var_addPostProcFn(
vl_idx, { refers(f_EPTF_UIHandler_simulation_saveDB_PostProc), {}} );
}
///////////////////////////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_simulation_saveDB_PostProc
//
// Purpose:
// Test management post proc function to save DB to file
//
// Parameters:
// -
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_simulation_saveDB_PostProc(
in integer pl_idx,
in EPTF_IntegerList pl_argList)
runs on EPTF_UIHandler_Private_CT
{
if(v_EPTF_UIHandler_simulation_buildDB_file != "") {
f_EPTF_UIHandler_simulation_saveDBToFile(v_EPTF_UIHandler_simulation_buildDB_file);
} else {
f_EPTF_UIHandler_error(%definitionId&": FileName to save simulation Database was not given");
}
}
private function f_EPTF_UIHandler_simulation_saveDBToFile(in charstring pl_fileName) runs on EPTF_UIHandler_Private_CT
return boolean {
var integer vl_file := f_FIO_open_trunc_wronly(pl_fileName);
var integer vl_retval:=-1;
if(vl_file==-1){
f_EPTF_UIHandler_error(%definitionId&": Couldn't open the file "&pl_fileName&".");
return false;
}
var charstring vl_stringDB := f_EPTF_UIHandler_simulation_encode_directContentDB(v_UIHandler_simulation_directContentDB);
vl_retval:=f_FIO_write_text(vl_file, vl_stringDB)
if(-1 == vl_retval){
f_EPTF_UIHandler_error(%definitionId&": Couldn't read the file "&pl_fileName&".");
return false;
}
if( f_FIO_close(vl_file)==-1) {
f_EPTF_UIHandler_error(%definitionId&": Could not close the file "&pl_fileName&".");
return false;
}
return true;
}
function f_EPTF_UIHandler_simulation_createDBFromFile(in charstring pl_fileName, out EPTF_UIHandler_simulation_directContentDB pl_DB)
runs on EPTF_UIHandler_Private_CT
{
var charstring vl_stringDB;
f_EPTF_UIHandler_readFileToCharstring(pl_fileName, vl_stringDB);
f_EPTF_UIHandler_simulation_decode_directContentDB(vl_stringDB, pl_DB)
}
private function f_EPTF_UIHandler_simulation_getDataFromDB(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName := "",
in charstring pl_element,
in EPTF_DataSource_Params pl_params := {})
runs on EPTF_UIHandler_Private_CT return integer
{
var charstring vl_simulation_id := "";
var integer vl_Idx := -1;
var integer vl_paramSize := sizeof(pl_params);
for(var integer i := 0; i < vl_paramSize; i := i + 1 ){
vl_simulation_id := vl_simulation_id & "." & pl_params[i].paramName;
vl_simulation_id := vl_simulation_id & "." & pl_params[i].paramValue;
}
vl_simulation_id:= "simulation." & pl_source & "." & pl_ptcName & "." & pl_element & "." & vl_simulation_id;
//if(f_EPTF_str2int_HashMap_Find(v_UIHandler_simulation_varsHashMapId, vl_simulation_id, vl_Idx)) {
//variable created in init function at simulation mode. The variable name is the simulation id.
if(f_EPTF_Var_getId(vl_simulation_id) != -1) {
pl_dataVarName := vl_simulation_id;
return 0;
} else {
return -1;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_simulation_encode_directContentDB
//
// Purpose:
// Encodes a EPTF_UIHandler_simulation_directContentDB to its charstring representation
//
///////////////////////////////////////////////////////////
public external function f_EPTF_UIHandler_simulation_encode_directContentDB(in EPTF_UIHandler_simulation_directContentDB pl_DB)
return charstring;
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_simulation_decode_directContentDB
//
// Purpose:
// Decode a charstring to EPTF_UIHandler_simulation_directContentDB
//
///////////////////////////////////////////////////////////
public external function f_EPTF_UIHandler_simulation_decode_directContentDB(in charstring pl_dbStr, out EPTF_UIHandler_simulation_directContentDB pl_DB);
}// /group simulation
} // group PrivateFunctions
group CLI{
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_init_CT
// Parameters:
// pl_prefix - *in charstring* - all UIHandler command-line interface
// commands are prefixed with this value
// Purpose:
// The initialization function.
///////////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_CLIClient_init_CT(in charstring pl_prefix)
runs on EPTF_UIHandler_Private_CT {
//if (not v_UIHandler_CLI_initialized)
{
//f_EPTF_UIHandler_init_CT(pl_selfName, pl_connectGUI);
//f_EPTF_Logging_init_CT(pl_selfName);
//f_EPTF_CLI_Client_init_CT(pl_selfName, pl_CLI_compRef)
v_UIHandler_CLI_loggingMaskId := f_EPTF_Logging_registerComponentMasks(tsp_EPTF_UIHandler_CLI_loggingComponentMask, c_EPTF_UIHandler_loggingEventClasses, EPTF_Logging_CLL);
if(tsp_debug_EPTF_UIHandler_CLI_Functions) {
f_EPTF_Logging_enableLocalMask(v_UIHandler_CLI_loggingMaskId, c_EPTF_UIHandler_loggingClassIdx_Debug);
} else {
f_EPTF_Logging_disableLocalMask(v_UIHandler_CLI_loggingMaskId, c_EPTF_UIHandler_loggingClassIdx_Debug);
}
//f_EPTF_Base_registerCleanup(refers(f_EPTF_UIHandler_CLIClient_cleanup_CT));
f_EPTF_HashMap_init_CT (pl_prefix);
v_UIHandler_CLI_vars2Display := f_EPTF_str2int_HashMap_New("v_UIHandler_CLI_vars2Display");
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandGET, c_UIHandler_CLIClient_commandGETHelp, refers(f_EPTF_UIHandler_CLIClient_handleGET))){
f_EPTF_Base_assert("Registration failed for command: ", false)
}
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandSET, c_UIHandler_CLIClient_commandSETHelp, refers(f_EPTF_UIHandler_CLIClient_handleSET))){
f_EPTF_Base_assert("Registration failed for command: "&c_UIHandler_CLIClient_commandSET, false)
}
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandLS, c_UIHandler_CLIClient_commandLSHelp, refers(f_EPTF_UIHandler_CLIClient_handleLS))){
f_EPTF_Base_assert("Registration failed for command: "&c_UIHandler_CLIClient_commandLS, false)
}
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandLSREADONLY, c_UIHandler_CLIClient_commandLSREADONLYHelp, refers(f_EPTF_UIHandler_CLIClient_handleLSREADONLY))){
f_EPTF_Base_assert("Registration failed for command: "&c_UIHandler_CLIClient_commandLSREADONLY, false)
}
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandLSWRITABLE, c_UIHandler_CLIClient_commandLSWRITABLEHelp, refers(f_EPTF_UIHandler_CLIClient_handleLSWRITABLE))){
f_EPTF_Base_assert("Registration failed for command: "&c_UIHandler_CLIClient_commandLSWRITABLE, false)
}
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandDISPLAY, c_UIHandler_CLIClient_commandDISPLAYHelp, refers(f_EPTF_UIHandler_CLIClient_handleDISPLAY))){
f_EPTF_Base_assert("Registration failed for command: "&c_UIHandler_CLIClient_commandDISPLAY, false)
}
if(registerOK != f_EPTF_CLI_Client_registerCommand(pl_prefix&c_UIHandler_CLIClient_commandHIDE, c_UIHandler_CLIClient_commandHIDEHelp, refers(f_EPTF_UIHandler_CLIClient_handleHIDE))){
f_EPTF_Base_assert("Registration failed for command: "&c_UIHandler_CLIClient_commandHIDE, false)
}
v_UIHandler_CLI_def := activate(as_UIHandler_CLIClient_main());
//v_UIHandler_CLI_initialized := true;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_cleanup_CT
//
// Purpose:
// Cleanup function of the EPTF_UIHandler_Private_CT component.
//
// Detailed Comments:
// This function mustn't be called directly. You must call f_EPTF_Base_cleanup_CT instead.
///////////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_CLIClient_cleanup_CT()
runs on EPTF_UIHandler_Private_CT {
//if (v_UIHandler_CLI_initialized)
{
//deactivate(v_UIHandler_CLI_def);
if(t_UIHandler_CLI_refresh.running){
t_UIHandler_CLI_refresh.stop;
}
f_EPTF_str2int_HashMap_Delete("v_UIHandler_CLI_vars2Display");
//unmap(self:v_UIHandler_CLI_TELNETaspIf, system:v_UIHandler_CLI_TELNETaspIf);
//unmap(self:v_UIHandler_CLI_displayTELNETaspIf, system:v_UIHandler_CLI_displayTELNETaspIf);
//v_UIHandler_CLI_initialized := false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_logAll
//
// Purpose:
// Log all internal variables in EPTF_UIHandler_Private_CT component.
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_CLIClient_logAll()
runs on EPTF_UIHandler_Private_CT {
log("------Content of EPTF_UIHandler_CLIClient_CT: -------");
//log("v_UIHandler_CLI_initialized: ", v_UIHandler_CLI_initialized);
log("v_UIHandler_CLI_clientConnected: ", v_UIHandler_CLI_clientConnected);
log("v_UIHandler_CLI_displayConnected: ", v_UIHandler_CLI_displayConnected);
log("v_UIHandler_CLI_vars2Display: ", v_UIHandler_CLI_vars2Display);
log("------Finished Content of EPTF_UIHandler_CLIClient_CT -------");
}//f_
friend function f_EPTF_UIHandler_CLIClient_displayVarContent(in charstring pl_msg)
runs on EPTF_UIHandler_Private_CT {
f_EPTF_CLI_Client_sendCommandDisplay(c_UIHandler_CLIClient_commandDISPLAY, pl_msg)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_refreshTimeout
// Purpose:
// Periodically displays the variables.
///////////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_CLIClient_refreshTimeout() runs on EPTF_UIHandler_Private_CT {
if(v_UIHandler_CLI_displayConnected){
var charstring vl_varName;
var boolean vl_hasItem := f_EPTF_str2int_HashMap_Begin(v_UIHandler_CLI_vars2Display, vl_varName);
//log(vl_varName);
while(vl_hasItem){
var integer vl_varIdx;
if(not f_EPTF_str2int_HashMap_Find(v_UIHandler_CLI_vars2Display, vl_varName, vl_varIdx)){
f_EPTF_UIHandler_CLIClient_error(log2str("Fatal hashmap error displaying variable ",vl_varName));
//f_EPTF_Base_stop();
}
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(vl_varIdx, vl_content);
f_EPTF_UIHandler_CLIClient_displayVarContent( f_UIHandler_CLIClient_varContentAnswer(vl_varName, f_EPTF_Var_directContent2str(vl_content)))
vl_hasItem := f_EPTF_str2int_HashMap_Next(v_UIHandler_CLI_vars2Display, vl_varName)
}
}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_CLIClient_main
// Purpose:
// The main altstep.
///////////////////////////////////////////////////////////////
friend altstep as_UIHandler_CLIClient_main() runs on EPTF_UIHandler_Private_CT {
[] as_UIHandler_CLIClient_handleRefreshTimeout(){repeat;}
// [] as_UIHandler_CLI_handleTelnetCmd(){repeat;}
}
///////////////////////////////////////////////////////////
// Altstep: as_UIHandler_CLIClient_handleRefreshTimeout
// Purpose:
// The periodic refresh.
///////////////////////////////////////////////////////////////
friend altstep as_UIHandler_CLIClient_handleRefreshTimeout() runs on EPTF_UIHandler_Private_CT {
[] t_UIHandler_CLI_refresh.timeout{
f_EPTF_UIHandler_CLIClient_refreshTimeout();
t_UIHandler_CLI_refresh.start( ts_CLI_refreshRate );
}
}
friend function f_EPTF_UIHandler_CLIClient_var2str(in integer pl_varIdx)
runs on EPTF_UIHandler_Private_CT
return charstring
{
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(pl_varIdx, vl_content);
if(ischosen(vl_content.intVal)) {
return int2str(vl_content.intVal);
} else if(ischosen(vl_content.floatVal)) {
return float2str(vl_content.floatVal);
} else if(ischosen(vl_content.boolVal)) {
if(vl_content.boolVal) { return "true"; }
else { return "false"; }
} else if(ischosen(vl_content.charstringVal)) {
return vl_content.charstringVal;
} else if(ischosen(vl_content.octetstringVal)) {
return oct2str(vl_content.octetstringVal);
} else if(ischosen(vl_content.hexstringVal)) {
return hex2str(vl_content.hexstringVal);
} else if(ischosen(vl_content.bitstringVal)) {
return bit2str(vl_content.bitstringVal);
} else if(ischosen(vl_content.integerlistVal)) {
return log2str(vl_content.integerlistVal);
} else if(ischosen(vl_content.floatlistVal)) {
return log2str(vl_content.floatlistVal);
} else if(ischosen(vl_content.statusLEDVal)) {
return log2str(vl_content.statusLEDVal);
}
return log2str(vl_content);
}
//FIXME
public function f_EPTF_CLI_Client_split(in charstring pl_string) return EPTF_CharstringList {
return f_EPTF_CLI_splitString(pl_string)
}
friend function f_EPTF_UIHandler_CLIClient_handleGET(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_ret := -1
var charstring vl_varName := pl_commandArgs
if("" != vl_varName){
var integer vl_varIdx:=f_EPTF_Var_getId(vl_varName);
if (-1 < vl_varIdx) {
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(vl_varIdx, vl_content);
pl_result := f_UIHandler_CLIClient_varContentAnswer(vl_varName, f_EPTF_Var_directContent2str(vl_content))
vl_ret := 0
}else{
pl_result := f_UIHandler_CLIClient_errInvalidVarName(vl_varName, c_UIHandler_CLIClient_commandGET)
}
}else{
pl_result := f_UIHandler_CLIClient_errEmptyVarName(c_UIHandler_CLIClient_commandGET)
}
return vl_ret
}
friend function f_EPTF_UIHandler_CLIClient_handleSET(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_ret := -1
// Old mechanism : simple regexp.
// var charstring vl_varName := regexp(pl_commandArgs,c_UIHandler_CLI_assignExt,0);
// var charstring vl_newContent := regexp(pl_commandArgs,c_UIHandler_CLI_assignExt,1);
//If help is needed, return immediately.
if(pl_commandArgs == "help"){
pl_result := c_UIHandler_CLIClient_cmdUsage&c_UIHandler_CLIClient_setUsage;
return vl_ret;
}
var charstring vl_varName := "";
var charstring vl_newContent := "";
var integer vl_startVarname := -1;
var integer vl_endVarname := -1;
var boolean vl_varnameWithQuot := false;
var boolean vl_moreLetItEqualSignFound := false;
var integer vl_letItEqualSignFound := -1;
var integer vl_backslashInARowCounter := 0;
var boolean vl_backslashInARowCounterResetNextTime := false;
//Loop along the input string letter by letter.
for(var integer i:= 0; i< lengthof(pl_commandArgs)-1; i:= i +1){
//Value backslash counter reset-ed
if(vl_backslashInARowCounterResetNextTime==true){
vl_backslashInARowCounter := 0;
vl_backslashInARowCounterResetNextTime := false;
}
//When a contiguous backslash sequence ends, this terminates in the next round of the loop
if(vl_startVarname > -1 and vl_backslashInARowCounter > 0 and pl_commandArgs[i] != "\\" ){
vl_backslashInARowCounterResetNextTime := true;
}
//The String has definitely started, with or without quote
if(vl_startVarname == -1 and pl_commandArgs[i] != " " and pl_commandArgs[i] != "\t" ){
if(pl_commandArgs[i] == "\"" and i + 1 < lengthof(pl_commandArgs)){
vl_startVarname := i+1;
vl_varnameWithQuot := true;
} else {
vl_startVarname := i;
}
continue;
}
//Quoted varname ends at the paired quote character
if(pl_commandArgs[i] == "\"" and vl_varnameWithQuot==true and (vl_backslashInARowCounter mod 2 == 0)){
vl_endVarname := i-1;
continue;
}
//Count backslashes
if(pl_commandArgs[i] == "\\" and vl_startVarname > -1){
vl_backslashInARowCounter := vl_backslashInARowCounter + 1;
continue;
}
//Non-quoted varname ends at last non-space character before :=
if(vl_startVarname > -1 and vl_endVarname == -1 and vl_varnameWithQuot == false and (pl_commandArgs[i] == " " or pl_commandArgs[i] == "\t" )){
vl_endVarname := i-1;
continue;
}
//Not Quoted Value end reset, because a not whitespace has arrived
if(vl_startVarname > -1 and vl_endVarname > -1 and i+1< lengthof(pl_commandArgs) and vl_varnameWithQuot == false
and (pl_commandArgs[i] != ":" or pl_commandArgs[i+1] != "=" ) and pl_commandArgs[i] != " " and pl_commandArgs[i] !="\t" ){
vl_endVarname := -1;
continue;
}
//Non-space character after quoted varname -> parse error
if(vl_startVarname > -1 and vl_endVarname > -1 and i+1< lengthof(pl_commandArgs) and vl_varnameWithQuot == true
and (pl_commandArgs[i] != ":" or pl_commandArgs[i+1] != "=" ) and pl_commandArgs[i] != " " and pl_commandArgs[i] !="\t" ){
break;
}
//Non-quoted varname ends at := if there are no spaces before :=
if(vl_startVarname > -1 and vl_endVarname == -1 and i+1< lengthof(pl_commandArgs) and vl_varnameWithQuot == false
and pl_commandArgs[i] == ":" and pl_commandArgs[i+1] == "="){
vl_endVarname := i-1;
}
//A Let It Be Equal sign has come, we register it. It is used when start has been found, but no end of the string
//that is not quoted but it looked it to be before.
if(i+1< lengthof(pl_commandArgs) and pl_commandArgs[i] == ":" and pl_commandArgs[i+1] == "="){
if(vl_letItEqualSignFound > -1){
vl_moreLetItEqualSignFound := true;
} else {
vl_letItEqualSignFound := i;
}
}
//The := and a valid varname start and end has been found, variable name is ready, let's find out the content.
if(vl_startVarname > -1 and vl_endVarname > -1 and i+1< lengthof(pl_commandArgs) and pl_commandArgs[i] == ":" and pl_commandArgs[i+1] == "="){
vl_varName := substr(pl_commandArgs,vl_startVarname,vl_endVarname-vl_startVarname+1);
vl_varName := f_EPTF_Common_decodeEscapeSequence(vl_varName);
vl_newContent := substr(pl_commandArgs,i+2,lengthof(pl_commandArgs)-i-2);
vl_newContent := f_EPTF_UIHandler_CLIClient_clearStringFromStartAndEndWhiteSpaces(vl_newContent);
break;
}
}
//If we found the start of the variable name, but not the end, than it is probably the case, that
//we thought that it is a quoted variable name, but it isn't. Try the other way, the quot is the part of the variable name
if( vl_startVarname > -1 and vl_endVarname == -1 and vl_varName == "" and vl_newContent == ""
and vl_moreLetItEqualSignFound == false and vl_letItEqualSignFound > -1){
//If it was thought to be quoted, but it isn't, we put the quot alsointo the name.
if(vl_varnameWithQuot==true){
vl_varName := substr(pl_commandArgs,vl_startVarname-1, vl_letItEqualSignFound-vl_startVarname+1);
} else {
//I really don't know, if this case is possible.
// remove this case, if not needed.
vl_varName := substr(pl_commandArgs,vl_startVarname, vl_letItEqualSignFound-vl_startVarname);
}
var integer vl_i;
//Remove white spaces from the back.
for( vl_i := lengthof(vl_varName)-1; vl_i > 0; vl_i:= vl_i-1){
if(vl_varName[vl_i] != "" and vl_varName[vl_i] != "\t"){
break;
}
}
vl_varName := substr(vl_varName, 0, vl_i);
vl_varName := f_EPTF_Common_decodeEscapeSequence(vl_varName);
vl_newContent := substr(pl_commandArgs,vl_letItEqualSignFound+2,lengthof(pl_commandArgs)-vl_letItEqualSignFound-2);
vl_newContent := f_EPTF_UIHandler_CLIClient_clearStringFromStartAndEndWhiteSpaces(vl_newContent);
}
if(f_EPTF_UIHandler_CLIClient_debugEnabled()){
f_EPTF_UIHandler_CLIClient_debug("SET command arrived, variable name : " & vl_varName);
f_EPTF_UIHandler_CLIClient_debug("SET command arrived, variable content : " & vl_newContent);
}
if("" != vl_varName and "" != vl_newContent){
//var charstring vl_varName := vl_args[0]
//var charstring vl_newContent := vl_args[1]
var integer vl_varIdx:=f_EPTF_Var_getId(vl_varName);
if (-1 < vl_varIdx) {
if(f_EPTF_UIHandler_isGuiVarEditable(vl_varIdx)) {
if(f_EPTF_UIHandler_parseParamValue(vl_varIdx, vl_newContent)){
//f_EPTF_CLI_Client_sendCommandDisplay(c_UIHandler_CLIClient_commandSET,
pl_result := f_UIHandler_CLIClient_setContentOK(vl_varName,vl_newContent)
//log(%definitionId,": pl_result==",pl_result)
vl_ret := 0
}else{
pl_result := f_UIHandler_CLIClient_errInvalidContent(vl_newContent, c_UIHandler_CLIClient_commandSET)
}
} else {
pl_result := f_UIHandler_CLIClient_errVarIsReadonly(vl_varName)
}
}else{
pl_result := f_UIHandler_CLIClient_errInvalidVarName(vl_varName, c_UIHandler_CLIClient_commandSET)
}
}else{
pl_result := c_UIHandler_CLIClient_cmdUsage&c_UIHandler_CLIClient_setUsage;
}
return vl_ret
}
private function f_EPTF_UIHandler_CLIClient_clearStringFromStartAndEndWhiteSpaces (
in charstring pl_stringToStrip) return charstring{
var charstring vl_newContent := pl_stringToStrip
var integer vl_startValue := -1;
var integer vl_endValue := -1;
var boolean vl_valueWithQuot := false;
var integer vl_valueBackslashInARowCounter := 0;
var boolean vl_valueBackslashInARowCounterResetNextTime := false;
//Go throug all the letters in the input string);
for(var integer j:= 0; j< lengthof(vl_newContent); j:= j +1){
//Value backslash counter reset-ed
if(vl_valueBackslashInARowCounterResetNextTime==true){
vl_valueBackslashInARowCounter := 0;
vl_valueBackslashInARowCounterResetNextTime := false;
}
//When a contiguous backslash sequence ends, this terminates in the next round of the loop
if(vl_startValue > -1 and vl_valueBackslashInARowCounter > 0 and vl_newContent[j] != "\\" ){
vl_valueBackslashInARowCounterResetNextTime := true;
}
//The String has definitely started, with or without quote
if(vl_startValue == -1 and vl_newContent[j] != " " and vl_newContent[j] != "\t" ){
if(vl_newContent[j] == "\"" and j + 1 < lengthof(vl_newContent)){
//Quoted Value start
vl_startValue := j+1;
vl_valueWithQuot := true;
} else {
//Not Quoted Value start
vl_startValue := j;
}
continue;
}
//Quoted varname ends at the paired quote character
if(vl_newContent[j] == "\"" and vl_valueWithQuot==true and (vl_valueBackslashInARowCounter mod 2 == 0)){
vl_endValue := j-1;
continue;
}
//Count backslashes
if(vl_newContent[j] == "\\" and vl_startValue > -1){
vl_valueBackslashInARowCounter := vl_valueBackslashInARowCounter + 1;
continue;
}
//Not Quoted Value probably end, but not sure, it depends on the forthcomming letters
if(vl_startValue > -1 and vl_valueWithQuot == false and (vl_newContent[j] == " " or vl_newContent[j] == "\t" )){
if(vl_endValue == -1){
vl_endValue := j-1;
}
continue;
}
//Not Quoted Value end reset, because a not whitespace has arrived
if(vl_startValue > -1 and vl_endValue > -1 and vl_valueWithQuot == false and vl_newContent[j] != " " and vl_newContent[j] !="\t" ){
vl_endValue := -1;
continue;
}
//After a Quoted Value, a non-whitespace character has arrived, it will be error at the end.
if(vl_startValue > -1 and vl_endValue > -1 and j+1< lengthof(vl_newContent) and vl_valueWithQuot == true
and vl_newContent[j] != " " and vl_newContent[j] !="\t" ){
vl_startValue := -1;
vl_endValue := -1;
break;
}
}
//After examing all letters, endvalue not found. This means that we thought that this is a quoted string, but it isn't
//or the string ends with a value character.
if( vl_endValue == -1){
if(vl_valueWithQuot == true and vl_startValue > 0){ vl_startValue:= vl_startValue-1;}
vl_endValue := lengthof(vl_newContent)-1;
}
//Get the value if possible, do the decode of the Escape Sequences
if(vl_startValue > -1 and vl_endValue-vl_startValue+1 > 0){
vl_newContent := substr(vl_newContent,vl_startValue,vl_endValue-vl_startValue+1);
vl_newContent := f_EPTF_Common_decodeEscapeSequence(vl_newContent);
} else {
vl_newContent := "";
}
return vl_newContent;
}
friend function f_EPTF_UIHandler_CLIClient_handleLS (
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var EPTF_UIHandler_OpenSubscriptions vl_subs := f_EPTF_UIHandler_openSubscriptions();
var charstring vl_list := "";
for(var integer i:=0;i<sizeof(vl_subs);i:=i+1) {
if(i>0) { vl_list := vl_list & "\n" }
vl_list := vl_list & f_EPTF_Var_getName(vl_subs[i].varIdx);
vl_list := vl_list & " := ";
vl_list := vl_list & f_EPTF_UIHandler_CLIClient_var2str(vl_subs[i].varIdx);
}
pl_result := vl_list
return 0
}
friend function f_EPTF_UIHandler_CLIClient_handleLSREADONLY(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var EPTF_UIHandler_OpenSubscriptions vl_subs := f_EPTF_UIHandler_openSubscriptions();
var charstring vl_list := "";
for(var integer i:=0;i<sizeof(vl_subs);i:=i+1) {
if(not f_EPTF_UIHandler_isGuiVarEditable(vl_subs[i].varIdx)) {
if(lengthof(vl_list)>0) { vl_list := vl_list & "\n" }
vl_list := vl_list & f_EPTF_Var_getName(vl_subs[i].varIdx);
vl_list := vl_list & " := ";
vl_list := vl_list & f_EPTF_UIHandler_CLIClient_var2str(vl_subs[i].varIdx);
}
}
pl_result := vl_list
return 0
}
friend function f_EPTF_UIHandler_CLIClient_handleLSWRITABLE(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var EPTF_UIHandler_OpenSubscriptions vl_subs := f_EPTF_UIHandler_openSubscriptions();
var charstring vl_list := "";
for(var integer i:=0;i<sizeof(vl_subs);i:=i+1) {
if(f_EPTF_UIHandler_isGuiVarEditable(vl_subs[i].varIdx)) {
if(lengthof(vl_list)>0) { vl_list := vl_list & "\n" }
vl_list := vl_list & f_EPTF_Var_getName(vl_subs[i].varIdx);
vl_list := vl_list & " := ";
vl_list := vl_list & f_EPTF_UIHandler_CLIClient_var2str(vl_subs[i].varIdx);
}
}
pl_result := vl_list
return 0
}
friend function f_EPTF_UIHandler_CLIClient_handleDISPLAY(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_ret := -1
var charstring vl_varName := pl_commandArgs
if("" != vl_varName){
var integer vl_varIdx:=f_EPTF_Var_getId(vl_varName);
if (-1 < vl_varIdx) {
var integer vl_temp;
if(not f_EPTF_str2int_HashMap_Find(v_UIHandler_CLI_vars2Display, vl_varName,vl_temp)){
f_EPTF_str2int_HashMap_Insert(v_UIHandler_CLI_vars2Display, vl_varName, vl_varIdx);
}
var EPTF_Var_DirectContent vl_content;
f_EPTF_Var_getContent(vl_varIdx, vl_content);
pl_result := f_UIHandler_CLIClient_varContentAnswer(vl_varName, f_EPTF_Var_directContent2str(vl_content))
if(not t_UIHandler_CLI_refresh.running){
t_UIHandler_CLI_refresh.start( ts_CLI_refreshRate );
}
vl_ret := 0
}else{
pl_result := f_UIHandler_CLIClient_errInvalidVarName(vl_varName, c_UIHandler_CLIClient_commandDISPLAY)
}
}else{
pl_result := f_UIHandler_CLIClient_errEmptyVarName(c_UIHandler_CLIClient_commandDISPLAY)
}
return vl_ret
}
friend function f_EPTF_UIHandler_CLIClient_handleHIDE(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_ret := -1
//Hide all the variables
if(""==pl_commandArgs){
f_EPTF_str2int_HashMap_Clear(v_UIHandler_CLI_vars2Display);
if(t_UIHandler_CLI_refresh.running){
t_UIHandler_CLI_refresh.stop;
}
vl_ret := 0
}else{
var charstring vl_varName := pl_commandArgs
var integer vl_varIdx:=f_EPTF_Var_getId(vl_varName);
if (-1 < vl_varIdx) {
var integer vl_temp;
if(f_EPTF_str2int_HashMap_Find(v_UIHandler_CLI_vars2Display, vl_varName,vl_temp)){
f_EPTF_str2int_HashMap_Erase(v_UIHandler_CLI_vars2Display, vl_varName);
}
if(0 == f_EPTF_str2int_HashMap_Size(v_UIHandler_CLI_vars2Display)){
if(t_UIHandler_CLI_refresh.running){
t_UIHandler_CLI_refresh.stop;
}
}
pl_result := f_UIHandler_CLIClient_hideAnswer(vl_varName)
vl_ret := 0
}else{
pl_result := f_UIHandler_CLIClient_errInvalidVarName(vl_varName, c_UIHandler_CLIClient_commandHIDE)
}
}
return vl_ret
}
friend function f_EPTF_UIHandler_CLIClient_handleQUIT(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_ret := -1
return vl_ret
}
friend function f_EPTF_UIHandler_CLIClient_handleSTOP(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
f_EPTF_Base_stopAll(none);
return 0
}
friend function f_EPTF_UIHandler_CLIClient_handleHELP(
in charstring pl_commandArgs,
inout charstring pl_result)
runs on EPTF_UIHandler_Private_CT
return integer{
pl_result := c_UIHandler_CLIClient_help
return 0
}
group Logging {
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_error
//
// Purpose:
// Function to log an error from UIHandler_CLIClient feature.
//
// Parameters:
// - pl_message - *in* *charstring* - the message to log
//
// Return Value:
// -
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_CLIClient_error(in charstring pl_message)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Logging_error(true, tsp_EPTF_UIHandler_CLI_loggingComponentMask&": "&pl_message);
f_EPTF_Base_stopAll();
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_warning
//
// Purpose:
// Function to log a warning from UIHandler_CLIClient feature.
//
// Parameters:
// - pl_message - *in* *charstring* - the message to log
//
// Return Value:
// -
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_CLIClient_warning(in @lazy charstring pl_message)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Logging_warningV2(pl_message, v_UIHandler_CLI_loggingMaskId, {c_EPTF_UIHandler_loggingClassIdx_Warning});
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_debug
//
// Purpose:
// Function to log a debug message from UIHandler_CLIClient feature.
//
// Parameters:
// - pl_message - *in* *charstring* - the message to log
//
// Return Value:
// -
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_CLIClient_debug(in @lazy charstring pl_message)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_Logging_debugV2(pl_message, v_UIHandler_CLI_loggingMaskId, {c_EPTF_UIHandler_loggingClassIdx_Debug});
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_debugEnabled
//
// Purpose:
// Function to check if debug is enabled for UIHandler_CLIClient
//
// Parameters:
// -
//
// Return Value:
// *boolean* - true if debug enabled
//
// Errors & assertions:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_CLIClient_debugEnabled()
runs on EPTF_UIHandler_Private_CT
return boolean
{
return f_EPTF_Logging_isEnabled(v_UIHandler_CLI_loggingMaskId, c_EPTF_UIHandler_loggingClassIdx_Debug);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_CLIClient_sendUserMessage
//
// Purpose:
// Sends a custom message to the display terminal
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_CLIClient_sendUserMessage(in charstring pl_msg)
runs on EPTF_UIHandler_Private_CT
{
f_EPTF_UIHandler_CLIClient_displayVarContent(pl_msg)
}
}
} //CLI
group UIHandler_Config{
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_readFileToCharstring
//
// Purpose:
// Loads a XUL describing a window layout and creates the described GUI.
//
// Parameters:
// *in charstring pl_fileName* - The name of the file to be processed
// It means the window if it's empty
//
// Detailed Comments:
// Calls the <f_EPTF_UIHandler_createGUI> function
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_readFileToCharstring(
in charstring pl_fileName,
out charstring pl_fileContent)
runs on EPTF_UIHandler_Private_CT
return boolean {
var integer vl_file := f_FIO_open_rdonly(pl_fileName);
var integer vl_retval:=-1;
if(vl_file==-1){
f_EPTF_UIHandler_error(%definitionId&": Couldn't open the file "&pl_fileName&".");
return false;
}
var integer vl_from:=f_FIO_seek_home(vl_file);
var integer vl_to:=f_FIO_seek_end(vl_file);
if( f_FIO_seek_home(vl_file)==-1) {
f_EPTF_UIHandler_error(%definitionId&": File seek error in file "&pl_fileName&".");
return false;
}
vl_retval:=f_FIO_read_text(vl_file, pl_fileContent, vl_to-vl_from)
if(-1 == vl_retval){
f_EPTF_UIHandler_error(%definitionId&": Couldn't read the file "&pl_fileName&".");
return false;
}
if( f_FIO_close(vl_file)==-1) {
f_EPTF_UIHandler_error(%definitionId&": Could not close the file "&pl_fileName&".");
return false;
}
return true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_createGUIFromFile
//
// Purpose:
// This function reads the given file and calls the
// f_EPTF_UIHandler_createGUI with the processed charstring.
//
// Parameters:
// *in charstring pl_fileName* - The name of the XUL file to be processed
// *in charstring pl_parentWidgetId* - ParentId where to insert the XUL.
//
// Detailed Comments:
// Calls the <f_EPTF_UIHandler_createGUI> function
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_createGUIFromFile(
in charstring pl_fileName,
in charstring pl_parentWidgetId := "")
runs on EPTF_UIHandler_CT
return boolean {
var charstring vl_GUI := "";
f_EPTF_UIHandler_readFileToCharstring(pl_fileName, vl_GUI)
return f_EPTF_UIHandler_createGUI(vl_GUI, pl_parentWidgetId);
}
// this function is only used in EPTF_CLL_UIHandler_GUIFunctions.cc, but passed to a function reference,
// but this is needed to be able to log the function ref from TTCN
private external function f_EPTF_UIHandler_expand_current_iterator(
//request parameters:
in charstring pl_source,
in charstring pl_ptcName, // response may fill this if it was ""
in charstring pl_element,
in EPTF_DataSource_Params pl_params,
// reponse parameters:
in integer pl_errorCode, // error code in the response
in charstring pl_remoteDataVarName, // var name on the remote component. In case errorCode!=0: it contains the error message
in EPTF_Var_CT/*EPTF_DataSourceClient_CT*/ pl_ownerCompRef,// reference to the remote component
in integer pl_localDataVarId, // var Id on the local component (contains the current value, not subscribed to remote!)
in EPTF_Var_DirectContent pl_dataValue, // the value of the data
// user data
in EPTF_IntegerList pl_userData // user specific data given at the request
);
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_createGUI
//
// Purpose:
// This function processes the given XML and resolves
// iterators, externalvalues and datasources in it.
//
// Parameters:
// *in charstring pl_xul* - The XML to process
// *in charstring pl_parentWidgetId* - ParentId where to insert the xml
//
// Detailed Comments:
// This function can be used to create a GUI based on an XML.
// The XML has to be valid against the XSD of the XTDP Protocol Module.
// The GUI created from the XML will be placed under the parant widget id
// specified in pl_parentWidgetId parameter. Use empty string to place
// the XML to the main window.
// Before this function is called with an XML, all datasources in it
// should be ready and all variables belonging to the data sources
// should exist. The function <f_EPTF_DataSource_registerReadyCallback>
// can be used to register callback functions that are called when a data source
// becomes ready. Before calling <f_EPTF_UIHandler_createGUI> you have to check
// that all data sources in the XML became ready.
//
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_createGUI(in charstring pl_xul,
in charstring pl_parentWidgetId := "")
runs on EPTF_UIHandler_Private_CT
return boolean {
return f_EPTF_UIHandler_createGUI_private(pl_xul, pl_parentWidgetId, true);
}
private external function f_EPTF_UIHandler_expandXML(out charstring pl_xulExpanded, in charstring pl_xul, in charstring pl_parentWidgetId := "") return boolean;
private external function f_EPTF_UIHandler_removeXML(in charstring pl_parentWidgetId := "") return boolean;
private external function f_EPTF_UIHandler_refreshedXMLforNode(in integer pl_nodePointer, out charstring pl_xulExpanded) return boolean;
private external function f_EPTF_UIHandler_printAllXML();
private function f_EPTF_UIHandler_createGUI_private (
in charstring pl_xul,
in charstring pl_parentWidgetId := "",
in boolean pl_appendTo_GUI_DescriptionDB := true,
in boolean pl_send_to_RTGUI := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
v_UIHandler_createGUIRunning := true;
var charstring vl_expandedXML;
var boolean vl_return := true;
var charstring vl_progressInfo := "Creating GUI from xml under widgetId: "&pl_parentWidgetId;
f_EPTF_UIHandler_updateOwnProgress(vl_progressInfo);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Started on: " & log2str(pl_xul));
}
if(f_EPTF_UIHandler_expandXML(vl_expandedXML, pl_xul, pl_parentWidgetId) == true) {
var integer vl_widgetParentIdx := 0;
var boolean vl_clearGui := false;
if("" != pl_parentWidgetId){
vl_widgetParentIdx := f_EPTF_UIHandler_widgetRecIndex(pl_parentWidgetId);
if(-1 == vl_widgetParentIdx){
f_EPTF_UIHandler_warning(%definitionId&": The received parent widget with ID """&pl_parentWidgetId&""" does not exist!");
vl_widgetParentIdx := 0;
}
}
if(pl_appendTo_GUI_DescriptionDB == true) {
f_EPTF_UIHandler_addWidgetWithParent(pl_parentWidgetId, vl_expandedXML);
}
var Widgets vl_widgets := f_EPTF_UIHandler_XSD_decodeXUL(vl_expandedXML);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Decoded widgets: " & log2str(vl_widgets));
}
f_EPTF_UIHandler_updateOwnProgress(vl_progressInfo&" Done.");
var boolean vl_widgetExists;
//If the root element is a window, clear the GUI
if(ischosen(vl_widgets.window)){
f_EPTF_UIHandler_clearInternalWidgetDB();
vl_clearGui := true;
}
//var EPTF_UIHandler_WidgetsList vl_widgetslist;
v_UIHandler_widgetIdxList := {}
v_UIHandler_actualParentIdx := -1;
v_UIHandler_actualParentIdxIsFilled := false;
v_UIHandler_customGUIProcess := true;
vl_return := f_EPTF_UIHandler_Config_Parse(vl_widgets,
vl_widgetParentIdx,
vl_widgetExists);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Widgets after: " & log2str(vl_widgets));
f_EPTF_UIHandler_debug(%definitionId&": "&f_EPTF_UIHandler_XSD_encodeXUL(vl_widgets));
}
if (vl_clearGui) {
f_EPTF_UIHandler_clearGUI(false);
}
if(not v_UIHandler_initToGUIClient and pl_send_to_RTGUI){
var integer vl_UIHandler_widgetIdxList_size := sizeof(v_UIHandler_widgetIdxList);
for(var integer vl_i := 0; vl_i < vl_UIHandler_widgetIdxList_size; vl_i := vl_i + 1) {
var integer vl_parentWidgetIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].parentIdx);
var charstring vl_parentWidgetId := "";
if(vl_parentWidgetIdx != -1) {
vl_parentWidgetId := v_UIHandler_guiItemList[vl_parentWidgetIdx].id;
}
// the valuelist should only be put on the GUI if its parent (distribution chart) was not already put:
if (v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtValuelist) {
// put only to the GUI if its parent chart is not in the v_UIHandler_widgetIdxList
var boolean vl_parentWasUpdated := false;
for (var integer vl_j:=vl_i-1; vl_j>=0; vl_j := vl_j - 1 ) {
if (vl_parentWidgetIdx == v_UIHandler_widgetIdxList[vl_j]) {
vl_parentWasUpdated := true;
}
}
if (vl_parentWasUpdated) {
continue; // vl_i
}
}
//valuelist xulsformat is in the distribution chart, so alredy in the gui
// if the xulformat is empty, that means it is intervallimits, which is inside the distribution chart and generated by buildchildrenxul below
//at tree: need to build the whole tree, RTGUI doesn't support add treecell element
if(ispresent(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].XULformat)) {
if(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType != wtTreecell and
v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType != wtTreecol) {
//if(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtDistributionchart or
// v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtTree) {
var Widgets vl_xul;
//buildchildrenxul cant handle window, f_EPTF_UIHandler_buildXUL makes the whole xul from the window.
if(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtWindow){
f_EPTF_UIHandler_buildXUL(vl_xul);
} else {
f_EPTF_UIHandler_buildchildrenXUL(v_UIHandler_widgetIdxList[vl_i], vl_xul, true);
}
f_EPTF_UIHandler_XSD_addElementToGui_private(vl_xul, vl_parentWidgetId, vl_widgetExists,false);
} else {
var Widgets vl_xul;
f_EPTF_UIHandler_buildchildrenXUL(v_UIHandler_widgetIdxList[vl_i], vl_xul, true);
f_EPTF_UIHandler_XSD_addElementToGui_private(vl_xul, vl_parentWidgetId, vl_widgetExists,false);
}
}
}
}
v_UIHandler_widgetIdxList := {};
v_UIHandler_actualParentIdx := -1;
v_UIHandler_actualParentIdxIsFilled := false;
// wait to finish all getData handlers:
f_EPTF_UIHandler_waitForProcessExternalData_handlers();
// FIXME: if more progress info is added later, the progress variable has to be connected to the widget
vl_return := f_EPTF_UIHandler_Config_connectAllVarsToWidget() and vl_return;
} else {
// XML Load error
f_EPTF_UIHandler_error(%definitionId&": The received XML is invalid, it can not be decoded fully.\n"&
"For further detailes see the log file above.");
}
v_UIHandler_createGUIRunning := false;
return vl_return;
}
public function f_EPTF_UIHandler_createGUI_old (in charstring pl_xul,
in charstring pl_parentWidgetId := "")
runs on EPTF_UIHandler_Private_CT
return boolean{
return f_EPTF_UIHandler_createGUI_private_old(pl_xul, pl_parentWidgetId, true);
}
private function f_EPTF_UIHandler_createGUI_private_old (
in charstring pl_xul,
in charstring pl_parentWidgetId := "",
in boolean pl_appendTo_GUI_DescriptionDB := true,
in boolean pl_send_to_RTGUI := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
if (not v_UIHandler_initialized){ return false }
v_UIHandler_createGUIRunning := true;
var charstring vl_progressInfo := "Creating GUI from xml under widgetId: "&pl_parentWidgetId;
f_EPTF_UIHandler_updateOwnProgress(vl_progressInfo);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Started on: " & log2str(pl_xul));
}
var integer vl_widgetParentIdx := 0;
var boolean vl_clearGui := false;
if("" != pl_parentWidgetId){
vl_widgetParentIdx := f_EPTF_UIHandler_widgetRecIndex(pl_parentWidgetId);
if(-1 == vl_widgetParentIdx){
f_EPTF_UIHandler_warning(%definitionId&": The received parent widget with ID """&pl_parentWidgetId&""" does not exist!");
vl_widgetParentIdx := 0;
}
}
if(pl_appendTo_GUI_DescriptionDB == true) {
f_EPTF_UIHandler_addWidgetWithParent(pl_parentWidgetId, pl_xul);
}
var Widgets vl_widgets := f_EPTF_UIHandler_XSD_decodeXUL(pl_xul);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Decoded widgets: " & log2str(vl_widgets));
}
f_EPTF_UIHandler_updateOwnProgress(vl_progressInfo&" Done.");
var boolean vl_widgetExists;
//If the root element is a window, clear the GUI
if(ischosen(vl_widgets.window)){
f_EPTF_UIHandler_clearInternalWidgetDB();
vl_clearGui := true;
}
//var EPTF_UIHandler_WidgetsList vl_widgetslist;
v_UIHandler_widgetIdxList := {}
v_UIHandler_actualParentIdx := -1;
v_UIHandler_actualParentIdxIsFilled := false;
//vl_widgetParentIdx := 0;
v_UIHandler_customGUIProcess := true;
var boolean vl_return := f_EPTF_UIHandler_Config_Parse(vl_widgets,
vl_widgetParentIdx,
vl_widgetExists);
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Widgets after: " & log2str(vl_widgets));
f_EPTF_UIHandler_debug(%definitionId&": "&f_EPTF_UIHandler_XSD_encodeXUL(vl_widgets));
}
if (vl_clearGui) {
f_EPTF_UIHandler_clearGUI(false);
}
if(not v_UIHandler_initToGUIClient and pl_send_to_RTGUI){
var integer vl_UIHandler_widgetIdxList_size := sizeof(v_UIHandler_widgetIdxList);
for(var integer vl_i := 0; vl_i < vl_UIHandler_widgetIdxList_size; vl_i := vl_i + 1) {
var integer vl_parentWidgetIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].parentIdx);
var charstring vl_parentWidgetId := "";
if(vl_parentWidgetIdx != -1) {
vl_parentWidgetId := v_UIHandler_guiItemList[vl_parentWidgetIdx].id;
}
// the valuelist should only be put on the GUI if its parent (distribution chart) was not already put:
if (v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtValuelist) {
// put only to the GUI if its parent chart is not in the v_UIHandler_widgetIdxList
var boolean vl_parentWasUpdated := false;
for (var integer vl_j:=vl_i-1; vl_j>=0; vl_j := vl_j - 1 ) {
if (vl_parentWidgetIdx == v_UIHandler_widgetIdxList[vl_j]) {
vl_parentWasUpdated := true;
}
}
if (vl_parentWasUpdated) {
continue; // vl_i
}
}
//valuelist xulsformat is in the distribution chart, so alredy in the gui
// if the xulformat is empty, that means it is intervallimits, which is inside the distribution chart and generated by buildchildrenxul below
//at tree: need to build the whole tree, RTGUI doesn't support add treecell element
if(ispresent(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].XULformat) and
v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType != wtTreecell and
v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType != wtTreecol) {
//if(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtDistributionchart or
// v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtTree) {
var Widgets vl_xul;
//buildchildrenxul cant handle window, f_EPTF_UIHandler_buildXUL makes the whole xul from the window.
if(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].widgetType == wtWindow){
f_EPTF_UIHandler_buildXUL(vl_xul);
} else {
f_EPTF_UIHandler_buildchildrenXUL(v_UIHandler_widgetIdxList[vl_i], vl_xul, true)
}
f_EPTF_UIHandler_XSD_addElementToGui(vl_xul, vl_parentWidgetId, vl_widgetExists,false);
//} else {
// f_EPTF_UIHandler_XSD_addElementToGui(v_UIHandler_guiItemList[v_UIHandler_widgetIdxList[vl_i]].XULformat, vl_parentWidgetId, vl_widgetExists,false);
//}
}
}
}
v_UIHandler_widgetIdxList := {};
v_UIHandler_actualParentIdx := -1;
v_UIHandler_actualParentIdxIsFilled := false;
// wait to finish all getData handlers:
f_EPTF_UIHandler_waitForProcessExternalData_handlers();
// FIXME: if more progress info is added later, the progress variable has to be connected to the widget
vl_return := f_EPTF_UIHandler_Config_connectAllVarsToWidget() and vl_return;
v_UIHandler_createGUIRunning := false;
var integer vl_sizeof_postponedPostProcDB := sizeof(v_UIHandler_postponedPostProcDB);
for(var integer vl_i := 0; vl_i < vl_sizeof_postponedPostProcDB ; vl_i := vl_i + 1){
f_EPTF_UIHandler_updateMenulistItemsFromExternaldata(v_UIHandler_postponedPostProcDB[vl_i].idx, v_UIHandler_postponedPostProcDB[vl_i].argList);
}
v_UIHandler_postponedPostProcDB := {};
return vl_return;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Config_Parse
//
// Purpose:
// It parses the input xul into the database, replaces the iterator tags and handles datadescription tags.
// Parameters:
// - pl_xul - *in* <Widgets> - incoming xml
// - pl_widgetsList - *out* <EPTF_UIHandler_WidgetsList> - result xml
// - pl_parentIdx - *in* *integer* - the id of the parent widget under that the xul should be inserted
// - pl_widgetExists - *out* *boolean* - Does any of the widgets defined in the incoming xml already exist on the GUI?
//
// Return Value:
// *boolean* - All the widgets definied in the incoming xul is on the GUI and ready to run?
//
// Errors:
// none
//
// Detailed Comments:
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Config_Parse (
in Widgets pl_xul,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var boolean vl_returnBool := false;
if(ischosen(pl_xul.iterator )) {
var Embeddedwidget vl_embeddedwidget := {iterator := pl_xul.iterator};
return f_EPTF_UIHandler_Config_processIterator(vl_embeddedwidget, pl_parentIdx, true, pl_widgetExists);
}
else if(ischosen(pl_xul.externalvalue )) {
var Embeddedwidget vl_embeddedwidget := {externalvalue := pl_xul.externalvalue};
return f_EPTF_UIHandler_Config_processIterator(vl_embeddedwidget, pl_parentIdx, true, pl_widgetExists);
}
else if(ischosen(pl_xul.window )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromWindow(pl_xul.window, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.tabpages )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTabpages(pl_xul.tabpages, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.tree )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTree(pl_xul.tree, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.treecols )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols(pl_xul.treecols.treecolgroups.treecolgroup_list, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.treecol )) {
vl_returnBool := -1 != f_EPTF_UIHandler_appendTreecol(pl_xul.treecol, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.treechildren )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups(pl_xul.treechildren.treeitemgroups.treeitemgroup_list, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.treeitem )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups(pl_xul.treeitem.treerowgroups.treerowgroup_list, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.treerow )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(pl_xul.treerow.treecellgroups.treecellgroup_list, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.treecell )) {
vl_returnBool := f_EPTF_UIHandler_appendCell(pl_xul.treecell, pl_parentIdx, pl_widgetExists, sizeof(v_UIHandler_guiItemList[pl_parentIdx].widgetData.treeData.columns)-1);
return vl_returnBool;
}
else if(ischosen(pl_xul.hbox )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromHbox(pl_xul.hbox, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.label_ )) {
vl_returnBool := f_EPTF_UIHandler_appendLabel(pl_xul.label_, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.spacer )) {
vl_returnBool := f_EPTF_UIHandler_appendSpacer(pl_xul.spacer, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.button )) {
vl_returnBool := f_EPTF_UIHandler_appendButton(pl_xul.button, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.textbox )) {
vl_returnBool := f_EPTF_UIHandler_appendTextbox(pl_xul.textbox, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.chart )) {
vl_returnBool := f_EPTF_UIHandler_appendChart(pl_xul.chart, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.trace )) {
vl_returnBool := f_EPTF_UIHandler_appendTrace(pl_xul.trace, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.toolbar )) {
vl_returnBool := f_EPTF_UIHandler_appendToolbar(pl_xul.toolbar, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.toolbarbutton )) {
vl_returnBool := f_EPTF_UIHandler_appendToolbarbutton(pl_xul.toolbarbutton, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.toolbarelements )) {
vl_returnBool := f_EPTF_UIHandler_appendToolbarelements(pl_xul.toolbarelements, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.tracelist )) {
var boolean vl_ret := true;
for(var integer vl_i := 0; vl_i < sizeof(pl_xul.tracelist.trace_list);vl_i := vl_i + 1){
vl_ret := vl_ret and f_EPTF_UIHandler_appendTrace(pl_xul.tracelist.trace_list[vl_i], pl_parentIdx, pl_widgetExists);
}
return vl_ret;
}
else if(ischosen(pl_xul.tabpage )) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTabpage(pl_xul.tabpage, pl_parentIdx, pl_widgetExists)
//vl_returnBool := vl_returnBool and f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(pl_xul.tabpage.embeddedwidgets, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.listbox )) {
vl_returnBool := f_EPTF_UIHandler_appendListbox(pl_xul.listbox, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.listitem )) {
vl_returnBool := f_EPTF_UIHandler_appendListitem(pl_xul.listitem, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.numericalwidget )) {
vl_returnBool := f_EPTF_UIHandler_appendNumericalwidget(pl_xul.numericalwidget, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.menulist )) {
vl_returnBool := f_EPTF_UIHandler_appendMenulist(pl_xul.menulist, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.menuitem )) {
vl_returnBool := f_EPTF_UIHandler_appendMenuitem(pl_xul.menuitem, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.distributionchart )) {
vl_returnBool := f_EPTF_UIHandler_appendDistributionchart(pl_xul.distributionchart, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.valuelist )) {
vl_returnBool := f_EPTF_UIHandler_appendValuelist(pl_xul.valuelist, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.image )) {
vl_returnBool := f_EPTF_UIHandler_appendImage(pl_xul.image, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.pushbutton )) {
vl_returnBool := f_EPTF_UIHandler_appendPushbutton(pl_xul.pushbutton, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.togglebutton )) {
vl_returnBool := f_EPTF_UIHandler_appendTogglebutton(pl_xul.togglebutton, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.htmlcode )) {
vl_returnBool := f_EPTF_UIHandler_appendHtmlcode(pl_xul.htmlcode, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
}
else if(ischosen(pl_xul.tabpagelist)) {
vl_returnBool := f_EPTF_UIHandler_appendAllWidgetIdsFromTabpagegroup_list(pl_xul.tabpagelist.tabpagegroups.tabpagegroup_list, pl_parentIdx, pl_widgetExists);
return vl_returnBool;
} else {
f_EPTF_UIHandler_warning("Unhandled widget type in "&%definitionId&": "&log2str(pl_xul));
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Config_processIterator
//
// Purpose:
// It processes the Iterator widget: retrieves the iterator data from the DataSource Client - usnig the DataSource Server,
// into which the client has registered previously, copies the embedded widgets according to the number of the iterator-request
// result and replaces all %the iterator name%s to the current value of the iterator.
// Parameters:
// - pl_iterator - *in* <Iterator> - iterator widget currently processed.
// - pl_result - *out* <EPTF_UIHandler_WidgetsList> - result of the function, contains the embedded widgets processed.
// - pl_parentIdx - *in* *integer* - the id of the parent widget under that the xul should be inserted
// - pl_widgetExists - *inout* *boolean* - Does any of the widgets defined in the intermediate xml already exist on the GUI?
// - pl_isExternalValue - *in* *boolean* - Is the processed item externalvalue or iterator
//
// Return Value:
// *boolean* - All the widgets definied in the iterator is on the GUI and ready to run?
//
// Errors:
// Configuration Error - iterator with same name or communication error.
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Config_processIterator(
in Embeddedwidget pl_embeddedWidget,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Iterator vl_iterator;
var boolean vl_bool := false;
var boolean vl_isExternalValue;
if(ischosen(pl_embeddedWidget.iterator)) {
vl_iterator := pl_embeddedWidget.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_embeddedWidget.externalvalue)) {
vl_iterator := pl_embeddedWidget.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Embeddedwidgets vl_widgets := {embeddedwidget_list := {pl_embeddedWidget}};
vl_bool := f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(vl_widgets,
pl_parentIdx,
pl_widgetExists);
return vl_bool;
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Started on : " & log2str(vl_iterator));
}
var integer vl_parentIdx;
if(pl_createMetaIterator) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, iterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
vl_bool := true; // bugfix_artf361869_empty_iterator: continue processing for empty iterator
for(var integer j := 0; j < sizeof(vl_iterator.embeddedwidgets.embeddedwidget_list); j := j + 1){
var Embeddedwidget vl_widget := vl_iterator.embeddedwidgets.embeddedwidget_list[j];
var Embeddedwidgets vl_widgets := {embeddedwidget_list := {vl_widget}};
vl_bool := f_EPTF_UIHandler_appendAllWidgetIdsFromEmbeddedwidgets(vl_widgets,
vl_parentIdx,
pl_widgetExists);
}
return vl_bool;
}
private external function dec_Embeddedwidgets (in octetstring p_oct, out Embeddedwidgets.embeddedwidget_list p_widgets) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Embeddedwidgets (in Embeddedwidgets.embeddedwidget_list p_widgets) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Config_processExternalData
//
// Purpose:
// Processing externaldata tag : retrieving the Data from DataSource and DataSoureClient, after that we connect to WidgetId.
// Parameters:
// - pl_datadescription - *in* <Datadescription> - datadescription of the widget
// - pl_widgetId - *in* *charstring* - connect datasource to the widget identied by this id
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Config_processExternalData(in Datadescription pl_datadescription,
in charstring pl_widgetId)
runs on EPTF_UIHandler_Private_CT{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Started on : " & log2str(pl_datadescription));
}
// Ask the UIHandler about the datasource, then send him the question.
var EPTF_DataSource_Params vl_dataparamList:= {};
var charstring vl_varName := "";
if(ispresent(pl_datadescription.params)){
for(var integer i := 0; i < sizeof(pl_datadescription.params.dataparam_list); i := i + 1 ){
var integer vl_dataParamsSize := sizeof(vl_dataparamList);
vl_dataparamList[vl_dataParamsSize].paramName := f_unichar2charstr(pl_datadescription.params.dataparam_list[i].name); // FIXME
vl_dataparamList[vl_dataParamsSize].paramValue := f_unichar2charstr(pl_datadescription.params.dataparam_list[i].value_);
}
}
var charstring vl_source := f_unichar2charstr(pl_datadescription.source);
var charstring vl_ptcname := "";
if(ispresent(pl_datadescription.ptcname)){ vl_ptcname := f_unichar2charstr(pl_datadescription.ptcname)}
var charstring vl_element := f_unichar2charstr(pl_datadescription.element);
var integer vl_widgetRecIdx := f_EPTF_UIHandler_widgetRecIndex(pl_widgetId);
v_UIHandler_nofRunning_processExternalData_handlers := v_UIHandler_nofRunning_processExternalData_handlers + 1;
f_EPTF_DataSource_getData_nonBlocking(
pl_source := vl_source,
pl_ptcName := vl_ptcname,
pl_element := vl_element,
pl_params := vl_dataparamList,
pl_getDataHandler := {refers(f_EPTF_UIHandler_Config_processExternalData_handler), {vl_widgetRecIdx}}
);
}
private function f_EPTF_UIHandler_waitForProcessExternalData_handlers() runs on EPTF_UIHandler_Private_CT {
timer t_maxWait := tsp_EPTF_UIHandler_maxWaitTimer;
t_maxWait.start;
timer t_wait := 0.0;
t_wait.start;
alt {
[v_UIHandler_nofRunning_processExternalData_handlers==0] t_wait.timeout;
[] t_maxWait.timeout {
f_EPTF_UIHandler_warning(%definitionId&": ProcessExternalData_handlers are still running, but maximum waiting time expired. Continuing anyway...");
}
}
}
private function f_EPTF_UIHandler_GUIFunctions_waitForProcessExternalData_handlers( in integer pl_idx) runs on EPTF_UIHandler_Private_CT {
timer t_wait := 0.0;
t_wait.start;
alt {
[v_UIHandler_GUIFunctions_nofRunning_processExternalData_handlers[pl_idx]==0] t_wait.timeout;
}
}
private function f_EPTF_UIHandler_GUIFunctions_waitForProcessExternalData_handlers_reset() runs on EPTF_UIHandler_Private_CT {
v_UIHandler_GUIFunctions_nofRunning_processExternalData_handlers := {};
}
private function f_EPTF_UIHandler_Config_processExternalData_handler(
//request parameters:
in charstring pl_source,
in charstring pl_ptcName, // response may fill this if it was ""
in charstring pl_element,
in EPTF_DataSource_Params pl_params,
// reponse parameters:
in integer pl_errorCode, // error code in the response
in charstring pl_remoteDataVarName, // var name on the remote component. In case errorCode!=0: it contains the error message
in EPTF_Var_CT/*EPTF_DataSourceClient_CT*/ pl_ownerCompRef,// reference to the remote component
in integer pl_localDataVarId, // var Id on the local component (contains the current value, not subscribed to remote!)
in EPTF_Var_DirectContent pl_dataValue, // the value of the data
// user data
in EPTF_IntegerList pl_userData // user specific data given at the request
) runs on EPTF_UIHandler_Private_CT {
var integer vl_widgetRecIdx := pl_userData[0];
var EPTF_UIHandler_WidgetIdString pl_widgetId := v_UIHandler_guiItemList[vl_widgetRecIdx].id;
var EPTF_UIHandler_GuiItemRec vl_widgetRec;
var EPTF_Var_DirectContent vl_defaultValue;
f_EPTF_UIHandler_getWidgetRec(pl_widgetId, vl_widgetRec)
f_EPTF_UIhandler_simulation_getDefaultValue(vl_widgetRec, vl_defaultValue);
// widget id is checked because it could happen that the widget or its parent is removed meanwhile (artf552584)
if (pl_errorCode==0 and v_UIHandler_guiItemList[vl_widgetRecIdx].id != "") {
var charstring vl_varDataName := f_EPTF_Var_getName(pl_localDataVarId);
f_EPTF_UIHandler_simulation_getData( vl_varDataName,
pl_source,
pl_ptcName,
pl_element,
pl_params,
-,
-,
vl_defaultValue );
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": widgetId: " & log2str(pl_widgetId) & " varId: " & log2str(pl_localDataVarId));
}
f_EPTF_UIHandler_Config_registerVarToWidget(pl_widgetId, pl_localDataVarId, self, "",pl_dataValue);
f_EPTF_Var_addSubsCanAdjustNotifyFn(pl_localDataVarId, {refers(f_EPTF_UIHandler_updateDisableStateByVarIdx), {}});// - called in f_EPTF_UIHandler_Config_connectAllVarsToWidget() as well
f_EPTF_UIHandler_updateDisableStateByVarIdx(pl_localDataVarId, {});// - called in f_EPTF_UIHandler_Config_connectAllVarsToWidget() as well
} else {
if(v_EPTF_UIHandler_simulatonMode) {
var charstring vl_dataVarName;
//get the data from DB
if(f_EPTF_UIHandler_simulation_getDataFromDB(vl_dataVarName, pl_source, pl_ptcName, pl_element, pl_params) != 0) {
//create random data to simulate
vl_dataVarName := log2str(vl_defaultValue);
if(f_EPTF_Var_getId(vl_dataVarName) == -1) {
f_EPTF_Var_newVar(log2str(vl_defaultValue), vl_defaultValue)
}
}
} else {
f_EPTF_UIHandler_warning(%definitionId&": Configuration error : Invalid dataSource parameters: \n"&
"\nSource: "&pl_source&
"\nPTC : "&pl_ptcName &
"\nData Name : " &pl_element&
"\nParams:" & log2str(pl_params)&
"\nCheck the warnings above for more info.");
}
}
v_UIHandler_nofRunning_processExternalData_handlers := v_UIHandler_nofRunning_processExternalData_handlers - 1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_updateDisableStateByVarIdx
//
// Purpose:
// Callback function for the variable's subsCanAdjust flag change event
//
// Parameters:
// pl_idx - *in* *integer* - EPTF Variable index
// pl_argList - *in* <EPTF_IntegerList> - argument list
//
// Detailed Comments:
// See f_EPTF_Var_addSubsCanAdjustNotifyFn
///////////////////////////////////////////////////////////
function f_EPTF_UIHandler_updateDisableStateByVarIdx(in integer pl_idx, in EPTF_IntegerList pl_argList)
runs on EPTF_UIHandler_Private_CT
{
if(f_EPTF_Var_getSubsCanAdjust(pl_idx)) {
f_EPTF_UIHandler_enableAllWidgetsOfVar(pl_idx);
} else {
f_EPTF_UIHandler_disableAllWidgetsOfVar(pl_idx);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_enableAllWidgetsOfVar
//
// Purpose:
// Enables all widgets connected to the provided variable
//
// Parameters:
// pl_varIdx - *in* *integer* - the ID of the variable
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_enableAllWidgetsOfVar(in integer pl_varIdx)
runs on EPTF_UIHandler_Private_CT
{
if (not v_UIHandler_initialized){ return }
var EPTF_UIHandler_OpenSubscriptions vl_varSubscriptions;
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": "&f_EPTF_Var_getName(pl_varIdx));
}
if(f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_varIdx, vl_varSubscriptions))//there are some subscriptions to the variable
{
for(var integer i:=0; i<sizeof(vl_varSubscriptions);i:=i+1)
{
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(vl_varSubscriptions[i].widgetId);
if(-1 < vl_widgetIdx) {
f_EPTF_UIHandler_updateguilist_enablewidget(vl_widgetIdx);
if (v_UIHandler_guiConnected) {
// f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_enableWidget(vl_varSubscriptions[i].widgetId));
// check here
if(f_EPTF_UIHandler_isWidgetEnabled(vl_widgetIdx) == true){
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_enableWidget(vl_varSubscriptions[i].widgetId));
} else {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_disableWidget(vl_varSubscriptions[i].widgetId));
}
}
}
}
}
else if(c_EPTF_Common_debugSwitch)
{
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": no subscriptions can be found to the variable: " & f_EPTF_Var_getName(pl_varIdx));
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_disableAllWidgetsOfVar
//
// Purpose:
// Disables all widgets connected to the provided variable
//
// Parameters:
// pl_varIdx - *in* *integer* - the ID of the variable
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_disableAllWidgetsOfVar(in integer pl_varIdx)
runs on EPTF_UIHandler_Private_CT
{
if (not v_UIHandler_initialized){ return }
var EPTF_UIHandler_OpenSubscriptions vl_varSubscriptions;
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": "&f_EPTF_Var_getName(pl_varIdx));
}
if(f_EPTF_UIHandler_getSubscriptionsByVarIdx(pl_varIdx, vl_varSubscriptions))//there are some subscriptions to the variable
{
for(var integer i:=0; i<sizeof(vl_varSubscriptions);i:=i+1)
{
var integer vl_widgetIdx := f_EPTF_UIHandler_widgetRecIndex(vl_varSubscriptions[i].widgetId);
if(-1 < vl_widgetIdx and f_EPTF_UIHandler_isWidgetEnabled(vl_widgetIdx)) {
f_EPTF_UIHandler_updateguilist_disablewidget(vl_widgetIdx);
if (v_UIHandler_guiConnected) {
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_disableWidget(vl_varSubscriptions[i].widgetId));
}
}
}
}
else if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled())
{
f_EPTF_UIHandler_debug(%definitionId&": no subscriptions can be found to the variable: " & f_EPTF_Var_getName(pl_varIdx));
}
}
group processIteratorDatas{
private external function dec_Treecolgroups (in octetstring p_oct, out Treecolgroups.treecolgroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Treecolgroups (in Treecolgroups.treecolgroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processTreecoliterator(
in Treecolgroup pl_treecolgroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Treecoliterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_treecolgroup.iterator)) {
vl_iterator := pl_treecolgroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_treecolgroup.externalvalue)) {
vl_iterator := pl_treecolgroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Treecolgroups.treecolgroup_list vl_treecolgroup_list;
vl_treecolgroup_list[0] := pl_treecolgroup;
f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols(vl_treecolgroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, treecoliterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendAllWidgetIdsFromTreecols(vl_iterator.treecolgroups.treecolgroup_list, vl_parentIdx, pl_widgetExists)
}
private external function dec_Treeitemgroups (in octetstring p_oct, out Treeitemgroups.treeitemgroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Treeitemgroups (in Treeitemgroups.treeitemgroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processTreeItemiterator(
in Treeitemgroup pl_treeitemgroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Treeitemiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_treeitemgroup.iterator)) {
vl_iterator := pl_treeitemgroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_treeitemgroup.externalvalue)) {
vl_iterator := pl_treeitemgroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Treeitemgroups.treeitemgroup_list vl_treeitemgroup_list;
vl_treeitemgroup_list[0] := pl_treeitemgroup;
f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups(vl_treeitemgroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, treeitemiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendAllWidgetIdsFromTreeItemGroups(vl_iterator.treeitemgroups.treeitemgroup_list, vl_parentIdx, pl_widgetExists)
}
private external function dec_Treerowgroups (in octetstring p_oct, out Treerowgroups.treerowgroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Treerowgroups (in Treerowgroups.treerowgroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processTreerowiterator(
in Treerowgroup pl_treerowgroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Treerowiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_treerowgroup.iterator)) {
vl_iterator := pl_treerowgroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_treerowgroup.externalvalue)) {
vl_iterator := pl_treerowgroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Treerowgroups.treerowgroup_list vl_treerowgroup_list;
vl_treerowgroup_list[0] := pl_treerowgroup;
f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups(vl_treerowgroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, treerowiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendAllWidgetIdsFromTreeRowGroups(vl_iterator.treerowgroups.treerowgroup_list, vl_parentIdx, pl_widgetExists)
}
private external function dec_Treecellgroups (in octetstring p_oct, out Treecellgroups.treecellgroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Treecellgroups (in Treecellgroups.treecellgroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processTreecelliterator(
inout Treecellgroup pl_treecellgroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Treecelliterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_treecellgroup.iterator)) {
vl_iterator := pl_treecellgroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_treecellgroup.externalvalue)) {
vl_iterator := pl_treecellgroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Treecellgroups.treecellgroup_list vl_treecellgroup_list;
vl_treecellgroup_list[0] := pl_treecellgroup;
f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(vl_treecellgroup_list, pl_parentIdx, pl_widgetExists, false);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, treecelliterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendAllWidgetIdsFromTreeCellGroups(vl_iterator.treecellgroups.treecellgroup_list, vl_parentIdx, pl_widgetExists, false)
}
private external function dec_Tabpagegroups (in octetstring p_oct, out Tabpagegroups.tabpagegroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Tabpagegroups (in Tabpagegroups.tabpagegroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processTabpageiterator(
in Tabpagegroup pl_tabpagegroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Tabpageiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_tabpagegroup.iterator)) {
vl_iterator := pl_tabpagegroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_tabpagegroup.externalvalue)) {
vl_iterator := pl_tabpagegroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Tabpagegroups.tabpagegroup_list vl_tabpagegroup_list;
vl_tabpagegroup_list[0] := pl_tabpagegroup;
f_EPTF_UIHandler_appendAllWidgetIdsFromTabpagegroup_list(vl_tabpagegroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, tabpageiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendAllWidgetIdsFromTabpagegroup_list(vl_iterator.tabpagegroups.tabpagegroup_list, vl_parentIdx, pl_widgetExists);
return;
}
private external function dec_Externaldatagroups (in octetstring p_oct, out Externaldatagroups.externaldatagroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Externaldatagroups (in Externaldatagroups.externaldatagroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processValueListiterator(
in Externaldatagroup pl_externaldatagroup,
inout Distributionchart pl_xul,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Externaldataiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_externaldatagroup.iterator)) {
vl_iterator := pl_externaldatagroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_externaldatagroup.externalvalue)) {
vl_iterator := pl_externaldatagroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Externaldatagroups.externaldatagroup_list vl_externaldatagroup_list;
vl_externaldatagroup_list[0] := pl_externaldatagroup;
f_EPTF_UIHandler_appendAllWidgetIdsFromExternaldatagroup_list(vl_externaldatagroup_list, pl_parentIdx, pl_widgetExists, pl_xul);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, valuelistiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendAllWidgetIdsFromExternaldatagroup_list(vl_iterator.externaldatagroups.externaldatagroup_list, vl_parentIdx, pl_widgetExists, pl_xul)
}
private external function dec_Listitemgroups (in octetstring p_oct, out Listitemgroups.listitemgroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Listitemgroups (in Listitemgroups.listitemgroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processListitemiterator(
in Listitemgroup pl_listitemgroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Listitemiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_listitemgroup.iterator)) {
vl_iterator := pl_listitemgroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_listitemgroup.externalvalue)) {
vl_iterator := pl_listitemgroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Listitemgroups.listitemgroup_list vl_listitemgroup_list;
vl_listitemgroup_list[0] := pl_listitemgroup;
f_EPTF_UIHandler_Config_processListitemgroups(vl_listitemgroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, listitemiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_Config_processListitemgroups(vl_iterator.listitemgroups.listitemgroup_list, vl_parentIdx, pl_widgetExists)
}
private external function dec_Menuitemgroups (in octetstring p_oct, out Menuitemgroups.menuitemgroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Menuitemgroups (in Menuitemgroups.menuitemgroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processMenuitemiterator(
in Menuitemgroup pl_menuitemgroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Menuitemiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_menuitemgroup.iterator)) {
vl_iterator := pl_menuitemgroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_menuitemgroup.externalvalue)) {
vl_iterator := pl_menuitemgroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Menuitemgroups.menuitemgroup_list vl_menuitemgroup_list;
vl_menuitemgroup_list[0] := pl_menuitemgroup;
f_EPTF_UIHandler_appendMenuitemGroups(vl_menuitemgroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, menuitemiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_appendMenuitemGroups(vl_iterator.menuitemgroups.menuitemgroup_list, vl_parentIdx, pl_widgetExists)
}
private external function dec_Tracegroups (in octetstring p_oct, out Tracegroups.tracegroup_list p_groups) return integer
with {extension "prototype(backtrack) decode (XER:XER_EXTENDED) errorbehavior(ALL:WARNING)"}
private external function enc_Tracegroups (in Tracegroups.tracegroup_list p_groups) return octetstring
with {extension "prototype(convert) encode (XER:XER_EXTENDED)"}
private function f_EPTF_UIHandler_Config_processTraceiterator(
in Tracegroup pl_tracegroup,
in integer pl_parentIdx,
in boolean pl_createMetaIterator := true,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT{
var integer vl_iteratorVarIdx;
var integer vl_nodePointer;
var Traceiterator vl_iterator;
var boolean vl_isExternalValue;
if(ischosen(pl_tracegroup.iterator)) {
vl_iterator := pl_tracegroup.iterator;
vl_isExternalValue := false;
} else if(ischosen(pl_tracegroup.externalvalue)) {
vl_iterator := pl_tracegroup.externalvalue;
vl_isExternalValue := true;
} else {
//from postproc
var Tracegroups.tracegroup_list vl_tracegroup_list;
vl_tracegroup_list[0] := pl_tracegroup;
f_EPTF_UIHandler_Config_processTracegroups(vl_tracegroup_list, pl_parentIdx, pl_widgetExists);
return;
}
//creating iterator element in widget database for meta data
var integer vl_parentIdx;
if(pl_createMetaIterator == true) {
//insert the iterator with its meta information to database:
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_iterator.metadata));
vl_parentIdx := f_EPTF_UIHandler_appendMetaIterator(pl_parentIdx, pl_widgetExists, traceiterator, vl_iteratorVarIdx, vl_nodePointer, vl_isExternalValue);
} else {
vl_parentIdx := pl_parentIdx;
}
f_EPTF_UIHandler_Config_processTracegroups(vl_iterator.tracegroups.tracegroup_list, vl_parentIdx, pl_widgetExists)
}
}//group
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Config_registerVarToWidget
//
// Purpose:
// Stores a widget-variable connection to a database
//
// Parameters:
// pl_widgetId - *in* *charstring* - the widget id
// pl_varIdx - *inout* *integer* - the var index to connect to
// pl_provider - *inout* *EPTF_Var_CT* - the provider component
// pl_providedParamName - *inout* *charstring* - the provided param name
// pl_currentValue - *in* <EPTF_Var_DirectContent> - the current value of the var pl_varIdx
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Config_registerVarToWidget(in charstring pl_widgetId,
in integer pl_varIdx,
in EPTF_Var_CT pl_provider,
in charstring pl_providedParamName,
in EPTF_Var_DirectContent pl_currentValue
)
runs on EPTF_UIHandler_Private_CT {
if(f_EPTF_UIHandler_checkSubscriptCompatibility(pl_widgetId, pl_varIdx, pl_currentValue) == true) {
var integer vl_size := sizeof(v_EPTF_UIHandler_Config_ConnectVarToWidgets);
v_EPTF_UIHandler_Config_ConnectVarToWidgets[vl_size] := c_EPTF_UIHandler_Config_ConnectVarToWidget_init;
v_EPTF_UIHandler_Config_ConnectVarToWidgets[vl_size].widgetId := pl_widgetId;
v_EPTF_UIHandler_Config_ConnectVarToWidgets[vl_size].varIdx := pl_varIdx;
v_EPTF_UIHandler_Config_ConnectVarToWidgets[vl_size].provider := pl_provider;
v_EPTF_UIHandler_Config_ConnectVarToWidgets[vl_size].providedParamName := pl_providedParamName;
v_EPTF_UIHandler_Config_ConnectVarToWidgets[vl_size].initialValue := pl_currentValue;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Config_connectAllVarsToWidget
//
// Purpose:
// Connects all a widget-variable connections stored in the database
//
// Parameters:
// -
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Config_connectAllVarsToWidget()
runs on EPTF_UIHandler_Private_CT return boolean {
var boolean vl_ret := true;
for(var integer i:=0; i<sizeof(v_EPTF_UIHandler_Config_ConnectVarToWidgets); i:=i+1) {
vl_ret := vl_ret and f_EPTF_UIHandler_Config_connectToWidget(
v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].widgetId,
v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].varIdx,
v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].provider,
v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].providedParamName,
v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].initialValue
);
f_EPTF_Var_addPostProcFn(v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].varIdx, {refers(f_EPTF_UIHandler_refreshVar),{}});
f_EPTF_Var_addSubsCanAdjustNotifyFn(v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].varIdx, {refers(f_EPTF_UIHandler_updateDisableStateByVarIdx),{}});
f_EPTF_UIHandler_updateDisableStateByVarIdx(v_EPTF_UIHandler_Config_ConnectVarToWidgets[i].varIdx, {});
}
v_EPTF_UIHandler_Config_ConnectVarToWidgets := {};
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_Config_connectToWidget
//
// Purpose:
// Connects a widget id to a variable
//
// Parameters:
// pl_widgetId - *in* *charstring* - the widget id
// pl_varIdx - *inout* *integer* - the var index to connect to
// pl_provider - *inout* *EPTF_Var_CT* - the provider component
// pl_providedParamName - *inout* *charstring* - the provided param name
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_Config_connectToWidget(in charstring pl_widgetId,
in integer pl_varIdx,
in EPTF_Var_CT pl_provider,
in charstring pl_providedParamName,
in EPTF_Var_DirectContent pl_initialValue := {unknownVal := {omit}} )
runs on EPTF_UIHandler_Private_CT
return boolean{
if(f_EPTF_UIHandler_checkSubscriptCompatibility(pl_widgetId, pl_varIdx, pl_initialValue) != true) {
return false;
}
// copied and simplified from f_EPTF_UIHandler_handleSubscriptNote, which handles subscribeMe requests
// Does not handle remote subscription!!!!
var EPTF_UIHandler_OpenSubscription vl_subs := c_UIHandler_defOpenSubscription;
//log("DEBUG: ","------- connect to a widget -------",pl_msg.widgetId);
//Check if the widget is already connected
var integer vl_subsIdx := f_EPTF_UIHandler_getSubscriptionIdxByWidgetId(pl_widgetId);
if(-1 != vl_subsIdx){
if(v_UIHandler_openSubscriptions[vl_subsIdx].varIdx == pl_varIdx){
f_EPTF_UIHandler_warning("The widget's already connected to the same variable!");
return true;
}
f_EPTF_UIHandler_warning("The widget is already connected!");
return false;
}
if( not f_EPTF_UIHandler_widgetTypeFromId(pl_widgetId, vl_subs)
/*-1 == f_EPTF_UIHandler_widgetRecIndex(pl_msg.widgetId)*/
){
f_EPTF_UIHandler_warning("The widget "&pl_widgetId&" affected in the subscription note does not exist.");
return false;
}
var EPTF_UIHandler_GuiItemRec vl_wRec;
f_EPTF_UIHandler_getWidgetRec(pl_widgetId, vl_wRec);
if(vl_wRec.widgetType == wtTrace){
f_EPTF_UIHandler_createTraceHistory(vl_wRec.XULformat.trace.maxPoints, vl_wRec.id, pl_varIdx);
}
vl_subs.widgetId := pl_widgetId;
vl_subs.provider := pl_provider;
vl_subs.varIdx := pl_varIdx;
vl_subs.providedParamName:=pl_providedParamName;
f_EPTF_UIHandler_newSubscription(vl_subs);
f_EPTF_UIHandler_refreshWidget(vl_subs, true,pl_initialValue);
return true;
}
private function f_EPTF_UIHandler_Config_appendListitemFromList(
inout EPTF_UIHandler_WidgetsList pl_widgets,
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return boolean{
pl_widgetExists := false;
var boolean vl_bool := false;
for(var integer i := 0; i<sizeof(pl_widgets); i:= i + 1){
var Listitem vl_xul := pl_widgets[i].listitem;
vl_xul.id := f_EPTF_UIHandler_setWidgetID(vl_xul.id);
vl_bool := vl_bool and -1 != f_EPTF_UIHandler_addWidgetRec({
f_EPTF_UIHandler_unichar2charstring(vl_xul.id),
wtListitem,
omit,
pl_parentIdx,
{},
omit,
{listitem := f_EPTF_UIHandler_deleteChildrenFromListitem(vl_xul)}, false}, pl_widgetExists);
}
return vl_bool;
}
}
group obsoleteXTDPAspFunctions{
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_addElementToGui
//
// Purpose:
// if the element to add to the Runtime Gui proves to be valid (will not destroy consistency),
// function sends out singleAddElementToGUI XTDP addRequest to the Gui and also adds this new
// element to GUI item list. With call of f_EPTF_UIHandler_expandXML for XML handling.
//
// Return Value:
// boolean
//
// Detailed Comments:
// It returns true if new element proved to be valid, XTDP addRequest is sent.
///////////////////////////////////////////////////////////
public function f_EPTF_UIHandler_XSD_addElementToGui(
in Widgets pl_widgets,
in EPTF_UIHandler_WidgetIdString pl_parentWidgetID := "",
inout boolean pl_widgetExists,
in boolean pl_updatedb := true)
runs on EPTF_UIHandler_Private_CT
return boolean {
if (not v_UIHandler_initialized){ return false }
var charstring vl_expandedXML;
var charstring vl_xul := f_EPTF_UIHandler_XSD_encodeXUL(pl_widgets);
var boolean vl_ret := true;
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&": Started on: " & log2str(vl_xul));
}
vl_ret := f_EPTF_UIHandler_expandXML(vl_expandedXML, vl_xul, pl_parentWidgetID);
if(vl_ret == true) {
if(vl_expandedXML != "") {
// Convert into widgets, becouse iterators - optimal if check the metadata= exitence and if no pl_widgets
var integer vl_separatorPos := f_strstr(vl_expandedXML,"metadata=");
if (vl_separatorPos<0) {
vl_ret := f_EPTF_UIHandler_XSD_addElementToGui_private(pl_widgets, pl_parentWidgetID, pl_widgetExists, pl_updatedb);
} else {
var Widgets vl_expandedXul := f_EPTF_UIHandler_XSD_decodeXUL(vl_expandedXML);
vl_ret := f_EPTF_UIHandler_XSD_addElementToGui_private(vl_expandedXul, pl_parentWidgetID, pl_widgetExists, pl_updatedb);
}
} else {
f_EPTF_UIHandler_warning("Invalid parent ID: "& pl_parentWidgetID);
vl_ret := false;
}
} else {
// XML Load error
f_EPTF_UIHandler_error(%definitionId&": The received XML is invalid, it can not be decoded fully.\n"&
"For further detailes see the log file above.");
}
return vl_ret;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_XSD_addElementToGui_private
//
// Purpose:
// if the element to add to the Runtime Gui proves to be valid (will not destroy consistency),
// function sends out singleAddElementToGUI XTDP addRequest to the Gui and also adds this new
// element to GUI item list.
//
// Return Value:
// boolean
//
// Detailed Comments:
// It returns true if new element proved to be valid, XTDP addRequest is sent.
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_XSD_addElementToGui_private(
in Widgets pl_widgets,
in EPTF_UIHandler_WidgetIdString pl_parentWidgetID := "",
inout boolean pl_widgetExists,
in boolean pl_updatedb := true)
runs on EPTF_UIHandler_Private_CT
return boolean{
if(ischosen(pl_widgets.metaiterator)) {
//no need to add metaiterator
return true;
}
f_EPTF_UIHandler_waitForLayoutReady();
pl_widgetExists := false;
//If there is no parent ID, the main window will be the first element.
var integer vl_parentIdx := v_UIHandler_windowIndex;
if (pl_parentWidgetID != "") {
vl_parentIdx := f_EPTF_UIHandler_widgetRecIndex(pl_parentWidgetID);
if(-1 == vl_parentIdx){
f_EPTF_UIHandler_warning("Invalid parent ID: "& pl_parentWidgetID);
return false;
}
if(v_UIHandler_guiItemList[vl_parentIdx].widgetType == wtMetaIterator) {
vl_parentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(vl_parentIdx);
}
}
if(not ischosen(pl_widgets.window)){
if(-1 == vl_parentIdx){
f_EPTF_UIHandler_warning("Adding widget to the window, but there is no window yet!");
return false;
}
if (pl_updatedb){
f_EPTF_UIHandler_addWidgetWithParent(pl_parentWidgetID, f_EPTF_UIHandler_XSD_encodeXUL(pl_widgets));
if (f_EPTF_UIHandler_appendAllWidgetIdsFromXul(pl_widgets, vl_parentIdx, pl_widgetExists)) {
//send element to the GUI
if (pl_parentWidgetID=="") {
pl_parentWidgetID := v_UIHandler_guiItemList[v_UIHandler_windowIndex].id;
}
if(ischosen(pl_widgets.tabpage) and v_UIHandler_guiItemList[vl_parentIdx].widgetType == wtTabpage) {
pl_parentWidgetID := v_UIHandler_guiItemList[v_UIHandler_guiItemList[vl_parentIdx].parentIdx].id;
}
if(not pl_widgetExists) {
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
var charstring vl_widgetId := "";
f_EPTF_UIHandler_getWidgetID(pl_widgets, vl_widgetId);
if(vl_widgetId == ""){
f_EPTF_UIHandler_Browser_reportGUIChanged(pl_parentWidgetID);
} else {
f_EPTF_UIHandler_Browser_reportGUIChanged(vl_widgetId);
}
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleAddElementToGUI(pl_parentWidgetID, pl_widgets));
} else {
}
return true;
}
} else {
if (pl_parentWidgetID=="") {pl_parentWidgetID := v_UIHandler_guiItemList[v_UIHandler_windowIndex].id;}
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
var charstring vl_widgetId := "";
f_EPTF_UIHandler_getWidgetID(pl_widgets, vl_widgetId);
if(vl_widgetId == ""){
f_EPTF_UIHandler_Browser_reportGUIChanged(pl_parentWidgetID);
} else {
f_EPTF_UIHandler_Browser_reportGUIChanged(vl_widgetId);
}
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleAddElementToGUI(pl_parentWidgetID, pl_widgets));
return true;
}
} else {
//This is a window
if(-1 != v_UIHandler_windowIndex){
if(v_UIHandler_guiItemList[v_UIHandler_windowIndex].id != pl_widgets.window.id){
f_EPTF_UIHandler_warning("There is another window already!");
return false;
}
}
if (pl_updatedb){
if(f_EPTF_UIHandler_appendAllWidgetIdsFromXul(pl_widgets, vl_parentIdx, pl_widgetExists)){
if(not pl_widgetExists) {
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
var charstring vl_widgetId := "";
f_EPTF_UIHandler_getWidgetID(pl_widgets, vl_widgetId);
if(vl_widgetId == ""){
f_EPTF_UIHandler_Browser_reportGUIChanged(pl_parentWidgetID);
} else {
f_EPTF_UIHandler_Browser_reportGUIChanged(vl_widgetId);
}
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleAddElementToGUI(omit, pl_widgets));
}
}
return true;
} else {
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
var charstring vl_widgetId := "";
f_EPTF_UIHandler_getWidgetID(pl_widgets, vl_widgetId);
if(vl_widgetId == ""){
f_EPTF_UIHandler_Browser_reportGUIChanged(pl_parentWidgetID);
} else {
f_EPTF_UIHandler_Browser_reportGUIChanged(vl_widgetId);
}
}
f_EPTF_UIHandler_send_XTDP(ts_ASP_XTDP_singleAddElementToGUI(omit, pl_widgets));
return true;
}
}
if(c_EPTF_Common_debugSwitch and f_EPTF_UIHandler_debugEnabled()){
f_EPTF_UIHandler_debug(%definitionId&" failed");
}
return false;
}
}
group RingBufferFunctions
{
private function f_EPTF_UIHandler_createTraceHistory(in integer pl_maxPoints, in charstring pl_traceId, in integer pl_varId)runs on EPTF_UIHandler_Private_CT
{
f_EPTF_UIHandler_ChartDataType_RB_init(v_EPTF_UIHandler_TraceRingBuffers[sizeof(v_EPTF_UIHandler_TraceRingBuffers)], pl_maxPoints);
var integer vl_i, vl_ringBufferIdx:=sizeof(v_EPTF_UIHandler_TraceRingBuffers)-1;
f_EPTF_str2int_HashMap_Insert (v_EPTF_UIHandler_Traces_HashmapId, pl_traceId, vl_ringBufferIdx);
var float vl_startTime := f_EPTF_Base_getAbsTimeInSecs();
for(vl_i := 0; vl_i < pl_maxPoints; vl_i := vl_i+1){
f_EPTF_UIHandler_ChartDataType_RB_push_front(v_EPTF_UIHandler_TraceRingBuffers[vl_ringBufferIdx], {0.0, vl_startTime});
}
var integer vl_traceIdx := f_EPTF_UIHandler_widgetRecIndex(pl_traceId);
var integer vl_chartIdx := v_UIHandler_guiItemList[vl_traceIdx].parentIdx;
f_EPTF_UIHandler_traceHistoryCallBack(pl_varId,{vl_ringBufferIdx, vl_chartIdx});
f_EPTF_Var_addPostProcFn(pl_varId, {refers(f_EPTF_UIHandler_traceHistoryCallBack), {vl_ringBufferIdx, vl_chartIdx}});
}
private function f_EPTF_UIHandler_traceHistoryCallBack(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on EPTF_UIHandler_Private_CT{
if(not v_UIHandler_initialized) {
return; // after UIHandler cleanup
}
var float vl_timestamp := f_EPTF_Base_getAbsTimeInSecs();
var EPTF_Var_DirectContent vl_value;
f_EPTF_Var_getContent(pl_idx, vl_value);
var integer vl_ringBufferIdx := pl_argList[0];
var integer vl_chartIdx := pl_argList[1];
for( var integer i := 0; i < sizeof(v_UIHandler_guiItemList[vl_chartIdx].children); i := i + 1) {
var charstring vl_traceId := v_UIHandler_guiItemList[v_UIHandler_guiItemList[vl_chartIdx].children[i]].id;
var integer vl_currentRingBufferIdx;
if(not f_EPTF_str2int_HashMap_Find(v_EPTF_UIHandler_Traces_HashmapId, vl_traceId, vl_currentRingBufferIdx)) {
// error
} else {
var EPTF_Var_DirectContent vl_currentvalue := vl_value;
if(vl_currentRingBufferIdx != vl_ringBufferIdx) {
f_EPTF_UIHandler_getLatestValueOfTrace(vl_traceId, vl_currentvalue);
var charstring vl_currentstrValue := regexp(vl_currentvalue.charstringVal,c_EPTF_CLI_everything&":"&c_EPTF_CLI_floatNumber,1);
if(vl_currentstrValue != "") {
vl_currentvalue := { floatVal := str2float(vl_currentstrValue)}
}
}
if(ischosen(vl_currentvalue.floatVal)){
f_EPTF_UIHandler_ChartDataType_RB_push_front(v_EPTF_UIHandler_TraceRingBuffers[vl_currentRingBufferIdx], {vl_currentvalue.floatVal, vl_timestamp});
}
else if(ischosen(vl_currentvalue.intVal)){
f_EPTF_UIHandler_ChartDataType_RB_push_front(v_EPTF_UIHandler_TraceRingBuffers[vl_currentRingBufferIdx], {int2float(vl_currentvalue.intVal), vl_timestamp});
}
}
}
}
friend function f_EPTF_UIHandler_getHistoryOfTrace(in charstring pl_traceId, out EPTF_Var_DirectContent pl_content)runs on EPTF_UIHandler_Private_CT{
pl_content.charstringVal := "";
var integer vl_i, vl_ringBufferIdx := -1;
var UIHandler_ChartDataType vl_data;
f_EPTF_str2int_HashMap_Find(v_EPTF_UIHandler_Traces_HashmapId, pl_traceId, vl_ringBufferIdx);
for(vl_i := f_EPTF_UIHandler_ChartDataType_RB_capacity(v_EPTF_UIHandler_TraceRingBuffers[vl_ringBufferIdx])-1; vl_i>-1; vl_i := vl_i -1)
{
vl_data := f_EPTF_UIHandler_ChartDataType_RB_get(v_EPTF_UIHandler_TraceRingBuffers[vl_ringBufferIdx], vl_i);
pl_content.charstringVal := pl_content.charstringVal & float2str(vl_data.timestamp) & ":" & float2str(vl_data.data) & "_";
}
pl_content.charstringVal := substr(pl_content.charstringVal, 0, lengthof(pl_content.charstringVal)-1);
}
friend function f_EPTF_UIHandler_getLatestValueOfTrace(in charstring pl_traceId, out EPTF_Var_DirectContent pl_content)runs on EPTF_UIHandler_Private_CT{
pl_content.charstringVal := "";
var integer vl_ringBufferIdx := -1;
var UIHandler_ChartDataType vl_data;
f_EPTF_str2int_HashMap_Find(v_EPTF_UIHandler_Traces_HashmapId, pl_traceId, vl_ringBufferIdx);
vl_data := f_EPTF_UIHandler_ChartDataType_RB_front(v_EPTF_UIHandler_TraceRingBuffers[vl_ringBufferIdx]);
pl_content.charstringVal := float2str(vl_data.timestamp) & ":" & float2str(vl_data.data);
}
}
////////////Dynamic iterator handling
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_addWidgetWithParent
//
// Purpose:
// Adding new element to GUI description database
//
// Parameters:
// pl_parentWidgetId - *in* *charstring* - the pl_parentWidgetId, where the xml described GUI part belongs
// pl_xml_widgets - *in* *charstring* - the GUI description XML
//
// Return Value:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_addWidgetWithParent(in charstring pl_parentWidgetId, in charstring pl_xml_widgets)
runs on EPTF_UIHandler_Private_CT {
v_UIHandler_GUI_DescriptionDB_Idx := sizeof(v_UIHandler_GUI_DescriptionDB);
v_UIHandler_GUI_DescriptionDB[v_UIHandler_GUI_DescriptionDB_Idx] := c_UIHandler_GUI_DescriptionDB_Item;
v_UIHandler_GUI_DescriptionDB[v_UIHandler_GUI_DescriptionDB_Idx].parentWidgetId := pl_parentWidgetId;
v_UIHandler_GUI_DescriptionDB[v_UIHandler_GUI_DescriptionDB_Idx].xml_widgets := pl_xml_widgets;
}
//FIXME: update the itarator variable created from a non-CharstringList variable (e.g in function f_EPTF_UIHandler_Config_processIterator and f_EPTF_UIHandler_Config_getIteratorData)
// this postproc rebuilds the GUI XML based on the custom XML using the new values of the iterator
private function f_EPTF_UIHandler_updateIterator_PostProc(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on EPTF_UIHandler_Private_CT {
var integer vl_iteratorVarIdx := pl_idx;
var integer vl_metaIteratorIdx := pl_argList[0];
// check if metaIterator exists:
if (
vl_metaIteratorIdx<sizeof(v_UIHandler_guiItemList)
and ispresent(v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData)
and ispresent(v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer)
and ischosen(v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData)
and v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.iteratorVarIdx == vl_iteratorVarIdx
) {
// metaIterator found
var integer vl_nodePointer := v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer;
// check if value was changed:
var EPTF_CharstringList vl_currentValue := v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.currentValue;
var EPTF_CharstringList vl_newValue := f_EPTF_Var_getCharstringlistValue(v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.iteratorVarIdx);
if (vl_currentValue == vl_newValue) {
// no change
return;
} else {
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.currentValue := vl_newValue;
}
// get XML descriptor from custom XML:
var integer vl_UIHandler_GUI_DescriptionDB_Idx := v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.GUI_DescriptionDB_Idx;
var charstring vl_parentWidgetId := v_UIHandler_GUI_DescriptionDB[vl_UIHandler_GUI_DescriptionDB_Idx].parentWidgetId;
var charstring vl_xml_widgets := v_UIHandler_GUI_DescriptionDB[vl_UIHandler_GUI_DescriptionDB_Idx].xml_widgets;
var Widgets vl_widgets;
var integer vl_retval;
vl_retval := dec_Widgets(char2oct(vl_xml_widgets), vl_widgets);
if(0 != vl_retval){
// this should never happen
f_EPTF_UIHandler_error(%definitionId&": The received XML is invalid, it can not be decoded fully.\n"&
"Unable to update gui while updating the iterator "&int2str(vl_metaIteratorIdx)&" . The XML: "&vl_xml_widgets)
}
// clear all children of the metaIterator from database:
var EPTF_IntegerList vl_childrens := v_UIHandler_guiItemList[vl_metaIteratorIdx].children;
for(var integer vl_i := 0; vl_i < sizeof(vl_childrens); vl_i := vl_i + 1){
f_EPTF_UIHandler_removeElementFromGuiByIdx(vl_childrens[vl_i], false, false);
}
//checking what parentid is removed. It's childrens need to be rebuild after the iterator refreshed. (If the parentIdx still exists)
var EPTF_IntegerList vl_removedDescriptionDBIdxs := {};
for(var integer vl_i := 0; vl_i < sizeof(v_UIHandler_GUI_DescriptionDB); vl_i := vl_i + 1) {
if (f_EPTF_UIHandler_widgetRecIndex(v_UIHandler_GUI_DescriptionDB[vl_i].parentWidgetId) == -1) {
vl_removedDescriptionDBIdxs[sizeof(vl_removedDescriptionDBIdxs)] := vl_i;
}
}
//Rebuild the gui:
var boolean vl_widgetExists;
var charstring vl_widget_xml;
var octetstring vl_widgetOctString;
if(not f_EPTF_UIHandler_refreshedXMLforNode(vl_nodePointer, vl_widget_xml)) {
f_EPTF_UIHandler_error(%definitionId&": Unable to generate the xml, after iterator is changed for nodepointer:"&log2str(vl_nodePointer))
}
select (v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.iteratorUnionType) {
case(iterator) {
vl_widget_xml := "<iterator xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</iterator>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Embeddedwidgets.embeddedwidget_list vl_embeddedwidget_list;
dec_Embeddedwidgets(vl_widgetOctString, vl_embeddedwidget_list);
// rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_embeddedwidget_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_embeddedwidget_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_embeddedwidget_list := vl_embeddedwidget_list[0].iterator.embeddedwidgets.embeddedwidget_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_embeddedwidget_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_embeddedwidget_list := vl_embeddedwidget_list[0].externalvalue.embeddedwidgets.embeddedwidget_list;
}
var integer vl_embeddedwidget_list_size := sizeof(vl_embeddedwidget_list);
for(var integer i := 0; i < vl_embeddedwidget_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processIterator( vl_embeddedwidget_list[i], vl_metaIteratorIdx, true, vl_widgetExists);
}
}
case(tabpageiterator) {
vl_widget_xml := "<tabpagegroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</tabpagegroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Tabpagegroups.tabpagegroup_list vl_tabpagegroup_list;
dec_Tabpagegroups(vl_widgetOctString, vl_tabpagegroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_tabpagegroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_tabpagegroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_tabpagegroup_list := vl_tabpagegroup_list[0].iterator.tabpagegroups.tabpagegroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_tabpagegroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_tabpagegroup_list := vl_tabpagegroup_list[0].externalvalue.tabpagegroups.tabpagegroup_list;
}
var integer vl_tabpagegroup_list_size := sizeof(vl_tabpagegroup_list);
for(var integer i := 0; i < vl_tabpagegroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processTabpageiterator(vl_tabpagegroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(treecoliterator) {
vl_widget_xml := "<treecolgroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</treecolgroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Treecolgroups.treecolgroup_list vl_treecolgroup_list;
dec_Treecolgroups(vl_widgetOctString, vl_treecolgroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_treecolgroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treecolgroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treecolgroup_list := vl_treecolgroup_list[0].iterator.treecolgroups.treecolgroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treecolgroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treecolgroup_list := vl_treecolgroup_list[0].externalvalue.treecolgroups.treecolgroup_list;
}
var integer vl_treecolgroup_list_size := sizeof(vl_treecolgroup_list);
for(var integer i := 0; i < vl_treecolgroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processTreecoliterator(vl_treecolgroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(treeitemiterator) {
vl_widget_xml := "<treeitemgroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</treeitemgroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Treeitemgroups.treeitemgroup_list vl_treeitemgroup_list;
dec_Treeitemgroups(vl_widgetOctString, vl_treeitemgroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_treeitemgroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treeitemgroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treeitemgroup_list := vl_treeitemgroup_list[0].iterator.treeitemgroups.treeitemgroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treeitemgroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treeitemgroup_list := vl_treeitemgroup_list[0].externalvalue.treeitemgroups.treeitemgroup_list;
}
var integer vl_treeitemgroup_list_size := sizeof(vl_treeitemgroup_list);
for(var integer i := 0; i < vl_treeitemgroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processTreeItemiterator(vl_treeitemgroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(treerowiterator) {
vl_widget_xml := "<treerowgroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</treerowgroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Treerowgroups.treerowgroup_list vl_treerowgroup_list;
dec_Treerowgroups(vl_widgetOctString, vl_treerowgroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_treerowgroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treerowgroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treerowgroup_list := vl_treerowgroup_list[0].iterator.treerowgroups.treerowgroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treerowgroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treerowgroup_list := vl_treerowgroup_list[0].externalvalue.treerowgroups.treerowgroup_list;
}
var integer vl_treerowgroup_list_size := sizeof(vl_treerowgroup_list);
for(var integer i := 0; i < vl_treerowgroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processTreerowiterator(vl_treerowgroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(treecelliterator) {
vl_widget_xml := "<treecellgroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</treecellgroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Treecellgroups.treecellgroup_list vl_treecellgroup_list;
dec_Treecellgroups(vl_widgetOctString, vl_treecellgroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_treecellgroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treecellgroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treecellgroup_list := vl_treecellgroup_list[0].iterator.treecellgroups.treecellgroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_treecellgroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_treecellgroup_list := vl_treecellgroup_list[0].externalvalue.treecellgroups.treecellgroup_list;
}
var integer vl_treecellgroup_list_size := sizeof(vl_treecellgroup_list);
for(var integer i := 0; i < vl_treecellgroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processTreecelliterator(vl_treecellgroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(traceiterator) {
vl_widget_xml := "<tracegroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</tracegroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Tracegroups.tracegroup_list vl_tracegroup_list;
dec_Tracegroups(vl_widgetOctString, vl_tracegroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_tracegroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_tracegroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_tracegroup_list := vl_tracegroup_list[0].iterator.tracegroups.tracegroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_tracegroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_tracegroup_list := vl_tracegroup_list[0].externalvalue.tracegroups.tracegroup_list;
}
var integer vl_tracegroup_list_size := sizeof(vl_tracegroup_list);
for(var integer i := 0; i < vl_tracegroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processTraceiterator(vl_tracegroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(listitemiterator) {
vl_widget_xml := "<listitemgroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</listitemgroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Listitemgroups.listitemgroup_list vl_listitemgroup_list;
dec_Listitemgroups(vl_widgetOctString, vl_listitemgroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_listitemgroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_listitemgroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_listitemgroup_list := vl_listitemgroup_list[0].iterator.listitemgroups.listitemgroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_listitemgroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_listitemgroup_list := vl_listitemgroup_list[0].externalvalue.listitemgroups.listitemgroup_list;
}
var integer vl_listitemgroup_list_size := sizeof(vl_listitemgroup_list);
for(var integer i := 0; i < vl_listitemgroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processListitemiterator(vl_listitemgroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(menuitemiterator) {
vl_widget_xml := "<listitemgroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</listitemgroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Menuitemgroups.menuitemgroup_list vl_menuitemgroup_list;
dec_Menuitemgroups(vl_widgetOctString, vl_menuitemgroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_menuitemgroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_menuitemgroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_menuitemgroup_list := vl_menuitemgroup_list[0].iterator.menuitemgroups.menuitemgroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_menuitemgroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_menuitemgroup_list := vl_menuitemgroup_list[0].externalvalue.menuitemgroups.menuitemgroup_list;
}
var integer vl_menuitemgroup_list_size := sizeof(vl_menuitemgroup_list);
for(var integer i := 0; i < vl_menuitemgroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processMenuitemiterator(vl_menuitemgroup_list[i], vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(externaldataiterator) {
vl_widget_xml := "<externaldatagroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</externaldatagroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Externaldatagroups.externaldatagroup_list vl_externaldatagroup_list;
dec_Externaldatagroups(vl_widgetOctString, vl_externaldatagroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_externaldatagroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_externaldatagroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_externaldatagroup_list := vl_externaldatagroup_list[0].iterator.externaldatagroups.externaldatagroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_externaldatagroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_externaldatagroup_list := vl_externaldatagroup_list[0].externalvalue.externaldatagroups.externaldatagroup_list;
}
var Distributionchart vl_xul;
var integer vl_externaldatagroup_list_size := sizeof(vl_externaldatagroup_list);
for(var integer i := 0; i < vl_externaldatagroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processValueListiterator(vl_externaldatagroup_list[i], vl_xul, vl_metaIteratorIdx, false, vl_widgetExists);
}
}
case(valuelistiterator) {
vl_widget_xml := "<externaldatagroup_list xmlns=\"http://ttcn.ericsson.se/protocolModules/xtdp/xtdl\">" & vl_widget_xml & "</externaldatagroup_list>";
vl_widgetOctString := char2oct(vl_widget_xml);
var Externaldatagroups.externaldatagroup_list vl_externaldatagroup_list;
dec_Externaldatagroups(vl_widgetOctString, vl_externaldatagroup_list);
//rewrite to nodepointer with the actual value, and remove the metaiterator/externalvalue, it is already on the database
if(ischosen(vl_externaldatagroup_list[0].iterator)) {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_externaldatagroup_list[0].iterator.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_externaldatagroup_list := vl_externaldatagroup_list[0].iterator.externaldatagroups.externaldatagroup_list;
} else {
f_EPTF_UIHandler_parseIteratorMetadata(vl_nodePointer,vl_iteratorVarIdx,f_unichar2charstr(vl_externaldatagroup_list[0].externalvalue.metadata));
v_UIHandler_guiItemList[vl_metaIteratorIdx].widgetData.metaIteratorData.nodePointer := vl_nodePointer;
vl_externaldatagroup_list := vl_externaldatagroup_list[0].externalvalue.externaldatagroups.externaldatagroup_list;
}
var Distributionchart vl_xul;
var integer vl_externaldatagroup_list_size := sizeof(vl_externaldatagroup_list);
for(var integer i := 0; i < vl_externaldatagroup_list_size; i := i + 1) {
f_EPTF_UIHandler_Config_processValueListiterator(vl_externaldatagroup_list[i], vl_xul, vl_metaIteratorIdx, false, vl_widgetExists);
}
}
}
// notify the GUI about the update:
var charstring vl_iteratorParentId := "";
if(v_UIHandler_guiItemList[vl_metaIteratorIdx].parentIdx != -1) {
var integer vl_iteratorNotMetaParentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(v_UIHandler_guiItemList[vl_metaIteratorIdx].parentIdx);
vl_iteratorParentId := v_UIHandler_guiItemList[vl_iteratorNotMetaParentIdx].id;
}
if(tsp_EPTF_UIHandler_enableBrowserGUI == true){
f_EPTF_UIHandler_Browser_reportGUIChanged(vl_iteratorParentId);
}
//rebuild the runtimeGUI:
if(v_UIHandler_guiConnected){
var Widgets vl_widgets_to_send;
f_EPTF_UIHandler_buildXUL(vl_widgets_to_send, true);
f_EPTF_UIHandler_clearGUI(false);
//var integer vl_notMetaParentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(vl_metaIteratorIdx);
// Ez itt ujra beolvastatja a widget kezelovel a teljes lapot - private helyette
f_EPTF_UIHandler_XSD_addElementToGui_private(vl_widgets_to_send, "", vl_widgetExists,false);
}
// wait to finish all getData handlers:
f_EPTF_UIHandler_waitForProcessExternalData_handlers()
f_EPTF_UIHandler_Config_connectAllVarsToWidget();
} else {
// if not remove the postproc:
f_EPTF_Var_removePostProcFn(pl_idx, {refers(f_EPTF_UIHandler_updateIterator_PostProc), {vl_metaIteratorIdx}});
return; // no metaiterator found
}
}
friend function f_EPTF_UIHandler_getNonEmptyParentId(in integer pl_parentIdx, out charstring pl_widgetid) runs on EPTF_UIHandler_Private_CT
return integer{
pl_widgetid := "";
var integer vl_parentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(pl_parentIdx);
if(vl_parentIdx != -1){
pl_widgetid := v_UIHandler_guiItemList[vl_parentIdx].id;
while(pl_widgetid == "" and vl_parentIdx != -1){
vl_parentIdx := f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(v_UIHandler_guiItemList[vl_parentIdx].parentIdx);
if(vl_parentIdx != -1){
pl_widgetid := v_UIHandler_guiItemList[vl_parentIdx].id;
}
}
}
return vl_parentIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendTreeRow
//
// Purpose:
// appending the treerow widget to the widget database
//
// Parameters:
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendTreeRow(
in integer pl_parentIdx,
inout boolean pl_widgetExists)
runs on EPTF_UIHandler_Private_CT
return integer{
pl_widgetExists := false;
var charstring vl_id := f_EPTF_UIHandler_unichar2charstring(f_EPTF_UIHandler_getrandomid(true));
var integer vl_treerowIdx := f_EPTF_UIHandler_addWidgetRec({
"",
wtTreerow,
omit,
pl_parentIdx,
{ },
omit,
{treerow := { treecellgroups := {treecellgroup_list := {}}}}, false}, pl_widgetExists);
return vl_treerowIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_appendMetaIterator
//
// Purpose:
// appending the iterator widget to the widget database
//
// Parameters:
// pl_parentIdx - *in* *integer* the idx of the parent widget in the gui items' list
// pl_widgetExists - *inout* *boolean* returns true if the widget already exists
// pl_iteratorVarIdx - *in* *integer* - the index of the iterator variable the new metaIterator belongs to
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_appendMetaIterator(
in integer pl_parentIdx,
inout boolean pl_widgetExists,
in EPTF_UIHandler_IteratorUnionType pl_iteratorUnionType,
in integer pl_iteratorVarIdx,
in integer pl_nodePointer,
in boolean pl_isExternalValue)
runs on EPTF_UIHandler_Private_CT
return integer{
if (pl_iteratorVarIdx<0) {
pl_iteratorVarIdx := f_EPTF_Var_getId("NonexistentIterator");
if (pl_iteratorVarIdx == -1) {
f_EPTF_Var_newCharstringlist("NonexistentIterator", {}, pl_iteratorVarIdx);
}
}
pl_widgetExists := false;
var charstring vl_id := "metaiterator_" & f_EPTF_UIHandler_unichar2charstring(f_EPTF_UIHandler_getrandomid());
var EPTF_Var_DirectContent vl_currentContent;
f_EPTF_Var_getContent(pl_iteratorVarIdx, vl_currentContent);
// if its externalvalue or iterator vith single variable
if( pl_isExternalValue == true or not ischosen(vl_currentContent.charstringlistVal)) {
var charstring vl_varName := f_EPTF_Var_getName(pl_iteratorVarIdx);
pl_iteratorVarIdx := f_EPTF_Var_getId(vl_varName&cg_ExternalVariableSign);
if(pl_iteratorVarIdx == -1){
f_EPTF_Var_newCharstringlist(vl_varName&cg_ExternalVariableSign, {vl_varName}, pl_iteratorVarIdx);
}
}
var EPTF_CharstringList vl_currentValue := f_EPTF_Var_getCharstringlistValue(pl_iteratorVarIdx);
//var charstring vl_id := "metaiterator_" & int2str(v_UIHandler_GUI_DescriptionDB_Idx) & "_" & int2str(vl_iteratorumber);
var integer vl_metaIteratorIdx := f_EPTF_UIHandler_addWidgetRec({
vl_id,
wtMetaIterator,
omit,
pl_parentIdx,
{ },
{metaIteratorData := {v_UIHandler_GUI_DescriptionDB_Idx, pl_iteratorUnionType, pl_iteratorVarIdx, vl_currentValue, pl_nodePointer}},
{metaiterator := { id := vl_id }}, false}, pl_widgetExists);
f_EPTF_Var_addPostProcFn(pl_iteratorVarIdx, {refers(f_EPTF_UIHandler_updateIterator_PostProc), {vl_metaIteratorIdx}});
return vl_metaIteratorIdx;
}
friend function f_EPTF_UIHAndler_getNotMetaiteratorParentIdx(in integer pl_widgetIdx)
runs on EPTF_UIHandler_Private_CT
return integer{
var integer vl_widgetIdx := pl_widgetIdx;
while(vl_widgetIdx != -1 and v_UIHandler_guiItemList[vl_widgetIdx].widgetType == wtMetaIterator) {
vl_widgetIdx := v_UIHandler_guiItemList[vl_widgetIdx].parentIdx;
}
return vl_widgetIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_getNonMetaChildren
//
// Purpose:
// Returns the list of all children. If one child is a metaiterator
// it returns its non-meta children
//
// Parameters:
// pl_itemIdx - *in* *integer* - the idx of the GUI item
//
// Return Value:
// EPTF_IntegerList - list of non-meta children indexes
//
///////////////////////////////////////////////////////////
private function f_EPTF_UIHandler_getNonMetaChildren(
in integer pl_itemIdx
) runs on EPTF_UIHandler_Private_CT return EPTF_IntegerList {
var EPTF_IntegerList vl_nonMetaChildren := {};
var EPTF_IntegerList vl_children := v_UIHandler_guiItemList[pl_itemIdx].children;
for(var integer i:=0; i<sizeof(vl_children); i:=i+1) {
if (v_UIHandler_guiItemList[vl_children[i]].widgetType == wtMetaIterator) {
vl_nonMetaChildren := vl_nonMetaChildren & f_EPTF_UIHandler_getNonMetaChildren(vl_children[i]);
} else {
vl_nonMetaChildren[sizeof(vl_nonMetaChildren)] := vl_children[i];
}
}
return vl_nonMetaChildren;
}
private function f_EPTF_UIHandler_parseIteratorMetadata(out integer pl_nodepointer, out integer pl_iteratorVarIdx, in charstring pl_metadata, in charstring pl_separator := "_") {
var integer vl_separatorPos := f_strstr(pl_metadata,pl_separator);
if (vl_separatorPos<0) {
return; //error: no separator found
}
pl_nodepointer := str2int(substr(pl_metadata,0,vl_separatorPos));
pl_iteratorVarIdx := str2int(substr(pl_metadata,vl_separatorPos+1,lengthof(pl_metadata)-vl_separatorPos-1));
}
public external function f_EPTF_UIHandler_GUIFunctions_Tests() return charstring
} // end of module