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;
}
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;
}
Aggregations