Implementing the client applications for Rich Client

To develop a Rich Client sample, perform the following steps.
  1. Configure the BTT configuration files.
    The following configurations are important to the connection with the BTT server side:
    1. Add CSClient class mapping to the services in btt.xml as follows:

      Configuring BTT configuration files

    2. Add CSClient configuration to dsesrvce.xml. The id is the unique identifier for this CSClient. You can use CSClient.getCSClient(id) to get an initialized CSClientService instance. The ServerName is the path of the server side Web project, which holds C/S connectivity servlets.
      <CSClient id="realCSClient"
        serverName="http://localhost:9080/BTTSampleWeb"
        sessionType="NonSecure" retryOnError="true"			
        csAssignServletName="/servlet/com.ibm.btt.cs.servlet.CSAssignServiceIdAndServerTIDProtocolServlet"	
        csNotifClToSrvServletName="/servlet/com.ibm.btt.event.CSNotifClToSrvProtocolServlet"			
        csNotifSrvToClServletName="/servlet/com.ibm.btt.event.CSNotifSrvToClProtocolServlet"			
        csReqProtocolServletName="/servlet/com.ibm.btt.cs.servlet.CSReqProtocolServlet"
        usedForServerToClientEventNotification="true"
        reconnectionAttempts="20"
        timeBetweenReconnectionAttempts="10000" userAgent="CSClient"
        useProxy="false" proxyHost="localhost" proxyPort="9080"
        serverCredentials="cred:cred" proxyCredentials="cred:cred"
        defaultOperationTimeout="10000" keepAliveConnection="false"
        runInSession="true" setTcpNoDelay="true" sendBufferSize="0"
        permanentConnectionForEvents="true" eventsPort="8082"/>
  2. Establishing BTT C/S connectivity.
    Add the following code into your plug-in project Activator class start (BundleContext context) method to establish BTT C/S connectivity.
      //init btt configuration files
        InitManager.reset("jar:///btt/btt.xml");		
      
      //create root context, the first context which created is the root.
        ContextFactory.createContext("branchClientCtx");		
    
      //establish Client/Server connectivity
        CSClientService cs = CSClient.getCSClient("realCSClient");
        cs.setKeepAliveConnection(false);
        cs.establishSession();
    
      //send client info to server to create session context
        BTTOperation oper = (BTTOperation) BTTOperation.readObject("startupClientOp");
        oper.execute();
        oper.close();
    Where:
    • InitManager is used to initialize BTT configuration files.
    • CSClientService is the key class used to establish, send and receive information from the server side.
    • StartupClientOp is used to create session context in the server side. According to your requirement, this operation can be executed after login.
    Note: This is a sample code. You can create root context according to your requirement, such as branch information context, teller information context and so on.
    Remember to close Client/Server connectivity in Activator class stop (BundleContext context) method:
      //logoff and dispose session context in server side.
        BTTOperation oper = (BTTOperation) BTTOperation.readObject("logoffClientOp");
        oper.execute();
        oper.close();
    
      //close Client/Server connectivity
        CSClientService cs = CSClient.getCSClient("realCSClient");
        cs.closeSession();
  3. Creating client operations.
    This step is to develop client operations for each transaction panels. You only need to extend BTTClientOperation. Following is a sample code for SingInClientOperation.java:
    package com.ibm.btt.rcp.sample.operation;
    
    import com.ibm.btt.base.BTTClientOperation;
    import com.ibm.btt.base.OperationRepliedEvent;
    import com.ibm.btt.clientserver.CSClientService;
    import com.ibm.btt.cs.servlet.CSClient;
    
    public class SignInClientOperation extends BTTClientOperation {
    
        private static final long serialVersionUID = -4709541432084340756L;
        
        public void execute() throws Exception {
        CSClientService csClientService = CSClient.getCSClient("realCSClient");
        csClientService.sendAndWait(this,60000);
        fireHandleOperationRepliedEvent(new OperationRepliedEvent(this));
        }
    }
    Where, the sendAndWait() method is used to send client information to the server side, and when the server side replies, an operation replied event will be fired.
    Following is the sign-in operation definition in dseoper.xml:
    <operation id="signInClientOp" context="signInCtx"
      implClass="com.ibm.btt.rcp.sample.operation.SignInClientOperation"
      serverOperation="signInOp">
      <refFormat name="csRequestFormat" refId="signInRecFmt" />
    </operation>
  4. Developing the transaction panel.

    You can develop SWT based transaction panels using the SWT Visual Beans Editor. This tools is used to graphically develop SWT based transaction panels. Following is the screen capture of sign in dialog. The main logic of this dialog is SignInComposite class. For steps to develop SWT UI panels with SWT Visual Beans Editor, refer to the Tasks of the SWT Visual Beans Editor.

    Sign in dialog of Rich Client

  5. Deploying the transaction panel

    To deploy a transaction panel to Rich Client application by extending the extension points:

    1. Create an activity extension to launch this transaction panel. For more information, refer to Creating an activity to launch the transaction panel in the Rich Client Infrastructure document.

      Screen capture of Creating an activity extension

    2. In order to launch this transaction activity, create a navigation item extension to add a tree node to the navigator view. For more information, see Creating a navigation item in the Rich Client Infrastructure document.

      Screen capture of creating a navigation item extension

  6. Specifying perspective layout

    The layout of the perspective can be specified by configuring an XML file. The path of this file can be set in extension points. BTT also provides a pre-activity for you to launch an activity before initializing the perspective. This activity is to specify which perspective definition file will be used. Different definition files create different perspective layouts.

    For more information about the parameters of Rich Client Perspective Definition, see Creating a navigation item in the Rich Client Infrastructure document.

  7. Specifying SWT theme.

    BTT Rich Client supports changing theme for SWT widgets. The themes are differentiated by their ID. There is only one default theme. It applies to navigator view, working area view and other BTT pre-built views. For other non-default themes, you can use them by calling the Theme API.

    To use default theme, use the ThemeManager.applyDefaultTheme(Control control API. To use non-default theme, use the ThemeManager.applyTheme(Control control, String themeId) API.

    Screen capture of specifying SWT theme

    For more information about BTT SWT Theme, see Configuring SWT Theme in the Rich Client Infrastructure document.

  8. Integrate complex applications.
    This sample shows these application integrations:
    • SWT based applications
    • Swing based applications
    • Microsoft® Word
    • Microsoft Outlook
    • Web based URL applications
    • Web based file(html, mht…) applications

    For more information about complex application integration, see Integrating complex application in the Rich Client Infrastructure document.

  9. Migrate to Lotus® Expeditor.
    You can run this application easily on IBM® Lotus Expeditor.
    Note:
    • Use com.ibm.btt.rcp.broker.xpd as the property broker plug-in. This plug-in offers the unique API for both BTT application and Lotus Expeditor property broker. To communicate between local portlet applications and BTT applications, use this plug-in.
    • Use com.ibm.eswe.workbench.WctApplication extension point to link to BTT Rich Client perspective.
    • Use com.ibm.rcp.personality.framework.personalities to simulate workbench window functions.