The XMA Eclipse plugins include a mapping-editor, that allows to graphically attach widgets and attributes of JavaBeans. To start the mapping-editor, a XMA-file must be opened and has to be visible in the Previewer. The Previewer must have the focus. The following figure shows how to open the mapping-editor:
Clicking on the toolbar-icon opens the mapping-dialog. The selected widget in the Previewer will be selected also in the opened dialog:
The dialog consists of the following parts:
Message area: the topmost part of the dialog contains always contains selection context senistive information about possible actions in the dialog.
Widgets tree: the left tree contains all possibly Attribute-connectable widgets of the actual processed component file. As items like separator widgets or pages could not be connected to Attributes these artifacts are filtered. For this reason the widget tree is a reduced model of the Outline view of the Guidesign editor.
Show Sep.leftAttach
checkbutton: Selecting this button appends information to
the items in the tree about the left attached seperators in the form
<-Sep:<seperatorname>. This information is
useful if you want to add new Attributes to the widtet tree and you
want to preserve the layout of the respective XMADialog.
Order widgets checkbutton: Selecting this button shows the widget tree in an lexical order inside each composite. This will be useful if you have lots of widgets on your dialog and you want to find the right one to connect to an Attribute. When this checkbox is unselected the order of the Outline view - which is also the tab order - is shown.
graph. Area in the middle: Show
already existing connections between widgets and Attributes. The
Del button of your keyboard removes the selected
connction.
Attribute tree: the right tree contains the Attributes of the JavaBeans which could be mapped to widgets.
Delete button: deletes the whole selected object instance representation in the Attibute tree. All existing connections to Attributes of that object will also be deleted.
New button: Opens a dialog to add a new object to the attribute view.
Up/Down buttons: Used to move objects up and down in the tree. Useful if you have a lot of objects with a huge amount of attributes.
Close button: finishes the mapping process
Using the new button the following dialog is shown:
In the Name field you have to input an instancename of the mapping object which is used in the generated tranfercode. In the Class field you may enter the full qualified classname of the class to be used. This class has to fullfill the Java Introspection specification just like JavaBeans. You could also select the appropriate class using the Browse button which opens the Eclipse ClassSearch dialog.
Attributes may be either attached to columns of tables or to plain widgets, like text-fields, check-boxes or combo-boxes.
For example, the mapping-editor allows to connect table-columns to attributes, as you may see in the following figure:
Some of the type metainformation of the bean properties automatically apply to the created widgets in the UI-designer, if these widgets are connected with attributes using the mapping-editor. For possible combinations of widgets, widget-models and Java-Types see section Widget-Model-Gallery(Widget Model Gallery).
The mapping-editor supports two ways of attaching widgets with attributes.
In this mode you attach a pre-existing widget or table column with an attribute. To do this you have to select one widget drags it to the Attribute tree and drops it on the attribute which should be connected to the widget.
If you attache table columns to attributes, the table itself has to be connected to an attribute. This attribute has to be a distinct key like an id, because it is used as key for the rows of the table.
Or you create widgets from attributes, where a lot of information, like labels or names of instance variables needed for the generated code are derived from the business object. This mode is the preferred one because it's the faster approach.
In this case you select a collection of attributes and drag it to the widget tree. For every Attribute one specific widget is create. Now you have to be careful where you drop these attributes. There exists the following cases where in this context attach means Attachments of the FormData Dialog:
The composite where you drop the attributes contain no widget with layout information (hidden widget could be inside). In this case you creat a collection of widgets which are layouted like exmple 5 inFormData Dialog. If there are some seperators already defined, the leftmost seperator ist used to produce this layout. If there are more than one preexisting seperators, the left-secondmost is used as right boundery of the newly created widgets. If no seperator exists a new seperator is created and used.
The composite where you drop the attributes contains widgets with layout information. In this case the new widgets are inserted before the topmost existing widgets. If this topmost widget is left attached to a seperator this mainseperator for layouting as above. If there are more existing seperators right from the mainseperator the nearest one is used as right boundary. If the topmost existing widget has no left attached seperator, a new one is created and used for layouting. Finally the topmost existing widget is top attached to last of the newly created widgets.
You drop the attributes near the upper edge of an existing widget. This droptype is indicated on the message area as inserted before widget '<widgetname>' . If the selected widget is the topmost you get the same behaviour as case 2. If the selected widget is in the middle additionally to behaviour of case 2 the topmost of the newly widgets is top attached to widget where the selected widget was former attached.
You drop the attributes near the lower edge of an existing widget. This droptype is indicated on the message area as inserted after widget '<widgetname>' . The behaviour is very similar to case 3 with the exception that all the existing widgets already attached to the selected widgets are reattached to last of the newly created widgets.
After choosing your droptarget the Create Widgets fro Attributes wizard appears. On the first page you may reorder the attributes by drag and drop:
On this page the mapping information produced as default could be changed on an per Attribute basis. So for example the widget type DatePicker could be used in place of the default mapped Text type. After using the finish button the newly created widgets will appear in the widget tree just as in the Previewer.