Search in sources :

Example 36 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project dbeaver by dbeaver.

the class LockGraphEdgeEditPart method createFigure.

@Override
protected IFigure createFigure() {
    PolylineConnection connection = (PolylineConnection) super.createFigure();
    connection.setLineWidth(1);
    PolygonDecoration decoration = new PolygonDecoration();
    decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
    connection.setSourceDecoration(decoration);
    return connection;
}
Also used : PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 37 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project whole by wholeplatform.

the class DecoratedConnectionPartFactory method createConnectionPart.

public ConnectionEditPart createConnectionPart(final int sourceDecorationType, final int targetDecorationType) {
    return new SimpleConnectionPart() {

        protected IFigure createFigure() {
            PolylineConnection connection = new PolylineConnection() {

                public void paintFigure(Graphics graphics) {
                    // workaround to eliminate initial painting using default coordinates
                    if (getSource() != null && getTarget() != null)
                        super.paintFigure(graphics);
                }

                @Override
                protected void paintClientArea(Graphics graphics) {
                    // workaround to eliminate initial painting using default coordinates
                    if (getSource() != null && getTarget() != null)
                        super.paintClientArea(graphics);
                }
            };
            connection.setSourceDecoration(createDecoration(sourceDecorationType));
            connection.setTargetDecoration(createDecoration(targetDecorationType));
            return connection;
        }
    };
}
Also used : Graphics(org.eclipse.draw2d.Graphics) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 38 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project whole by wholeplatform.

the class DecoratedConnectionPartFactory method createConnection.

public PolylineConnection createConnection(final int sourceDecorationType, final int targetDecorationType) {
    PolylineConnection connection = new PolylineConnection();
    connection.setSourceDecoration(createDecoration(sourceDecorationType));
    connection.setTargetDecoration(createDecoration(targetDecorationType));
    return connection;
}
Also used : PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 39 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project whole by wholeplatform.

the class DecorableConnectionPart method createFigure.

protected IFigure createFigure() {
    PolylineConnection connection = (PolylineConnection) super.createFigure();
    connection.setSourceDecoration(DecoratedConnectionPartFactory.instance().createDecoration(sourceDecorationType));
    connection.setTargetDecoration(DecoratedConnectionPartFactory.instance().createDecoration(targetDecorationType));
    return connection;
}
Also used : PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 40 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project archi by archimatetool.

the class ZestViewerLabelProvider method selfStyleConnection.

// ========================================================================================
// ISelfStyleProvider
// ========================================================================================
@Override
public void selfStyleConnection(Object element, GraphConnection connection) {
    connection.setLineWidth(0);
    connection.setTooltip(getTooltip(element));
    connection.setLineColor(ColorConstants.black);
    connection.setText(getText(element));
    PolylineConnection conn = (PolylineConnection) connection.getConnectionFigure();
    if (element instanceof ISpecializationRelationship) {
        conn.setTargetDecoration(SpecializationConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof ICompositionRelationship) {
        conn.setSourceDecoration(CompositionConnectionFigure.createFigureSourceDecoration());
    } else if (element instanceof IAggregationRelationship) {
        conn.setSourceDecoration(AggregationConnectionFigure.createFigureSourceDecoration());
    } else if (element instanceof IAssignmentRelationship) {
        conn.setSourceDecoration(AssignmentConnectionFigure.createFigureSourceDecoration());
        conn.setTargetDecoration(AssignmentConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof IRealizationRelationship) {
        conn.setTargetDecoration(RealizationConnectionFigure.createFigureTargetDecoration());
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 2 });
    } else if (element instanceof ITriggeringRelationship) {
        conn.setTargetDecoration(TriggeringConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof IFlowRelationship) {
        conn.setTargetDecoration(FlowConnectionFigure.createFigureTargetDecoration());
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 6, 3 });
    } else if (element instanceof IServingRelationship) {
        conn.setTargetDecoration(ServingConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof IAccessRelationship) {
        switch(((IAccessRelationship) element).getAccessType()) {
            case IAccessRelationship.WRITE_ACCESS:
            default:
                conn.setSourceDecoration(null);
                // arrow at target endpoint
                conn.setTargetDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                break;
            case IAccessRelationship.READ_ACCESS:
                // arrow at source endpoint
                conn.setSourceDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                conn.setTargetDecoration(null);
                break;
            case IAccessRelationship.UNSPECIFIED_ACCESS:
                // no arrows
                conn.setSourceDecoration(null);
                conn.setTargetDecoration(null);
                break;
            case IAccessRelationship.READ_WRITE_ACCESS:
                // both arrows
                conn.setSourceDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                conn.setTargetDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                break;
        }
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 2 });
    } else if (element instanceof IInfluenceRelationship) {
        conn.setTargetDecoration(InfluenceConnectionFigure.createFigureTargetDecoration());
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 6, 3 });
    } else if (element instanceof IAssociationRelationship) {
        if (((IAssociationRelationship) element).isDirected()) {
            conn.setTargetDecoration(AssociationConnectionFigure.createFigureTargetDecoration());
        } else {
            conn.setTargetDecoration(null);
        }
    }
    conn.setAntialias(SWT.ON);
}
Also used : IInfluenceRelationship(com.archimatetool.model.IInfluenceRelationship) ICompositionRelationship(com.archimatetool.model.ICompositionRelationship) IRealizationRelationship(com.archimatetool.model.IRealizationRelationship) IAssociationRelationship(com.archimatetool.model.IAssociationRelationship) ITriggeringRelationship(com.archimatetool.model.ITriggeringRelationship) ISpecializationRelationship(com.archimatetool.model.ISpecializationRelationship) IAssignmentRelationship(com.archimatetool.model.IAssignmentRelationship) IAggregationRelationship(com.archimatetool.model.IAggregationRelationship) IFlowRelationship(com.archimatetool.model.IFlowRelationship) IAccessRelationship(com.archimatetool.model.IAccessRelationship) IServingRelationship(com.archimatetool.model.IServingRelationship) 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