To display a customized widget in the XUI editor, a technical developer must implement a Java class to present the widget.
Two different types of figures can be used to display a widget in the XUI editor: draw2D and SWT. The draw2D figure displays a widget in the XUI editor as an image. Draw2D can be implemented easily, but it cannot change dynamically when the widget is being edited in the XUI editor. The SWT type figure is a standard Eclipse SWT widget, and it supports dynamic change when a widget is being edited in the XUI editor, for example, when the text of a widget is being edited.
To implement the draw2D figure, a technical developer can either directly extend the org.eclipse.draw2d.Shape class or extend the com.ibm.btt.tools.xui.editor2.figure.LabelShape class, which is more convenient to implement. When the figure class extends from the com.ibm.btt.tools.xui.editor2.figure.LabelShape class, the image is loaded as a label icon and refreshed in its constructor method. The following code is a sample code: