Search in sources :

Example 1 with TableTreeEntityFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure 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 TableTreeEntityFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.

the class TreeBranchLayout method calculateDepth.

public void calculateDepth() {
    int depth = 0;
    if (getTreeNodeFigure() != null) {
        TableTreeEntityFigure parent = getTreeNodeFigure().getParentEntity();
        if (parent != null && parent.getTreeBranch() != null) {
            depth += parent.getTreeBranch().getDepth();
        }
    }
    depth++;
    setDepth(depth);
}
Also used : TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) Point(org.eclipse.draw2d.geometry.Point)

Example 3 with TableTreeEntityFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.

the class TreeExpandSupportEditPolicy method activate.

@Override
public void activate() {
    super.activate();
    TableEntityPart host = (TableEntityPart) getHost();
    if (host.getFigure() instanceof TableEntityFigure) {
        TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
        if (treeNodeFigure.getTreeBranch() != null) {
            ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
            if (ecFigure != null) {
                ecFigure.addMouseListener(l);
            }
        }
    }
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Example 4 with TableTreeEntityFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.

the class TreeExpandSupportEditPolicy method deactivate.

@Override
public void deactivate() {
    TableEntityPart host = (TableEntityPart) getHost();
    if (host.getFigure() instanceof TableTreeEntityFigure) {
        TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
        if (treeNodeFigure.getTreeBranch() != null) {
            ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
            if (ecFigure != null) {
                ecFigure.removeMouseListener(l);
            }
        }
    }
    super.deactivate();
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Example 5 with TableTreeEntityFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.

the class TreeBranchLayout method paintLines.

public void paintLines(Graphics g) {
    int gap = treeBranch.getGaps();
    g.setLineStyle(getBranchLineStyle());
    IFigure startFig = treeBranch.getTitle();
    int x = startFig.getBounds().x + gap;
    int y = startFig.getBounds().bottom() - 2;
    if (getTreeNodeFigure() != null) {
        List children = getTreeNodeFigure().getContents().getChildren();
        if (children.size() == 0) {
            return;
        }
        int bottom = y;
        for (int i = 0; i < children.size(); i++) {
            TableTreeEntityFigure treeNode = (TableTreeEntityFigure) children.get(i);
            Rectangle childStartBounds = treeNode.getTreeBranch().getTitle().getBounds();
            Point pt = childStartBounds.getLeft();
            g.drawLine(x, pt.y, pt.x, pt.y);
            bottom = Math.max(bottom, pt.y);
        }
        g.drawLine(x, y, x, bottom);
    }
}
Also used : TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) List(java.util.List) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)9 Point (org.eclipse.draw2d.geometry.Point)7 IFigure (org.eclipse.draw2d.IFigure)4 PolylineConnection (org.eclipse.draw2d.PolylineConnection)2 ExpressionFigure (org.talend.designer.gefabstractmap.figures.ExpressionFigure)2 ExpandCollapseFigure (org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)2 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)2 InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)2 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)2 TableEntityPart (org.talend.designer.gefabstractmap.part.TableEntityPart)2 XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)2 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)2 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Figure (org.eclipse.draw2d.Figure)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 DirectEditRequest (org.eclipse.gef.requests.DirectEditRequest)1 IWidgetCell (org.talend.designer.gefabstractmap.figures.cells.IWidgetCell)1 TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)1