use of org.openforis.collect.metamodel.ui.UIFormSet in project collect by openforis.
the class CollectEarthBalloonGenerator method generateRootComponent.
private CETabSet generateRootComponent() {
EntityDefinition rootEntityDef = getRootEntity();
UIOptions uiOptions = survey.getUIOptions();
UIConfiguration uiConfiguration = survey.getUIConfiguration();
if (uiConfiguration == null) {
// $NON-NLS-1$
throw new IllegalStateException("Error unmarshalling the survey - no UI configruration!");
}
if (uiConfiguration.getFormSets().isEmpty()) {
// no ui configuration defined
// $NON-NLS-1$ //$NON-NLS-2$
CETabSet tabSet = new CETabSet("", "");
// $NON-NLS-1$
CETab tab = new CETab(rootEntityDef.getName(), "");
for (NodeDefinition childDef : rootEntityDef.getChildDefinitions()) {
if (!uiOptions.isHidden(childDef)) {
tab.addChild(createComponent(childDef));
}
}
tabSet.addTab(tab);
return tabSet;
} else {
// $NON-NLS-1$ //$NON-NLS-2$
CETabSet tabSet = new CETabSet("", "");
UIFormSet formSet = uiConfiguration.getMainFormSet();
for (UIForm form : formSet.getForms()) {
boolean main = tabSet.getTabs().isEmpty();
CETab tab = createTabComponent(rootEntityDef, form, main);
tabSet.addTab(tab);
}
return tabSet;
}
}
Aggregations