IBM WebSphere Multichannel Bank Transformation Toolkit, Version 7.1

Setting up a self-defined service

About this task

To set up a self-define service, do the following steps:
  1. Define the service list in service XML file, which supports following two service definitions:
    • Define Service with widget attributes:
      <ServiceCategory id="2" name="web2_transaction" desc="web2_transaction" 
      logo="theme/servicelogo/serviceCategory.gif">
      	    <Service id="2.3" name="account_transfer" desc="account_transfer" 
      logo="theme/servicelogo/navlogo.gif">
      	        <Widget name="account_transfer"></Widget>
          	</Service>
      		</ServiceCategory>
    • Define Service without widget properties:
      <ServiceCategory id="2" name="web2_transaction" desc="web2_transaction" 
      logo="theme/servicelogo/serviceCategory.gif">
      	    <Service id="2.4" name="self-defined" desc="self-defined" logo="theme/servicelogo/navlogo.gif"/>	
      </ServiceCategory>
  2. Handle the event from the service list. BTT Web 2 On-Demand Workplace provides an interface addEventHandler for you. You can refer to the following table:
    Table 1. Service list
    API Input Output
    BTTUtil.servicelist.addEventHandler P1(service id), P2(event name), P3(handler), P4(scope) When the event is triggered, the corresponding handler under the specified scope is invoked.
    Note that P1(service id) and P4(scope) are optional. If you do not define service id, it will add the specified listener to all the services in the definition. And the default scope is window. The following four examples show how to add Event listener:
    1. Example 1: Add event listener for all of the service:
      		BTTUtil.Servicelist.addListener( 'onclick', function(servId){
      			if(!BTTUtil.Servicelist.isCategoryNode(servId)) {
      				BTTUtil.Workarea.addService(servId);
      			}
      		});
    2. Example 2: Add Event listener for a specified service:
      BTTUtil.Servicelist.addListener('2.3', 'onclick', function(){
      			if(!BTTUtil.Servicelist.isCategoryNode('2.3')) {
      				var tabId = BTTUtil.Workarea.addTab();
      				var columnId =BTTUtil.Workarea.addColumn(tabId);
      				BTTUtil.Workarea.addService(columnId,'2.3');
      			}
      		});
    3. Example 3: Add Event listener for a service category:
      1. Define a variable
        var testScope = {
        		test1:100
        	};
      2. Add listener for a specified service category with parameter scope
        BTTUtil.Servicelist.addListener('2', 'expand', function(){
        			if(BTTUtil.Servicelist.isCategoryNode('2')) {
        				alert("expand");
        				alert(this.test1);
        			}
        		}, testScope);	


Feedback