Search in sources :

Example 1 with InputXmlTreeFigure

use of org.talend.designer.xmlmap.figures.InputXmlTreeFigure in project tdi-studio-se by Talend.

the class XmlMapTreeContainerLayout method getLookupConnectionSize.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.layout.TreeContainerLayout#getLookupConnectionSize()
     */
@Override
protected int getLookupConnectionSize(AbstractTableContainer tableContainer) {
    if (tableContainer instanceof InputXmlTreeFigure) {
        InputXmlTree inputModel = ((InputXmlTreeFigure) tableContainer).getInputXmlTree();
        List<TreeNode> nodeList = inputModel.getNodes();
        int maxSize = 0;
        List<IConnection> lookConnections = XmlMapUtil.getAllNodeLookConnections(inputModel);
        List<IConnection> filterConnections = XmlMapUtil.getInputTreeFilterConnections(inputModel);
        if (lookConnections.size() < filterConnections.size()) {
            maxSize = filterConnections.size();
        } else {
            maxSize = lookConnections.size();
        }
        return maxSize;
    }
    return 0;
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) IConnection(org.talend.designer.xmlmap.model.emf.xmlmap.IConnection) InputXmlTreeFigure(org.talend.designer.xmlmap.figures.InputXmlTreeFigure)

Example 2 with InputXmlTreeFigure

use of org.talend.designer.xmlmap.figures.InputXmlTreeFigure in project tdi-studio-se by Talend.

the class SearchZoneMapper method search.

public void search(Map<Integer, Map<Integer, Figure>> searchMaps, String searchValue) {
    if (searchValue.equals("") || searchValue == null) {
        return;
    }
    List<InputXmlTree> inputTrees = mapperManager.getExternalData().getInputTrees();
    List<VarTable> varTables = mapperManager.getExternalData().getVarTables();
    List<OutputXmlTree> outputTrees = mapperManager.getExternalData().getOutputTrees();
    matcher.setPattern("*" + searchValue.trim() + "*");
    int index = -1;
    // for the InputTables
    for (InputXmlTree inputXmlTree : inputTrees) {
        // ExpressionFilter
        if (inputXmlTree.getExpressionFilter() != null && matcher.matches(inputXmlTree.getExpressionFilter())) {
            EList<Adapter> adapter = inputXmlTree.eAdapters();
            if (adapter.size() > 0) {
                if (adapter.get(0) instanceof InputXmlTreeEditPart) {
                    InputXmlTreeEditPart inputXmlTreeEditPart = (InputXmlTreeEditPart) adapter.get(0);
                    if (inputXmlTreeEditPart != null && inputXmlTreeEditPart.getFigure() != null && inputXmlTreeEditPart.getFigure() instanceof InputXmlTreeFigure) {
                        InputXmlTreeFigure inputXmlTreeFigure = (InputXmlTreeFigure) inputXmlTreeEditPart.getFigure();
                        Map<Integer, Figure> map = new HashMap<Integer, Figure>();
                        map.put(0, inputXmlTreeFigure.getFilterContainer());
                        index++;
                        searchMaps.put(index, map);
                    }
                }
            }
        }
        // TreeNode
        for (TreeNode node : inputXmlTree.getNodes()) {
            // id_Document type
            if (XmlMapUtil.DOCUMENT.equals(node.getType())) {
                for (TreeNode nodeTemp : XmlMapUtil.getFlatChildrenList(node)) {
                    if (getMatcherNodeFigure(nodeTemp).size() > 0) {
                        index++;
                        searchMaps.put(index, getMatcherNodeFigure(nodeTemp));
                    }
                }
            }
            if (getMatcherNodeFigure(node).size() > 0) {
                index++;
                searchMaps.put(index, getMatcherNodeFigure(node));
            }
        }
    }
    // for the VarsTables
    for (VarTable varTable : varTables) {
        for (VarNode node : varTable.getNodes()) {
            if (getMatcherNodeFigure(node).size() > 0) {
                index++;
                searchMaps.put(index, getMatcherNodeFigure(node));
            }
        }
    }
    // for the OutputTables
    for (OutputXmlTree outputXmlTree : outputTrees) {
        // ExpressionFilter
        if (outputXmlTree.getExpressionFilter() != null && matcher.matches(outputXmlTree.getExpressionFilter())) {
            EList<Adapter> adapter = outputXmlTree.eAdapters();
            if (adapter.size() > 0) {
                if (adapter.get(0) instanceof OutputXmlTreeEditPart) {
                    OutputXmlTreeEditPart outputXmlTreeEditPart = (OutputXmlTreeEditPart) adapter.get(0);
                    if (outputXmlTreeEditPart != null && outputXmlTreeEditPart.getFigure() != null && outputXmlTreeEditPart.getFigure() instanceof OutputXmlTreeFigure) {
                        OutputXmlTreeFigure outputXmlTreeFigure = (OutputXmlTreeFigure) outputXmlTreeEditPart.getFigure();
                        Map<Integer, Figure> map = new HashMap<Integer, Figure>();
                        map.put(0, outputXmlTreeFigure.getFilterContainer());
                        index++;
                        searchMaps.put(index, map);
                    }
                }
            }
        }
        // OutputTreeNode
        for (OutputTreeNode node : outputXmlTree.getNodes()) {
            // id_Document type
            if (XmlMapUtil.DOCUMENT.equals(node.getType())) {
                for (TreeNode nodeTemp : XmlMapUtil.getFlatChildrenList(node)) {
                    if (getMatcherNodeFigure(nodeTemp).size() > 0) {
                        index++;
                        searchMaps.put(index, getMatcherNodeFigure(nodeTemp));
                    }
                }
            } else {
                if (getMatcherNodeFigure(node).size() > 0) {
                    index++;
                    searchMaps.put(index, getMatcherNodeFigure(node));
                }
            }
        }
    }
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) HashMap(java.util.HashMap) Adapter(org.eclipse.emf.common.notify.Adapter) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) InputXmlTreeFigure(org.talend.designer.xmlmap.figures.InputXmlTreeFigure) OutputXmlTreeEditPart(org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart) IFigure(org.eclipse.draw2d.IFigure) OutputXmlTreeFigure(org.talend.designer.xmlmap.figures.OutputXmlTreeFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) VarNodeFigure(org.talend.designer.xmlmap.figures.varnode.VarNodeFigure) InputXmlTreeFigure(org.talend.designer.xmlmap.figures.InputXmlTreeFigure) VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) Figure(org.eclipse.draw2d.Figure) InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) VarTable(org.talend.designer.xmlmap.model.emf.xmlmap.VarTable) InputXmlTreeEditPart(org.talend.designer.xmlmap.parts.InputXmlTreeEditPart) 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) OutputXmlTreeFigure(org.talend.designer.xmlmap.figures.OutputXmlTreeFigure)

Example 3 with InputXmlTreeFigure

use of org.talend.designer.xmlmap.figures.InputXmlTreeFigure in project tdi-studio-se by Talend.

the class InputXmlTreeEditPart method notifyChanged.

@Override
public void notifyChanged(Notification notification) {
    int type = notification.getEventType();
    int featureId = notification.getFeatureID(XmlmapPackage.class);
    switch(type) {
        case Notification.ADD:
        case Notification.REMOVE:
        case Notification.REMOVE_MANY:
            switch(featureId) {
                case XmlmapPackage.INPUT_XML_TREE__NODES:
                case XmlmapPackage.INPUT_XML_TREE__GLOBAL_MAP_KEYS_VALUES:
                    refreshChildren();
                    break;
                case XmlmapPackage.ABSTRACT_IN_OUT_TREE__FILTER_INCOMING_CONNECTIONS:
                    refreshTargetConnections();
                    break;
            }
            break;
        case Notification.SET:
            switch(featureId) {
                case XmlmapPackage.INPUT_XML_TREE__NODES:
                case XmlmapPackage.INPUT_XML_TREE__GLOBAL_MAP_KEYS_VALUES:
                    refreshChildren();
                    break;
                case XmlmapPackage.INPUT_XML_TREE__ACTIVATE_CONDENSED_TOOL:
                    getFigure().validate();
                    break;
                case XmlmapPackage.INPUT_XML_TREE__LOOKUP_MODE:
                case XmlmapPackage.INPUT_XML_TREE__MATCHING_MODE:
                case XmlmapPackage.INPUT_XML_TREE__INNER_JOIN:
                case XmlmapPackage.INPUT_XML_TREE__PERSISTENT:
                case XmlmapPackage.INPUT_XML_TREE__MINIMIZED:
                case XmlmapPackage.INPUT_XML_TREE__EXPRESSION_FILTER:
                    ((InputXmlTreeFigure) getFigure()).update(featureId);
                    break;
                case XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS:
                    if (getParent() instanceof XmlMapDataEditPart) {
                        List childPart = ((XmlMapDataEditPart) getParent()).getChildren();
                        for (Object o : childPart) {
                            if (o instanceof OutputXmlTreeEditPart) {
                                OutputXmlTreeEditPart outputPart = (OutputXmlTreeEditPart) o;
                                boolean hasDocument = XmlMapUtil.hasDocument((OutputXmlTree) outputPart.getModel());
                                if (!hasDocument) {
                                    OutputXmlTreeFigure outputTreeFigure = (OutputXmlTreeFigure) outputPart.getFigure();
                                    outputTreeFigure.update(XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS);
                                } else {
                                    List nodeChild = outputPart.getChildren();
                                    for (Object nc : nodeChild) {
                                        if (nc instanceof OutputTreeNodeEditPart) {
                                            refreshOutputNodeLoopFunctionBtn((OutputTreeNodeEditPart) nc);
                                        }
                                    }
                                }
                            }
                        }
                        boolean changed = clearOutputAggregateIfNeeded();
                        if (changed) {
                            ((XmlMapDataEditPart) getParent()).refresh();
                        }
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().getProblemsAnalyser().checkProblems();
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().getMapperUI().updateStatusBar();
                    }
            }
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) OutputXmlTreeFigure(org.talend.designer.xmlmap.figures.OutputXmlTreeFigure) InputXmlTreeFigure(org.talend.designer.xmlmap.figures.InputXmlTreeFigure) XmlMapGraphicViewer(org.talend.designer.xmlmap.editor.XmlMapGraphicViewer) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

InputXmlTreeFigure (org.talend.designer.xmlmap.figures.InputXmlTreeFigure)3 OutputXmlTreeFigure (org.talend.designer.xmlmap.figures.OutputXmlTreeFigure)2 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)2 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Figure (org.eclipse.draw2d.Figure)1 IFigure (org.eclipse.draw2d.IFigure)1 Point (org.eclipse.draw2d.geometry.Point)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)1 VarEntityFigure (org.talend.designer.gefabstractmap.figures.var.VarEntityFigure)1 XmlMapGraphicViewer (org.talend.designer.xmlmap.editor.XmlMapGraphicViewer)1 XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)1 VarNodeFigure (org.talend.designer.xmlmap.figures.varnode.VarNodeFigure)1 IConnection (org.talend.designer.xmlmap.model.emf.xmlmap.IConnection)1 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)1 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)1 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)1