use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class CodeListsVM method addLevel.
@Command
@NotifyChange({ "listLevels" })
public void addLevel() {
List<CodeListLevel> levels = editedItem.getHierarchy();
int levelPosition = levels.size() + 1;
CodeListLevel level = new CodeListLevel();
String generatedName = Labels.getLabel(SURVEY_CODE_LIST_GENERATED_LEVEL_NAME_LABEL_KEY, new Object[] { levelPosition });
level.setName(generatedName);
editedItem.addLevel(level);
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class SchemaLayoutSimpleVM method addTab.
@Command
@NotifyChange({ "treeModel", "selectedTab" })
public void addTab(@BindingParam("parent") UITabSet parent) {
if (rootTabSet != null) {
if (parent == null) {
parent = rootTabSet;
treeModel.deselect();
}
CollectSurvey survey = getSurvey();
UIOptions uiOptions = survey.getUIOptions();
UITab tab = uiOptions.createTab();
String label = Labels.getLabel("survey.schema.node.layout.default_tab_label");
tab.setLabel(currentLanguageCode, label);
parent.addTab(tab);
treeModel.appendNodeToSelected(tab);
selectedTab = tab;
dispatchTabSetChangedCommand();
}
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class SurveyConfigurationEditVM method applyChanges.
@Command
@NotifyChange({ "editedTabDefinition", "editedTab", "selectedTab" })
public void applyChanges() {
CollectSurvey survey = getSurvey();
UIConfiguration uiConfiguration = survey.getUIConfiguration();
if (newTab) {
if (editedTabDefinition != null) {
uiConfiguration.addTabDefinition(editedTabDefinition);
treeModel.appendToSelected(editedTabDefinition);
selectedTab = editedTabDefinition;
} else if (editedTab != null) {
selectedTab.addTab(editedTab);
treeModel.appendToSelected(editedTab);
selectedTab = editedTab;
}
} else {
String tabName = selectedTab.getName();
if (editedTabDefinition != null) {
String newName = editedTabDefinition.getName();
UITabDefinition newTabDefn = uiConfiguration.updateTabDefinition(tabName, newName);
// TODO avoid use of side effect...
// treeModel.updateSelectedNode(newTabDefn);
selectedTab = newTabDefn;
} else {
selectedTab.setName(editedTab.getName());
((UITab) selectedTab).setLabel(editedTab.getLabel());
// TODO avoid use of side effect...
// treeModel.updateSelectedNode(editedTab);
}
}
newTab = false;
HashMap<String, Object> args = new HashMap<String, Object>();
args.put("tab", selectedTab);
BindUtils.postGlobalCommand(null, null, TAB_DEFINITIONS_UPDATED_COMMAND, args);
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class CalculatedAttributeVM method deleteFormula.
@Command
@NotifyChange({ "selectedFormula", "formulas" })
public void deleteFormula() {
ConfirmParams params = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {
@Override
public void onOk() {
editedItem.removeFormula(selectedFormula);
selectedFormula = null;
initFormulas();
notifyChange("selectedFormula", "formulas");
}
}, "survey.schema.attribute.calculated.formula.confirm_delete");
params.setOkLabelKey("global.delete_item");
MessageUtil.showConfirm(params);
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class CalculatedAttributeVM method addFormula.
@Command
@NotifyChange("formulas")
public void addFormula() {
editingNewFormula = true;
editedFormula = new Formula();
openFormulaEditPopUp();
}
Aggregations