Sample Project (Creating Search Form-list.xfdl)

Search form is a type of forms searching data of customer management per condition. As executeing this project,

Generating Project

The process to create Project, to add Forms and to design Compositions is required in order to create programs.

The orders are as follows:

Creating Project

Execute UX-Studio of XPLATFORM development tools.

  1. Select the menu “Creating Project”. (File > New > Project)

  1. Specify Names and Locations using “Project Wizard”.

  1. Specify generating files of ADL and Type Definition using“Project Wizard”.

  1. Options used in “Project Wizard”are as follows:

Properties

Description

Name

Demo

Location

C:\DocumentsandEnvironment\LoginUserID\MyDocuments\TOBESOFT\XPLATFORM\demo

Character Set

utf-8

Language

Korean

TypeDefinition

Create new TypeDefinition from default

TypeDefinition

C:\DocumentsandEnvironment\LoginUserID\MyDocuments\TOBESOFT\XPLATFORM\demo\default_typedef.xml

  1. Once completing “Creating Project”, the projet created in UX-Studio is opened.

Creating Form

  1. "Creating Form" menu is selected. (File > New > Item > Form)

  1. Specify names of files and their saving location using“Create New Form Wizard” window.

  1. Specify Inheritance using “Create New Form Wizard” window.

  1. Specify Position using “Create New Form Wizard” window.

  1. Options used in “Create New Form Wizard” are as follows:.

Properties

Description

Name

List

Location

Base

Width

800

Height

600

  1. Once completing“Creating Form”, Form created in UX-Studio is opened.

  1. Specify titletext property values of Form as “Customer List Search”.

Designing Dataset Column

Dataset compositions received data from the server and provide data to Grid.
Dataset not only stores data and informs the transformed status (add/modify/delete) of data. Modified data store original data prior to their modification.
Dataset have Column structure due to saving data in 2D table format and treat data with the unit of Row and Record.
In one from, more than one Dataset cannot be stored.
If data are common contents for the entire project, Dataset can be used in multiple forms at the same time by using Global Dataset.

Creating Dataset - : Dataset

From the composition tool bar, select .

Wherever clicking any parts, Dataset is created at “Invisible Objects”.

Due to Dataset is a type of compositions, properties and events are specified by using “Properties” windows.
Specify Dataset ID to “dsCustomers”.

Designing Dataset Column

Dataset stores data in 2D table format.
Data for testing can be employed to designing by entering directly.
Design of Dataset uses “Dataset Contents Editor” window.
“Dataset Contents Editor” window is shown up by double-clicking applicable Dataset.

“Const Columns” information at the top is treated as Const Value and creates “Const Column” if it has common value for all records(Record, Row).
“Columns” information in the middle is the place to design the shape of record.
“Rows” at the bottom is a part which sets up data for testing.
For details of usage, please refer to “UX-Studio Guide”.

The procss of adding column information and data for testing are as follows:

  1. Open “Dataset Contents Editor” window and create a Column in the middle part of “Columns” part. Adding column is created by clicking the button located at the“Columns” tool bar.

  1. Set up “ID”, “Type” and “Size” in added column information.

    Specify “ID” not to have duplicated value within the same Dataset.

    Korean Column ID is allowed. However, it could be hard to recongnize if encoding does not match well. So, Korean Column ID is not recommended if possible.

    There are “Types” of STRING, INT, FLOAT/DECIMAL, DATE/DATETIME/TIME, BIGDECIMAL, BLOB and etc.

    Since specifying “Size” is free but its limit is all different by type, it would be better to specify as the length that type allows. If data exceeding their limit are sent in, data in allowed area is permiited but rest of them are cut off or ignored.

Dataset Contents Editor(dsCustomers)

Id

Type

Size

Contents

id

String

4

Serial Number

name

String

16

Name

email

String

32

Email

birthday

String

8

Date of Birth

phone

String

16

Phone Number

home_addr

String

256

Home Address

company

String

32

Company Name

jobtitle

String

32

Position

busi_phone

String

16

Company Phone Number

busi_addr

String

256

Company Address

The completed features are as follows:

  1. Data for testing can check the print contents of the form without any connection to the server when designing them. In order to add data for testing, they can be directly registered after adding record by clicking button in Rows” parts.

Composing Form (1) : Title and Search Button Design

Here, the title and search button will be added to the basic search program.
Compositions use Static and Div Button.

Creating Title - Static : Static

Create “Static” by selecting at the composition tool bar.

Revise properties of “Static” as follows:

Static

Properties

Value

Description

id

sttList


text

Customer List Search


Creating Division - Division: Div

By selecting at the component tool bar, create Division(“Div”).

Revise properties of division(“Div”) as follows:

Division(Div)

Properties

Value

Description

id

divCommand


Creating Button - Button : Button

Create Button at the component tool bar by selecting .

Revise properties of Button as follows:

Button

Properties

Value

Description

id

btnSearch


text

Search


Composing Forms (2): Grid – Column Design

Grid components print data to the form by binding dataset. Since it is possible to print and to enter through Grid by binding Grid to Dataset, data of Dataset can be modified.
All the tasks are executeed centered Dataset which are binded and reflected as Dataset in real-time.
If, adding record to Dataset, record added to Grid is print.
If modifying data through Grid, binded data of Dataset is modified right away. When data is printed or entered, Grid can provide Format. For users easier understandability of data, it is possible to set up“-“words and etc. to be shown up when printing out. When entering the date, it is possible to choose the entering format of date type not to exceed the area of availability.

Designing Column

Draw it on the form by selecting at the component tool bar.

When trying to bind Dataset to created Grid, select applicable Grid, set up the ID as “grdCustomers” in “Properties” window which can specify properties of component and click selection items by finding “binddataset”. When the list of Dataset and common Dataset are opened, select Dataset to bind.

When designing Grid, the initial features only show the area displays as above. Drag Dataset to connect and move it to the top of Grid.

By double-clicking Grid, it is possible to confirm that all columns of Dataset are designed on Grid.

Select columns which need to be changed and modify them by using property windows shown on the right.
Select columns needed to be deleted, and work on them by pop-up menu shown when clicking the right button of a mouse. For changing the order of columns, employ “Cut” and “Paste” menu. Since data in XPLATFORM program are stored in Dataset, and gird are used by binding Dataset, it is required to design only columns which meant to be exposed.
Now, columns of grid and of Dataset are about to bind together.
This task is only possible under the situation that binddataset value of grid has been set.
Select columns of grid which are bound. Then, a window of properties for columns which are selected on right of “Grid Contents Editor” is shown up.

Select columns of Dataset to bind in the “text” items of “Binding”groups.
Grid used in the sample would design columns as follows:

Grid Contents Editor(grdCustomers)

Order of Columns

Head Cells : text

Body Cells : text

Size of Columns

col0

ID

bind:id

80

col1

Customer names

bind:name

150

col2

Email

bind:email

200

Company names

bind:company

col3

Date of Birth

bind:birthday

150

Position

bind:jobtitle

col4

Phone Numbers

bind:phone

150

Company Phone numbers

bind:busi_phone

  1. Delete columns from col5 to col9.

  1. In order to make headers in 2 lines, rows are added.

  1. In order to make data in 2 lines, rows are added.

  1. Please confirm that both rows of head and body are extended.

  1. Both ID and name data combine 2 lines of headers as one.

  1. Entering header text.

  1. Both ID and name data combine 2 lines of rows as one.

  1. Bind data to each cell.

  1. Specify the size of column.

Complete by clicking “OK” button after finishing all the tasks.

Creating Script: Button - Dataset load

It is a method to call service (search.jsp) implemented in the server when activating program. It is progressed under assumption that the service has been already completed. Create button for calling service in the form and create script for receiving data in Dataset by calling server service while clicking.

Create Button Script

In order to create script, select “Search” button, enter the function name (divCommand_btnSearch_onclick) to bind with input by finding “Onclick” event from the event list in “Properties”window and finally press <Enter> key. Or it automatically enters the name of function and moves to the script tab of Work Area by double-clicking the mouse during empty status. At this time, function to be registered autometically is created as “[Event Name]_[Component Name]”, and if there are the same name of functions existed already, an input cursor moves to the location of applicable function of Script tab. If there is not any same name of functions, it moves to applicable location after creating function at script.

Creating Data Adding Script

Without calling server service first, data is added directly to the script. The contents of script to create are as follow:

function divCommand_btnSearch_onclick(obj:Button, e:ClickEventInfo)
{
	var row = dsCustomers.addRow();
	dsCustomers.setColumn(row, "id", "0");
	dsCustomers.setColumn(row, "name", "James Carman");
	dsCustomers.setColumn(row, "email", "carman@live.com");
	dsCustomers.setColumn(row, "birthday", "19650925");
	dsCustomers.setColumn(row, "phone", "619-987-6543");
	dsCustomers.setColumn(row, "home_addr", "1234 Bonnie Ct. San Diego");
	dsCustomers.setColumn(row, "company", "Oracle Corporation");
	dsCustomers.setColumn(row, "jobtitle", "Consultant");
	dsCustomers.setColumn(row, "busi_phone", "+1.650.506.7000");
	dsCustomers.setColumn(row, "busi_addr", "500 Oracle Parkway Redwood Shores");
}

The method of reading object properties of event information(EventInfo)

Evnent of XPLATFORM has all the same Argument structure.

The first argument delivers objects generating event to “obj”.

According to the type of objet, the list of members which are approachable become different.

The type of object is written by putting “.” after “obj” for the object types.

The second argument is “e” which is object managing diverse information to be delivered to the event.

The member of Event Information (EventInfo) object becomes different by types of event information.

To confirm the accessible member list, please refer to “Help”.

To excute running test using Execute Form of HTML5, the form is executed as follows:

Creating Service Calling Script

It is a script giving and taking serer by interlocking OGI of server.

Features calling the service used transaction methods.

transaction?

Transaction is a method calling service to renew the value of Dataset and execute CallBack Function after completing transaction.

transaction(strSvcID,strURL,strInDatasets,strOutDatasets,strArgument
    ,strCallbackFunc[,bAsync[,bBinary[,bCompress]]]);

Parameters

Type

Description

strSvcID

String

It is an ID value for identifying transaction.

strURL

String

It is an address value calling transaction.

strInDatasets

String

It is a Data ID to be sent as the input value when calling transaction. Each pair of ID is identified as empty spaces and matches with the real name in forms of a=b.

strOutDatasets

String

It is a Dataset ID to receive the result of processing for transaction. Its usage is the same as above.

strArgument

String

It is an argument value for transaction. Its usage is the same as above.

strCallbackFunc

String

It is the name of Function to return the result of transaction.

bAsync

Boolean

It specifies whether to synchronize or not. Default : true

bBinary

Boolean

It specifies whether to send in forms of Binary. Default : false

bCompress

Boolean

It specifies whether to press PostData or not during communicating.

Default : false

It operates in unsynchronized forms in general.

Options of ':U', ':A', ':N' can be attached on strInDatasets.

':U' only sends the renewed contents to strInDatasets, but ':A' sends all information. ':N' sends Data in general status excepting current Delete. Unspecified Dataset is operated by General.

Delete pre-created script but recreate service calling scripts.
Script contents to be created are as follows:
function divCommand_btnSearch_onclick(obj:Button, e:ClickEventInfo)
{
	var id = "search";
	var url = "http://127.0.0.1:8080/xplatform9-ajax/search.jsp”;
	var reqDs = "";
	var respDs = "dsCustomers=customers";
	var args = "";
	var callback = "received";
	transaction(id, url, reqDs, respDs, args, callback);
}

Creating Callback Functions of Transaction

If calling server services by transaction methods, execute callback functions specified in all situations of normal or abnormal calling. In order to implement scripts, it is required to create scripts with proper function names and to deliver callback functions by arguments while calling transaction methods.

The contents to be created are as follows:

function received(id, code, message)
{
if (code == 0) {
alert(dsCustomers.rowcount + "numbers of data have been found.");
} else{
alert("Error["+code+"]:"+message);
}
}
After creating scripts, implementing buttons from the HTML5 tool bars are .
It can be implemented in orders.
By execute the program and clicking the search button with Execute Form Menu of HTML5, it operates as follows:

Creating Grid Combo

They can show Grid Cell in diverse components and can edit.
One of them is Combo. For the forms of selection list showing multiples of smaple values, use Combo. To find out all possible components, please refer to “Help”.
  1. Add Dataset included in Combo of Grid.

Dataset

Properties

Value

Description

id

dsJobTitle


Dataset Contents Editor(dsJobTitle)

Id

Type

Size

Contents

Code

String

256

Code

value

String

256

Value

Dataset Contents Editor(dsJobTitle)

code

data

0

Analyst

1

Assistant

2

CEO

3

CFO

4

CIO

5

Consultant

6

Director

7

Engineer

8

Manager

9

Programmer

10

Specialist

  1. By selecting and double-clicking Grid from the form, show up the window of “Grid Contents Editor”.

  1. By using the window of“Grid Contents Editor”, properties of “Position” columns would be modified.

    First, if selecting displaytype as “combo” and combodataset as “dsJobTitle”, columns to bind at combocodecol and cobodatacol is appeared.

Grid Contents Editor(grdCustomers)

Properties

Value

Description

displaytype

combo


combodataset

dsJobTitle


combocodecol

code


combodatacol

value


Bu using Execute Form menus of HTML5 and executeing running test, it is implemented as follows:

Creating Searching Condition: Staic and Edit

Here now, the features of searching conditions will be added to the basic searching programs. On the form, conditional parts will be added as well. For this, Static and Edit of components are used.

Creating Titles - Static : Static

By selecting  from the component tool bars, “Static” is created.
Properties of “Static” are to be revised as follows:

Static

Properties

Values

Description

id

sttSearch


text

Customer Names


Creating Edit - Edit : Edit

Create “Edit” on the form by selecting  from the component tool bar.
Revise properties of “Edit”as follows:

Edit

Properties

Value

Description

id

edtSearch


Creating Service Calling Script

Add scripts for conditional searching. Only prior scripts and modified parts are “url”, and rest of them is the same. Contents of Script to create are as follows:

function divCommand_btnSearch_onclick(obj:Button, e:ClickEventInfo)
{
	var id = "search";
	var url = "http://localhost:8080/xplatform9-ajax/search.jsp?keyword=" 
		+ divCommand.edtSearch.text;
	var reqDs = "";
	var respDs = "dsCustomers=customers";
	var args = "";
	var callback = "received";
	transaction(id, url, reqDs, respDs, args, callback);
}

Compiling and Execution

From the patch version of February 2012, Server Compile method is changed to Local Compile method for compile speed enhancement. That means, while compile has been conducted in Server it is now conducted in Client (PC) from the version. The existing Server Compile method transfers compile objects such as *.xadl and *.xfdl to Server, and then Server Compile module compiles the transferred files and create *.js files in Server. However, the Local Compile method calls a local compile module, XHTML5Complier.exe, in UX-Studioand this module compiles objects such as *.xadl and *.xfdl and create *.js files in client. Local compiled file names are identical to those of the existing server compile methods.

Entire Project Compile

As information related to a project is not yet compiled, the entire project should be compiled before running the developed display.
Clicking UxStudio> HTML5 Menu > Compile Application Menu, the entire project shall be compiled.

Folder where compiled file shall be located is set in UX-Studio> Tools > Options > HTML5 > Compiled Path.
Compiled Path is set as “<Tomcat Home>/webapps/xplatform9-ajax/projects”. In this example, as the project title is “demo”, the actual folder for saving the project is “<Tomcat Home>/webapps/xplatform9-ajax/projects/demo/…”.

Yet, when Server, not PC, runs WebServer, the compiled output should be manually copied to the Server in order to be executed. This will be automated in the future.

Files to be compiled and compiled files are summarized as table below.

Files to be compiled

Compiled files

Description


LaunchProject.jsp

Initial HTML file to be run in WebBrowser


QuickView.jsp

HTML file to be run when QuickView is executed.

*.xadl

*.xadl.js

ADL file

*.xadl.debug.js

ADL file for debugging

/Service /*.xfdl

/Service /*.xfdl.js

FDL(Display) file

/Service/*. xfdl. debug.js

FLD(Display) file for debugging

__theme__/…/*.css

__theme__/…/*.css.js

CSS file of theme

__theme__/…/*.png,…

__theme__/…/*.png,…

Image Files, file name remains the same when compiled

QuickView Execution

  1. It is about how to run one developed list.xfdl display.

    Compile list.xfdl display. Click UX-Studio> HTML5 menu > Compile File menu. As the project title is “demo” and service group name is “Base” in this example, the actual save location for the compiled display is “<Tomcat Home>/webapps/xplatform9-ajax/projects/demo/Base/list.xfdl.js”.

  1. Run UX-Studio> HTML5 Menu > QuickView Menu. For execution in the debug mode, run QuickView Debug Menu.

Set “http://127.0.0.1:8080/xplatform9-ajax/projects/demo/QuickView.jsp”, the execution path, in QuickView dialogue and click OK. The same applies to execution of QuickView Debug Menu.

  1. WebBrowser is run, and “http://127.0.0.1:8080/xplatform9-ajax/projects/demo/QuickView.jsp?formname=Base::list.xfdl” shall be executed. If QuickView Debug Menu is run, and http://127.0.0.1:8080/xplatform9-ajax/projects/demo/QuickView.jsp?formname=Base::list.xfdl&debugmode=true shall be executed.

# Execute Application

For execution of one display only QuickView is used, but for that of the entire project Execute Application menu is used. Followings are how to execute the entire project.

  1. Compile the entire project. Details are skipped as identical to 1) above.

  2. Run UX-Studio > HTML5 Menu > Execute Application menu.

Set the LaunchProject.jsp execution path, “http://127.0.0.1:8080/xplatform9-ajax/projects/demo/LaunchProject.jsp”, in LaunchProject dialogue and then Click OK.

  1. WebBrowser is run and “http://127.0.0.1:8080/xplatform9-ajax/projects/demo/LaunchProject.jsp” shall be executed.