use of org.openforis.collect.designer.util.MessageUtil.ConfirmHandler in project collect by openforis.
the class CodeListsVM method removeLevel.
@Command
public void removeLevel() {
final List<CodeListLevel> levels = editedItem.getHierarchy();
if (!levels.isEmpty()) {
final int levelIndex = levels.size() - 1;
if (codeListManager.hasChildItemsInLevel(editedItem, levelIndex + 1)) {
ConfirmHandler handler = new ConfirmHandler() {
@Override
public void onOk() {
performRemoveLevel(levelIndex);
}
};
MessageUtil.ConfirmParams params = new MessageUtil.ConfirmParams(handler, "survey.code_list.alert.cannot_delete_non_empty_level");
params.setOkLabelKey("global.delete_item");
MessageUtil.showConfirm(params);
} else {
performRemoveLevel(levelIndex);
}
}
}
use of org.openforis.collect.designer.util.MessageUtil.ConfirmHandler in project collect by openforis.
the class SurveyObjectBaseVM method deleteItem.
@Command
public void deleteItem(@BindingParam("item") final T item) {
MessageUtil.ConfirmParams params = new MessageUtil.ConfirmParams(new ConfirmHandler() {
@Override
public void onOk() {
performDeleteItem(item);
}
}, getConfirmDeleteMessageKey());
params.setOkLabelKey("global.delete_item");
MessageUtil.showConfirm(params);
}
Aggregations