use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode in project collect by openforis.
the class SchemaVM method refreshSelectedTreeNode.
protected void refreshSelectedTreeNode(Component view) {
Treeitem selectedItem = nodesTree.getSelectedItem();
SchemaTreeNode treeNode = selectedItem.getValue();
SchemaNodeData data = treeNode.getData();
// update context menu
Menupopup popupMenu = getPopupMenu(data);
selectedItem.setContext(popupMenu);
}
use of org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode 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