Relationship
This explains how to access Application, main frame, child frame in the application environment
This content explains the actions how to run it. It will help you to understand.
Brief Description
Top Frame Description
You can access the Child Frame from Top Frame. We can also access function and value.
Left Frame Description
We can access TopFrame area, ChildFrame area from LeftFram area. We can also access values and functions.
ChildFrame
form 1, 2
We can access Top Frame, Left Frame and other form's functions and values.
Is it possible to refer functions and values between forms?
Execute Sample Application
http://www.xplatform.co.kr:8080/Next_JSP/nexacro/Application_Etc/Application_sample/index.jsp
Source Location
Sample\Application_Etc\Application_sample
Data Communication
This is way to identify the communication related content and controlling them.
Related method
transaction
This method is used to call service for updating value in Dataset, and After completion this calls callback method.
Transaction uses asynchronous communication by default.
Synchronize mode: While calling the script waits for result, after getting result it calls for another script.
Asynchronous mode: After calling one script, calls for another script, it does not wait for first script's result.
While calling service use URL address as PreFix
ex) application.transaction( "MyService01" ,"DataSrv::samplexml.jsp","input1=Dataset02","Dataset03=output1","a=b","callbackFunction
By using prefix communication with server environment is easy. For example if we are using IP address in every page and suppose we need to change this address on every page. Then we need to modify on every page, it is a time taken process.
So if we are using Prefix than we need to modify in TypeDefinition only and this will be affected immediately.
Server environment information may be changed.(Domain Information,IP etc)
In this case which action is required?
Verifying HTTP error code
Verifying error from onerror event of ADL
By using onerrror event from ADL event on Project, we can verify the HTTP error on server while communicating.
function application_onerror(obj:Object, e:ErrorEventInfo) { trace("application_onerror" + "\n errorcode=" + e.errorcode + "\n errormsg=" + e.errormsg + "\n requesturi=" + e.requesturi + "\n statuscode=" + e.statuscode); ...Skip... }
Reference Detail
e.errorcode
Error code is returned.
e.errormsg
Error message is returned.
e.requesturi
Shows the error occured URI
e.statuscode
During HTTP communication when error occured is shows by status code.
Error code , HTTP Error
The way of verification on callback method of transaction
Transaction method is used to get data on form from service. After calling service, callback method is processed to check whether the result processed normally. We can know error status using parameters of callback function.
this.fn_callback = function(serviceID, errCD, errMSG) { if(errCD < 0) { this.alert("Error MSG" + errCD + "==" + errMSG); } }
Meaning of the error code is blow.
0 : normally In case of less then 0 : error In case of greater then 0 : Warning
Error code, HTTP error
Reference
Way to receive additional variable with default variable after calling Transaction
We can receive variable defined by developer with default ErrorCode and ErrorMsg under Transaction.
nexacro platform source)
this.parm1 = ""; this.parm2 = null; this.parm3; this.Button00_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { this.transaction("test","http://IP//say_test.jsp","","Dataset00=Dataset00","","fn_search_after"); } this.fn_search_after = function(obj:Button, e:nexacro.ClickEventInfo) { trace(this.parm1); trace(this.parm2); trace(this.parm3); }
After defining this.parm1 = “”; , In case service (java/ jsp) puts value in VariableList, we can receive variable from call back.
When variable is defined, In case you don't define like this.parm1 = "“; , only you define null or variable, you can not receive.
As above, In case variable is initialized using double quotes, you can receive variable from transaction callback.
In case variable is only defined or initialized using null, you can not receive variable from transaction callback.
Source in service)
... syncopation VariableList varList = o_xpData.getVariableList(); // Add value to VariableList directly varList.add("ErrorCode", "200"); varList.add("ErrorMsg", ""); varList.add("parm1", "test1"); varList.add("parm2", "test2"); varList.add("parm3", "test3"); out.clear();
Data Inquiry
Setting number of queries
Through Service(JSP/JAVA etc) we can set number of records.
Communication Type (Response Type)
Service (JSP/JAVA etc.) we can set communication type information. By default XML, SSV, Binary communication is supported.(It can be vary according to product version)
In case of HTML5 version XML, SSV is supported by default.
Setting compress
We can set compress format on the receiving data from Service (JSP/JAVA etc.). Using compress SSV data transmission can be possible in to compressed zip format.
When we want to transfer the compressed data, data size is reduced on communcation section, but service resources are required for compression.
Main Source Content
var sStartTime; var serviceURL = "Svc::Service_Default.jsp"; this.Button00_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { this.ds_data.clearData(); var objDate = new Date(); sStartTime = objDate.getTime(); this.mk_time.set_value(0); this.mk_cnt.set_value(0); var arg = "row_cnt=" + this.rdCount.value + " type=" + this.comType.value + " compress=" + this.ckCompress.value; this.transaction("select",serviceURL,"","ds_data=output",arg,"fn_callback"); } this.fn_callback = function(serviceID, errCD, errMSG) { if(errCD < 0) { this.alert(serviceID + "==" + errCD + "==" + errMSG); }else{ var objDate = new Date(); this.mk_time.set_value(Math.floor((objDate.getTime()-sStartTime)/1000,1) ); this.mk_cnt.set_value(this.ds_data.rowcount); } } this.form01_onload = function(obj:Form, e:nexacro.LoadEventInfo) { this.comType.set_value("XML"); this.ckCompress.set_enable(false); } this.comType_onitemchanged = function(obj:Combo, e:nexacro.ItemChangeEventInfo) { if(e.postvalue == 'SSV') { this.ckCompress.set_enable(true); } else { this.ckCompress.set_enable(false); } }
Svc:: prefix is defined in the TypeDefinition, it is used to call services.
Service Sample Source(Service_Default.jsp)
<%@ page contentType="text/html; charset=euc-kr" %><%@ page language="java"%><%@ page import = "java.io.*" %><%@ page import = "java.util.*" %><%@ page import = "java.util.zip.*" %><%@ page import="com.nexacro.xapi.tx.*" %><%@ page import="com.nexacro.xapi.data.*" %><%@ page import="com.nexacro.xapi.data.datatype.*" %><% out.clear(); String strCharset = "euc-kr"; PlatformRequest platformRequest = new PlatformRequest(request.getInputStream(), PlatformType.CONTENT_TYPE_XML, strCharset); platformRequest.receiveData(); PlatformData inPD = platformRequest.getData(); VariableList inVariableList = inPD.getVariableList(); DataSetList inDataSetList = inPD.getDataSetList(); String row_cnt = inVariableList.getString("row_cnt"); String type = inVariableList.getString("type"); String compress = inVariableList.getString("compress"); if(row_cnt==null || row_cnt.equals("")) row_cnt = "3"; if(type==null || row_cnt.equals("")) type = "XML"; if(compress==null || compress.equals("")) compress = "false"; PlatformData outPD = platformRequest.getData(); VariableList outVariableList = new VariableList(); DataSetList outDataSetList = new DataSetList(); GZIPOutputStream gzipOut = null; DataSet outDataSet = null; try { outDataSet = new DataSet("output"); outDataSet.addColumn("SEQ", DataTypes.STRING, 5); outDataSet.addColumn("ADDRESS", DataTypes.STRING, 100); outDataSet.addColumn("NAME", DataTypes.STRING, 100); outDataSet.addColumn("HOMEPAGE", DataTypes.STRING, 100); outDataSet.addColumn("TECHHOMEPAGE",DataTypes.STRING, 100); int nRow; for(int i = 1; i <= Integer.parseInt(row_cnt); i++) { nRow = outDataSet.newRow(); outDataSet.set(nRow, "SEQ", i); outDataSet.set(nRow, "ADDRESS", "5F INTOPS Building, 108-7 Samsung-Dong, Gangnam-Gu"); outDataSet.set(nRow, "NAME", "TOBESOFT Col,Ltd"); outDataSet.set(nRow, "HOMEPAGE", "www.tobesoft.com"); outDataSet.set(nRow, "TECHHOMEPAGE", "www.xplatform.com"); } outDataSetList.add(outDataSet); outVariableList.add("ErrorCode", 0); outVariableList.add("ErrorMsg", "SUCCESS"); outVariableList.add("strOutputData", "※ Output Vairable을 받으려면, 화면의 전역변수로 선언하면 됩니다."); } catch(Exception e) { outVariableList.add("ErrorCode", -1); outVariableList.add("ErrorMsg", e.toString()); } finally { outPD.setDataSetList(outDataSetList); outPD.setVariableList(outVariableList); String Contents_type; if(type.equals("SSV")) { Contents_type = PlatformType.CONTENT_TYPE_SSV; } else if(type.equals("XML")) { Contents_type = PlatformType.CONTENT_TYPE_XML; } else { Contents_type = PlatformType.CONTENT_TYPE_XML; } if(compress.equals("true")) { response.setHeader("Accept-Encoding", "gzip, deflate"); response.setHeader("X-Compression", "gzip"); response.setHeader("Content-Encoding", "gzip"); response.setHeader("Content-Type", "text/xml"); String RS = String.valueOf((char) 0x1e); //rs(record seperator) String US = String.valueOf((char) 0x1f); //us(unit seperator) StringBuffer sb = new StringBuffer(); sb.append("SSV:").append("euc-kr").append(RS); //헤더의 처음 4바이트는 "SSV"로 시작(53 53 56) VariableList varLstOut = new VariableList(); varLstOut.add("ErrorCode", 0); varLstOut.add("ErrorMsg", "Success!!!!"); if(varLstOut != null) { int size = varLstOut.size(); for(int i=0; i<size; i++) { //Type 생략시 STRING 으로 고정 Variable var = varLstOut.get(i); sb.append(var.getName()).append("=").append(var.getString()); //각 Variable 은 US 로 구분 if(i<size-1) { sb.append(US); } } sb.append(RS); } sb.append("Dataset:").append("output").append(RS); //데이터셋 생성 sb.append("_RowType_"+US); for(int i=0; i<outDataSet.getColumnCount(); i++) { sb.append(outDataSet.getColumn(i).getName()); sb.append(":String(255)"); if(i<outDataSet.getColumnCount()-1) { sb.append(US); } } sb.append(RS); for(int totCnt=0; totCnt<outDataSet.getRowCount(); totCnt++) { sb.append("N"+US); //"N" is RowType. (N : Normal Record) for(int i=0; i<outDataSet.getColumnCount(); i++) { sb.append(outDataSet.getString(totCnt, i)); //Row Value if(i<outDataSet.getColumnCount()-1) { sb.append(US); } } sb.append(RS); } gzipOut = getGZipOut(new BufferedOutputStream(response.getOutputStream())); try{ flushBuffer(gzipOut, sb); } catch(Exception e) { } if(gzipOut != null) { try { gzipOut.close(); } catch (IOException e) { e.printStackTrace(); } } } else { HttpPlatformResponse res = new HttpPlatformResponse(response, Contents_type, "UTF-8"); res.setData(outPD); res.sendData(); } } %><%! //Respond to Client private void flushBuffer(GZIPOutputStream gzipOut, StringBuffer buff) { try { byte[] arrByteRslt = buff.toString().getBytes(); gzipOut.write(arrByteRslt, 0, arrByteRslt.length); gzipOut.flush(); } catch(Throwable th) { System.out.println("flushBuffer() Exception : "+th.getMessage()); } } private GZIPOutputStream getGZipOut(BufferedOutputStream bous) throws IOException { GZIPOutputStream gzip = new GZIPOutputStream(bous); return gzip; } public PrintWriter getZipWriter(HttpServletResponse response) throws IOException{ short TOBE_COMPRESS_MARK = (short)0xFFAD; response.resetBuffer(); response.setContentType("application/octet-stream"); DataOutputStream ostream = new DataOutputStream(response.getOutputStream()); ostream.writeShort(TOBE_COMPRESS_MARK); DeflaterOutputStream compress = new DeflaterOutputStream(ostream); return new PrintWriter(compress); } %>
Source Location
Sample\Application\np_Transaction_Basic.xfdl
Preventing mouse right click
Running nexacro platform using a web browser, the browser Right-click supports the basic functions.
This is explaining how to prevent right mouse click.
We should add the following script on the body part of HTML page
The HTML page can be modified or generated automatically, so please keep back up and make sure the values should exists in the page.
Can we stop default mouse right click functionality on web browser?
Setting httptimeout / httpretry
httptimeout
This is Property to set Wait Time (second)for HTTP Communication.
Default: 30 (seconds)
The input value ranges from 0 to 2147483. If 0 is entered, the wait time will be infinite.
HTML 5 : The httptimeout property is not applied in the synchronous communications due to error occurrence.
In case usehttpkeepalive Property is true, Wait Time is used for KeepAlive.
In case usehttpkeepalive Property is false, Wait Time is used for HTTP Communication.
Handling error when there is no return within timeout after calling service
Error occurs when there is no return from server within assigned timeout on bottom of form.
httptimeout Priority
Timeout value is applied according to priority below. 1) designated in script 2) designated in Properties of ADL
When error occurs after setting enough timeout in nexacro, you need to check timeout of firewall, DB and WAS.
Reference
While big data searching or saving, it takes long time. In this case httptimeout value should be assigned enough time. And assign 0 to value of httpretry.
Error occurs in case the data search/save time is longer than TimeOut time which is assigned to communication.
httpretry
This is property to designate number of retry for HTTP communication when there is no return within httptimeout.
Default value of httpretry property is 3.
This is property to designate number of retry for HTTP communication when there is no return within httptimeout.
When there is httpretry value(bigger than 0), service is recalled as many as designated number.
Handling Session
We describe here how to handle session (Cookies) in nexacro platform. nexacro platform defines global variables to use cookie options setting these parameters. By adding these variable to cookie, can be sent to the server.
Set usecookie
While calling server data we can set cookie parameters, by setting usecookie true in the GlobalVariables, these parameters delivered to the service together.
Verifying use of packet program
We can verify the actual cookie value by traffic monitor program between Client and Server.
Above screen shot shows use of monitoring program Fiddler.
Can we set values in Cookie?
Setting Prefix
In the nexacro platform we can use Prefix for grouping and calling service.
Form type bases on Service, can be divided into JSP and others, form of the screen means that the source location of the form.
If type is JSP or others for data retrieve/ save, we can set prefix on the URL path.
By using prefix we can adjust corresponding server environment changes. For example if we are using IP address in every page and suppose we need to change this address on every page. Then we need to modify on every page, it is a time taken process.
So if we are using Prefix then we need to modify in TypeDefinition only and this will be affected immediately.
Cache
nexacro platform's cache setting follows client's web browser setting.
Screen (Form),xjs, images etc comes over the web server. Depending on
Internet Browser's Options setting cache can be changed.
Cookie
Verifying Cookie value
This is the description to check the cookie value on web browser of nexacro platform HTML5 14 running environment.
Main Source Content
this.Application_Cookie_onclick = function(obj:Button, e:nexacro.ClickEventInfo)
{
var arrCookie = window.document.cookie;
arrCookie = arrCookie.split(";");
var arrCookie1;
this.alert(arrCookie);
for(var i=0; i<arrCookie.length; i++)
{
arrCookie1 = arrCookie[i].split("=");
if( arrCookie1[0] == "MenuID" ){
gv_MainForm.set_visible(false);
this.gv_Cookie = arrCookie1[1];
}
}
}
If we set nexacro platform's GlobalVariable's usecookie property true, we can verify cookie content.
We can verify cookie values on WebBrowser.
The test page of Cookie value is below. You can verify when you run below page.
Source Location
Sample\Application\np_Application_Cookie.xfdl
Verifying Cookie value and setting
This explains about verifying cookie value of web browser on nexacro platform Web broswer (html5).
Main source code
Setting cookie value
this.setCookie = function(cName, cValue, cDay){ var expire = new Date(); expire.setDate(expire.getDate() + cDay); cookies = cName + '=' + escape(cValue) + '; path=/ '; // Use escape(cValue) to prevent Korean breaking. if(typeof cDay != 'undefined') cookies += ';expires=' + expire.toGMTString() + ';'; window.document.cookie = cookies; }
Verifying set value
this.getCookie = function (cName) { cName = cName + '='; var cookieData = window.document.cookie; var start = cookieData.indexOf(cName); var cValue = ''; if(start != -1){ start += cName.length; var end = cookieData.indexOf(';', start); if(end == -1)end = cookieData.length; cValue = cookieData.substring(start, end); } return unescape(cValue); }
Receiving Get type
In case of Get type, you can verify forwarded value as parameter value(name) at end of called URL . Parameter name can be changed while developing.
Example) support.tobesoft.co.kr/index.html?name=nexacro platform
this.Button04_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { var address = unescape(location.href); var param = ""; if(address.indexOf("name", 0) != -1) { param = address.substring(address.indexOf("name", 0) + 5); } alert(param); }
This function is possible on Web browser method(HTML5).
Source Location
Sample\Application\np_Application_Cookie2.xfdl
Personalizing using setPrivateProfile / getPrivateProfile method
setPrivateProfile, getPrivateProfile are method to save for personalizing in Application, and get saved data.
Main Source Content
this.Button00_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { var bSucc; bSucc =application.setPrivateProfile("Data", this.Edit00.value); } this.Button01_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { var strValue; strValue = application.getPrivateProfile("Data"); alert(strValue); }
Reference
setPrivateProfile, getPrivateProfile method use localStorage in browser.
Cookie has valid time, and localStorage is not deleted unless user delete purposely.
Source Location
Sample\Application\np_PrivateProfile.xfdl
Run Environment of nexacro platform
We can verify information about the Run environment of nexacro platform
Main Source Content
this.Application_environment_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { this.alert(system.navigatorname); }
Reference Detail
navigatorname
This property returns the information of application environment For example) Broswer : nexacro IE Embedded : nexacro ActiveX Etc HTML5 : "IE", "Chrome", "Gecko" etc
Source Location
Sample\Application\np_Application_Navigatorname.xfdl
Can we get the environment information where nexacro platform is running?
Changing Image
Way to change the Loading Image (waitingimage )
nexacro platform calls service using transaction method for Data communication. While searching data a loading image appears. This is how to change the default image.
If you don't set loading property, the default image will be appeared.
Way to change ADL property
Open the project you want to change and then set the image which you want to use on loadingimage property in ADL property
When you set patch, please set the web patch
Image after changing
I want to know how to change the default image when data communicate.
I want to change waitingimage image.
TypeDefinition
Based on questions that asked frequently, this explains about TypeDefinition that is environment information being used in nexacro platform.
Services Information
We can verify the services information using application.services property.
Verifying information using application.services
Main Source Content
this.Application_Cookie_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { this.dsServices.clearData(); for(var i=0;i<application.services.length;i++) { this.dsServices.addRow(); this.dsServices.setColumn(this.dsServices.rowposition,"prefixid",application.services[i].prefixid); this.dsServices.setColumn(this.dsServices.rowposition,"type",application.services[i].type); this.dsServices.setColumn(this.dsServices.rowposition,"url",application.services[i].url); this.dsServices.setColumn(this.dsServices.rowposition,"cachelevel",application.services[i].cachelevel); } }
Reference Detail
When we want to change the value in Services, We can use as below.
application.services["Svc"].url= "./Next_JSP/nexacro/Service/";
Source Location
Sample\Application\np_Application_TypeDefinition_Services.xfdl
We access to TypeDefinition by collection way in script.
We access to each object through application.services[index], application.services["id"] and application.services.length etc .
Ways to access object, form and frame with each other in nexacro platform
This explains about way to access to Popup window, Form and Frame etc which are used for user interface (forwarding data with each other)/ controlling interface) using sample source developed by nexacro platform. This is simple content but users are confused while developing. Access way is dependence on frame structure. if you study this , you can do developing easily.
Running sample URL
http://www.xplatform.co.kr:8080/Next_JSP/Sample_call/index.html
Source download URL
http://www.xplatform.co.kr:8080/Next_JSP/Sample_call/Sample_call.zip
Way to forward Argument when a Popup Window calls
Argument is forwarded using parameter of method.
String, Dataset and Array etc can be used as forwarding Argument.
Refer to sample source below
Open
application.open("modeless","Base::Form1_Pop.xfdl",this.getOwnerFrame(), {mode:'modeless',ds:this.Dataset01}, "showtitlebar=true", 400, 200);
showModal
popWin.showModal(this.getOwnerFrame(),{mode:'modal',ds:this.Dataset01},this, "fn_pop_callback");
showModalWindow
system.showModalWindow(popWin,"modeless2",this.getOwnerFrame(), {mode:'showModalWindow',ds:this.Dataset01}, this);
showModalSync
system.showModalSync(popWin,"modal2",this.getOwnerFrame(), {mode:'showModalSync',ds:this.Dataset01}, this);
Way to check the forwarded value by Popup Window
Argument checking
Ex) this.parent.variable name this.parent.dataset name
In case the forwarded value is Dataset object
In case the forwarded value is Dataset, need to copy using copydada.
Ex) this.Dataset01.copyData(this.parent.dataset name);
If there is not bound dataset to component of Popup Form, dataset of upper form will be bound.
Way to access from Popup Window to parent Form
In case of accessing from Popup Window to parent Form, approach using opener attribute as below.
Ex) this.opener.object
Way to forward value from Popup Window to parent Form.
In case of forwarding value from Popup Window to parent Form, forward as the same form as below.
open, showModalSync
Access to function or object of parent Form and close Window after setting value using this.opener.
showModal
While closing window, value is forwarded by callback function which is set as parameter value of close function. (Only string type value is possible to forward.)
showModalWindow
Forward to argument of close method.
Way to access frame with each other
Accessing using full path name
application.mainframe.VFrameSet0.HFrameSet0.LeftFrame application.mainframe.VFrameSet0.HFrameSet0.WorkFrameSet.ChildFrame0
Accessing using index of all property
application.all[0].all[0].all[1].all[0] → LeftFrame application.all[0].all[0].all[1].all[1].all[0] → ChildFrame0
Accessing using id of all property
application.all["mainframe"].all["VFrameSet0"].all["HFrameSet0"].all["LeftFrame"]
Accessing frame with each other
1) Accessing using path name application.mainframe.VFrameSet0.HFrameSet0.LeftFrame.form 2) Accessing using index of all property application.all[0].all[0].all[1].all[0].form 3) Accessing using id of all property application.all["mainframe"].all["VFrameSet0"].all["HFrameSet0"].all["LeftFrame"].form
Way to access Global Dataset, Variable
Global Dataset
application.GlobalDatasetName Ex) application.gv_Ds
Global Variable
application.GlobalVariableName
Ex) application.gv_var1
Way to access Popup Windows connected to Application
application.popupframes["popupframeID"].form.object application.popupframes[0].form.object
Way to access from componet to parent Form
On Form
obj.parent
On Div
obj.parent.parent
On Tab
obj.parent.parent.parent
Way to access from grid component
Refer to content below way to access using expr on Grid. 1) comp : Grid 2) comp.parent : Parent Form 3) comp.parent.object : component of Form
Notes for Nan, Infinity, null
In case there is null value in Dataset data, nexacro recognizes the value as undefined value. If null values are involved in arithmetic operations, data is output abnormally. This describes ways to solve this error.
NaN(undefined)
phenomenon
Solution
NaN, Infinity and Null value can be replaced with number using toNumber() method provided by nexacro.
Syntax) nexacro.toNumber(varValue [, varNanVal [, varPinfVal [, nIfnVal]]])
Source Location
Sample\Application_sample\np_Operation.xfdl
Infinity
phenomenon
In case Row count of dataset is zero or column value of all rows is blank or column type is string, return value of getAvg() is displayed as Infinity.
Solution
NaN, Infinity and Null value can be replaced with number using toNumber() method provided by nexacro.
Syntax) nexacro.toNumber(varValue [, varNanVal [, varPinfVal [, nIfnVal]]])
Source Location
Sample\Application_sample\np_Operation2.xfdl
Reference
In case column type of dataset is numeric types, the value should be defined as numeric value or 0.
Please set number value when you add value to numeric type column of DataSet using script.
for(var i=0;i<this.Dataset00.getRowCount();i++) { if((this.Dataset00.getColumn(i,"Column0") == null) || (this.Dataset00.getColumn(i,"Column0") == "")) { this.Dataset00.setColumn(i,"Column0",0); } }