Search in sources :

Example 1 with TableEntityFigure

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

the class RowSelectionEditPolicy method getLocatorFigure.

private IFigure getLocatorFigure(GraphicalEditPart owner) {
    IFigure figure = owner.getFigure();
    if (owner instanceof TableEntityPart) {
        TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
        // table figure to restrict the width
        MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
        IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
        Rectangle treeBounds = parentFigure.getBounds();
        Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
        Rectangle treeNodeBounds = figure.getBounds();
        figure = new Figure();
        if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
            figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
            return figure;
        } else {
            figure.setBounds(owner.getFigure().getBounds().getCopy());
            figure.getBounds().height = rowBounds.height;
            return figure;
        }
    } else if (figure instanceof VarEntityFigure) {
        Rectangle copy = figure.getBounds().getCopy();
        figure = new Figure();
        figure.setBounds(copy);
        return figure;
    }
    return owner.getFigure();
}
Also used : VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) IFigure(org.eclipse.draw2d.IFigure) VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) Figure(org.eclipse.draw2d.Figure)

Example 2 with TableEntityFigure

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

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

the class LookupColumnAnchor method getReferencePoint.

@Override
public Point getReferencePoint() {
    if (connectionPart == null) {
        return getOwner().getBounds().getLeft();
    }
    MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(entityManager.getEditPart());
    Point ref = null;
    if (mapperTablePart != null && entityManager.isTableMinimized()) {
        ref = mapperTablePart.getFigure().getBounds().getLeft();
    } else {
        if (getOwner() == null) {
            return null;
        } else if (getOwner() instanceof TableEntityFigure) {
            TableEntityFigure nodeFigure = (TableEntityFigure) getOwner();
            if (nodeFigure.getElement() != null) {
                ref = nodeFigure.getElement().getBounds().getLeft();
                getOwner().translateToAbsolute(ref);
            }
        } else {
            ref = getOwner().getBounds().getCenter();
            getOwner().translateToAbsolute(ref);
        }
    }
    if (mapperTablePart != null && ref != null) {
        IFigure treeFigure = mapperTablePart.getFigure();
        int avialableX = treeFigure.getBounds().x;
        if (ref.x < avialableX) {
            ref.x = avialableX;
        }
    }
    if (connectionPart instanceof BaseConnectionEditPart && connectionPart.getFigure() instanceof PolylineConnection) {
        BaseConnectionEditPart baseConnectionPart = (BaseConnectionEditPart) connectionPart;
        PolylineConnection connFigure = (PolylineConnection) connectionPart.getFigure();
        org.eclipse.swt.graphics.Point avilableSize = entityManager.getGraphicalViewer().getControl().getSize();
        if (ref != null) {
            if (ref.y < 0) {
                if (!(baseConnectionPart instanceof LookupConnectionPart)) {
                    ref.y = 0;
                }
                baseConnectionPart.setTargetContained(false);
                if (baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                } else {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            } else if (ref.y > avilableSize.y) {
                if (!(baseConnectionPart instanceof LookupConnectionPart)) {
                    ref.y = avilableSize.y;
                }
                baseConnectionPart.setTargetContained(false);
                if (baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                } else {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            } else {
                baseConnectionPart.setTargetContained(true);
                if (!baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            }
        }
    }
    return ref;
}
Also used : Point(org.eclipse.draw2d.geometry.Point) LookupConnectionPart(org.talend.designer.gefabstractmap.part.LookupConnectionPart) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure) BaseConnectionEditPart(org.talend.designer.gefabstractmap.part.BaseConnectionEditPart) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 4 with TableEntityFigure

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

the class SearchZoneMapper method getMatcherNodeFigure.

private Map<Integer, Figure> getMatcherNodeFigure(AbstractNode node) {
    Map<Integer, Figure> map = new HashMap<Integer, Figure>();
    int i = -1;
    TableEntityFigure figure = null;
    if (node != null) {
        EList<Adapter> adapter = node.eAdapters();
        if (adapter.size() > 0) {
            if (adapter.get(0) instanceof TableEntityPart) {
                TableEntityPart tableEntityPart = (TableEntityPart) adapter.get(0);
                if (tableEntityPart != null && tableEntityPart.getFigure() != null && tableEntityPart.getFigure() instanceof TableEntityFigure) {
                    figure = (TableEntityFigure) tableEntityPart.getFigure();
                }
            }
        }
        if (node.getExpression() != null && matcher.matches(node.getExpression())) {
            i++;
            map.put(i, figure);
        } else if (node.getName() != null && matcher.matches(node.getName())) {
            i++;
            map.put(i, figure);
        }
    }
    return map;
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) HashMap(java.util.HashMap) Adapter(org.eclipse.emf.common.notify.Adapter) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) 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)

Aggregations

TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)4 IFigure (org.eclipse.draw2d.IFigure)3 TableEntityPart (org.talend.designer.gefabstractmap.part.TableEntityPart)3 Figure (org.eclipse.draw2d.Figure)2 VarEntityFigure (org.talend.designer.gefabstractmap.figures.var.VarEntityFigure)2 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)2 HashMap (java.util.HashMap)1 PolylineConnection (org.eclipse.draw2d.PolylineConnection)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 ExpandCollapseFigure (org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)1 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)1 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)1 LookupConnectionPart (org.talend.designer.gefabstractmap.part.LookupConnectionPart)1 InputXmlTreeFigure (org.talend.designer.xmlmap.figures.InputXmlTreeFigure)1 OutputXmlTreeFigure (org.talend.designer.xmlmap.figures.OutputXmlTreeFigure)1 XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)1 VarNodeFigure (org.talend.designer.xmlmap.figures.varnode.VarNodeFigure)1