Search in sources :

Example 26 with UIOptions

use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.

the class CollectSurveyContext method createSurvey.

@Override
public Survey createSurvey() {
    CollectSurvey survey = new CollectSurvey(this);
    // application options
    UIOptions uiOptions = survey.createUIOptions();
    survey.addApplicationOptions(uiOptions);
    return survey;
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions)

Example 27 with UIOptions

use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.

the class UITreeModelCreator method createFirstLevelNodes.

@Override
protected List<AbstractNode<SchemaNodeData>> createFirstLevelNodes(EntityDefinition rootEntity) {
    List<AbstractNode<SchemaNodeData>> firstLevelTreeNodes = new ArrayList<AbstractNode<SchemaNodeData>>();
    if (includeRootEntity) {
        SchemaTreeNode node = createRootNode(rootEntity);
        if (node != null) {
            firstLevelTreeNodes.add(node);
        }
    } else {
        CollectSurvey survey = (CollectSurvey) rootEntity.getSurvey();
        UIOptions uiOptions = survey.getUIOptions();
        UITabSet tabSet = uiOptions.getAssignedRootTabSet(rootEntity);
        for (UITab tab : tabSet.getTabs()) {
            SchemaTreeNode node = createNode(tab);
            if (node != null) {
                firstLevelTreeNodes.add(node);
            }
        }
    }
    return firstLevelTreeNodes;
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) AbstractNode(org.openforis.collect.designer.component.BasicTreeModel.AbstractNode) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) ArrayList(java.util.ArrayList) CollectSurvey(org.openforis.collect.model.CollectSurvey) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Example 28 with UIOptions

use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.

the class UITreeModelCreator method createNodes.

protected List<SchemaTreeNode> createNodes(UITab parentTab, List<? extends NodeDefinition> nodes) {
    List<SchemaTreeNode> result = null;
    if (nodes != null) {
        result = new ArrayList<SchemaTreeNode>();
        for (NodeDefinition nodeDefn : nodes) {
            if (includeNodePredicate == null || includeNodePredicate.evaluate(nodeDefn)) {
                CollectSurvey survey = (CollectSurvey) nodeDefn.getSurvey();
                UIOptions uiOptions = survey.getUIOptions();
                UITab assignedTab = uiOptions.getAssignedTab(nodeDefn);
                if (assignedTab == parentTab && (version == null || version.isApplicable(nodeDefn))) {
                    SchemaNodeData data = new SchemaNodeData(nodeDefn, nodeDefn.getName(), false, false);
                    SchemaTreeNode treeNode = (SchemaTreeNode) createNode(data, false);
                    if (treeNode != null) {
                        result.add(treeNode);
                    }
                }
            }
        }
    }
    return result;
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Example 29 with UIOptions

use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.

the class CodeAttributeDefinitionFormObject method saveTo.

@Override
public void saveTo(CodeAttributeDefinition dest, String languageCode) {
    super.saveTo(dest, languageCode);
    dest.setList(list);
    dest.setAllowUnlisted(!strict);
    dest.setParentCodeAttributeDefinition(parentCodeAttributeDefinition);
    dest.setAllowValuesSorting(dest.isMultiple() && allowValuesSorting);
    CollectSurvey survey = (CollectSurvey) dest.getSurvey();
    UIOptions uiOptions = survey.getUIOptions();
    uiOptions.setShowAllowedValuesPreviewValue(dest, showAllowedValuesPreview);
    uiOptions.setLayoutType(dest, CodeAttributeLayoutType.valueOf(layoutType));
    uiOptions.setLayoutDirection(dest, StringUtils.isBlank(layoutDirection) ? null : Orientation.valueOf(layoutDirection));
    uiOptions.setShowCode(dest, showCode);
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 30 with UIOptions

use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.

the class CodeAttributeDefinitionFormObject method loadFrom.

@Override
public void loadFrom(CodeAttributeDefinition source, String languageCode) {
    super.loadFrom(source, languageCode);
    list = source.getList();
    setParentCodeAttributeDefinition(source.getParentCodeAttributeDefinition());
    hierarchicalLevel = extractHierarchicalLevel(source);
    strict = !source.isAllowUnlisted();
    allowValuesSorting = source.isMultiple() && source.isAllowValuesSorting();
    CollectSurvey survey = (CollectSurvey) source.getSurvey();
    UIOptions uiOptions = survey.getUIOptions();
    showAllowedValuesPreview = uiOptions.getShowAllowedValuesPreviewValue(source);
    layoutType = uiOptions.getLayoutType(source).name();
    Orientation sourceItemsDirection = uiOptions.getLayoutDirection(source);
    layoutDirection = sourceItemsDirection == null ? null : sourceItemsDirection.name();
    showCode = uiOptions.getShowCode(source);
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey) Orientation(org.openforis.collect.metamodel.ui.UIOptions.Orientation)

Aggregations

UIOptions (org.openforis.collect.metamodel.ui.UIOptions)69 CollectSurvey (org.openforis.collect.model.CollectSurvey)38 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)22 UITab (org.openforis.collect.metamodel.ui.UITab)19 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)18 Layout (org.openforis.collect.metamodel.ui.UIOptions.Layout)10 ArrayList (java.util.ArrayList)9 CollectAnnotations (org.openforis.collect.metamodel.CollectAnnotations)9 UITabSet (org.openforis.collect.metamodel.ui.UITabSet)9 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)9 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)5 Schema (org.openforis.idm.metamodel.Schema)5 Command (org.zkoss.bind.annotation.Command)5 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)5 ExternalizedProperty (org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)4 SchemaNodeData (org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)4 SchemaTreeNode (org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode)4 SurveyObjectsGenerator (org.openforis.collect.manager.SurveyObjectsGenerator)3 KeyAttributeDefinition (org.openforis.idm.metamodel.KeyAttributeDefinition)3 SurveyObject (org.openforis.idm.metamodel.SurveyObject)3