use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaVM method duplicateEditedNodeInto.
private void duplicateEditedNodeInto(NodeDefinition node, SurveyObject parent) {
NodeDefinition clone = survey.getSchema().cloneDefinition(node);
EntityDefinition parentEntity = determineRelatedEntity(parent);
clone.setName(createDuplicateNodeName(node, parentEntity));
editedNode = clone;
changeEditedNodeParent(parent, true);
editNode(false, parentEntity, editedNode);
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaVM method openMoveNodePopup.
@Command
public void openMoveNodePopup() {
SchemaNodeData selectedTreeNode = getSelectedTreeNode();
if (selectedTreeNode == null) {
return;
}
SurveyObject selectedItem = selectedTreeNode.getSurveyObject();
if (selectedItem instanceof NodeDefinition) {
NodeDefinition selectedNode = (NodeDefinition) selectedItem;
boolean changeParentNodeAllowed = checkChangeParentNodeAllowed(selectedNode);
if (changeParentNodeAllowed) {
openSelectParentNodePopupForReparent(selectedNode);
}
} else {
// TODO support tab moving
return;
}
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaVM method changeEditedNodeParentEntity.
private void changeEditedNodeParentEntity(EntityDefinition newParentEntity) {
// update parent entity
NodeDefinition node = (NodeDefinition) editedNode;
Schema schema = survey.getSchema();
schema.changeParentEntity(node, newParentEntity);
// update tab
UIOptions uiOptions = survey.getUIOptions();
uiOptions.removeTabAssociation(node);
if (node instanceof AttributeDefinition) {
survey.getAnnotations().setMeasurementAttribute((AttributeDefinition) node, false);
}
// update ui
refreshTreeModel();
editedNodeParentEntity = newParentEntity;
selectTreeNode(editedNode);
treeModel.showSelectedNode();
notifyChange("selectedTreeNode", "editedNode");
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaVM method openDuplicateNodePopup.
@Command
public void openDuplicateNodePopup() {
if (!checkCanLeaveForm()) {
return;
}
SchemaNodeData selectedTreeNode = getSelectedTreeNode();
if (selectedTreeNode == null) {
return;
}
SurveyObject selectedItem = selectedTreeNode.getSurveyObject();
if (selectedItem instanceof NodeDefinition) {
openSelectParentNodePopupForDuplicate((NodeDefinition) selectedItem);
}
}
use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.
the class SchemaVM method changeEditedNodeParent.
private void changeEditedNodeParent(SurveyObject newParent, boolean forceReassignment) {
EntityDefinition newParentEntityDef = determineRelatedEntity(newParent);
NodeDefinition editedNodeDef = (NodeDefinition) editedNode;
if (forceReassignment || editedNodeDef.getParentDefinition() != newParentEntityDef) {
changeEditedNodeParentEntity(newParentEntityDef);
}
if (newParent instanceof UITab) {
associateNodeToTab(editedNodeDef, (UITab) newParent);
}
dispatchSurveyChangedCommand();
}
Aggregations