use of org.openforis.collect.metamodel.ui.UITabSet 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.metamodel.ui.UITabSet in project collect by openforis.
the class UIOptionsSerializer method write.
public void write(UIOptions options, Writer out, String defaultLanguage) {
try {
XmlSerializer serializer = createXmlSerializer();
serializer.setOutput(out);
List<UITabSet> tabSets = options.getTabSets();
for (UITabSet tabSet : tabSets) {
writeTabSet(serializer, tabSet, defaultLanguage);
}
serializer.flush();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.
the class UITabSetProxy method fromList.
public static List<UITabSetProxy> fromList(List<UITabSet> tabSets) {
List<UITabSetProxy> result = new ArrayList<UITabSetProxy>();
for (UITabSet tabSet : tabSets) {
UITabSetProxy proxy = new UITabSetProxy(tabSet);
result.add(proxy);
}
return result;
}
use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.
the class SchemaVM method performRemoveTab.
protected void performRemoveTab(UITab tab) {
// remove all nodes associated to the tab
UIOptions uiOptions = tab.getUIOptions();
List<NodeDefinition> nodesPerTab = uiOptions.getNodesPerTab(tab, false);
for (NodeDefinition nodeDefn : nodesPerTab) {
EntityDefinition parentDefn = nodeDefn.getParentEntityDefinition();
parentDefn.removeChildDefinition(nodeDefn);
}
performRemoveSelectedTreeNode();
UITabSet parent = tab.getParent();
parent.removeTab(tab);
refreshTreeModel();
dispatchSurveyChangedCommand();
}
use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.
the class SchemaVM method moveNode.
protected void moveNode(int newIndexInTree) {
SurveyObject surveyObject = selectedTreeNode.getSurveyObject();
List<SurveyObject> siblings = getSiblingsInTree(surveyObject);
SurveyObject newIndexItem = siblings.get(newIndexInTree);
SchemaTreeNode newIndexNode = treeModel.getTreeNode(newIndexItem);
int newIndexInModel = newIndexNode.getIndexInModel();
if (surveyObject instanceof NodeDefinition) {
NodeDefinition nodeDefn = (NodeDefinition) surveyObject;
EntityDefinition parentEntity = nodeDefn.getParentEntityDefinition();
if (parentEntity != null) {
parentEntity.moveChildDefinition(nodeDefn, newIndexInModel);
} else {
EntityDefinition rootEntity = nodeDefn.getRootEntity();
Schema schema = rootEntity.getSchema();
schema.moveRootEntityDefinition(rootEntity, newIndexInModel);
}
} else {
UITab tab = (UITab) surveyObject;
UITabSet parent = tab.getParent();
parent.moveTab(tab, newIndexInModel);
}
treeModel.moveSelectedNode(newIndexInTree);
notifyChange("treeModel", "moveNodeUpDisabled", "moveNodeDownDisabled");
dispatchSurveyChangedCommand();
}
Aggregations