use of org.openforis.collect.model.ui.UIConfiguration 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.openforis.collect.model.ui.UIConfiguration in project collect by openforis.
the class SurveyConfigurationEditVM method getTabs.
public DefaultTreeModel<UITabsGroup> getTabs() {
if (treeModel == null) {
UIConfiguration uiConfig = getSurvey().getUIConfiguration();
treeModel = new UIConfigurationTreeModel(uiConfig);
}
return treeModel.getModel();
}
Aggregations