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