Search in sources :

Example 1 with InputLoopNodesTable

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

the class OutputXmlTreeEditPart method setModel.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#setModel(java.lang.Object)
     */
@Override
public void setModel(Object model) {
    super.setModel(model);
    OutputXmlTree outputTree = (OutputXmlTree) getModel();
    manager = new XmlMapTableManager(outputTree, this);
    for (InputLoopNodesTable sourceLoopTable : outputTree.getInputLoopNodesTables()) {
        addListenerForInputLoopNodeTable(sourceLoopTable);
    }
}
Also used : XmlMapTableManager(org.talend.designer.xmlmap.figures.table.XmlMapTableManager) InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)

Example 2 with InputLoopNodesTable

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

the class OutputTreeNodeImpl method setInputLoopNodesTable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
public void setInputLoopNodesTable(InputLoopNodesTable newInputLoopNodesTable) {
    InputLoopNodesTable oldInputLoopNodesTable = inputLoopNodesTable;
    inputLoopNodesTable = newInputLoopNodesTable;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, XmlmapPackage.OUTPUT_TREE_NODE__INPUT_LOOP_NODES_TABLE, oldInputLoopNodesTable, inputLoopNodesTable));
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with InputLoopNodesTable

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable 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));
                    }
                }
            }
        }
    }
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) Problem(org.talend.core.model.process.Problem) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)

Example 4 with InputLoopNodesTable

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

the class InputLoopTableUtil method addSourceLoopToInputLoopTable.

public static void addSourceLoopToInputLoopTable(TreeNode connectionSource, OutputTreeNode targetOutputNode, InputXmlTree mainInputTree) {
    // create InputLoopTable nodes only when main table is multiloops
    if (mainInputTree == null || !mainInputTree.isMultiLoops()) {
        return;
    }
    InputLoopNodesTable inputLoopNodesTable = null;
    AbstractInOutTree abstractTree = XmlMapUtil.getAbstractInOutTree(targetOutputNode);
    List<InputLoopNodesTable> listInputLoopNodesTablesEntry = ((OutputXmlTree) abstractTree).getInputLoopNodesTables();
    if (!XmlMapUtil.hasDocument(abstractTree)) {
        if (listInputLoopNodesTablesEntry.size() == 0) {
            inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
            listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
        } else if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
            inputLoopNodesTable = listInputLoopNodesTablesEntry.get(0);
        }
    } else {
        OutputTreeNode loopParentOutputTreeNode = (OutputTreeNode) XmlMapUtil.getLoopParentNode(targetOutputNode);
        if (loopParentOutputTreeNode != null) {
            inputLoopNodesTable = loopParentOutputTreeNode.getInputLoopNodesTable();
            if (inputLoopNodesTable == null) {
                inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
                listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
            }
        }
    }
    if (inputLoopNodesTable == null) {
        return;
    }
    List<TreeNode> soruceLoops = new ArrayList<TreeNode>();
    getSourceLoopsFromConnectionSource(connectionSource, soruceLoops, mainInputTree);
    for (TreeNode sourceLoop : soruceLoops) {
        if (!inputLoopNodesTable.getInputloopnodes().contains(sourceLoop)) {
            inputLoopNodesTable.getInputloopnodes().add(sourceLoop);
        }
    }
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)

Example 5 with InputLoopNodesTable

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

the class InputLoopTableUtil method removeSourceLoopFromInputLoopTable.

public static void removeSourceLoopFromInputLoopTable(List removedConnections, OutputTreeNode outputNode, InputXmlTree mainInputTree) {
    if (mainInputTree == null || !mainInputTree.isMultiLoops()) {
        return;
    }
    List<TreeNode> neededSource = new ArrayList<TreeNode>();
    InputLoopNodesTable inputLoopNodesTable = null;
    AbstractInOutTree abstractTree = XmlMapUtil.getAbstractInOutTree(outputNode);
    List<InputLoopNodesTable> listInputLoopNodesTablesEntry = ((OutputXmlTree) abstractTree).getInputLoopNodesTables();
    if (!XmlMapUtil.hasDocument(abstractTree)) {
        if (listInputLoopNodesTablesEntry.size() == 0) {
            inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
            listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
        } else if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
            inputLoopNodesTable = listInputLoopNodesTablesEntry.get(0);
        }
        OutputXmlTree outputTree = (OutputXmlTree) abstractTree;
        getSourceLoop(neededSource, outputTree.getNodes(), mainInputTree);
    } else {
        OutputTreeNode loopParentOutputTreeNode = (OutputTreeNode) XmlMapUtil.getLoopParentNode(outputNode);
        if (loopParentOutputTreeNode != null) {
            inputLoopNodesTable = loopParentOutputTreeNode.getInputLoopNodesTable();
            if (inputLoopNodesTable == null) {
                inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
                listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
            }
            List<OutputTreeNode> nodes = new ArrayList<OutputTreeNode>();
            nodes.add(loopParentOutputTreeNode);
            getSourceLoop(neededSource, nodes, mainInputTree);
        }
    }
    if (inputLoopNodesTable == null) {
        return;
    }
    List<TreeNode> sourceLoopsToRemove = new ArrayList<TreeNode>();
    for (Object object : removedConnections) {
        if (object instanceof Connection) {
            Connection connection = (Connection) object;
            if (connection.getSource() instanceof TreeNode) {
                getSourceLoopsFromConnectionSource((TreeNode) connection.getSource(), sourceLoopsToRemove, mainInputTree);
            }
        }
    }
    for (TreeNode sourceToRemove : sourceLoopsToRemove) {
        if (!neededSource.contains(sourceToRemove)) {
            inputLoopNodesTable.getInputloopnodes().remove(sourceToRemove);
        }
    }
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) Connection(org.talend.designer.xmlmap.model.emf.xmlmap.Connection) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)

Aggregations

InputLoopNodesTable (org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable)11 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)9 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)7 ArrayList (java.util.ArrayList)5 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)5 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)4 List (java.util.List)2 ImageInfo (org.talend.designer.gefabstractmap.resource.ImageInfo)2 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)2 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)2 LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)2 Label (org.eclipse.draw2d.Label)1 MouseEvent (org.eclipse.draw2d.MouseEvent)1 MouseListener (org.eclipse.draw2d.MouseListener)1 Point (org.eclipse.draw2d.geometry.Point)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Problem (org.talend.core.model.process.Problem)1 ToolBarButtonImageFigure (org.talend.designer.gefabstractmap.figures.treetools.ToolBarButtonImageFigure)1 OutputXmlTreeFigure (org.talend.designer.xmlmap.figures.OutputXmlTreeFigure)1 XmlMapTableManager (org.talend.designer.xmlmap.figures.table.XmlMapTableManager)1