Search in sources :

Example 1 with XmlmapTreeNodeFigure

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

the class TreeNodeEditPart method performRequest.

@Override
public void performRequest(Request req) {
    if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
        Figure figure = null;
        DirectEditRequest drequest = (DirectEditRequest) req;
        Point figureLocation = drequest.getLocation();
        if (getFigure() instanceof TableTreeEntityFigure) {
            XmlmapTreeNodeFigure treeNodeFigure = (XmlmapTreeNodeFigure) getFigure();
            ArrayList collection = new ArrayList();
            collection.add(treeNodeFigure.getExpressionFigure());
            collection.add(treeNodeFigure.getBranchContent());
            figure = (Figure) treeNodeFigure.findFigureAt(figureLocation.x, figureLocation.y, new FigureSearch(collection));
        }
        if (figure instanceof IWidgetCell) {
            directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator(figure, this));
        }
        if (directEditManager != null) {
            TreeNode outputTreeNode = (TreeNode) getModel();
            if (figure instanceof ExpressionFigure) {
                if (XmlMapUtil.isExpressionEditable(outputTreeNode)) {
                    Point location = drequest.getLocation();
                    if (figure.containsPoint(location)) {
                        directEditManager.show();
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
                    }
                }
            } else if (!(((TreeNode) getModel()).eContainer() instanceof AbstractInOutTree)) {
            // disable for RC2
            // directEditManager.show();
            // ((XmlMapGraphicViewer)
            // getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
            }
        }
    }
    super.performRequest(req);
}
Also used : XmlMapNodeDirectEditManager(org.talend.designer.xmlmap.parts.directedit.XmlMapNodeDirectEditManager) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) ArrayList(java.util.ArrayList) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) Point(org.eclipse.draw2d.geometry.Point) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) IFigure(org.eclipse.draw2d.IFigure) ExpressionFigure(org.talend.designer.gefabstractmap.figures.ExpressionFigure) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) Figure(org.eclipse.draw2d.Figure) XmlMapNodeCellEditorLocator(org.talend.designer.gefabstractmap.part.directedit.XmlMapNodeCellEditorLocator) ExpressionFigure(org.talend.designer.gefabstractmap.figures.ExpressionFigure) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) IWidgetCell(org.talend.designer.gefabstractmap.figures.cells.IWidgetCell)

Example 2 with XmlmapTreeNodeFigure

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

the class TreeNodeEditPart method createFigure.

@Override
protected IFigure createFigure() {
    TreeNode model = (TreeNode) getModel();
    boolean isRoot = false;
    if (model.eContainer() instanceof AbstractInOutTree) {
        isRoot = true;
    }
    XmlmapTreeNodeFigure treeNodeFigure = new XmlmapTreeNodeFigure(entityManger, isRoot);
    return treeNodeFigure;
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)

Example 3 with XmlmapTreeNodeFigure

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

the class SearchZoneMapper method setEntryState.

public void setEntryState(MapperManager mapperManager, EntryState entryState, Figure entry) {
    if (entry != null) {
        if (entry instanceof XmlmapTreeNodeFigure) {
            XmlmapTreeNodeFigure xmlMapTreeNodeFigure = (XmlmapTreeNodeFigure) entry;
            if (xmlMapTreeNodeFigure != null) {
                if (xmlMapTreeNodeFigure.getExpressionFigure() != null && matcher.matches(xmlMapTreeNodeFigure.getExpressionFigure().getText())) {
                    xmlMapTreeNodeFigure.getExpressionFigure().setOpaque(true);
                    xmlMapTreeNodeFigure.getExpressionFigure().setBackgroundColor(entryState.getColor());
                }
                if (xmlMapTreeNodeFigure.getTreeNode() != null && matcher.matches(xmlMapTreeNodeFigure.getTreeNode().getName())) {
                    if (XmlMapUtil.isSubElementOfDocument(xmlMapTreeNodeFigure.getTreeNode())) {
                        if (!xmlMapTreeNodeFigure.getTreeNode().getName().endsWith("(choice)")) {
                            xmlMapTreeNodeFigure.getBranchContent().setOpaque(true);
                            xmlMapTreeNodeFigure.getBranchContent().setBackgroundColor(entryState.getColor());
                        }
                    } else {
                        xmlMapTreeNodeFigure.setOpaque(true);
                        xmlMapTreeNodeFigure.setBackgroundColor(entryState.getColor());
                        xmlMapTreeNodeFigure.setOpaque(false);
                        if (xmlMapTreeNodeFigure.getExpressionFigure() != null && !matcher.matches(xmlMapTreeNodeFigure.getExpressionFigure().getText())) {
                        // xmlMapTreeNodeFigure.getExpressionFigure().setOpaque(true);
                        // xmlMapTreeNodeFigure.getExpressionFigure().setBackgroundColor(EntryState.NONE.getColor());
                        }
                    }
                }
            }
        } else if (entry instanceof VarEntityFigure) {
            VarEntityFigure varEntityFigure = (VarEntityFigure) entry;
            if (varEntityFigure != null) {
                if (varEntityFigure.getExpression() != null && matcher.matches(varEntityFigure.getExpression().getText())) {
                    varEntityFigure.getExpression().setOpaque(true);
                    varEntityFigure.getExpression().setBackgroundColor(entryState.getColor());
                }
                if (varEntityFigure.getVarName() != null && matcher.matches(varEntityFigure.getVarName())) {
                    varEntityFigure.setOpaque(true);
                    varEntityFigure.setBackgroundColor(entryState.getColor());
                    if (varEntityFigure.getExpression() == null || !matcher.matches(varEntityFigure.getExpression().getText())) {
                        varEntityFigure.getExpression().setOpaque(true);
                        varEntityFigure.getExpression().setBackgroundColor(EntryState.NONE.getColor());
                    }
                    varEntityFigure.getTypeFigure().setOpaque(true);
                    varEntityFigure.getTypeFigure().setBackgroundColor(EntryState.NONE.getColor());
                }
            }
        } else if (entry instanceof XmlMapFilterContainer) {
            XmlMapFilterContainer filterText = (XmlMapFilterContainer) entry;
            if (filterText != null && filterText.getTextArea() != null) {
                filterText.getTextArea().setOpaque(true);
                filterText.getTextArea().setBackgroundColor(entryState.getColor());
            }
        }
    }
}
Also used : VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) XmlMapFilterContainer(org.talend.designer.xmlmap.figures.treesettings.XmlMapFilterContainer)

Example 4 with XmlmapTreeNodeFigure

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

the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.

public void moveScrollBarZoneAtSelectedTableItem(Figure entry) {
    if (entry != null) {
        Rectangle bounds = entry.getBounds();
        int selection = bounds.y - 100;
        if (entry instanceof XmlmapTreeNodeFigure) {
            XmlmapTreeNodeFigure xmlMapTreeNodeFigure = (XmlmapTreeNodeFigure) entry;
            TreeNode treeNode = xmlMapTreeNodeFigure.getTreeNode();
            if (treeNode != null) {
                for (Adapter adapter : treeNode.eAdapters()) {
                    TreeNodeEditPart part = (TreeNodeEditPart) adapter;
                    XmlMapDataEditPart xmlMapDataEditPart = part.getMapDataEditPart();
                    if (adapter instanceof OutputTreeNodeEditPart) {
                        Viewport viewport = xmlMapDataEditPart.getOutputScroll().getViewport();
                        viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
                    } else if (adapter instanceof TreeNodeEditPart) {
                        Viewport viewport = xmlMapDataEditPart.getInputScroll().getViewport();
                        viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
                    }
                }
            }
        } else if (entry instanceof VarNodeFigure) {
            VarNodeFigure varNodeFigure = (VarNodeFigure) entry;
            VarNode varNode = varNodeFigure.getVarNode();
            if (varNode != null) {
                for (Adapter adapter : varNode.eAdapters()) {
                    VarNodeEditPart part = (VarNodeEditPart) adapter;
                    XmlMapDataEditPart xmlMapDataEditPart = part.getMapDataEditPart();
                    Viewport viewport = xmlMapDataEditPart.getVarScroll().getViewport();
                    viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
                }
            }
        }
    }
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) VarNodeEditPart(org.talend.designer.xmlmap.parts.VarNodeEditPart) VarNodeFigure(org.talend.designer.xmlmap.figures.varnode.VarNodeFigure) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Viewport(org.eclipse.draw2d.Viewport) Adapter(org.eclipse.emf.common.notify.Adapter) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) OutputTreeNodeEditPart(org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart) XmlMapDataEditPart(org.talend.designer.xmlmap.parts.XmlMapDataEditPart) TreeNodeEditPart(org.talend.designer.xmlmap.parts.TreeNodeEditPart) OutputTreeNodeEditPart(org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)

Example 5 with XmlmapTreeNodeFigure

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

the class OutputTreeNodeEditPart method notifyChanged.

@Override
public void notifyChanged(Notification notification) {
    super.notifyChanged(notification);
    int type = notification.getEventType();
    int featureId = notification.getFeatureID(XmlmapPackage.class);
    switch(type) {
        case Notification.SET:
            switch(featureId) {
                case XmlmapPackage.TREE_NODE__TYPE:
                    if (XmlMapUtil.DOCUMENT.equals(notification.getOldValue()) || !XmlMapUtil.DOCUMENT.equals(notification.getOldValue()) && XmlMapUtil.DOCUMENT.equals(notification.getNewValue())) {
                        MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(this);
                        if (mapperTablePart.getFigure() instanceof OutputXmlTreeFigure) {
                            ((OutputXmlTreeFigure) mapperTablePart.getFigure()).update(XmlmapPackage.TREE_NODE__TYPE);
                        }
                    }
                    break;
                case XmlmapPackage.TREE_NODE__LOOP:
                    ((XmlmapTreeNodeFigure) getFigure()).getBranchContent().updateLoopButtonFigure();
                    AbstractInOutTree abstractInOutTree = XmlMapUtil.getAbstractInOutTree((OutputTreeNode) getModel());
                    if (abstractInOutTree != null) {
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().getProblemsAnalyser().checkProblems(abstractInOutTree);
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().getMapperUI().updateStatusBar();
                    }
            }
            break;
        case Notification.REMOVE:
        case Notification.REMOVE_MANY:
            switch(featureId) {
            }
        // }
        case Notification.ADD:
        case Notification.ADD_MANY:
            switch(featureId) {
                case XmlmapPackage.INPUT_LOOP_NODES_TABLE__INPUTLOOPNODES:
                case XmlmapPackage.OUTPUT_TREE_NODE__INPUT_LOOP_NODES_TABLE:
                    XmlmapTreeNodeFigure outputFigure = (XmlmapTreeNodeFigure) getFigure();
                    if (outputFigure.getElement() != null) {
                        outputFigure.getBranchContent().updateLoopButtonFigure();
                    }
                    break;
                default:
                    break;
            }
    }
}
Also used : AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) OutputXmlTreeFigure(org.talend.designer.xmlmap.figures.OutputXmlTreeFigure) XmlMapGraphicViewer(org.talend.designer.xmlmap.editor.XmlMapGraphicViewer)

Aggregations

XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)6 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)4 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)4 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)3 Point (org.eclipse.draw2d.geometry.Point)2 ExpressionFigure (org.talend.designer.gefabstractmap.figures.ExpressionFigure)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 ArrayList (java.util.ArrayList)1 Figure (org.eclipse.draw2d.Figure)1 IFigure (org.eclipse.draw2d.IFigure)1 Viewport (org.eclipse.draw2d.Viewport)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 DirectEditRequest (org.eclipse.gef.requests.DirectEditRequest)1 IWidgetCell (org.talend.designer.gefabstractmap.figures.cells.IWidgetCell)1 VarEntityFigure (org.talend.designer.gefabstractmap.figures.var.VarEntityFigure)1 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)1 XmlMapNodeCellEditorLocator (org.talend.designer.gefabstractmap.part.directedit.XmlMapNodeCellEditorLocator)1 XmlMapGraphicViewer (org.talend.designer.xmlmap.editor.XmlMapGraphicViewer)1 OutputXmlTreeFigure (org.talend.designer.xmlmap.figures.OutputXmlTreeFigure)1