final int[] selectedIndices = availableList.getSelectedIndices();
final List<FieldWrapper> groups = getGroupFields();
final DataSchema schema = getEditorModel().getDataSchema().getDataSchema();
for (final int i : selectedIndices)
{
final SourceFieldDefinition group = getSelectableFields().get(i);
final GroupDefinition xulGroup = new DefaultGroupDefinition();
xulGroup.setField(group.getFieldName());
FieldWrapper wrapper = new FieldWrapper(xulGroup, schema);
groups.add(wrapper);
final DefaultGroupDefinition definition = (DefaultGroupDefinition) wrapper.getFieldDefinition();
new XulGroupDefinition(definition, schema);