text
stringlengths 322
5.82k
|
|---|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Developing Protocol Adaptor<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Nexacro basically uses HTTP to handle requests and responses. The platform does not convert data itself during the process. Depending on environments, however, you may need to encrypt data while receiving and converting certain types of data.
Protocol adapters allow you to encrypt data or change data structure with simple settings. In that way, they help you to achieve your intentions.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Protocol Adaptor Module & Using It in the App<|eot_id|><|start_header_id|>assistant<|end_header_id|>
To use a protocol adapter, you need to write a module, register it in Nexacro Studio and add it as a protocol and service.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Protocol Adaptor Module & Using It in the App Creating Protocol Adaptor Module<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Create a new project in the Nexacro Module Developer. Select [File > New > Project] from the menu.
Step 2. When Project Wizard is opened, select the 'Protocol Adaptor' from the Module item.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Creating Protocol Adaptor Module/1.jpg</ImgTag>
Step 3. Enter the project ID and then click the [Next] button.
Step 4. Enter the Object ID and then change the FinalClass item to true.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Creating Protocol Adaptor Module/2.jpg</ImgTag>
Step 5. The project is created and the basicPtAdp.js file is displayed in the edit window.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Creating Protocol Adaptor Module/3.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Protocol Adaptor Module & Using It in the App Editing Protocol Adaptor Module<|eot_id|><|start_header_id|>assistant<|end_header_id|>
When you create a new protocol adaptor module, 4 functions are created by default.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Editing Protocol Adaptor Module/1.png</ImgTag>
initialize
<CodeTag>
nexacro.basicPtAdp.prototype.initialize = function() { trace('basicPtAdp initialize');};
</CodeTag>
In the case of the external plug-in module being used, initialize it using PluginElement as shown below.
<CodeTag>
nexacro.basicPtAdp.prototype.initialize = function() { this._plugin = new nexacro.PluginElement(); this._plugin.setElementClassId('Microsoft.XMLDOM'); //this._plugin.setElementClassId('{7E9FDB80-5316-11D4-B02C-00C04F0CD404}'); this._plugin.create(); };
</CodeTag>
finalize
<CodeTag>
nexacro.basicPtAdp.prototype.finalize = function() { trace('basicPtAdp finalize');};
</CodeTag>
The external module created through the initialize function is deleted.
<CodeTag>
nexacro.basicPtAdp.prototype.finalize = function(){ this._plugin.destroy(); delete this._plugin; }
</CodeTag>
encrypt
The data to be transmitted is converted and processed by being put into the return string variable.
<CodeTag>
nexacro.basicPtAdp.prototype.encrypt = function(strUrl, strData) { trace('encrypt url=' + strUrl + ';data=' + strData); return strData;};
</CodeTag>
decrypt
The data received in response is converted and passed to the calling app.
<CodeTag>
nexacro.basicPtAdp.prototype.decrypt = function(strUrl, strData) { trace('decrypt url=' + strUrl + ';data=' + strData); return strData;}
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Protocol Adaptor Module & Using It in the App Deploying the Protocol Adaptor Module<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Select the Nexacro Module Developer menu [Deploy > Module Package] and then run the Deploy Wizard.
Step 2. Change the Type item to 'protocoladaptor' in the Module Information.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Deploying the Protocol Adaptor Module/1.jpg</ImgTag>
Step 3. Click the [Deploy] button to deploy the module.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Protocol Adaptor Module & Using It in the App Installing the Module & Registering the Protocol Service<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Select the Nexacro Studio menu [File > Install Module] and then run the Install Module Wizard.
Step 2. Select and install the module installation file created in the Nexacro Module Developer.
Note:
Since the registration property value among the module meta-info properties is set to the default value ('deny'), the list of modules to be installed is not displayed.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Installing the Module & Registering the Protocol Service/1.jpg</ImgTag>
Step 3. Select the TypeDefinition item in the Project Explorer and then select [Add > Protocol] from the context menu.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Installing the Module & Registering the Protocol Service/2.jpg</ImgTag>
Step 4. Set the Protocol ID and the Prefix ID in the New Protocol Wizard.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Installing the Module & Registering the Protocol Service/3.jpg</ImgTag>
Step 5. Click the [Next] button to check the Web Browser item and then enter the ClassName.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Creating Protocol Adaptor Module & Using It in the App|Installing the Module & Registering the Protocol Service/4.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Protocol Adaptor Module & Using It in the App Calling Service through the Protocol Adaptor<|eot_id|><|start_header_id|>assistant<|end_header_id|>
When executing the transaction method, if the protocol adaptor URL format is applied to the strURL parameter as shown below, then the communication request is not directly passed to the server, but rather passes through the protocol adaptor.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.transaction('srv00', 'basicPtAdp://127.0.0.1:4098/test.xml', '','dsOut=Dataset00','value=a','fnCallback');};this.fnCallback = function(id, code, message){ trace('Error['+code+']:'+message);}
</CodeTag>
When you click the button, you can see that the protocol adaptor operation is processed in the following order.
initialize
There is no initialization in the example, and only the trace method is executed.
encrypt
Check that the value passed to the strArgument parameter is processed.
decrypt
Check the response data for the request.
CallbackFunc
Check that the callback function is operating after normal processing.
basicPtAdp initialize
encrypt url=basicPtAdp://127.0.0.1:8080/test.xml;data=<?xml version='1.0' encoding='UTF-8'?>
<Root xmlns='http://www.nexacroplatform.com/platform/dataset'>
<Parameters>
<Parameter id='value'>b</Parameter>
</Parameters>
</Root>
decrypt url=basicPtAdp://127.0.0.1:8080/test.xml;data=<?xml version='1.0' encoding='utf-8'?>
<Root xmlns='http://www.nexacroplatform.com/platform/dataset' ver='5000' >
<Parameters>
<Parameter id='ErrorCode' type='int'>0</Parameter>
<Parameter id='ErrorMsg' type='string'>SUCC</Parameter>
</Parameters>
<Dataset id='customers'>
<ColumnInfo>
<Column id='id' type='STRING' size='4'/>
...
Error[0]:SAUCC<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Additional Configurable Interface Functions<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The protocol adaptor provides additional configurable interface functions.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Additional Configurable Interface Functions Redefinable Interface Functions<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The functions provided by the inherited nexacro.ProtocolAdp can be redefined. They can be added and used in the properties window.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Additional Configurable Interface Functions|Redefinable Interface Functions/1.jpg</ImgTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Additional Configurable Interface Functions|Redefinable Interface Functions/1.png</ImgTag>
The getCommunicationHeaders function can be set as follows.
<CodeTag>
nexacro.basicPtAdp.prototype.getCommunicationHeaders = function (strUrl){ var ret = nexacro.ProtocolAdp.prototype.getCommunicationHeaders.call(this, strUrl); ret.push({id:'PHPSESSID', value:'298zf09hf012fh2'}); ret.push({id:'csrftoken', value:'u32t4o3tb3gg43'}); return ret;};
</CodeTag>
You can see that additional cookie information has been set when communicating.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Additional Configurable Interface Functions|Redefinable Interface Functions/2.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Additional Configurable Interface Functions Functions Added as Methods<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Select the object in the Project Explorer and then set it by adding the method from the context menu.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Additional Configurable Interface Functions|Functions Added as Methods/1.jpg</ImgTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Additional Configurable Interface Functions|Functions Added as Methods/1.png</ImgTag>
The getHTTPHeader, version function can be set as follows.
<CodeTag>
nexacro.basicPtAdp.prototype.initialize = function() { this._httpheaders = []; this._httpheaders.push({ id: 'Accept', value: 'application/json, text/json, */*'});}; nexacro.basicPtAdp.prototype.version = function (){ return '1.1';}; nexacro.basicPtAdp.prototype.getHTTPHeader = function (){ return this._httpheaders;};
</CodeTag>
You can see that the header Accept information has been changed when communicating.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing Protocol Adaptor|Additional Configurable Interface Functions|Functions Added as Methods/2.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
X-PUSH App<|eot_id|><|start_header_id|>assistant<|end_header_id|>
X-PUSH is a product that employs server push, a style of Internet-based communication where information or messages are delivered on a real-time basis. Nexacro provides an XPush object, which processes messages sent from an X-PUSH server. The object allows you to request and process messages easily just with simple settings. This chapter shows you how to register an XPush object and develop an application designed to process messages, all using Nexacro Studio.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Register XPush Object<|eot_id|><|start_header_id|>assistant<|end_header_id|>
As the XPush is not a default object, you should register the object through Project Explorer of Nexacro Studio to make it available.
Step 1. Choose the menu [File > New > Project] to create a new project.
Step 2. Choose [TypeDefinition > Objects] in the Project Explorer to open a window that allows you to add a module.
Step 3. Click the + button in Modules on the left side of the window. After the File Explorer is opened, select the Push.json file.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Register XPush Object/1.jpg</ImgTag>
Step 4. After finding that Push.json has been added to the module list, click the + button on the right side of nexacro.XPush to add XPush to the object list.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Register XPush Object/2.jpg</ImgTag>
Step 5. After finding that XPush has been added to the object list. click the OK button to close the window. The project will be reloaded automatically to apply the changes made by the addition of the XPush object.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Display Real-time Messages in Grid<|eot_id|><|start_header_id|>assistant<|end_header_id|>
In this section, you will learn about how to add an XPush object, receive messages from an X-PUSH server on a real-time basis and display obtained messages through a Grid.
Note:
To receive real-time messages, the X-PUSH server must be in operation with the message provider service also running. An X-PUSH server sends messages while the run_provider_demo_Push.bat file is being executed, and the transmission continues until the end of the execution of the file.
Step 1. Choose the menu [File > New > Project] to create a Form.
Step 2. Add a Grid and Dataset to the Form.
Step 3. Set the columns of the Dataset as presented below through the Dataset Editor and bind the Dataset to the Grid.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Display Real-time Messages in Grid/1.jpg</ImgTag>
Note:
The columns of the Dataset must match the IDs defined by the message layout XML file that is set by the layouturl property.
<CodeTag>
...<message type='OPDT'> <field id='id' type='string' size='9'/> <field id='content' type='string' size='255'/></message>...
</CodeTag>
Step 4. Add an XPush object by dragging and dropping it from the component toolbar onto the Form design pane. Like a Dataset, the object will appear in the Invisible Object pane.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Display Real-time Messages in Grid/2.jpg</ImgTag>
Step 5. After selecting the added XPush object, set the layouturl and iplist properties in the Properties pane. To set layouturl, you can designate a message layout XML file by specifying the file's URL or designating its location in the local computer. To set iplist, specify the IP address and port number of the X-PUSH server.
Caution:
You can select either the TCP connection (Nexacro Browser) or the HTTP connection (web browser) as a value of the iplist property.
When you select the TCP connection, you must specify 10081 as a port number.
When you select the HTTP connection, you must specify 10080 as a port number.
If you want to provide both servicesβNRE and WREβsimultaneously, you must specify the two port numbers together as a value of iplist.
iplist='http://localhost:10080, localhost:10081'
Step 6. Add the onload event of the Form with the below handler, which is designed to connect to the X-PUSH server.
<CodeTag>
this.Form_Work_onload = function(obj:nexacro.Form,e:nexacro.LoadEventInfo){ this.XPush00.connect('user00', 'password');};
</CodeTag>
Step 7. Add the onsuccess event of the XPush object with the below handler, which prompts the following actions if the connection is successfully made: the subscribe method will be called to receive messages on a real-time basis. Then, the data of the received messages will be added to the Dataset. Eventually, the messages will be displayed through the Grid.
<CodeTag>
this.XPush00_onsuccess = function(obj:nexacro.XPush,e:nexacro.XPushEventInfo){ if(e.action == nexacro.XPushAction.AUTH) // 0 { this.XPush00.subscribe('OPDT', 'ALL', this, this.Dataset00, 'append', 'fn_PushCallback'); }};this.fn_PushCallback = function(Row,ChangeColumn,AllColumn,Type,ActionType){ trace(Row,ChangeColumn,AllColumn,Type,ActionType);}
</CodeTag>
Step 8. Add the onerror event of the XPush object with the below handler, which is designed to check the reason for the connect failure.
<CodeTag>
this.XPush00_onerror = function(obj:nexacro.XPush,e:nexacro.XPushErrorEventInfo){ trace(e.errormsg, e.statuscode);};
</CodeTag>
Step 9. Upon launching the app, messages will be received after the X-PUSH server is connected within the onload event. You can see that the Grid will display messages in real time.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Display Real-time Messages in Grid/3.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Reliable Messaging<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Note:
The process of creating a Form and initializing an XPush object is the same in this section and in Display Real-time Messages in Grid. Therefore, this section begins its explanation with adding the onload event handler.
Note:
For reliable messaging, the X-PUSH server must be in operation with the message provider service also running. An X-PUSH server sends one message while the run_provider_demo_Reli.bat file is being executed.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Reliable Messaging Register Topic for Reliable Messaging<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Reliable messaging is the concept of making certain guarantees about the successful transmission of the messages. Real-time messaging does not check whether users have received the messages after the transmission. This is like radio broadcasting, where messages keep being sent unilaterally and listeners just keep receiving them. However, reliable messaging is similar to an audio message aimed at a certain recipient. Even if users miss messages at the point of transmission, reliable messaging guarantees that they will check the messages later.
For reliable messaging, there should be a predetermined arrangement about who receives what type of messages. You can register such information in a database by calling the registerTopic method.
Step 1. Add the onload event of the Form with the below handler, which is designed to the X-PUSH server.
<CodeTag>
this.Form_Work_onload = function(obj:nexacro.Form,e:nexacro.LoadEventInfo){ this.XPush00.connect('user00', 'password');}
</CodeTag>
Step 2. Add the onsuccess event of the XPush object with the below handler, which prompts the following actions if the connection is successfully made: the subscribe method will be called to receive messages on a real-time basis. Then, the data of the received messages will be added to the Dataset. Eventually, the messages will be displayed through the Grid.
<CodeTag>
this.XPush00_onsuccess = function(obj:nexacro.XPush,e:nexacro.XPushEventInfo){ if(e.action == nexacro.XPushAction.AUTH) // 0 { this.XPush00.subscribe('NOTI', 'ALL', this, this.Dataset00, 'append', 'fn_PushCallback'); }};
</CodeTag>
Step 3. Add a Button component to the Form. Then, add the onclick event with the below handler, which is designed to add a topic under the user ID specified when the connect method was called. You should register a topic only once.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.XPush00.registerTopic('NOTI', 'ALL');};
</CodeTag>
Step 4. Add the onerror event of the XPush object with the below handler, which is designed to check the reason for a failure to register a topic: e.g. there has been a registered topic already.
<CodeTag>
this.XPush00_onerror = function(obj:nexacro.XPush,e:nexacro.XPushErrorEventInfo){ trace(e.errormsg, e.statuscode);};
</CodeTag>
Step 5. Once a topic is registered, reliable messaging begins. You can check the registered topic in the T_TOPIC table of the database.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Reliable Messaging|Register Topic for Reliable Messaging/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Reliable Messaging Receive Messages<|eot_id|><|start_header_id|>assistant<|end_header_id|>
If messages are sent while the app is not in operation, those messages will be saved to the T_USER_MESSAGE table of the database. if the value of the MESSAGE_STATE column is 0, it means that the messages have not been reached the user.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Reliable Messaging|Receive Messages/1.jpg</ImgTag>
Step 1. Add a Button component to the Form. Then, add the onclick event with the below handler, which is designed to check whether there are unreceived messages under the user ID specified when the connect method was called. If found, the server will send those messages, causing the value of the MESSAGE_STATE column to change to 1.
<CodeTag>
this.Button01_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.XPush00.requestMessage('NOTI', 'ALL');};
</CodeTag>
Step 2. As the requestMessage method does not define a separate callback, it uses the callback defined by the subscribe method instead. Once you receive messages through the requestMessage method, you can send the response to the reception by calling the sendResponse method. After the server receives the response, the value of the MESSAGE_STATE column will turn to 2.
<CodeTag>
this.fn_PushCallback = function(Row,ChangeColumn,AllColumn,Type,ActionType,MessageId){ trace(Row,ChangeColumn,AllColumn,Type,ActionType,MessageId); if(ActionType=='RELI') this.XPush00.sendResponse(MessageId);}
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Reliable Messaging Unregister Topic<|eot_id|><|start_header_id|>assistant<|end_header_id|>
If you do not need to receive messages anymore, you can call the unregisterTopic method to cancel the registered topic.
Step 1. Add a Button component to the Form. Then, add the onclick event with the below handler, which is designed to unregister a topic under the user ID specified when the connect method was called.
<CodeTag>
this.Button02_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.XPush00.unregisterTopic('NOTI', 'ALL');};
</CodeTag>
Step 2. Once you unregister the topic, the reliable messaging will also stop. You will see that the value of the ACTIVE column has been changed to 'N' in the T_TOPIC table of the database, the table containing the information on registered topics.
<ImgTag>Advanced Development Guide 21.0.0.300|X-PUSH App|Reliable Messaging|Unregister Topic/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Developing the Widget App<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Widgets are small UI tools that are always displayed on the screen for monitoring real-time information, such as clock or CPU status. In the Nexacro, widget UI can be implemented by opening a new window with a transparent layer.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating a Simple Calendar Widget<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Create a new project. Select the Full type from Frameset Template.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Creating a Simple Calendar Widget/1.jpg</ImgTag>
Step 2. Add the Button component to the Form_Work form and create the onclick event function as shown below.
The layered property is a property that sets the background window to be transparent when creating ChildFrame. By setting this property value to true, you can display a background image of the desired shape on the screen.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ nexacro.open('NewWidget', 'FrameBase::WidgetMain1.xfdl', this.getOwnerFrame(), '', 'showontaskbar=false showtitlebar=false showstatusbar=false topmost=true layered=true', 0, 0);};
</CodeTag>
The WidgetMain1.xfdl form is a form that will be displayed in the widget form. As only necessary UI is exposed in the widget form, the taskbar, title bar, and status bar are processed to be invisible in the OpenStyle parameter setting. Then, set the topmost property value to true to ensure that it is not covered by other programs.
Step 3. Create a new Form object with the name of WidgetMain1.
Step 4. Select the ResourceExplorer tab and select [Import] from the context menu.
Import a transparent image file to be used as the background image. For example, if it is a circular shape, only the circle is displayed with the background area being displayed transparently. In the example, the image below was used.
https://pixabay.com/en/book-character-glasses-show-1773756/
Step 5. Select the transparent image file as the imageurl property value in the background property of the Form object and then set the background-color property value to transparent.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Creating a Simple Calendar Widget/2.jpg</ImgTag>
Step 6. Resize the Form object to fit the transparent image file and then place the Calendar component in the desired position.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Creating a Simple Calendar Widget/3.jpg</ImgTag>
Step 7. Select NRE as the execution option from the toolbar and click the Launch icon or enter the shortcut key (Ctrl + F5) to run the app.
Caution:
When running Launch, the widget function cannot be used in web browsers other than NRE.
Step 8. When you click the button in the app, the widget UI created with WidgetMain1 is displayed on the screen.
Step 9. You can drag the non-transparent background image area with the mouse to move it to the desired position.
Caution:
If you click the transparent background image area, then you cannot change the position of the widget by dragging it with the mouse as the focus moves to the window shown at the back.
If you click the individual component, then you cannot change the position of the widget by dragging it with the mouse as the individual component needs to operate.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Creating a Simple Calendar Widget/4.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating a Widget that Runs Immediately<|eot_id|><|start_header_id|>assistant<|end_header_id|>
In the previous example, the widget UI appeared when the main form was executed and the button was clicked. In this example, we will create a widget that runs immediately (or appears to do so) without user input.
Step 1. Create the oninit event function in the Form_Work form that was used in the previous example as shown below.
<CodeTag>
this.Form_Work_oninit = function(obj:nexacro.Form,e:nexacro.EventInfo){ nexacro.getApplication().mainframe.set_visible(false); nexacro.open('NewWidget', 'FrameBase::WidgetMain1.xfdl', this.getOwnerFrame(), '', 'showontaskbar=false showtitlebar=false showstatusbar=false topmost=true layered=true', 0, 0);};
</CodeTag>
Step 2. Add the Button component for closing the widget to the widget form (WidgetMain1).
In the previous example, when the main form is closed, the widget is closed with it but as the title bar is not displayed on the widget, a separate close button needs to be created.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Creating a Widget that Runs Immediately/1.jpg</ImgTag>
Step 3. Add the Button component and then create the onclick event function as shown below.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.close();};
</CodeTag>
Step 4. Select NRE as the execution option from the toolbar and then click the Launch icon or enter the shortcut key (Ctrl + F5) to run the app.
As the app runs, the open method is executed while making the mainframe invisible, resulting in only the widget UI being displayed on the screen. Click the [CLOSE] button to close the widget UI.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Creating a Widget that Runs Immediately/2.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Controlling the Widget in the Tray<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Having the widget displayed on the screen may interfere with any other tasks you are performing. In that case, you can hide the widget for a while and then make it visible again. You can register the tray in the app and control widgets from the tray.
Step 1. Select the App in the Project Explorer and select the [Add > Tray] item from the context menu.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/1.jpg</ImgTag>
Step 2. Select the tray icon and then set the icon, tooltip property values in the property window.
icon: 'application'
tooltip: Nexacro Widget Tray
Note:
For the icon property value, you can use the system icon provided by default or set the URL value. In the example,
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/2.jpg</ImgTag>
Step 3. Add the onrbuttonup event function as shown below.
'PopupMenu00' is the PopupMenu component id value to be created in the next step. It makes the menu appear when right-clicking on the tray.
<CodeTag>
this.Tray0_onrbuttonup = function(obj:nexacro.Tray,e:nexacro.MouseEventInfo){ var pdivWigetMenu = obj.items[obj.findItem('PopupMenu00')]; pdivWigetMenu.trackPopup()};
</CodeTag>
Step 4. Click the add button in the PopupMenu window underneath the tray icon.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/3.jpg</ImgTag>
Step 5. Select the PopupMenu00 item to set innerdataset in the property window to the right.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/4.jpg</ImgTag>
Specify the captioncolumn, idcolumn items as 'Widget', 'Exit' and the levelcolumn item as 0.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/5.jpg</ImgTag>
Step 6. By selecting the Event icon from the properties window, you can add event functions. Add the onmenuclick event function as below.
This code specifies the operation when the menu item is selected by right-clicking with the mouse cursor on the tray. When the 'Widget' item is selected, the widget is displayed if the widget is closed (invisible), and only the log is recorded if it is already displayed. When the 'Exit' item is selected, the app will be closed.
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/6.jpg</ImgTag>
<CodeTag>
this.Tray0_PopupMenu00_onmenuclick = function(obj:nexacro.TrayPopupMenu,e:nexacro.MenuClickEventInfo){ if(e.id == 'Widget') { var widgetFrame = nexacro.getPopupFrames()['NewWidget']; if(widgetFrame.visible) { trace(widgetFrame); } else { widgetFrame.set_visible(true); } } else if(e.id == 'Exit') { nexacro.getApplication().exit(); }};
</CodeTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/7.jpg</ImgTag>
Step 7. Modify the event script that occurs when the button is clicked on the widget form (WidgetMain1).
When selecting the menu in the tray, do not create a new widget screen every time, but rather only modify the visible property value to change whether to display or not. Then, add the code to display a message in the tray area when the widget is closed.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ //this.close(); this.parent.set_visible(false); nexacro.getApplication().trays['Tray0'].showBalloonTip('information', 'Info', 'Widget Close');};
</CodeTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Developing the Widget App|Controlling the Widget in the Tray/8.jpg</ImgTag>
Step 8. Select NRE as the execution option from the toolbar and then click the Launch icon or enter the shortcut key (Ctrl + F5) to check if the tray is displayed normally in the lower right corner of the window screen, and check that the menu is displayed when right-clicked.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Unit Test in the Windows OS NRE<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The WinAppDriver linkage function uses the UIAutomation interface provided by the Nexacro to read or write properties of apps running in NRE and to support methodological execution by specifying parameters. You can write unit tests and test using UI automation testing tools, such as Selenium.
In this chapter, we will look at the steps to install the WinAppDriver, create basic C# and Java projects in Visual Studio and Eclipse, and connect them to the Nexacro apps.
Caution:
WinAppDriver operates in Windows 10 or later environments.
https://github.com/Microsoft/WinAppDriver#system-requirements<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Configuring the WinAppDriver Linkage Installing the WinAppDriver<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Enable 'Developer Mode' in the Windows operating system [Settings > Use Developer Features].
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the WinAppDriver/1.jpg</ImgTag>
Caution:
If you are enabling developer mode for the first time, the operating system configuration may take some time. Please allow some time to enable the mode.
Step 2. Download the WinAppDriver installation file (WindowsApplicationDriver.msi).
Note:
https://github.com/Microsoft/WinAppDriver
https://github.com/Microsoft/WinAppDriver/releases
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the WinAppDriver/2.jpg</ImgTag>
Step 3. Run the downloaded installation file (WindowsApplicationDriver.msi) to install the WinAppDriver.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the WinAppDriver/3.jpg</ImgTag>
Step 4. Run the WinAppDriver with administrator privileges from the installation path.
Note:
The general installation path is as follows.
C:\Program Files (x86)\Windows Application Driver\
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the WinAppDriver/4.jpg</ImgTag>
Step 5. Check if it runs normally.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the WinAppDriver/5.jpg</ImgTag>
Note:
If you want to change the ip, port settings, then execute the following.
> WinAppDriver.exe [ip] [port]<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Configuring the WinAppDriver Linkage Installing the Development Tools<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Unit test projects can be created using the C# or Java languages.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Installing the Development Tools Installing Visual Studio<|eot_id|><|start_header_id|>assistant<|end_header_id|>
In the case of using the C# language and Visual Studio not being installed, you can install the development tool provided for free.
Step 1. Download the Visual Studio community installation file (vs_community__xxxx.xxxx.exe).
Note:
Visual Studio Community
https://visualstudio.microsoft.com/vs/community/
Step 2. Run the downloaded installation file (vs_community__xxxx.xxxx.exe) to install Visual Studio.
Caution:
It may take some time to download the required package during installation. Please allow some time before proceeding with the installation.
Step 3. Select the 'Universal Windows Platform development' from the Workloads item and then proceed with the installation.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the Development Tools/1.jpg</ImgTag>
Note:
The development environment can also be added following installation.
Tip:
A window to log in to your Microsoft account is displayed, but you can still test without logging in.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Installing the Development Tools Installing Eclipse<|eot_id|><|start_header_id|>assistant<|end_header_id|>
In the case of using the Java language and Eclipse not being installed, you can install the development tool provided for free.
Step 1. Download the Eclipse installation file (eclipse-inst-win64.exe).
Note:
eclipse.org
https://www.eclipse.org/downloads/
Step 2. Run the downloaded installation file (eclipse-inst-win64.exe) to install Eclipse.
Step 3. Select the 'Java Developers' item from the development type selection step.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Configuring the WinAppDriver Linkage|Installing the Development Tools/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating & Running a Unit Test Creating & Deploying the Nexacro App<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Create and deploy a simple Nexacro app.
Tip:
You can skip this step if you are going to use the Nexacro app that has already been installed.
Step 1. Run Nexacro Studio.
Step 2. Create a project and a simple form screen.
Place only the Button component and the Edit component on the screen.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating & Deploying the Nexacro App/1.jpg</ImgTag>
Step 3. Write the onclick event function of the Button component.
When the Button component onclick event occurs, change the value property value in the Edit component.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.Edit00.set_value('BUTTON CLICK');};
</CodeTag>
Step 4. Select the menu [Deploy > Packing (Archive&Update)] item and then create an archive file to be deployed.
Set the Update Type to 'Local' so that it can run without a server connection.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating & Deploying the Nexacro App/2.jpg</ImgTag>
Step 5. Click the [Packing] button to create the archive file and then click the [Build App] button.
Step 6. Click the [Build] button in the Build App window to create the installation file.
Step 7. Run the created installation file to install the Nexacro app.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating a Unit Test Project Creating a Unit Test Project in Visual Studio<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Run Visual Studio.
Step 2. Select the 'Unit Test Project' from the New Project to create a new project.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/1.jpg</ImgTag>
Step 3. Install the Appium WebDriver library.
Select the menu [Project > Manage NuGet Package] and then enter 'Appium' in the search window to check the Appium WebDriver library in the search results. Click the [Install] button to install the library.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/2.jpg</ImgTag>
Step 4. Check the Selenium related package in the Updates tab.
Caution:
If the latest version is installed, then the code may not work. If you have the latest version, please conduct the minor upgrade to version 3.0.1.
https://github.com/Microsoft/WinAppDriver/issues/497
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/3.jpg</ImgTag>
Step 5. Modify the created C# source code file as follows.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/4.jpg</ImgTag>
Modify the settings related to the Nexacro app through the code below. Modify the pathway where the app is installed, the path to the nexacro.exe executable file, and the nexacro.exe execution option to match the actual installation path.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/1.png</ImgTag>
<CodeTag>
using System;using System.Threading;using System.Diagnostics;using Microsoft.VisualStudio.TestTools.UnitTesting;using OpenQA.Selenium.Appium.Windows;using OpenQA.Selenium.Remote;namespace UnitTestProject1{ [TestClass] public class NexaTestSession { // winappdriver url protected const string WindowsApplicationDriverUrl = 'http://127.0.0.1:4723/'; // app path private const string NexacroAppDr = 'C:\\Program Files\\TOBESOFT\\Nexacro N\\21\\app0201'; // nexacro.exe path private const string NexacroAppId = 'C:\\Program Files\\TOBESOFT\\Nexacro N\\21\\app0201\\nexacro.exe'; // nexacro.exe argument private const string NexacroAppAg = '-k 'UnitTest' -s 'C:\\Program Files\\TOBESOFT\\Nexacro N\\21\\app0201\\app0201\\start.json''; // search root private const string FindNexacro = 'Root'; // OS/Device private const string TestOs = 'Windows'; private const string TestDevice = 'WindowsPC'; // Session Object : WindowsDriver protected static WindowsDriver<WindowsElement> session; // WinAppDriver Session Create [ClassInitialize] public static void Setup(TestContext context) { // Launch a new instance of nexacro application or find nexacro application } // WinAppDriver Session Delete public static void TearDown() { // Close the application and delete the session if (session != null) { // Close Session β Close Application session.Close(); // Quit Session session.Quit(); // Delete Session session = null; } } [TestMethod] public void Test_Session() { Debug.WriteLine('session:' + session); Debug.WriteLine('session.SessionId:' + session.SessionId); } }}
</CodeTag>
Step 6. Run the Nexacro app and add code to create the session.
Modify the Setup method in the code above as follows.
<CodeTag>
// WinAppDriver Session Create[ClassInitialize]public static void Setup(TestContext context){ // Launch a new instance of nexacro application or find nexacro application if (session == null) { // Create a new session to launch nexacro application DesiredCapabilities appCapabilities = new DesiredCapabilities(); TimeSpan time = new TimeSpan(0, 0, 10); // Launch Nexacro appCapabilities.SetCapability('app', NexacroAppId); appCapabilities.SetCapability('appArguments', NexacroAppAg); appCapabilities.SetCapability('appWorkingDir', NexacroAppDr); appCapabilities.SetCapability('platformName', TestOs); appCapabilities.SetCapability('deviceName', TestDevice); // Request Remote WinAppDriver Service session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities, time); // Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times session.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0.5)); Thread.Sleep(TimeSpan.FromSeconds(1.0)); }}
</CodeTag>
Tip:
A timeout error may occur depending on the TimeSpan setting value. In that case, change the setting value as follows and proceed with the test.
TimeSpan time = new TimeSpan(0, 0, 30);
Step 7. Select the menu [Test > Run > All Tests] item to proceed with the test. You can see that the installed app is running.
You can check the access information and session being created on the console screen where the WinAppDriver was executed.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/5.jpg</ImgTag>
Step 8. You can check the successful test information in the Visual Studio test explorer.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/6.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating a Unit Test Project Creating the Unit Test Project in Eclipse<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Run Eclipse.
Step 2. Select the menu [File > New > Java Project] and create a new project.
Step 3. Download the required library and unzip the compressed file (.zip).
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/1.png</ImgTag>
Note:
Download and install the Apache Commons Lang library when the following error occurs during execution.
It may not be necessary, depending on the development environment.
java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
Step 4. Add the JUnit library. Select the menu [Project > Properties > Java Build Path > Libraries] tab and then click the [Add Library] button.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/1.jpg</ImgTag>
Step 5. Add the Appium, Selenium libraries. Click the [Add External JARs] button and add the JAR file from the downloaded library file.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/2.jpg</ImgTag>
Step 6. Click the [Apply and Close] button to apply the changes.
Step 7. Select the menu [File > New > Class] and then create a new class file. Only enter the Name item and do not modify other options.
Step 8. Modify the created Java source code file as follows.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/3.jpg</ImgTag>
Modify the settings related to the Nexacro app in the code below. Modify the pathway where the app is installed, the pathway to the nexacro.exe executable file, and the nexacro.exe execution option to match the actual installation pathway.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/2.png</ImgTag>
<CodeTag>
import org.junit.*;import org.openqa.selenium.remote.DesiredCapabilities;import org.openqa.selenium.remote.RemoteWebElement;import io.appium.java_client.windows.WindowsDriver;import java.util.concurrent.TimeUnit;import java.net.URL;public class UnitTest { // winappdriver url private String WindowsApplicationDriverUrl = 'http://127.0.0.1:4723/'; // app path private String NexacroAppDr = 'C:\\Program Files (x86)\\TOBESOFT\\Nexacro N\\21\\app0201'; // nexacro.exe path private String NexacroAppId = 'C:\\Program Files (x86)\\TOBESOFT\\Nexacro N\\21\\app0201\\nexacro.exe'; // nexacro.exe argument private String NexacroAppAg = '-k 'UnitTest' -s 'C:\\Program Files (x86)\\TOBESOFT\\Nexacro N\\21\\app0201\\app0201\\start.json''; // search root // private String FindNexacro = 'Root'; // OS/Device private String TestOs = 'Windows'; private String TestDevice = 'WindowsPC'; // Session Object : WindowsDriver private static WindowsDriver<RemoteWebElement> session = null; @Before public void setUp() throws Exception { // Launch a new instance of nexacro application or find nexacro application } @After public void tearDown() throws Exception { if (session != null) { // Nexacro17Session.quit(); } } @Test public void Test_01_Session() { System.out.println('session : ' + session); System.out.println('session.SessionId : ' + session.getSessionId()); }}
</CodeTag>
Step 9. Run the Nexacro app and then add code to create the session.
Modify the Setup method in the code above as follows.
<CodeTag>
@Beforepublic void setUp() throws Exception { // Launch a new instance of nexacro application or find nexacro application try { // Create a new session to launch nexacro application DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.setCapability('app', NexacroAppId); appCapabilities.setCapability('appArguments', NexacroAppAg); appCapabilities.setCapability('appWorkingDir', NexacroAppDr); appCapabilities.setCapability('platformName', TestOs); appCapabilities.setCapability('deviceName', TestDevice); // Request Remote WinAppDriver Service session = new WindowsDriver<RemoteWebElement>(new URL(WindowsApplicationDriverUrl), appCapabilities); session.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } finally { }}
</CodeTag>
Step 10. Select the menu [Run > Run As > JUnit Test] item to proceed with the test. You can see that the installed app is running.
You can check the access information and session being created on the console screen where the WinAppDriver was executed.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/4.jpg</ImgTag>
Step 11. You can check the successful test information in the JUnit panel.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Creating a Unit Test Project/5.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating & Running a Unit Test Running the Unit Test<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Add the code to run the unit test as follows.
Find the Button component in the current session and then process the mouse click command.
<CodeTag>
Code - C#
</CodeTag>
[TestMethod]public void Test_Button(){ WindowsElement element = session.FindElementByAccessibilityId('mainframe.WorkFrame.form.Button00'); Assert.IsNotNull(element); Thread.Sleep(TimeSpan.FromSeconds(0.1)); element.Click();}
<CodeTag>
Code - Java
</CodeTag>
@Testpublic void Test_Button() throws Exception { WebElement element = session.findElementByAccessibilityId('mainframe.WorkFrame.form.Button00'); Assert.assertNotNull(element); Thread.sleep(1000); element.click();}
Step 2. When the test is run, the installed app is executed. You can see that the mouse cursor is placed on the Button component and the click command is executed.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Creating & Running a Unit Test|Running the Unit Test/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Checking the AccessibilityId Property Value<|eot_id|><|start_header_id|>assistant<|end_header_id|>
To access the component or control, the FindElementByAccessibilityId method is used, and you need to check the AccessibilityId property value at this time.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Checking the AccessibilityId Property Value Checking the Component Property Value<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The method to access the component itself placed on the form is as follows.
[MainFrame id property value].[ChildFrame id property value].form.[Component id property value]
To get the element of the Button component with the id property value being 'Button00', write the following code.
<CodeTag>
Code - C#
</CodeTag>
WindowsElement element = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.Button00');
Components placed in the Div component can be accessed as follows.
<CodeTag>
Code - C#
</CodeTag>
WindowsElement element = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.Div00.form.CheckBox00');<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Checking the AccessibilityId Property Value Checking the Control & the Item Property Values<|eot_id|><|start_header_id|>assistant<|end_header_id|>
For example, the dropbutton of the Combo component placed in the Div component can generate the element as below.
<CodeTag>
Code - C#
</CodeTag>
WindowsElement element = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.Div00.form.Combo00.dropbutton');
To proceed with the unit test, you need to expand the dropdown list of the Combo component and then select the item. To expand the dropdown list, you need to access the ButtonControl in the Combo component and then check the property value of the control.
The control property value can be checked in the component overview by running Help (shortcut key F1) in the Nexacro Studio. You can check that the id property value of the button clicked to expand the dropdown list in the Combo component is 'dropbutton'.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Checking the AccessibilityId Property Value|Checking the Control & the Item Property Values/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Checking the AccessibilityId Property Value Checking the Property Value with Inspect<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Caution:
Property values (sub-controls) that are not exposed in Help may be changed depending on the product version.
When the property value is changed, the written test may not work.
However, it does not tell you how to access Item 3 after expanding the dropdown list. In this case, you can use the tool called 'Inspect'. 'Inspect' can be found in the installation pathway if Windows SDK is installed.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Checking the AccessibilityId Property Value|Checking the Property Value with Inspect/1.jpg</ImgTag>
Note:
Inspect
https://docs.microsoft.com/en-us/windows/desktop/winauto/inspect-objects
Step 1. Run the inspect.exe file in the Windows SDK installation pathway.
Step 2. Run the Nexacro and then move the mouse cursor to the desired location.
Step 3. Click the dropdown button of the Combo component to expand the dropdown list.
Step 4. Place the mouse cursor on the desired item area. As shown in the figure below, a borderline is displayed in the target area recognized by Inspect, and the related information is displayed in the Inspect window.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Checking the AccessibilityId Property Value|Checking the Property Value with Inspect/2.jpg</ImgTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Checking the AccessibilityId Property Value|Checking the Property Value with Inspect/3.jpg</ImgTag>
Various information is displayed, and the item to be used as the AccessibilityId property value among them is 'AutomationId'.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Checking the AccessibilityId Property Value|Checking the Property Value with Inspect/4.jpg</ImgTag>
When selecting the 2nd item from the dropdown list, you can generate the element as shown below.
<CodeTag>
Code - C#
</CodeTag>
WindowsElement element = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.Div00.form.Combo00.combolist.item_1');
The element corresponding to the item can be accessed after the dropdown list is expanded. If you try to access the item before expanding the list, then it will be processed as a test failure.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Checking the AccessibilityId Property Value|Checking the Property Value with Inspect/5.jpg</ImgTag>
In the test code, find the dropbutton element first, process the mouse click event, and then access the desired item when the dropdown list is expanded.
<CodeTag>
Code - C#
</CodeTag>
[TestMethod]public void Test_00_FindElementItem(){ WindowsElement element = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.Div00.form.Combo00.dropbutton'); Assert.IsNotNull(element); element.Click(); Thread.Sleep(TimeSpan.FromSeconds(0.1)); WindowsElement elementItem = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.Div00.form.Combo00.combolist.item_1'); Assert.IsNotNull(elementItem); Debug.WriteLine('elementItem.Text:' + elementItem.Text);}<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Running the Demo Unit Test by Feature<|eot_id|><|start_header_id|>assistant<|end_header_id|>
You can download the Nexacro app installation file and the Java and C# sample files to run demos by feature.
Step 1. Access the address below in a web browser.
https://github.com/TOBESOFT-DOCS/sample_nexacroplatform_17_winappdriver
You can see 2 folders and 1 installation file.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Running the Demo Unit Test by Feature/1.jpg</ImgTag>
Step 2. Download the nexacro17_SetupRuntime_x86.exe file. Click the file name with the mouse to see the [Download] button.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Running the Demo Unit Test by Feature/2.jpg</ImgTag>
Step 3. Install the app by running the downloaded installation file. The app will be installed in the pathway below.
C:\Program Files (x86)\nexacro\17\app0201
Step 4. Paste the C# and Java samples into the project created in the Unit Test Project.
Step 5. Run the unit test and check if the unit test is processing normally.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Running the Demo Unit Test by Feature/3.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Supported Interface<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Caution:
Not all SeleniumRC and Appium interfaces are supported.
Features that cannot be supported in the Nexacro or are not supported in the WinAppDriver are excluded.
Note:
The items below can be used when the client does not support a separate interface and they are called directly from the web browser or are called using HttpWebResponse, etc.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface/1.png</ImgTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Session Creating a Session<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Create the session with the winappdriver information and then run the app.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Session/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Session Ending a Session<|eot_id|><|start_header_id|>assistant<|end_header_id|>
End the session and then close the app.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Session/1.png</ImgTag>
Caution:
Some of the interfaces provided by the WinAppDriver are not supported in the Nexacro.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Timeout Setting a Timeout<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Set the timeout value to be applied during the session operation.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Timeout/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Frame Checking the Mainframe Information<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the titletext property value of the MainFrame object.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Frame/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Changing the Enabled Window<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Change the current window. Windowhandle can be obtained from session.WindowHandles. For the initial execution, the MainFrame object is set as the current window.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Ending the Enabled Window<|eot_id|><|start_header_id|>assistant<|end_header_id|>
End the current window.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Obtaining the Enabled Window Handle<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the current window handle object.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Obtaining the Window Handle Array<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return all window handle objects as an array.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Checking the Window Size Information<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the window size in the form of the Size object.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Changing the Window Size<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Change the window size.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Checking the Window Position Information<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the window position in the form of the Point object.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Changing the Window Position<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Change the window coordinates.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Window Maximizing the Window<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Maximize the window size.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Window/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Supported Interface Element<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Element is the smallest unit of the WinAppDriver operation. In the Nexacro, nexacro Element, which is the element of components and controls, is processed as Element.
ControlElement surrounds the component and Elements, such as ContainerElement, InputElement, IconTextElement, TextElement, are located inside. In the case of the Button component, it is configured as follows.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Obtaining the Element<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the ControlElement object of the component and control.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Note:
In the case of the objParentFrame parameter value set to null when executing the open method in the Nexacro, it is accessed based on the ChildFrame ID.
<CodeTag>
Code - C#
</CodeTag>
// When specifying parent null: nexacro.open('openframe', url, null, ...) nexaButton00 = session.FindElementByAccessibilityId('openframe.form.Button00');// When specifying parent frame: nexacro.open('openframe', url, ownerframe, ...)nexaButton00 = session.FindElementByAccessibilityId('mainframe.ChildFrame00.openframe.form.Button00');<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Obtaining the Element Array<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the ControlElement object list of component and control as an array value.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking the Element id Value<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the id value of the WinAppDriver Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking the Text Information Displayed on Element<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the text value of Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Note:
The property value specified in the Nexacro prioritizes processing the text displayed on the screen. The priorities are as follows.
displaytext > text > titletext > value<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Processing the Element Mouse Click Event<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The mouse click event occurs at the center of the Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Caution:
Since the mouse click event occurs at the center of the element, the caret position does not move to the front in the case of the MaskEdit component. In this case, you can enter the CTRL+'A' keys to select the entire input area and then enter the text string.
<CodeTag>
Code - C#
</CodeTag>
[TestMethod]public void Test_10_MaskEditInput(){ WindowsElement nexaMaskEdit00 = session.FindElementByAccessibilityId('mainframe.ChildFrame00.form.MaskEdit00'); Assert.IsNotNull(nexaMaskEdit00); Thread.Sleep(TimeSpan.FromSeconds(0.1)); nexaMaskEdit00.Clear(); nexaMaskEdit00.Click(); nexaMaskEdit00.SendKeys(Keys.Control + 'a'); Thread.Sleep(TimeSpan.FromSeconds(0.1)); nexaMaskEdit00.SendKeys('abcde1234'+Keys.Enter); Assert.AreEqual('abcde-1234', nexaMaskEdit00.Text);}<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Deleting the Element Input Value<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Delete the input value of the component with the text editing area.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Passing the Keyboard Input Value to Element<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Process the keyboard input value.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Note:
Input values are processed differently depending on the component.
Please refer to the 'Basic Key Action' item of the component in Product Help.
Caution:
When passing keyboard input values, the app must be enabled, and if 2 or more windows are displayed, then the target window must be enabled.
Caution:
The keyboard input value must be passed after processing the mouse click event to the target element to operate normally.
Caution:
If 2 or more displays are being used, then the keyboard input values may not be passed normally. Either use only one display, or restart the WinAppDriver.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking Whether the Element is Selected<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the Selected status value of the Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Note:
Components and controls supported in the Nexacro are as follows.
CheckBox, RadioButton, TabButton, ListBoxItem, MenuItem, TreeCell, GridCell<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking Whether the Element Can be Used<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the Enabled status value of the Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking Whether the Element Screen is Displayed<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return whether the Element is displayed.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Note:
It is not returning the visible property value of the component, but rather it is returning whether it is displayed on the actual screen.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/2.png</ImgTag>
Caution:
If the visible property value of the component is set to false when starting the app, then the corresponding Element cannot be found. This is because the Element is created only when the visible property value is true in the Nexacro.
The Element can be processed by setting the visible property value to true when loading the app and then changing the visible property value of the component to false within the onload event function.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking the Element Size Information<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the Element size in the form of the Size object.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking the Element Position Information (Based on the Parent Element)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the Element position in the form of the Point object based on the parent Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking the Element Position Information (Based on the Screen)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the Element position in the form of the Point object based on the Screen.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Obtaining the Enabled Element<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the currently enabled Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Comparing 2 Elements<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Compare Elements to see if they are the same Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Element Checking the UIA Interface Attribute Value of the Element<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Provide the attribute value of the UIA Interface of the Element.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|Element/1.png</ImgTag>
Note:
Automation Element Property Identifiers
https://docs.microsoft.com/en-us/windows/desktop/WinAuto/uiauto-automation-element-propids<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
ScreenShot Obtaining the Window & Element Screenshot<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Return the Screen window area or the Element as a Screenshot object.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in the Windows OS NRE|Supported Interface|ScreenShot/1.png</ImgTag>
Note:
You can use the SaveAsFile method, AsBase64EncodedString property, to convert to an image file or to Base64 format.
Caution:
The window must be exposed at the top to obtain a normal screenshot.
Caution:
Java code can only access repositories for which you have privileges.
<CodeTag>
Code - Java
</CodeTag>
FileHandler.copy(sessionshot, new File(System.getProperty('user.home')+'\\Downloads\\SessionScreenShot.png'));<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Related Link Information<|eot_id|><|start_header_id|>assistant<|end_header_id|>
WebDriver Interface
http://www.w3.org/TR/webdriver1/
https://www.seleniumhq.org/projects/webdriver/
https://developer.mozilla.org/en-US/docs/Web/WebDriver
AppDriver Interface
https://github.com/Microsoft/WinAppDriver
https://appium.io/docs/en/drivers/windows/
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
UIA Interface
https://docs.microsoft.com/en-us/windows/desktop/WinAuto/entry-uiauto-win32
https://docs.microsoft.com/en-us/windows/desktop/winauto/testing-tools
https://en.wikipedia.org/wiki/Microsoft_UI_Automation
MSAA Interface
https://docs.microsoft.com/en-us/windows/desktop/WinAuto/microsoft-active-accessibility
https://docs.microsoft.com/en-us/windows/desktop/winauto/testing-tools
https://en.wikipedia.org/wiki/Microsoft_Active_Accessibility<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Unit Test in Android OS NRE<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The Appium linkage function uses the UIAutomation2 interface provided by the Nexacro to read or write properties of apps running in Android NRE and to support method execution by specifying parameters. You can write unit tests and test using UI automation testing tools, such as Selenium.
In this chapter, we will look at the steps to install Appium, create a basic Java project in Visual Studio code, and connect it to the Nexacro apps.
Note:
The following is written based on Appium 1.19.1, Android Studio version 4.1.1.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Configuring the Appium Linkage Installing Appium & Checking the Terminal Connection<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Check if Android Studio and Android SDK, JDK are installed.
Step 2. Enable the developer option on the terminal to test and then check the following 3 options to use.
USB debugging
Install via USB
USB debugging (Security settings)
Step 3. Download and install the Appium installation file on the PC to test.
https://github.com/appium/appium-desktop/releases/latest
Step 4. Connect the terminal and PC using a USB cable.
Step 5. Check the serial number of the connected terminal with the adb command.
In the image below, '0a388e93' is the serial number of the connected terminal.
$ adb devices
List of devices attached
0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo
Step 6. Install the Nexacro app on the terminal to test.
When building the app, the Package Name is set to 'nexacro' and the Program Name is set to'TEST0120'.
Step 7. Run Appium on the PC.
Step 8. Click the [Start Server] button to start the Appium server.
In the Windows operating system environment, change the Host setting to '127.0.0.1'.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Installing Appium & Checking the Terminal Connection/1.jpg</ImgTag>
Step 9. Click the [Start Inspector Session] button to open the Appium Inspector window.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Installing Appium & Checking the Terminal Connection/2.jpg</ImgTag>
Step 10. In the [Custom Server] tab, enter the JSON Representation item as follows.
<CodeTag>
{ 'platformName': 'Android', 'platformVersion': '10', 'appPackage': 'nexacro.TEST0120', 'appActivity': '.MainActivity', 'automationName': 'UIAutomator2', 'autoGrantPermissions': 'true', 'deviceName': '0a388e93'}
</CodeTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Installing Appium & Checking the Terminal Connection/1.png</ImgTag>
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Installing Appium & Checking the Terminal Connection/3.jpg</ImgTag>
Note:
Please refer to the link below for additional settings.
http://appium.io/docs/en/writing-running-appium/caps/
Step 11. Click the [Start Session] button.
Note:
The Appium Settings app is installed on the terminal for the initial execution.
Step 12. Check if the app is running on the terminal to test it, and check that the running status of the app is displayed in the Appium Inspector window.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Installing Appium & Checking the Terminal Connection/4.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Configuring the Appium Linkage Configuring the Test Project Execution & Testing<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Install Visual Studio Code.
Step 2. Select Extensions from the sidebar and install the Java Extension Pack.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Configuring the Test Project Execution & Testing/1.jpg</ImgTag>
Step 3. Set the appium, selenium, testing libraries required for project execution.
Note:
Please refer to the related document for the configuration of the Maven, Gradle, Eclipse plug-ins, etc.
client-combined-3.141.59.jar (https://www.selenium.dev/downloads/)
byte-buddy-1.8.15.jar
commons-exec-1.3.jar
guava-25.0-jre.jar
okhttp-3.11.0.jar
okio-1.14.0.jar
testng-7.3.0.jar (https://testng.org/doc/download.html)
jcommander-1.78.jar
java-client-7.4.1.jar (https://github.com/appium/java-client)
commons-lang3-3.11.jar (https://commons.apache.org/proper/commons-lang/)
Step 4. Create the Java Project and the BaseClass.java file as below.
<CodeTag>
package tests;import java.net.MalformedURLException;import java.net.URL;import org.openqa.selenium.remote.DesiredCapabilities;import org.testng.annotations.AfterTest;import org.testng.annotations.BeforeTest;import org.testng.annotations.Test;import io.appium.java_client.MobileElement;import io.appium.java_client.android.AndroidDriver;public class BaseClass { AndroidDriver<MobileElement> driver; final String URL_STRING = 'http://127.0.0.1:4723/wd/hub'; @BeforeTest public void setup() { System.out.println('setup'); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability('automationName', 'UiAutomator2'); capabilities.setCapability('platformName', 'Android'); capabilities.setCapability('platformVersion', '10'); capabilities.setCapability('deviceName', '0a388e93'); capabilities.setCapability('autoGrantPermissions', 'true'); capabilities.setCapability('appPackage', 'nexacro.TEST0120'); capabilities.setCapability('appActivity', '.MainActivity'); try { driver = new AndroidDriver<MobileElement>(new URL(URL_STRING), capabilities); } catch (MalformedURLException e) { System.out.println('MalformedURLException'); e.printStackTrace(); } catch (Exception e) { System.out.println('Exception'); e.printStackTrace(); } } @Test public void sampleTest() { System.out.println('sampleTest'); } @AfterTest public void teardown() { System.out.println('teardown'); driver.close(); }}
</CodeTag>
Step 5. Select Test from the sidebar and then click the [Run] button in the BaseClass item.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Configuring the Test Project Execution & Testing/2.jpg</ImgTag>
Step 6. Check if the app is running on the terminal to test it, and then check that the test success message is displayed normally in the DEBUG CONSOLE.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Configuring the Appium Linkage|Configuring the Test Project Execution & Testing/3.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating & Running the Unit Test<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Step 1. Modify and update the Nexacro app as follows.
Place the Button component at the top and the Edit component below it.
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Creating & Running the Unit Test/1.jpg</ImgTag>
Write the onclick event handler function of the Button component as follows.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){ this.Edit00.set_value('BUTTON CLICK');};
</CodeTag>
Step 2. Create the Tests.java file as shown below.
<CodeTag>
package tests;import java.net.MalformedURLException;import java.util.concurrent.TimeUnit;import org.testng.annotations.Test;public class Tests extends BaseClass { @Test public void testOne() throws MalformedURLException, InterruptedException { System.out.println('testOne'); int nTestSpeed = 2000; driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); driver.findElementById('mainframe.WorkFrame.form.Button00').click(); Thread.sleep(nTestSpeed); }}
</CodeTag>
Step 3. Select Test from the sidebar and then click the [Run] button in the Tests item.
Step 4. Check if the app is running on the terminal to test it, and then check that the Button click event is processed normally for the Edit component value to be changed.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Supported Interfaces<|eot_id|><|start_header_id|>assistant<|end_header_id|>
<ImgTag>Advanced Development Guide 21.0.0.300|Unit Test in Android OS NRE|Supported Interfaces/1.png</ImgTag>
How Nexacro Platform Works<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Structures of Project and Files<|eot_id|><|start_header_id|>assistant<|end_header_id|>
If you want to develop a Form running on the Nexacro, you must create a project first. Then, you need to create files or link existing data to prepare the constituents necessary for the project, including components, screens, environments and themes (or styles). The form can be executed in the form of either an app or a Form itself.
This chapter explains what types of files are created in the working folder as a result of creating a project or form and what role each file performs. In addition, this chapter touches upon the files that are created as a result of generation.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Project<|eot_id|><|start_header_id|>assistant<|end_header_id|>
A project contains basic information on settings for developing a Form. Creating a new project accompanies the creation of basic filesβincluding settings filesβthat comprise the project.
The below table describes such files.
<ImgTag>Advanced Development Guide 21.0.0.300|Structures of Project and Files|Creating Project/1.png</ImgTag>
Note:
A service folder for frames may be added depending on what type of frame structure you set when you create a project.
If the application consists of multiple frames, for example, a service folder for frames will be created automatically.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Project Project Settings File (XPRJ)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This file is created automatically when you create a project. The information on application settings can be added or deleted.
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><Project version='2.1'> <EnvironmentDefinition url='environment.xml'/> <TypeDefinition url='typedefinition.xml'/> <AppVariables url='appvariables.xml'/> <AppInfos> <AppInfo url='[file name].xadl'/> <AppInfo url='[file name].xadl'/> </AppInfos></Project>
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Project Application Settings File (XADL)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
An App Info file is created automatically when you create a project, and you can add more files. A project must include at least one App Info file. Therefore, if you attempt to delete a sole App Info file, Nexacro Studio will not remove it while opening the below alert message.
<ImgTag>Advanced Development Guide 21.0.0.300|Structures of Project and Files|Creating Project|Application Settings File (XADL)/1.jpg</ImgTag>
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><ADL version='2.0'> <Application id='[id]' screenid='[screen id]'> <Layout> <MainFrame/> </Layout> </Application> <Script type='xscript5.1'><![CDATA[β¦]]></Script></ADL>
</CodeTag>
You can add a script to an .xadl file. An App Info file manages a script that affects the entire scope of the application, such as an event for the application or a certain frame.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Project Type Definition<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This settings file contains information on modules, components, services, protocol and updates. You can add, change or delete information for each item. In the build process, Nexacro Studio may automatically edit the information on protocols and deployment options.
<ImgTag>Advanced Development Guide 21.0.0.300|Structures of Project and Files|Creating Project|Type Definition/1.png</ImgTag>
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><TypeDefinition version='3.0'> <Modules> <Module url='CompBase.json'/> <Module url='ComComp.json'/> <Module url='Grid.json'/> <Module url='DeviceAPI.json'/> </Modules> <Components> <Component type='JavaScript' id='Button' classname='nexacro.Button'/> <Component type='JavaScript' id='Combo' classname='nexacro.Combo'/> <Component type='JavaScript' id='Edit' classname='nexacro.Edit'/> ... </Components> <Services> <Service prefixid='theme' type='resource' url='./_resource_/_theme_/' version='0' communicationversion='0'/> <Service prefixid='initvalue' type='resource' url='./_resource_/_initvalue_/' version='0' communicationversion='0'/> <Service prefixid='xcssrc' type='resource' url='./_resource_/_xcss_/'/> <Service prefixid='imagerc' type='resource' url='./_resource_/_images_/'/> <Service prefixid='font' type='resource' url='./_resource_/_font_/' version='0' communicationversion='0'/> <Service prefixid='Base' type='form' cachelevel='session' url='./Base/' version='0' communicationversion='0'/> </Services> <Protocols/> <Update/></TypeDefinition>
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Project Environment<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This settings file contains the information on screens, variables, cookies and HTTP headers. A project must include one screen at least. If you try to delete a sole screen, the below alert will appear and Nexacro Studio will not remove it.
<ImgTag>Advanced Development Guide 21.0.0.300|Structures of Project and Files|Creating Project|Environment/1.jpg</ImgTag>
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><ENV version='2.1'> <Environment themeid='theme::default' datatyperule='2.0'> <ScreenDefinition> <Screen id='[Screen id]' type='[type property value]'/> </ScreenDefinition> <Variables/> <Cookies/> </Environment></ENV>
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Creating Project AppVariables<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This settings file contains the information on Datasets and variables that can be used globally by any application in a project.
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><AppVariables version='2.0'> <Datasets> <Dataset id='[Dataset id]'> <ColumnInfo/> <Rows/> </Dataset> </Datasets> <Variables> <Variable id='[Variable id]' initval='[init value]'/> </Variables></AppVariables>
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Resources initValue<|eot_id|><|start_header_id|>assistant<|end_header_id|>
When you create a project, an initValue folder is created rather than an initValue file. Later on, you can add an XML file to save initial settings values. After creating a file, select an object and then specify initial values for the object. Although the file format is XML. the file extension is .xiv.
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><GlobalPropInitvalueDefinition> <nexacro.Button> <initvalueid id='[initvalueid ]' ... /> </nexacro.Button> <nexacro.Edit> <initvalueid id='[initvalueid ]' ... /> </nexacro.Edit></GlobalPropInitvalueDefinition>
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Resources XTHEME<|eot_id|><|start_header_id|>assistant<|end_header_id|>
If you see the Resource Explorer of Nexacro Studio immediately after creating a project, you will find two roots of themes: one is Nexacro Theme and the other is Theme. The Nexacro Theme root includes basic theme files including default.xtheme while the Theme root is empty at its inception. You can add new themes only to the Theme root, not Nexacro Theme. You can copy existing themes into or create new themes in the Theme root.
Basically a theme is a combination of a style file (theme.xcss) and a group of image files.
Caution:
The theme files included in the Nexacro Theme root are stored in a separate cache space. You cannot edit those basic theme files.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Resources ImageResource<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This segment manages image files that can be globally used within a project. The added image files will be exposed in the Properties pane when you need to specify an image file as the value of a certain property in the process of developing a Form.
<ImgTag>Advanced Development Guide 21.0.0.300|Structures of Project and Files|Resources|ImageResource/1.jpg</ImgTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Resources UserFont<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This segment manage font files, which are largely divided into a conventional type (.woff, .ttf, .off) and UserFont type. UserFont files are saved with the extension .xfont, and their codes are written as described below.
<CodeTag>
@font-face { font-family : 'NanumGothic'; font-style : normal; font-weight : 400; src : local('NanumGothic'), url(NanumGothic.ttf) format('truetype'), url(NanumGothic.eot), url(NanumGothic.eot?#iefix) format('embedded-opentype'), url(NanumGothic.wpff2) format('woff2'), url(NanumGothic.woff) format('woff'),}
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Others Form (XFDL)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
A form is the definition of a screen that users actually handle to do their jobs. A form contains program codes to conduct various invisible tasks such as data transaction with a server or calculations.
<ImgTag>Advanced Development Guide 21.0.0.300|Structures of Project and Files|Others|Form (XFDL)/1.png</ImgTag>
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><FDL version='2.1'> <Form> <Layouts> <Layout> <Button/> </Layout> </Layouts> <Script type='xscript5.1'><![CDATA[]]></Script> <Objects> <Dataset/> </Objects> <Bind> <BindItem/> </Bind> </Form></FDL>
</CodeTag>
Caution:
A form cannot designate an XCSS file, which can apply only to the application level.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Others Script (XJS)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
You can write a script in a Form file if the script is necessary only to the Form. If a script applies a whole application, however, it should be written separately. Then, you should program each form to refer to the script.
You can make a Form refer to a separate script by writing a code as written below.
<CodeTag>
include 'lib::comLib.xjs'
</CodeTag>
If a script file is too long, you can divide it into several portions. In such a case where multiple .xjs files comprise one script file, you can include a specific reference rather than one big inclusive reference when writing source codes. For example, You can divide the foregoing example comLib.xjs into the below script files. Afterwards, you can add new features just by modifying comLib.xjs without changing the whole form file, even if the number of reference files increases.
<CodeTag>
include 'lib::comConstants.xjs';include 'lib::comService.xjs';include 'lib::comForm.xjs';include 'lib::comGrid.xjs'; include 'lib::comUtil.xjs';include 'lib::comDataset.xjs';
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Others Style Settings File (XCSS)<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Although CSS has its official standards, the ways it applies to each web browser are different from each other. Therefore, in the process of developing web apps, you need to specify several CSS properties that are necessary only to specific browsers. However, Nexacro makes it easy: once you write a single source based on the CSS standards, the platform will automatically create CSS codes appropriate to each browser during the process of building an application.
<CodeTag>
<?xml version='1.0' encoding='utf-8'?><XCSS type='xcss1.0'><![CDATA[.Button{ background : #c0504d; -nexa-text-align : left;}]]></XCSS>
</CodeTag>
The above example XCSS codes include both a CSS standard property and a Nexacro-only property. In this case, the platform will produce CSS codes like the below one as a result of building an application.
<CodeTag>
.Button{ background : #c0504d;}.Button .nexacontentsbox{ text-align : left;}
</CodeTag>
Caution:
An XCSS file is formatted in XML. Moreover, while an XCSS file complies with the CSS standards, it does not mean that the file supports all the standard CSS properties.
Caution:
An XCSS file can apply only to the application level.
If you want to style a whole project, you need to use a theme file. Meanwhile, apply an XCSS file if you want to style an application.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Application Running Scenario<|eot_id|><|start_header_id|>assistant<|end_header_id|>
This section describes the process of launching a Nexacro app.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
bootstrap<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Bootstrap refers to the process of verifying related information and fetching necessary resources to load an application.
<ImgTag>Advanced Development Guide 21.0.0.300|Application Running Scenario|bootstrap/1.png</ImgTag>
Tip:
In general parlance, bootstrapping usually refers to a self-starting process that is supposed to proceed without external input. In computer technology the term (usually shortened to booting) usually refers to the process of loading the basic software into the memory of a computer.
https://en.wikipedia.org/wiki/Bootstrapping
In relation to Nexacro, bootstrap means a preparatory process for launching an app.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Application Loading<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The process of loading the form connected to Application to run the app is as follows.
<ImgTag>Advanced Development Guide 21.0.0.300|Application Running Scenario|Application Loading/1.png</ImgTag>
Caution:
Because of the loading sequence, you cannot use objects that are not loaded yet.
For example, if you access AppVariables within the event handler of the Environment.onload event, 'undefined' will be returned.
<CodeTag>
this.Environment_onload = function(obj:nexacro.Environment,e:nexacro.LoadEventInfo){ trace(nexacro.getApplication().all['Variable0']); //undefined}
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Form Loading<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The below sequence is the elaboration of the process between 12. Loading Forms and 20. Event occurrence: Form.onload, as in the above Application Loading.
Loading a Form
Executing the Form
Downloading and executing sub-files
Initializing the Form
Setting style properties of the Form
Setting non-style properties of the Form
Creating objects, components and BindItems
Performing scripts that are processed inside the engine
Registering event handlers
Calling the methods of the objects and components: Object.createComponent
Event occurrence: Form.oninit
Method calling: Form.on_created
Calling the methods of the objects and components: Object.on_created
Loading images and processing transactions
Event occurrence: Form.onload
Note:
A subfile refers to a file that is connected through the include directive. (eg. a script file)
Note:
The objects and components included in a Form are created according to the specified Z-order.
Caution:
The loading times for Div and Tab components may vary according to network speeds if those components are designed to load Forms connected through the url property.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Nexacro Platform Script Language<|eot_id|><|start_header_id|>assistant<|end_header_id|>
You will apply basic JavaScript syntax when developing a Nexacro-based app. Nexacro offers its own APIs to provide additional features that cannot be achieved with JavaScript. Scripts written in Nexacro can be executed in web browsers and mobile devices directly after they undergo the build process.
This chapter explains the syntactic elements and other noteworthy points that you need to know when writing a script in Nexacro.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Scope<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Scope explains issues related to the range of accessible variables. Apps used in business often manipulate a number of screens simultaneously while one variable can be referred to by multiple screens. Therefore, the accurate use of scope lets you exactly access the resources that you want.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Scope Local<|eot_id|><|start_header_id|>assistant<|end_header_id|>
If you write the below code on the first line of a Form script, the variable will be given local scope. If this is standard JavaScript code, the scope of the variable will be global. However, Nexacro works differently.
<CodeTag>
var value0 = 0;
</CodeTag>
You can find the syntactic differences between standard JavaScript and Nexacro by seeing the below code, which is generated as a result of the build process and will apply to web browsers. The above code will be included in a automatically-created function, making the scope of the variable local.
<CodeTag>
this.registerScript('TEST.xfdl', function() { var value0 = 0;});
</CodeTag>
Caution:
If you want to get a global variable in a Form script, do not use the keyword var when you declare a variable. However, there is a possibility that a global variable can affect the entire app. Therefore, you are recommended to define appropriate scope.
You do not need to define scope when you declare a variable within a function. You also do not need to define scope for a value delivered as a parameter.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button, e:nexacro.ClickEventInfo){ obj.set_text('button'); var a = 3; trace(a); // 3}
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Scope this<|eot_id|><|start_header_id|>assistant<|end_header_id|>
When designating the effective scope for items used in Application or the application form, you always need to use 'this'. You should designate a proper level of scope when referring to properties and Forms, as well as variables.
Variables within the Form are declared as follows:
<CodeTag>
this.formvalue = 4;
</CodeTag>
You need to designate the scope even when you declare a function. Moreover, you also need to designate the scope when you reference a variable in a function and the variable has been declared within the relevant Form.
<CodeTag>
this.formvalue = 4;this.test = function(){ this.formvalue = 3; this.parent.value = 3; this.parent.parent.value = 3;}
</CodeTag>
As for some methods like trace and alert, you can opt for either of the following types according to designated scope: one follows the basic JavaScript syntax while the other is additionally provided by Nexacro. That is to say, calling the alert method will vary markedly depending on whether you do not define scope or you designate scope by specifying this.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button, e:nexacro.ClickEventInfo){ alert(e.button); // JavaScript this.alert(e.button); // Form.alert() nexacro.getApplication.alert(e.button); // Application.alert()}
</CodeTag>
When declaring a function, you need to designate the scope so that it can be included as a member of a Form or an application.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button, e:nexacro.ClickEventInfo){...}
</CodeTag>
When using the eval function to access a Form, this should be used as well.
<CodeTag>
eval('this.formfunc()');
</CodeTag>
Caution:
As presented below, you can declare a function without designating scope. However, such a function will be used globally and may become unsupported later. Therefore, this way of function declaration is not recommended.
function Button00_onclick(obj:nexacro.Button, e:nexacro.ClickEventInfo)
{
...
}<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Scope Global<|eot_id|><|start_header_id|>assistant<|end_header_id|>
If you do not define scope of a variable or function in a script written in Nexacro, the variable or function will treated as a global member. The below code is an example.
<CodeTag>
globalvar = 2; var globalvar2 = 3;
</CodeTag>
Even variables used in a function are treated as global when their scopes are not designated. However, variables defined by using the keyword var cannot be used outside a function.
<CodeTag>
this.test = function(){ trace(globalvar); //2 trace(globalvar2); //3 value = 4; var localvar = 5;}this.test = function(){ trace(value); // 4 trace(localvar); // ReferenceError: localvar is not defined}
</CodeTag>
Caution:
When a Form includes a script file from outside, it will treat the script file as a function. Therefore, you should be careful when using the keyword var.
Please see the below two sample codes. Code 2 (includecode.xjs.js) shows how the variables defined in the includecode.xjs file are processed after generation. (The generated code may differ according to the version of the platform.)
<CodeTag>
Code - includecode.xjs
</CodeTag>
bbb = 'bbb';var ccc = 'ccc';
<CodeTag>
Code - includecode.xjs.js
</CodeTag>
(function(){ return function(path) { var obj; // User Script this.registerScript(path, function() { bbb = 'bbb'; var ccc = 'ccc'; }); this.loadIncludeScript(path); obj = null; };})();
When you declare or call a function, you need to designate the associated scope. Test() and this.test() in the script below calls two different functions respectively. If you call test() without designating the scope, the function declared in global will be called.
<CodeTag>
this.Button00_onclick = function(obj:nexacro.Button, e:nexacro.ClickEventInfo){ test(); this.test();}
</CodeTag>
The functions designated without the scope shown as below will be treated as global.
<CodeTag>
Button00_onclick = function(obj:nexacro.Button, e:nexacro.ClickEventInfo){...}function Button00_onclick(obj:nexacro.Button, e:nexacro.ClickEventInfo){...}
</CodeTag>
Caution:
You need to designate the scope of a method like transaction(), of which there are two variants: one belongs to the Application object and the other to the Form object.
//application
nexacro.getApplication().exit('');
nexacro.getApplication().transaction('');
//Form
this.close('');
this.go('');
this.transaction('');
Tip:
If you want to use a certain variable in the scope of an application, the best practice is to register it in AppVariables instead of declaring it as a global variable.
<CodeTag>
nexacro.getApplication().addVariable('aaa', 'TEST');trace(nexacro.getApplication().aaa); // TEST
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Scope Expr<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The expr script used in a Grid component can be applied without designating the scope as it is processed based on an internally bound Dataset within Nexacro. However, you should designate the scope to access an unbound Dataset directly.
To use expr in a bound Dataset shown, you do not need to use this as shown here.
<CodeTag>
<Cell text='expr:Column00'/><Cell text='expr:Column00.min'/><Cell text='expr:currow'/><Cell text='expr:rowposition'/><Cell text='expr:getSumNF('col0')'/>
</CodeTag>
<CodeTag>
Dataset.set_filterstr('Column00=='test'');Dataset.filter('Column00=='test'');
</CodeTag>
If you want to designate a Grid object, cell object or bound Dataset component as scope defined within an expr script, you need to use the below variables or selectors.
Grid: comp
Dataset: dataset
Cell: this
<CodeTag>
<Cell text='expr:this.col'/> <!-- cell --><Cell text='expr:dataset.rowcount'/> <!-- binded dataset --><Cell text='expr:comp.currentcell'/> <!-- grid --><Cell text='expr:dataset.parent.func1()'/> <!-- form --><Cell text='expr:comp.parent.func1()'/> <!-- form -->
</CodeTag>
Note:
There are no specific indicators for Forms, so you can use comp.parent or dataset.parent if necessary.
Caution:
If you use this instead of comp.parent.func() when you access a function in a Form, it will be processed as an error. In an expr script, this means cell.
<Cell text='expr:this.func01()'/>
If a component has expr and text as its property at the same time, the getDisplayText property, which returns the text displayed on the screen, can be used.
<CodeTag>
this.Button00.set_text('text');this.Button00.set_expr('1+1');trace(this.Button00.text); // 'text'trace(this.Button00.expr); // '1+1'trace(this.Button00.displaytext); // '2'
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Scope lookup<|eot_id|><|start_header_id|>assistant<|end_header_id|>
The lookup method is designed to be used when it is difficult to access with the designated scope. For example, you can look up objects or functions with ID names or function names.
The lookup method is used in the actual code as follows.
<CodeTag>
Form.lookup( strid );nexacro.getApplication().lookup( strid );[Component].addEventHandlerLookup( eventid, funcid, target );
</CodeTag>
Here are additional examples.
<CodeTag>
// it returns an object relevant to objectid after lookup in thisvar obj = this.lookup('objectid');// it returns a function relevant to fn_onclick after lookup in thisthis.lookup('fn_onclick')();// Event handler handles a function relevant to fn_onclick after lookup in thisbtn00.addEventHandlerLookup( 'onclick', 'fn_onclick', this );
</CodeTag><|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Event Handler<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Event handlers to deal with events can be added in the Properties window when using Nexacro Studio, or they can be added within scripts by using methods provided for each component and object as described in this section.<|eot_id|>
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024
λ₯μ¬ν¬λ‘μ κ΄λ ¨λ λ΄μ©μ μ°μ μΌλ‘ λλ΅ν΄μ€<|eot_id|><|start_header_id|>user<|end_header_id|>
Event Handler Method<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Methods to add/set/delete event handlers are provided in order to handle events within scripts:
addEventHandler( eventid, funcobj, target )
addEventHandlerLookup( eventid, funcstr, target )
setEventHandler( eventid, funcobj, target )
setEventHandlerLookup( eventid, functstr, target )
removeEventHandler( eventid, funcobj, target )
removeEventHandlerLookup( eventid, funcstr, target )
Use appropriate methods to process events according to the scope of functions.
<CodeTag>
this.btn00.setEventHandler('onclick', this.fn_onclick, this);this.dataset00.addEventHandlerLookup('onrowposchange', 'fn_onchange', this);
</CodeTag>
Caution:
It is recommended to use the addEventHandlerLookup, setEventHandlerLookup and removeEventHandlerLookup methods only when they are really necessary since they are likely to affect the performance of an app.
Note:
When you create an event through the Properties pane of Nexacro Studio, the event will be written in the form of a string as presented below.
<Button id='Button00' ... onclick='Button00_onclick'/>
The build process will convert the above code into the below JavaScript code by adding the selector this.
this.Button00.addEventHandler('onclick', this.Button00_onclick, this);<|eot_id|>
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 1