Binding data to a combo widget

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:

  1. Create a transaction file, and enter test.transaction in the File name field of the New Transaction window.
  2. Open the test.transaction file in the Transaction editor, and then click the Data tab.
  3. 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.
    1. Right-click in the Data panel, and then click New Child > kColl.
    2. In the Id field that is in the Detailed Information panel of the kColl that you are creating, enter testData.
  4. Create an iColl in the test.transaction file as a root data container.
    1. Right-click in the Data panel, and then click New Child > iColl.
    2. In the Id field that is in the Detailed Information panel of the iColl that you are creating, enter testCombo.
    3. In the Size field in theDetailed Information panel, enter 3.
  5. Create a kColl as a child data element of the testCombo iColl.
    1. Right-click the testCombo iColl, and then click New Child > kColl.
    2. In the Id field of the child kColl that you are creating, enter comboData.
  6. Create a child field element for the root testData kColl.
    1. In the Data panel, right-click the testData kColl, and then click New Child > field.
    2. 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.
  7. Create a child refData element for the root testData kColl.
    1. Right-click the testData root kColl, and then click New Child > refData.
    2. In the RefId field of the refData element, click the Browse icon. The Select Data window is opened.
    3. In the Select Data window, expand Local, and then click iColl [testCombo]. Click OK.
  8. Define a context for the test.transaction file.
    1. In Transaction editor, click the Context tab.
    2. Right-click in the Context panel, and then click New Child > context.
    3. In the Id field of the Detailed Information panel, enter testContext.
    4. In the Context panel, right-click the context that you are defining, and then click New Child > refKcoll.
    5. In the RefId field of the Detailed Information panel, click the Browse button. The Select KeyedCollection window is opened.
    6. In the Select KeyedCollection window, expand Local, and then click kColl [testData]. Click OK.
  9. Save the test.transaction file.
  10. In the Project Explorer view, double-click the testOperation.java file, and then add the following code:

  11. In the Project Explorer view, right-click the test.transaction file, and then click Transaction Editor > Generate BTT Transaction XML.
  12. Create an XUI file, and then bind the XUI file to the testContext context.
    1. Create an XUI file. For information on how to create an XUI file, refer to the Creating an XUI file topic.
    2. Open the XUI file in the XUI editor, and then click on the grey area of the XUI editor area.
    3. In the Properties view, click Select Context. The Please select a context window is opened.
    4. Expand processors, and then expand test, and then click testContext. Click OK.
  13. 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.