Search in sources :

Example 46 with InputXmlTree

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

the class XmlMapInputZoneToolBar method minSize.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.xmlmap.figures.treetools.zone.ZoneToolBar#minSize()
     */
@Override
public void minSize() {
    minimized = !minimized;
    EList<InputXmlTree> inputTrees = externalData.getInputTrees();
    for (InputXmlTree inputTree : inputTrees) {
        if (minimized != inputTree.isMinimized()) {
            inputTree.setMinimized(minimized);
        }
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)

Example 47 with InputXmlTree

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

the class XmlMapInputZoneToolBar method moveUp.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.xmlmap.figures.treetools.zone.ZoneToolBar#moveUp()
     */
@Override
public void moveUp() {
    List<InputXmlTree> inputTrees = externalData.getInputTrees();
    InputXmlTreeEditPart currentSelectedInputXmlTree = graphicViewer.getFiguresManager().getCurrentSelectedInputTable();
    if (currentSelectedInputXmlTree != null) {
        InputXmlTree selectedTree = (InputXmlTree) currentSelectedInputXmlTree.getModel();
        int index = inputTrees.indexOf(selectedTree);
        if (index != -1 && index - 1 >= 0) {
            inputTrees.remove(selectedTree);
            inputTrees.add(index - 1, selectedTree);
            // index of modelchildren is different from index of tree
            int indexOf = externalPart.getModelChildren().indexOf(selectedTree);
            if (indexOf != -1) {
                externalPart.getViewer().appendSelection((EditPart) externalPart.getChildren().get(indexOf));
            }
        }
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) InputXmlTreeEditPart(org.talend.designer.xmlmap.parts.InputXmlTreeEditPart)

Example 48 with InputXmlTree

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

the class InputXmlTreeEditPart method setModel.

@Override
public void setModel(Object model) {
    super.setModel(model);
    manager = new XmlMapTableManager((InputXmlTree) model, this);
}
Also used : XmlMapTableManager(org.talend.designer.xmlmap.figures.table.XmlMapTableManager) InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)

Example 49 with InputXmlTree

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

the class OutputXmlTreeEditPart 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.OUTPUT_XML_TREE__NODES:
                    refreshChildren();
                    break;
                case XmlmapPackage.ABSTRACT_IN_OUT_TREE__FILTER_INCOMING_CONNECTIONS:
                    refreshTargetConnections();
                    break;
            }
            break;
        case Notification.SET:
            switch(featureId) {
                case XmlmapPackage.OUTPUT_XML_TREE__NODES:
                    refreshChildren();
                case XmlmapPackage.OUTPUT_XML_TREE__REJECT:
                case XmlmapPackage.OUTPUT_XML_TREE__REJECT_INNER_JOIN:
                case XmlmapPackage.OUTPUT_XML_TREE__EXPRESSION_FILTER:
                case XmlmapPackage.OUTPUT_XML_TREE__MINIMIZED:
                case XmlmapPackage.OUTPUT_XML_TREE__ALL_IN_ONE:
                case XmlmapPackage.OUTPUT_XML_TREE__ENABLE_EMPTY_ELEMENT:
                    ((OutputXmlTreeFigure) getFigure()).update(featureId);
                    break;
                case XmlmapPackage.TREE_NODE__EXPRESSION:
                    ((OutputXmlTreeFigure) getFigure()).update(XmlmapPackage.TREE_NODE__TYPE);
                    break;
                case XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS:
                    // fix for TDI-20808 , clean aggreage and groups if it's multiloops
                    OutputXmlTree model = (OutputXmlTree) getModel();
                    boolean changed = false;
                    if (model.isMultiLoops()) {
                        changed = XmlMapUtil.cleanGroup(model.getNodes());
                    }
                    if (model.isMultiLoops() && getParent() instanceof XmlMapDataEditPart) {
                        List childPart = ((XmlMapDataEditPart) getParent()).getChildren();
                        for (Object o : childPart) {
                            if (o instanceof InputXmlTreeEditPart) {
                                InputXmlTree inputTree = (InputXmlTree) ((InputXmlTreeEditPart) o).getModel();
                                if (inputTree.isMultiLoops() && !inputTree.isLookup()) {
                                    changed = XmlMapUtil.cleanAggregate(model.getNodes()) || changed;
                                    break;
                                }
                            }
                        }
                    }
                    if (changed) {
                        refreshChildren();
                    }
            }
    }
    // change icon for set loop function button
    if (type == Notification.ADD && featureId == XmlmapPackage.OUTPUT_XML_TREE__INPUT_LOOP_NODES_TABLES) {
        final InputLoopNodesTable loopNodeTable = (InputLoopNodesTable) notification.getNewValue();
        addListenerForInputLoopNodeTable(loopNodeTable);
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) ArrayList(java.util.ArrayList) List(java.util.List) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputXmlTreeFigure(org.talend.designer.xmlmap.figures.OutputXmlTreeFigure) Point(org.eclipse.draw2d.geometry.Point)

Example 50 with InputXmlTree

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

the class XmlMapDataImpl method equals.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated not
     */
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    XmlMapDataImpl dbObj = (XmlMapDataImpl) obj;
    EList<InputXmlTree> inputs = dbObj.getInputTrees();
    EList<OutputXmlTree> outputs = dbObj.getOutputTrees();
    EList<VarTable> vars = dbObj.getVarTables();
    EList<IConnection> conns = dbObj.getConnections();
    if (inputs.size() != getInputTrees().size()) {
        return false;
    }
    if (outputs.size() != getOutputTrees().size()) {
        return false;
    }
    if (vars.size() != getVarTables().size()) {
        return false;
    }
    if (getConnections().size() != conns.size()) {
        return false;
    }
    for (InputXmlTree inputTable : inputTrees) {
        boolean found = false;
        for (InputXmlTree input : inputs) {
            if (inputTable.getName().equals(input.getName())) {
                found = true;
                if (!inputTable.equals(input)) {
                    return false;
                }
                break;
            }
        }
        if (found == false) {
            return false;
        }
    }
    for (OutputXmlTree outputTable : outputTrees) {
        boolean found = false;
        for (OutputXmlTree output : outputs) {
            if (outputTable.getName().equals(output.getName())) {
                found = true;
                if (!outputTable.equals(output)) {
                    return false;
                }
                break;
            }
        }
        if (found == false) {
            return false;
        }
    }
    for (VarTable varTable : varTables) {
        boolean found = false;
        for (VarTable var : vars) {
            if (varTable.getName().equals(var.getName())) {
                found = true;
                if (!varTable.equals(var)) {
                    return false;
                }
                break;
            }
        }
        if (found == false) {
            return false;
        }
    }
    return true;
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) VarTable(org.talend.designer.xmlmap.model.emf.xmlmap.VarTable) IConnection(org.talend.designer.xmlmap.model.emf.xmlmap.IConnection) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)

Aggregations

InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)52 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)34 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)28 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)26 XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)18 ArrayList (java.util.ArrayList)17 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)12 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)12 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)9 List (java.util.List)5 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)5 IConnection (org.talend.designer.xmlmap.model.emf.xmlmap.IConnection)5 InputXmlTreeEditPart (org.talend.designer.xmlmap.parts.InputXmlTreeEditPart)5 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)4 HashMap (java.util.HashMap)3 Point (org.eclipse.draw2d.geometry.Point)3 EList (org.eclipse.emf.common.util.EList)3 ExpressionFigure (org.talend.designer.gefabstractmap.figures.ExpressionFigure)3 LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)3 Iterator (java.util.Iterator)2