use of org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode in project tdi-studio-se by Talend.
the class DropContextAnalyzer method checkDropIsValid.
private boolean checkDropIsValid() {
if (objects == null || objects.getToTransfer().isEmpty() || targetEditPart == null) {
return false;
}
Object targetModel = targetEditPart.getModel();
targetFigure = targetEditPart.getFigure().findFigureAt(dropLocation.x, dropLocation.y);
boolean isTragetOutputNode = targetModel instanceof OutputTreeNode;
boolean isTragetInputNode = targetModel instanceof TreeNode && !(targetModel instanceof OutputTreeNode);
boolean isVar = targetModel instanceof VarNode;
boolean isDropInputTree = targetModel instanceof InputXmlTree;
boolean isDropOutputTree = targetModel instanceof OutputXmlTree;
boolean isDropVarTable = targetModel instanceof VarTable;
// drop expression
if (targetFigure instanceof ExpressionFigure) {
dropType = DropType.DROP_EXPRESSION;
if (isTragetOutputNode) {
// INPUT => OUTPUT
return XmlMapUtil.isExpressionEditable((TreeNode) targetModel);
} else if (isTragetInputNode) {
// INPUT => INPUT ,can't dnd in the same tree
boolean isValid = checkDropInputValid(targetModel);
if (isValid) {
isValid = XmlMapUtil.isExpressionEditable((TreeNode) targetModel);
}
return isValid;
}
return true;
} else // drop tree filter
if (targetFigure instanceof FilterTextArea) {
dropType = DropType.DROP_FILTER;
return true;
} else {
if (objects.getType() == TransferdType.INPUT) {
if (isTragetOutputNode) {
return checkDropOutputDocChildValid(targetModel);
} else if (isVar || isDropVarTable) {
dropType = DropType.DROP_INSERT_VAR;
return true;
} else if (isDropInputTree) {
dropType = DropType.DROP_INSERT_INPUT;
return checkDropInputValid(targetModel);
} else if (isDropOutputTree) {
dropType = DropType.DROP_INSERT_OUTPUT;
return true;
}
} else if (objects.getType() == TransferdType.VAR) {
if (isTragetOutputNode) {
return checkDropOutputDocChildValid(targetModel);
} else if (isDropOutputTree) {
dropType = DropType.DROP_INSERT_OUTPUT;
return true;
}
}
}
return false;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkInputLoopTablesProblem.
private void checkInputLoopTablesProblem(OutputXmlTree outputTree, InputXmlTree mainInputTree) {
if (mainInputTree == null) {
return;
}
if (mainInputTree.isMultiLoops()) {
if (!XmlMapUtil.hasDocument(outputTree)) {
if (outputTree.getInputLoopNodesTables().isEmpty() || outputTree.getInputLoopNodesTables().get(0).getInputloopnodes().isEmpty()) {
String message = outputTree.getName() + " have no source loop";
addProblem(outputTree, new Problem(null, message, ProblemStatus.ERROR));
}
} else {
List<TreeNode> loopNodes = new ArrayList<TreeNode>();
XmlMapUtil.getChildLoops(loopNodes, outputTree.getNodes());
if (!loopNodes.isEmpty()) {
for (TreeNode node : loopNodes) {
InputLoopNodesTable inutLoopTable = ((OutputTreeNode) node).getInputLoopNodesTable();
if (inutLoopTable == null || inutLoopTable.getInputloopnodes().isEmpty()) {
String message = node.getXpath() + " have no source loop";
addProblem(outputTree, new Problem(null, message, ProblemStatus.ERROR));
}
}
}
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode in project tdi-studio-se by Talend.
the class XmlMapUtil method detachConnectionsSouce.
public static void detachConnectionsSouce(AbstractNode treeNode, XmlMapData mapData, boolean detachChildren) {
for (Connection connection : treeNode.getIncomingConnections()) {
AbstractNode source = connection.getSource();
if (source.getOutgoingConnections().contains(connection)) {
source.getOutgoingConnections().remove(connection);
mapData.getConnections().remove(connection);
}
}
treeNode.getIncomingConnections().clear();
if (treeNode instanceof OutputTreeNode) {
OutputTreeNode outputTreeNode = (OutputTreeNode) treeNode;
if (!XmlMapUtil.isExpressionEditable(outputTreeNode) && outputTreeNode.isAggregate()) {
outputTreeNode.setAggregate(false);
}
if (detachChildren && !outputTreeNode.getChildren().isEmpty()) {
for (int i = 0; i < outputTreeNode.getChildren().size(); i++) {
TreeNode child = outputTreeNode.getChildren().get(i);
detachConnectionsSouce(child, mapData);
}
}
}
treeNode.setExpression("");
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode in project tdi-studio-se by Talend.
the class XmlMapUtil method cleanGroup.
public static boolean cleanGroup(List<? extends TreeNode> nodes) {
boolean changed = false;
for (TreeNode obj : nodes) {
OutputTreeNode outputNode = (OutputTreeNode) obj;
if (outputNode.isGroup()) {
outputNode.setGroup(false);
changed = true;
}
if (!outputNode.getChildren().isEmpty()) {
changed = cleanGroup(outputNode.getChildren()) || changed;
}
}
return changed;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode in project tdi-studio-se by Talend.
the class XmlMapUtil method removeLoopTableForOutput.
public static void removeLoopTableForOutput(OutputXmlTree outputTable2Check, List<TreeNode> reomvedOutputLoops, boolean isMainMultiloops) {
for (TreeNode reomved : reomvedOutputLoops) {
OutputTreeNode outputNode = (OutputTreeNode) reomved;
if (outputNode.getInputLoopNodesTable() != null) {
outputTable2Check.getInputLoopNodesTables().remove(outputNode.getInputLoopNodesTable());
outputNode.setInputLoopNodesTable(null);
}
}
// incase there are no used InputLoopNodesTables from previous version
if (!isMainMultiloops) {
outputTable2Check.getInputLoopNodesTables().clear();
}
}
Aggregations