This section provides an example of how to bind data to
a combo widget.
Procedure
To bind data to a combo widget, do the following example
steps:
- Create a transaction file, and enter test.transaction in
the File name field of the New Transaction window.
- Open the test.transaction file in
the Transaction editor, and then click the Data tab.
- Create a kColl as the root data container.
Note: Every .transaction file
must have at least one kColl data type as a root data container.
- Right-click in the Data panel,
and then click .
- In the Id field that is in the Detailed
Information panel of the kColl that you are creating, enter testData.
- Create an iColl in the test.transaction file
as a root data container.
- Right-click in the Data panel,
and then click .
- In the Id field that is in the Detailed
Information panel of the iColl that you are creating, enter testCombo.
- In the Size field in theDetailed
Information panel, enter 3.
- Create a kColl as a child data element of the testCombo
iColl.
- Right-click the testCombo iColl, and then click .
- In the Id field of the child
kColl that you are creating, enter comboData.
- Create a child field element for the root testData kColl.
- In the Data panel, right-click
the testData kColl, and then click .
- In the Id field of the field
data element that you are creating, enter comboName.
Note: There are two
ways to set the value for a field:
- The user can directly input the field value in the field value
property.
- Or the user can set the value in the class dynamically.
For the purpose of this example we will proceed with the second
option.
- Create a child refData element for the root testData kColl.
- Right-click the testData root kColl, and then click .
- In the RefId field of the refData
element, click the Browse icon. The Select
Data window is opened.
- In the Select Data window, expand Local,
and then click iColl [testCombo]. Click OK.
- Define a context for the test.transaction file.
- In Transaction editor, click the Context tab.
- Right-click in the Context panel,
and then click .
- In the Id field of the Detailed
Information panel, enter testContext.
- In the Context panel, right-click
the context that you are defining, and then click .
- In the RefId field of the Detailed
Information panel, click the Browse button. The Select KeyedCollection window
is opened.
- In the Select KeyedCollection window,
expand Local, and then click kColl
[testData]. Click OK.
- Save the test.transaction file.
- In the Project Explorer view, double-click
the testOperation.java file, and then add the
following code:
- In the Project Explorer view, right-click
the test.transaction file, and then click .
- Create an XUI file, and then bind the XUI file to the testContext
context.
- Create an XUI file. For information on how
to create an XUI file, refer to the Creating an XUI file topic.
- Open the XUI file in the XUI editor, and then click
on the grey area of the XUI editor area.
- In the Properties view, click Select
Context. The Please select a context
window is opened.
- Expand processors, and then expand test,
and then click testContext. Click OK.
- Place a combo widget into the XUI editor area, and then
bind the dataName property of the combo widget to comboName, then
bind the dataNameForList of the combo widget to testCombo.
Results
Data is bound to the combo widget.