Search in sources :

Example 1 with LookupConnection

use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.

the class InsertNewColumnCommand method createLookupConnection.

private void createLookupConnection(TreeNode sourceNode, TreeNode targetNode) {
    LookupConnection conn = XmlmapFactory.eINSTANCE.createLookupConnection();
    conn.setSource(sourceNode);
    conn.setTarget(targetNode);
    targetNode.getLookupIncomingConnections().add(conn);
    sourceNode.getLookupOutgoingConnections().add(conn);
    if (xmlMapData != null) {
        xmlMapData.getConnections().add(conn);
    }
}
Also used : LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)

Example 2 with LookupConnection

use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.

the class XmlMapConnectionBuilder method createLookupConnection.

public void createLookupConnection(TreeNode sourceNode, TreeNode targetNode, XmlMapData mapData) {
    LookupConnection conn = XmlmapFactory.eINSTANCE.createLookupConnection();
    conn.setSource(sourceNode);
    conn.setTarget(targetNode);
    targetNode.getLookupIncomingConnections().add(conn);
    sourceNode.getLookupOutgoingConnections().add(conn);
    mapData.getConnections().add(conn);
}
Also used : LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)

Example 3 with LookupConnection

use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.

the class XmlMapUtil method detachLookupSource.

public static void detachLookupSource(TreeNode treeNode, XmlMapData mapData, boolean detachChildren) {
    for (LookupConnection connection : treeNode.getLookupIncomingConnections()) {
        TreeNode source = (TreeNode) connection.getSource();
        if (source.getLookupOutgoingConnections().contains(connection)) {
            source.getLookupOutgoingConnections().remove(connection);
            mapData.getConnections().remove(connection);
        }
    }
    treeNode.getLookupIncomingConnections().clear();
    if (detachChildren) {
        if (!treeNode.getChildren().isEmpty()) {
            for (TreeNode child : treeNode.getChildren()) {
                detachLookupSource(child, mapData, detachChildren);
            }
        }
    }
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)

Example 4 with LookupConnection

use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.

the class XmlMapUtil method detachLookupTarget.

public static void detachLookupTarget(TreeNode treeNode, XmlMapData mapData, boolean detachChildren) {
    for (LookupConnection connection : treeNode.getLookupOutgoingConnections()) {
        if (connection.getTarget() instanceof TreeNode) {
            TreeNode target = (TreeNode) connection.getTarget();
            if (target.getLookupIncomingConnections().contains(connection)) {
                target.getLookupIncomingConnections().remove(connection);
                mapData.getConnections().remove(connection);
            }
        }
    }
    treeNode.getLookupOutgoingConnections().clear();
    if (detachChildren) {
        if (!treeNode.getChildren().isEmpty()) {
            for (TreeNode child : treeNode.getChildren()) {
                detachLookupTarget(child, mapData, detachChildren);
            }
        }
    }
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)

Example 5 with LookupConnection

use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.

the class XmlMapLookupConnectionPart method calculateConnOffset.

protected int calculateConnOffset() {
    LookupConnection model = (LookupConnection) getModel();
    if (model.getSource() == null) {
        return 0;
    }
    TreeNode sourceTreeNode = (TreeNode) model.getSource();
    List<IConnection> outConns = new ArrayList<IConnection>();
    TreeNode inputTreeNodeRoot = XmlMapUtil.getTreeNodeRoot(sourceTreeNode);
    if (inputTreeNodeRoot != null) {
        InputXmlTree inputTree = (InputXmlTree) inputTreeNodeRoot.eContainer();
        outConns.addAll(XmlMapUtil.getAllNodeLookConnections(inputTree));
    }
    int indexOf = outConns.indexOf(model);
    if (indexOf != -1) {
        return -(indexOf + 1) * XmlMapUtil.DEFAULT_OFFSET;
    }
    return 0;
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) IConnection(org.talend.designer.xmlmap.model.emf.xmlmap.IConnection) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)

Aggregations

LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)13 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)10 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)9 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)4 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)3 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)3 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)3 ArrayList (java.util.ArrayList)2 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)2 FilterConnection (org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection)2 IConnection (org.talend.designer.xmlmap.model.emf.xmlmap.IConnection)2 INodeConnection (org.talend.designer.xmlmap.model.emf.xmlmap.INodeConnection)2 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)2 HashMap (java.util.HashMap)1 List (java.util.List)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 JavaType (org.talend.core.model.metadata.types.JavaType)1 GlobalMapNode (org.talend.designer.xmlmap.model.emf.xmlmap.GlobalMapNode)1