Search in sources :

Example 1 with UIFormSet

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;
    }
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) UIConfiguration(org.openforis.collect.metamodel.ui.UIConfiguration) UIForm(org.openforis.collect.metamodel.ui.UIForm) UIFormSet(org.openforis.collect.metamodel.ui.UIFormSet)

Aggregations

UIConfiguration (org.openforis.collect.metamodel.ui.UIConfiguration)1 UIForm (org.openforis.collect.metamodel.ui.UIForm)1 UIFormSet (org.openforis.collect.metamodel.ui.UIFormSet)1 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)1 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)1 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)1