Search in sources :

Example 6 with InputLoopNodesTable

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

the class InputLoopTableUtil method getInputLoopNodesTable.

private static InputLoopNodesTable getInputLoopNodesTable(OutputTreeNode outputNode) {
    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);
        }
    } 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);
            }
        }
    }
    return inputLoopNodesTable;
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) 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 7 with InputLoopNodesTable

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

the class XmlmapBranchContent method createContent.

@Override
protected void createContent() {
    super.createContent();
    statusFigure = new Label();
    statusFigure.setForegroundColor(ColorConstants.red);
    statusFigure.setText(getStatus());
    defaultValue = new Label();
    defaultValue.setForegroundColor(ColorConstants.blue);
    defaultValue.setText(getDefaultValue());
    ImageInfo infor = ImageInfo.SETLOOPFUNCTION_BUTTON;
    if (treeNode instanceof OutputTreeNode) {
        InputLoopNodesTable inputLoopNodesTable = ((OutputTreeNode) treeNode).getInputLoopNodesTable();
        infor = (inputLoopNodesTable == null || inputLoopNodesTable.getInputloopnodes().isEmpty()) ? ImageInfo.SETLOOPFUNCTION_BUTTON_ERROR : ImageInfo.SETLOOPFUNCTION_BUTTON;
    }
    loopButtonFigure = new ToolBarButtonImageFigure(ImageProviderMapper.getImage(infor));
    loopButtonFigure.addMouseListener(new MouseListener.Stub() {

        @Override
        public void mousePressed(MouseEvent me) {
            OutputTreeNode outputTreeNode = (OutputTreeNode) treeNode;
            List<TreeNode> loopNodes = new ArrayList<TreeNode>();
            if (manager.isMainTableMultiLoop()) {
                loopNodes.addAll(XmlMapUtil.getMultiLoopsForXmlTree(manager.getMainInputTree()));
            }
            InputLoopNodesTable inputLoopNodesTable = null;
            if (outputTreeNode.getInputLoopNodesTable() != null) {
                inputLoopNodesTable = outputTreeNode.getInputLoopNodesTable();
            } else {
                inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                outputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
                AbstractInOutTree abstractInOutTree = XmlMapUtil.getAbstractInOutTree(outputTreeNode);
                if (abstractInOutTree != null) {
                    ((OutputXmlTree) abstractInOutTree).getInputLoopNodesTables().add(inputLoopNodesTable);
                }
            }
            SetLoopFunctionDialog nsDialog = new SetLoopFunctionDialog(null, outputTreeNode.getInputLoopNodesTable(), loopNodes);
            if (nsDialog.open() == Window.OK) {
                manager.getProblemsAnalyser().checkProblems(XmlMapUtil.getAbstractInOutTree(outputTreeNode));
                manager.getMapperUI().updateStatusBar();
            }
        }
    });
    if (treeNode != null && treeNode instanceof OutputTreeNode) {
        // display loop setup button only when input main is multiloop
        if (treeNode.isLoop() && manager.isMainTableMultiLoop()) {
            this.add(loopButtonFigure);
        }
    }
    this.add(statusFigure);
    this.add(defaultValue);
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) ToolBarButtonImageFigure(org.talend.designer.gefabstractmap.figures.treetools.ToolBarButtonImageFigure) MouseEvent(org.eclipse.draw2d.MouseEvent) Label(org.eclipse.draw2d.Label) SetLoopFunctionDialog(org.talend.designer.xmlmap.ui.dialog.SetLoopFunctionDialog) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) MouseListener(org.eclipse.draw2d.MouseListener) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) List(java.util.List) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) ImageInfo(org.talend.designer.gefabstractmap.resource.ImageInfo)

Example 8 with InputLoopNodesTable

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

the class TreeToolBarContainer method createToolbar.

@Override
protected void createToolbar() {
    super.createToolbar();
    condensedButton = new CondensedButton(ImageProviderMapper.getImage(ImageInfo.CONDENSED_TOOL_ICON));
    condensedButton.setSelected(getTableManager().isActivateCondensedTool());
    setTooltips(condensedButton, "tXmlMap settings");
    expressionFilterButton = new ExpressionFilterButton(ImageProviderMapper.getImage(ImageInfo.ACTIVATE_FILTER_ICON));
    expressionFilterButton.setSelected(getTableManager().isActivateExpressionFilter());
    setTooltips(expressionFilterButton, "Enable/disable expression filter");
    inputMainTable = ((MapperManager) getTableManager().getGraphicalViewer().getMapperManager()).getMainInputTree();
    abstractTree = getTableManager().getModel();
    if (abstractTree instanceof OutputXmlTree) {
        ImageInfo info = ImageInfo.SETLOOPFUNCTION_BUTTON;
        EList<InputLoopNodesTable> inputLoopNodesTables = ((OutputXmlTree) abstractTree).getInputLoopNodesTables();
        if (!inputLoopNodesTables.isEmpty() && inputLoopNodesTables.get(0) != null) {
            if (inputLoopNodesTables.get(0).getInputloopnodes().isEmpty()) {
                info = ImageInfo.SETLOOPFUNCTION_BUTTON_ERROR;
            }
        }
        setLoopFunctionButton = new SetLoopFunctionButton(ImageProviderMapper.getImage(info));
        setTooltips(setLoopFunctionButton, "set Loop Function");
        this.add(setLoopFunctionButton);
        if (inputMainTable == null || !inputMainTable.isMultiLoops()) {
            setLoopFunctionButton.setVisible(false);
        }
    }
    // TDI-22087
    if (abstractTree instanceof OutputXmlTree || (abstractTree instanceof InputXmlTree && ((InputXmlTree) abstractTree).isLookup())) {
        this.add(condensedButton);
        this.add(expressionFilterButton);
    }
    boolean isErrorReject = false;
    if (abstractTree instanceof OutputXmlTree) {
        isErrorReject = ((OutputXmlTree) abstractTree).isErrorReject();
    }
    if (isErrorReject) {
        condensedButton.setEnabled(false);
        expressionFilterButton.setEnabled(false);
    }
    this.add(min_size);
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) ImageInfo(org.talend.designer.gefabstractmap.resource.ImageInfo)

Example 9 with InputLoopNodesTable

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

the class XmlMapUtil method removeloopInOutputTree.

/**
     * 
     * DOC WCHEN Remove source loops refrenced from input main
     * 
     * @param mapData
     * @param mainInput
     * @param oldLoopsFromInput
     * @param checkProblem
     */
public static void removeloopInOutputTree(XmlMapData mapData, InputXmlTree mainInput, List<TreeNode> oldLoopsFromInput, boolean checkProblem) {
    boolean isMainInputMultiLoop = mainInput == null ? false : mainInput.isMultiLoops();
    EList<OutputXmlTree> outputTrees = mapData.getOutputTrees();
    for (OutputXmlTree outputTree : outputTrees) {
        if (isMainInputMultiLoop) {
            for (TreeNode oldLoop : oldLoopsFromInput) {
                EList<InputLoopNodesTable> inputLoopNodesTables = outputTree.getInputLoopNodesTables();
                for (InputLoopNodesTable inputLoopTable : inputLoopNodesTables) {
                    inputLoopTable.getInputloopnodes().remove(oldLoop);
                }
            }
        } else {
            List<TreeNode> multiLoopsForXmlTree = getMultiLoopsForXmlTree(outputTree);
            for (TreeNode loop : multiLoopsForXmlTree) {
                ((OutputTreeNode) loop).setInputLoopNodesTable(null);
            }
            outputTree.getInputLoopNodesTables().clear();
        }
    }
}
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) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)

Example 10 with InputLoopNodesTable

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

the class SetLoopAction method addInputLoopNodesToOutput.

private void addInputLoopNodesToOutput(TreeNode loopNode, List<Connection> connections) {
    for (Connection connection : connections) {
        if (connection.getTarget() instanceof OutputTreeNode) {
            OutputTreeNode loopParentNode = (OutputTreeNode) XmlMapUtil.getLoopParentNode((OutputTreeNode) connection.getTarget());
            if (loopParentNode != null) {
                if (loopParentNode.getInputLoopNodesTable() != null) {
                    loopParentNode.getInputLoopNodesTable().getInputloopnodes().add(loopNode);
                }
            } else {
                OutputXmlTree abstractInOutTree = (OutputXmlTree) XmlMapUtil.getAbstractInOutTree((OutputTreeNode) connection.getTarget());
                if (!XmlMapUtil.hasDocument(abstractInOutTree)) {
                    EList<InputLoopNodesTable> inputLoopNodesTables = abstractInOutTree.getInputLoopNodesTables();
                    if (inputLoopNodesTables.size() == 1) {
                        InputLoopNodesTable inputLoopNodesTable = inputLoopNodesTables.get(0);
                        inputLoopNodesTable.getInputloopnodes().add(loopNode);
                    }
                }
            }
        }
    }
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) Connection(org.talend.designer.xmlmap.model.emf.xmlmap.Connection) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)

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