use of org.openforis.collect.model.ui.UITabDefinition in project collect by openforis.
the class SurveyConfigurationEditVM method addTabDefinition.
@Command
@NotifyChange({ "newTab", "editedTab", "editedTabDefinition" })
public void addTabDefinition() {
editedTab = null;
editedTabDefinition = new UITabDefinition();
newTab = true;
}
use of org.openforis.collect.model.ui.UITabDefinition 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);
}
Aggregations