Search in sources :

Example 6 with InputTablePart

use of org.talend.designer.gefabstractmap.part.InputTablePart in project tdi-studio-se by Talend.

the class FilterColumnAnchor method getReferencePoint.

@Override
public Point getReferencePoint() {
    if (connectionPart == null) {
        return getOwner().getBounds().getLeft();
    }
    MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(entityManager.getEditPart());
    boolean loctionRight = true;
    if (connectionPart.getTarget() instanceof InputTablePart) {
        loctionRight = false;
    }
    Point ref = null;
    if (mapperTablePart != null && entityManager.isTableMinimized()) {
        if (loctionRight) {
            ref = mapperTablePart.getFigure().getBounds().getRight();
        } else {
            ref = mapperTablePart.getFigure().getBounds().getLeft();
        }
    } else {
        if (getOwner() == null) {
            return null;
        } else if (getOwner() instanceof TableTreeEntityFigure) {
            TableTreeEntityFigure nodeFigure = (TableTreeEntityFigure) getOwner();
            if (nodeFigure.getElement() != null) {
                if (loctionRight) {
                    ref = nodeFigure.getElement().getBounds().getRight();
                } else {
                    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();
        if (loctionRight) {
            int avialableX = treeFigure.getBounds().getRight().x;
            if (ref.x > avialableX) {
                ref.x = avialableX;
            }
        } else {
            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) {
                ref.y = 0;
                baseConnectionPart.setSourceConcained(false);
                if (baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                } else {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            } else if (ref.y > avilableSize.y) {
                ref.y = avilableSize.y;
                baseConnectionPart.setSourceConcained(false);
                if (baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                } else {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            } else {
                baseConnectionPart.setSourceConcained(true);
                if (!baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            }
        }
    }
    return ref;
}
Also used : TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) Point(org.eclipse.draw2d.geometry.Point) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) InputTablePart(org.talend.designer.gefabstractmap.part.InputTablePart) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure) BaseConnectionEditPart(org.talend.designer.gefabstractmap.part.BaseConnectionEditPart) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Aggregations

InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)6 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)5 List (java.util.List)4 OutputTablePart (org.talend.designer.gefabstractmap.part.OutputTablePart)4 ArrayList (java.util.ArrayList)2 IFigure (org.eclipse.draw2d.IFigure)2 PolylineConnection (org.eclipse.draw2d.PolylineConnection)2 Point (org.eclipse.draw2d.geometry.Point)2 EditPart (org.eclipse.gef.EditPart)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)2 MapperRootEditPart (org.talend.designer.gefabstractmap.part.MapperRootEditPart)2 TableEntityPart (org.talend.designer.gefabstractmap.part.TableEntityPart)2 EventObject (java.util.EventObject)1 InputZoneToolBar (org.talend.designer.gefabstractmap.figures.treetools.zone.InputZoneToolBar)1 OutputZoneToolBar (org.talend.designer.gefabstractmap.figures.treetools.zone.OutputZoneToolBar)1 MapperTable (org.talend.designer.gefabstractmap.model.abstractmap.MapperTable)1 LookupConnectionPart (org.talend.designer.gefabstractmap.part.LookupConnectionPart)1