Search in sources :

Example 1 with LookupConnectionPart

use of org.talend.designer.gefabstractmap.part.LookupConnectionPart 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 2 with LookupConnectionPart

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

the class FilterTreeAnchor method getReferencePoint.

@Override
public Point getReferencePoint() {
    Point ref = null;
    if (tableManager.isMinimized()) {
        ref = tableManager.getEditPart().getFigure().getBounds().getLeft();
    } else {
        if (getOwner() == null) {
            return null;
        } else if (getOwner() instanceof AbstractTableContainer) {
            AbstractTableContainer treeFigure = (AbstractTableContainer) getOwner();
            FilterContainer filterContainer = treeFigure.getFilterContainer();
            if (filterContainer != null) {
                ref = filterContainer.getBounds().getLeft();
            }
        }
    }
    if (ref != null) {
        IFigure treeFigure = tableManager.getEditPart().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 = tableManager.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 : FilterContainer(org.talend.designer.gefabstractmap.figures.treesettings.FilterContainer) Point(org.eclipse.draw2d.geometry.Point) LookupConnectionPart(org.talend.designer.gefabstractmap.part.LookupConnectionPart) AbstractTableContainer(org.talend.designer.gefabstractmap.figures.table.AbstractTableContainer) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure) BaseConnectionEditPart(org.talend.designer.gefabstractmap.part.BaseConnectionEditPart) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 3 with LookupConnectionPart

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

the class ConnectionColumnAnchor method getReferencePoint.

@Override
public Point getReferencePoint() {
    if (connectionPart == null) {
        return getOwner().getBounds().getLeft();
    }
    MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(entityManager.getEditPart());
    boolean loctionRight = false;
    if (mapperTablePart instanceof InputTablePart) {
        loctionRight = true;
    }
    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 (forceDarshDot) {
            connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
        } else if (ref != null) {
            if (ref.y < 0) {
                if (!(baseConnectionPart instanceof LookupConnectionPart)) {
                    ref.y = 0;
                }
                if (loctionRight) {
                    baseConnectionPart.setSourceConcained(false);
                } else {
                    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;
                }
                if (loctionRight) {
                    baseConnectionPart.setSourceConcained(false);
                } else {
                    baseConnectionPart.setTargetContained(false);
                }
                if (baseConnectionPart.isDOTStyle()) {
                    connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                } else {
                    connFigure.setLineStyle(SWT.LINE_SOLID);
                }
            } else {
                if (loctionRight) {
                    baseConnectionPart.setSourceConcained(true);
                } else {
                    baseConnectionPart.setTargetContained(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) PolylineConnection(org.eclipse.draw2d.PolylineConnection) LookupConnectionPart(org.talend.designer.gefabstractmap.part.LookupConnectionPart) IFigure(org.eclipse.draw2d.IFigure) BaseConnectionEditPart(org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)3 PolylineConnection (org.eclipse.draw2d.PolylineConnection)3 Point (org.eclipse.draw2d.geometry.Point)3 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)3 LookupConnectionPart (org.talend.designer.gefabstractmap.part.LookupConnectionPart)3 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)2 AbstractTableContainer (org.talend.designer.gefabstractmap.figures.table.AbstractTableContainer)1 TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)1 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)1 FilterContainer (org.talend.designer.gefabstractmap.figures.treesettings.FilterContainer)1 InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)1