Search in sources :

Example 6 with SchemaNodeData

use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData in project collect by openforis.

the class UITreeModelCreator method createRootNode.

private SchemaTreeNode createRootNode(EntityDefinition rootEntity) {
    SchemaNodeData data = new SchemaNodeData(rootEntity, rootEntity.getName(), false, false);
    SchemaTreeNode treeNode = (SchemaTreeNode) createNode(data, false);
    return treeNode;
}
Also used : SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Example 7 with SchemaNodeData

use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData 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 8 with SchemaNodeData

use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData 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 9 with SchemaNodeData

use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData in project collect by openforis.

the class SchemaTreeModelCreator method createChildNode.

private SchemaTreeNode createChildNode(NodeDefinition nodeDefn) {
    if (version == null || version.isApplicable(nodeDefn)) {
        SchemaNodeData data = new SchemaNodeData(nodeDefn, nodeDefn.getName(), false, false);
        SchemaTreeNode childNode = (SchemaTreeNode) createNode(data, false);
        return childNode;
    } else {
        return null;
    }
}
Also used : SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Example 10 with SchemaNodeData

use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData in project collect by openforis.

the class UITreeModelCreator method createChildNodes.

private List<AbstractNode<SchemaNodeData>> createChildNodes(EntityDefinition entityDefn) {
    List<AbstractNode<SchemaNodeData>> childNodes = new ArrayList<AbstractNode<SchemaNodeData>>();
    CollectSurvey survey = (CollectSurvey) entityDefn.getSurvey();
    UIOptions uiOptions = survey.getUIOptions();
    UITab assignedTab = uiOptions.getAssignedTab(entityDefn);
    // include node definitions
    List<NodeDefinition> childDefns = entityDefn.getChildDefinitions();
    Collection<? extends AbstractNode<SchemaNodeData>> schemaTreeNodes = createNodes(assignedTab, childDefns);
    childNodes.addAll(schemaTreeNodes);
    // include tabs
    if (entityDefn.isMultiple() && uiOptions.getLayout(entityDefn) == Layout.FORM) {
        List<UITab> tabs = uiOptions.getTabsAssignableToChildren(entityDefn, false);
        Collection<? extends AbstractNode<SchemaNodeData>> tabNodes = createNodes(tabs);
        childNodes.addAll(tabNodes);
    }
    return childNodes;
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) AbstractNode(org.openforis.collect.designer.component.BasicTreeModel.AbstractNode) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) ArrayList(java.util.ArrayList) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Aggregations

SchemaNodeData (org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)13 SchemaTreeNode (org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode)9 SurveyObject (org.openforis.idm.metamodel.SurveyObject)6 UITab (org.openforis.collect.metamodel.ui.UITab)5 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)5 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)4 AbstractNode (org.openforis.collect.designer.component.BasicTreeModel.AbstractNode)3 CollectSurvey (org.openforis.collect.model.CollectSurvey)3 Treeitem (org.zkoss.zul.Treeitem)3 ArrayList (java.util.ArrayList)2 Predicate (org.openforis.collect.designer.util.Predicate)2 NodeSelectedEvent (org.openforis.collect.designer.viewmodel.SchemaTreePopUpVM.NodeSelectedEvent)2 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)2 Command (org.zkoss.bind.annotation.Command)2 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)2 Window (org.zkoss.zul.Window)2 HashSet (java.util.HashSet)1 UITabSet (org.openforis.collect.metamodel.ui.UITabSet)1 Menupopup (org.zkoss.zul.Menupopup)1