Search in sources :

Example 1 with TreeNode

use of org.zkoss.zul.TreeNode in project collect by openforis.

the class SchemaTreeModel method getOpenSchemaNodes.

public Set<SurveyObject> getOpenSchemaNodes() {
    Set<SurveyObject> result = new HashSet<SurveyObject>();
    Set<TreeNode<SchemaNodeData>> openObjects = getOpenObjects();
    for (TreeNode<SchemaNodeData> treeNode : openObjects) {
        if (treeNode != null) {
            SchemaNodeData data = treeNode.getData();
            SurveyObject node = data.getSurveyObject();
            result.add(node);
        }
    }
    return result;
}
Also used : SurveyObject(org.openforis.idm.metamodel.SurveyObject) TreeNode(org.zkoss.zul.TreeNode) HashSet(java.util.HashSet)

Example 2 with TreeNode

use of org.zkoss.zul.TreeNode in project collect by openforis.

the class SchemaTreeModel method getSiblingsAndSelf.

public List<SurveyObject> getSiblingsAndSelf(SurveyObject obj, boolean sameType) {
    List<SurveyObject> result = new ArrayList<SurveyObject>();
    TreeNode<SchemaNodeData> treeNode = getTreeNode(obj);
    SchemaTreeNode parent = (SchemaTreeNode) treeNode.getParent();
    List<TreeNode<SchemaNodeData>> children = parent.getChildren();
    for (TreeNode<SchemaNodeData> child : children) {
        SurveyObject surveyObject = child.getData().getSurveyObject();
        if (sameType && ((obj instanceof UITab && surveyObject instanceof UITab) || (obj instanceof NodeDefinition && surveyObject instanceof NodeDefinition))) {
            result.add(surveyObject);
        }
    }
    return result;
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) SurveyObject(org.openforis.idm.metamodel.SurveyObject) TreeNode(org.zkoss.zul.TreeNode) ArrayList(java.util.ArrayList) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition)

Aggregations

SurveyObject (org.openforis.idm.metamodel.SurveyObject)2 TreeNode (org.zkoss.zul.TreeNode)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 UITab (org.openforis.collect.metamodel.ui.UITab)1 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)1