Search in sources :

Example 11 with InputLoopNodesTable

use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable 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)

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