454 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
Table 8-9 Swing components
8.4.4 Connecting the view to the operation
To link the client operation to the view, the following tasks need to be complete:
򐂰 Defining the fields in view, that will interact with the operation. This task was
completed when you set the DSE_dataName properties of the components in
the OperationPanel.
򐂰 Setting the operation attribute of the view with the client operation
instance.This too was done when you specified the DSE_operationName
property of the OperationPanel.
SpComboBox beanName:vbAccountNumber
DSE_dataName:AccountNubmer
DSE_dataNameForList:accountListData
SpTextField beanName:vbAmount
DSE_dataName:Amount
DSE_mandatory:true
DSE_autoTab:true
DSE_maxChar:5
DSE_formatter:FloatFormatter
SpLabel beanName:vbAccountBalance
DSE_dataName:AccountBalance
SpErrorList beanName:vbErrorList
SpButton beanName:vbWithdrawal
text:OK
DSE_type:ok
SpButton beanName:vbClose
text:Close
DSE_type:close
Swing beans Properties
JLabel text:Customer Name:
JLabel text:Select Account Nubmer:
JLabel text:Amount:
JLabel text:Available Balance:
JLabel text:Error Messages:
DSE visual beans Properties
Running H/F 1 455
򐂰 Notifying the view when the operation execution is finished. You may have
noticed that when carrying out visual composition, you were setting the
attribute DSE_dataName of the input and output components as the ID of the
fields from the operation context. This is all that you require to define which
fields will interact with the operation context.
In order to create a client operation instance, initialize the Branch Transformation
Toolkit environment. In this sample, since you are working in a client/server
environment, initialize the complete Branch Transformation Toolkit client
environment. To do this, use the initialize() method of the view that has been
automatically created.
1. Navigate to the class declaration of the WithdrawalView (right-click it and
select Open With Java Editor), add a statement to import the contents of
the com.ibm.dse.base package, as shown in Example 8-40.
Example 8-40 Add import class
...
import java.io.BufferedInputStream;
import com.ibm.btt.dse.base.*;
import com.ibm.dse.clientserver.CSClientService;
...
2. Create a new method named initEnv() in the class WithdrawalView that
throws Exception. This method initializes the entire Branch Transformation
Toolkit client environment.The source code is shown in Example 8-41.
Example 8-41 Add method initEnv
...
private void initEnv() throws Exception{
String iniPath =
"http://127.0.0.1:9080/BTTBankAppClientWeb/dse/dse.ini";//$NON-NLS-1$
Context.reset();
Settings.reset(iniPath);
Settings.initializeExternalizers(Settings.MEMORY);
Context context= (Context)Context.readObject("workstationCtx");
System.out.println(context);
System.out.println(context.getService("CSClient"));
((CSClientService) context.getService("CSClient")).establishSession();
ClientOperation anOp =
(ClientOperation)DSEOperation.readObject("startupClientOp");
anOp.execute();
}
...
456 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
3. Add a call to this method in initialize() at the top of the method. See
Example 8-42.
Example 8-42 Add method initEnv() into initialize()
//user code begin {1}
try{
initEnv();
}catch(Exception e){
System.out.println(e.toString());
}
//user code end
4. Use the refresh method to update the visual components at the end of the
method. See Example 8-43.
Example 8-43 Add refresh method into initialize method
// user code begin {2}
refresh();
// user code end
This step is necessary if you require interaction between the view
components and the operation when the operation execution is completed. In
this sample, the view should get the AccountBalance and the
TrxErrorMessage values when the operation finishes.
After you have completed step 3 and step 4, the initialize() method will look as
shown in Example 8-44.
Example 8-44 Initialize method
private void initialize() {
//user code begin {1}
try {
initEnv();
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(e.toString());
}
//user code end
this.add(getSpLabel(), null);
this.add(getJLabel(), null);
this.add(getJLabel1(), null);
this.add(getSpComboBox(), null);
this.add(getJLabel2(), null);
this.add(getJLabel3(), null);
this.add(getJLabel4(), null);
this.add(getSpTextField(), null);
this.add(getSpButton(), null);

Get IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.