Search in sources :

Example 6 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class FilterConnectionPart method createFigure.

@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection();
    connection.setTargetDecoration(new PolygonDecoration());
    connection.setForegroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_UNSELECTED_FILTER_LINK));
    connection.setLineWidth(2);
    return connection;
}
Also used : PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 7 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class FilterConnectionPart method getFigure.

@Override
public IFigure getFigure() {
    PolylineConnection figure = (PolylineConnection) super.getFigure();
    if (getTarget() instanceof OutputTablePart) {
        if (curvrRouter == null) {
            curvrRouter = new CurveConnectionRouter();
            figure.setConnectionRouter(curvrRouter);
        }
    } else if (getTarget() instanceof InputTablePart) {
        if (cr == null) {
            cr = new LookupConnectionRouter();
            figure.setConnectionRouter(cr);
        }
    }
    if (cr != null) {
        cr.setOffset(calculateConnOffset());
    }
    return figure;
}
Also used : LookupConnectionRouter(org.talend.designer.gefabstractmap.figures.routers.LookupConnectionRouter) CurveConnectionRouter(org.talend.designer.gefabstractmap.figures.routers.CurveConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 8 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection 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 9 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection 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 10 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class ConnLabelEditPart method refreshVisuals.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
     */
@Override
protected void refreshVisuals() {
    String text = ((ConnectionLabel) getModel()).getLabelText();
    Point offset = ((ConnectionLabel) getModel()).getOffset();
    Label figure = (Label) getFigure();
    figure.setText(text);
    ConnectionPart parent = (ConnectionPart) getParent();
    PolylineConnection connFigure = (PolylineConnection) parent.getFigure();
    //$NON-NLS-1$
    ConnLabelConstraint constraint = new ConnLabelConstraint(text, "center", offset, connFigure);
    parent.setLayoutConstraint(this, getFigure(), constraint);
}
Also used : Label(org.eclipse.draw2d.Label) Point(org.eclipse.draw2d.geometry.Point) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Aggregations

PolylineConnection (org.eclipse.draw2d.PolylineConnection)43 Point (org.eclipse.draw2d.geometry.Point)11 PolygonDecoration (org.eclipse.draw2d.PolygonDecoration)10 IFigure (org.eclipse.draw2d.IFigure)8 BendpointConnectionRouter (org.eclipse.draw2d.BendpointConnectionRouter)6 Label (org.eclipse.draw2d.Label)6 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)5 Edge (org.eclipse.draw2d.graph.Edge)3 ArrayList (java.util.ArrayList)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)2 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 Node (org.eclipse.draw2d.graph.Node)2 NodeList (org.eclipse.draw2d.graph.NodeList)2 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)2 CurveConnectionRouter (org.talend.designer.gefabstractmap.figures.routers.CurveConnectionRouter)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)2 LookupConnectionPart (org.talend.designer.gefabstractmap.part.LookupConnectionPart)2