Registering your component or widget

Registering your custom components and widgets in the ComponentWidget.xml file makes them available for use in the ZIETrans Toolkit, such as in the Insert Host Component wizard.

Host components must map to specific widgets. Custom host components can map to any existing widget or to a custom widget. The Create a custom component or widget wizards register your custom components and widgets in the ComponentWidget.xml file, and associates components and widgets. When using the wizards, if you did not associate your custom component or widget, you need to edit the ComponentWidget.xml file and add the associations. To edit the ComponentWidget.xml file, click the Navigator tab of the ZIETrans Toolkit. The ComponentWidget.xml file is shown at the bottom of the Navigator view of your project.
Note: If you decide to delete a custom component or widget after it has been registered, simply deleting the source code for the component or widget from the Source folder of your project is not enough to completely remove it. It is still referenced in the registry and there is no programmatic way to remove it. You should remove it from the registry by editing the ComponentWidget.xml file and deleting the references to the component or widget.
Following is an example of the ComponentWidget.xml file that shows the ZIETrans-supplied Field Table component and one of the associated widgets, the vertical bar graph widget.
<ComponentWidgetList>
  <components>
    <component className="com.ibm.hats.transform.components.FieldTableComponent" 
							displayName="Field table" image="table.gif"> 
      <associatedWidgets> 
        <widget className="com.ibm.hats.rcp.transform.widgets.SwtVerticalBarGraphWidget"/> 
      </associatedWidgets> 
    </component>
  </components>


  <widgets>
    <widget className="com.ibm.hats.rcp.transform.widgets.SwtVerticalBarGraphWidget" 
							displayName="Vertical graph" image="verticalBarGraph.gif" />
  </widgets>
</ComponentWidgetList> 

As you can see, there are two sections to this file: components and widgets.

The components section contains the list of all registered components. To register a custom component and make it available to the ZIETrans Toolkit, add a <component> tag and the associated <widget> tags to the ComponentWidget.xml file. You must supply a className, displayName, and the associated widgets.
className
Identifies the Java™ class that contains the code to recognize elements of the host screen. The class name is usually in the form com.myCompany.myOrg.ClassName.
displayName
Identifies the name by which your custom component is known and how it appears in the list of components in the ZIETrans Toolkit. This name must be unique among the registered components. The form of the displayName for a custom component is simply a string. Spaces are allowed in the displayName.
image
The image attribute identifies the image to use for your component when it appears in the ZIETrans Toolkit.
widget
Identifies the widgets that are associated with this component. There must be a separate <widget> tag for each associated widget. All of the <widget> tags for the component must be defined within the <associatedWidgets> tag and its </associatedWidgets> ending tag. The <widget> tag within the <associatedWidgets> tag contains only the className attribute, which identifies the Java class that contains the code to link the widget to the component. The class name is usually in the form com.myCompany.myOrg.ClassName.
The widgets section contains the list of all registered widgets. To register a widget, link it to a component, make it available for use in the ZIETrans Toolkit, and add a <widget> tag to the ComponentWidget.xml file. You must supply a className and a displayName.
className
Identifies the Java class that contains the code to render the widget. The class name is usually in the form com.myCompany.myOrg.ClassName.
displayName
Identifies the name by which your custom widget is known and how it appears in the list of widgets in the ZIETrans Toolkit. This name must be unique among the registered widgets. The form of the displayName for a custom widget is simply a string. Spaces are not allowed in the displayName. However, you can use an underscore ( _ ) in place of a space.