Components and widgets properties for RCP applications

In RCP projects, transformations are SWT (Standard Widget Toolkit) composites. RCP transformations have a .java file extension. Transformations can be found in the ZIETrans projects view under Rich Client Content > Transformations. Transformations are made up of ComponentRendering composites (a specialized composite or panel that transforms a given region using the specified component, widget, and settings). The following code example illustrates the concept:
ComponentRendering rendering1 = new ComponentRendering(this, 0);
	  	rendering1.setComponent("<fully qualified component class name>");
	  	rendering1.setWidget("<fully qualified widget class name>");
  		rendering1.setRegion(new BlockScreenRegion(start_row, start_col, end_row, end_col));
  		rendering1.setComponentSettings(new StringableProperties("<component settings>"));
  		rendering1.setWidgetSettings(new StringableProperties("<widget settings>"));
  		rendering1.setHostScreen(getHostScreen());
  		rendering1.setTransformInfo(getTransformInfo());
  		rendering1.setAutoRender(false);
  		rendering1.setTextReplacement("<text replacement string>");
  		rendering1.render();

In the above example, component settings means a string of component settings and widget settings means a string of widget settings.

These composites are usually constructed and rendered within the render() method of the transformation.

SWT widgets must implement the com.ibm.hats.rcp.transform.renderers.SwtRenderer interface for RCP projects, and SWT widgets have a drawSwt method.

The following SWT widget code sample shows the constructor and drawSwt method:
public MyCustomWidget extends Widget implements SwtRenderer {

    public MyCustomWidget (ComponentElement[] componentElements, Properties settings) {
        super(componentElements, settings);
    }

    public Control[] drawSwt(Composite parent) {
        SwtElementFactory elementFactory = SwtElementFactory.newInstance(getContextAttributes(), 
        getSettings(), parent.getDisplay());

        // Add code here to generate SWT Control objects here

         return controls;  // returns controls added to the specified parent
    }
}