use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.
the class XmlMapFilterConnectionPart method calculateConnOffset.
protected int calculateConnOffset() {
FilterConnection model = (FilterConnection) getModel();
if (model.getSource() == null) {
return 0;
}
TreeNode sourceTreeNode = (TreeNode) model.getSource();
AbstractInOutTree inputTreeNodeRoot = XmlMapUtil.getAbstractInOutTree(sourceTreeNode);
List<IConnection> outConns = new ArrayList<IConnection>();
if (inputTreeNodeRoot instanceof InputXmlTree) {
outConns.addAll(XmlMapUtil.getInputTreeFilterConnections((InputXmlTree) inputTreeNodeRoot));
}
int indexOf = outConns.indexOf(model);
if (indexOf != -1) {
return -(indexOf + 1) * XmlMapUtil.DEFAULT_OFFSET_FILTER;
}
return 0;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.
the class TreeNodeEditPart method performRequest.
@Override
public void performRequest(Request req) {
if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
Figure figure = null;
DirectEditRequest drequest = (DirectEditRequest) req;
Point figureLocation = drequest.getLocation();
if (getFigure() instanceof TableTreeEntityFigure) {
XmlmapTreeNodeFigure treeNodeFigure = (XmlmapTreeNodeFigure) getFigure();
ArrayList collection = new ArrayList();
collection.add(treeNodeFigure.getExpressionFigure());
collection.add(treeNodeFigure.getBranchContent());
figure = (Figure) treeNodeFigure.findFigureAt(figureLocation.x, figureLocation.y, new FigureSearch(collection));
}
if (figure instanceof IWidgetCell) {
directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator(figure, this));
}
if (directEditManager != null) {
TreeNode outputTreeNode = (TreeNode) getModel();
if (figure instanceof ExpressionFigure) {
if (XmlMapUtil.isExpressionEditable(outputTreeNode)) {
Point location = drequest.getLocation();
if (figure.containsPoint(location)) {
directEditManager.show();
((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
}
}
} else if (!(((TreeNode) getModel()).eContainer() instanceof AbstractInOutTree)) {
// disable for RC2
// directEditManager.show();
// ((XmlMapGraphicViewer)
// getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
}
}
}
super.performRequest(req);
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.
the class TreeNodeEditPart method createFigure.
@Override
protected IFigure createFigure() {
TreeNode model = (TreeNode) getModel();
boolean isRoot = false;
if (model.eContainer() instanceof AbstractInOutTree) {
isRoot = true;
}
XmlmapTreeNodeFigure treeNodeFigure = new XmlmapTreeNodeFigure(entityManger, isRoot);
return treeNodeFigure;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.
the class XmlMapComponent method renameMetadataColumnName.
@Override
protected void renameMetadataColumnName(String conectionName, String oldColumnName, String newColumnName) {
List<AbstractInOutTree> abstractTrees = new ArrayList<AbstractInOutTree>();
XmlMapData externalEmfData = (XmlMapData) getExternalEmfData();
abstractTrees.addAll(externalEmfData.getInputTrees());
abstractTrees.addAll(externalEmfData.getOutputTrees());
for (AbstractInOutTree abstractTree : abstractTrees) {
if (abstractTree.getName() != null && abstractTree.getName().equals(conectionName)) {
List<TreeNode> children = new ArrayList<TreeNode>();
if (abstractTree instanceof InputXmlTree) {
children.addAll(((InputXmlTree) abstractTree).getNodes());
} else {
children.addAll(((OutputXmlTree) abstractTree).getNodes());
}
for (TreeNode treeNode : children) {
if (treeNode.getName() != null && treeNode.getName().equals(oldColumnName) && !oldColumnName.equals(newColumnName)) {
treeNode.setName(newColumnName);
XmlMapUtil.updateXPathAndExpression(externalEmfData, expressionManager, treeNode, newColumnName, 2, true);
}
}
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.
the class XmlMapService method cloneTreeNode.
private EObject cloneTreeNode(EObject node) {
if (node instanceof AbstractInOutTree) {
AbstractInOutTree source = null;
AbstractInOutTree oriSource = null;
if (node instanceof InputXmlTree) {
oriSource = (InputXmlTree) node;
source = XmlmapFactory.eINSTANCE.createInputXmlTree();
((InputXmlTree) source).setActivateGlobalMap(((InputXmlTree) oriSource).isActivateGlobalMap());
((InputXmlTree) source).setInnerJoin(((InputXmlTree) oriSource).isInnerJoin());
((InputXmlTree) source).setLookup(((InputXmlTree) oriSource).isLookup());
((InputXmlTree) source).setLookupMode(((InputXmlTree) oriSource).getLookupMode());
((InputXmlTree) source).setMatchingMode(((InputXmlTree) oriSource).getMatchingMode());
((InputXmlTree) source).setPersistent(((InputXmlTree) oriSource).isPersistent());
} else if (node instanceof OutputXmlTree) {
oriSource = (OutputXmlTree) node;
source = XmlmapFactory.eINSTANCE.createOutputXmlTree();
((OutputXmlTree) source).setAllInOne(((OutputXmlTree) oriSource).isAllInOne());
((OutputXmlTree) source).setEnableEmptyElement(((OutputXmlTree) oriSource).isEnableEmptyElement());
((OutputXmlTree) source).setErrorReject(((OutputXmlTree) oriSource).isErrorReject());
((OutputXmlTree) source).setReject(((OutputXmlTree) oriSource).isReject());
((OutputXmlTree) source).setRejectInnerJoin(((OutputXmlTree) oriSource).isRejectInnerJoin());
}
source.setActivateCondensedTool(oriSource.isActivateCondensedTool());
source.setActivateExpressionFilter(oriSource.isActivateExpressionFilter());
source.setExpressionFilter(oriSource.getExpressionFilter());
source.setMinimized(oriSource.isMinimized());
source.setMultiLoops(oriSource.isMultiLoops());
source.setName(oriSource.getName());
return source;
} else if (node instanceof VarNode) {
VarNode oriSource = (VarNode) node;
VarNode source = XmlmapFactory.eINSTANCE.createVarNode();
source.setExpression(oriSource.getExpression());
source.setName(oriSource.getName());
source.setNullable(oriSource.isNullable());
source.setType(oriSource.getType());
return source;
} else if (node instanceof TreeNode) {
TreeNode source = null;
TreeNode oriSource = null;
if (node instanceof OutputTreeNode) {
oriSource = (OutputTreeNode) node;
source = XmlmapFactory.eINSTANCE.createOutputTreeNode();
((OutputTreeNode) source).setAggregate(((OutputTreeNode) oriSource).isAggregate());
((OutputTreeNode) source).setInputLoopNodesTable(((OutputTreeNode) oriSource).getInputLoopNodesTable());
} else if (node instanceof GlobalMapNode) {
oriSource = (GlobalMapNode) node;
source = XmlmapFactory.eINSTANCE.createGlobalMapNode();
return source;
} else {
oriSource = (TreeNode) node;
source = XmlmapFactory.eINSTANCE.createTreeNode();
}
source.setChoice(oriSource.isChoice());
source.setDefaultValue(oriSource.getDefaultValue());
source.setExpression(oriSource.getExpression());
source.setGroup(oriSource.isGroup());
source.setKey(oriSource.isKey());
source.setLoop(oriSource.isLoop());
source.setMain(oriSource.isMain());
source.setName(oriSource.getName());
source.setNodeType(oriSource.getNodeType());
source.setNullable(oriSource.isNullable());
source.setOptional(oriSource.isOptional());
source.setPattern(oriSource.getPattern());
source.setSubstitution(oriSource.isSubstitution());
source.setType(oriSource.getType());
source.setXpath(oriSource.getXpath());
return source;
}
return null;
}
Aggregations