modes.put(ResourceSelectionMode.RELATIVE.name(), ResourceSelectionMode.RELATIVE.getDisplayString());
modeSelectItem.setValueMap(modes);
modeSelectItem.addChangedHandler(new ChangedHandler() {
@Override
public void onChanged(ChangedEvent event) {
ResourceSelectionMode mode = ResourceSelectionMode.valueOf(event.getValue().toString());
switch (mode) {
case SELF: {
setOperationDropDownMenuValues(resourceType.getId(), null, null);
break;
}
case SPECIFIC: {
singleResourceTextItem.setValue(MSG
.view_alert_definition_notification_operation_editor_specific_pick_text());
singleResourceTextItem.setAttribute(RESOURCE_ID_ATTRIBUTE, 0);
hideOperationDropDownMenu();
break;
}
case RELATIVE: {
ancestorTypeSelectItem.clearValue();
descendantTypeSelectItem.clearValue();
descendantNameTextItem.clearValue();
hideOperationDropDownMenu();
populateRelativeDropDownMenus(null, null, null, null);
break;
}
}
}
});
dynamicForm.setFields(modeSelectItem, singleResourceTextItem, singleResourceButtonItem, ancestorTypeSelectItem,
descendantTypeSelectItem, descendantNameTextItem, operationSelectItem);
addMember(dynamicForm);
addMember(operationArgumentsCanvasItem);
// prepopulate the form
ResourceOperationNotificationInfo notifInfo;
notifInfo = ResourceOperationNotificationInfo.load(getConfiguration(), getExtraConfiguration());
ResourceSelectionMode mode = notifInfo.getMode();
if (mode != null) {
modeSelectItem.setValue(mode.name());
switch (mode) {
case SELF: {
setOperationDropDownMenuValues(resourceType.getId(), notifInfo.getOperationId(),
notifInfo.getOperationArguments());
break;