Developing and deploy SWT code based transaction panels

About this task

You can develop SWT based transaction panels using the SWT Visual Beans Editor. This tool is used to graphically develop SWT based transaction panels and generate java code (separate with XUI editor, it generates xml files). 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.

After you created the transactional panel, you may want to launch it in your RCP application. If it is embedded into a dialog, you can control the dialog yourself, like the sign-in dialog. But if you want to launch it in the working area of your RCP application, you can use the BTT activity and navigator framework.

Following are the steps to launch the account summary composite:

Procedure

  1. Add a new activity to your plugin.xml extension point. You can extend the extension point that BTT provides you: com.ibm.btt.rcp.activity.activities. Right-click the com.ibm.btt.rcp.activity.activities, and select New > swtActivity. Enter the fields in Extension Elements Details as appropriate. Then your activity is added.
    • swtActivity is a pre-built activity to integrate the SWT UI panel into working area.
    • id Specify the id of the activity which can used to find or run this activity.
    • name The name property’s value will display in the view’s tab and the extension points’tree.
    • composite The composite will show in the view opened by the activity. The composite should extend from org.eclipse.swt.widgets.Composite
    • description The description of the activity will show as the tooltip of the opened view.
    • unique If it is set to true. This activity will open only one view. And click the item again will activate the opened view.
  2. After you create the activity, you need to add a tree item to BTT pre-build navigation tree view. Right-click the com.ibm.btt.rcp.navigator.items, and select New > item . Enter the fields in the Extension Element Details as appropriate:

    You need to specify the following parameters:

    • id: The unique identifier for this item.
    • name: The name of this item. This name will be the title of the navigation tree node.
    • activityId: If this tree item needs to launch an activity, and specify the activity id. You can set it to com.ibm.btt.rcp.sample.AccountSummary.
    • icon: The icon path for this navigation tree. This icon will be set to the tree item.
    • initial: If this navigation item will be displayed at the start of this navigation tree.

What to do next

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.