Java Code Examples for org.eclipse.draw2d.PolylineConnection#setConnectionRouter()

The following examples show how to use org.eclipse.draw2d.PolylineConnection#setConnectionRouter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected IFigure createFigure() {
	Link link = (Link) getModel();
	link.editPart = this;
	SankeyDiagram editor = ((ProductSystemNode) link.sourceNode.parent).editor;
	PolylineConnection conn = new LinkFigure(link.getWidth(), editor);
	if (editor.isRouted()) {
		conn.setConnectionRouter(ROUTER);
	} else {
		conn.setConnectionRouter(ConnectionRouter.NULL);
	}
	link.figure = conn;
	conn.setTolerance(0);
	conn.setForegroundColor(link.getColor());
	return conn;
}
 
Example 2
Source File: CommentConnectionEditPart.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
protected IFigure createFigure() {
    final boolean bezier = getDiagram().getDiagramContents().getSettings().isUseBezierCurve();
    final PolylineConnection connection = new ERDiagramConnection(bezier);
    connection.setConnectionRouter(new BendpointConnectionRouter());
    connection.setLineStyle(SWT.LINE_DASH);
    return connection;
}
 
Example 3
Source File: RelationEditPart.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
protected IFigure createFigure() {
    final boolean bezier = getDiagram().getDiagramContents().getSettings().isUseBezierCurve();
    final PolylineConnection connection = new ERDiagramConnection(bezier);
    connection.setConnectionRouter(new BendpointConnectionRouter());
    final ConnectionEndpointLocator targetLocator = new ConnectionEndpointLocator(connection, true);
    this.targetLabel = new Label("");
    connection.add(targetLabel, targetLocator);
    return connection;
}
 
Example 4
Source File: BPMNShapeFactory.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private PolylineConnection createConnectorFigure(Edge bonitaEdge) {
    Bounds sourceLocation = getBPMNShapeBounds(modelExporter.getEObjectID(bonitaEdge.getSource()));
    Bounds targetLocation = getBPMNShapeBounds(modelExporter.getEObjectID(bonitaEdge.getTarget()));

    PolylineConnection conn = new PolylineConnection();
    AbstractRouter router = new CustomRectilinearRouter();
    conn.setConnectionRouter(router);
    final List<RelativeBendpoint> pointList = ((RelativeBendpoints) bonitaEdge.getBendpoints()).getPoints();
    List<org.eclipse.draw2d.RelativeBendpoint> figureConstraint = new ArrayList<>();
    for (int i = 0; i < pointList.size(); i++) {
        RelativeBendpoint relativeBendpoint = (RelativeBendpoint) pointList.get(i);
        IFigure sourceFigure = new Figure();
        sourceFigure.setBounds(toRectangle(sourceLocation));
        IFigure targetFigure = new Figure();
        targetFigure.setBounds(toRectangle(targetLocation));
        conn.setSourceAnchor(new CustomAnchor(sourceFigure));
        conn.setTargetAnchor(new CustomAnchor(targetFigure));
        org.eclipse.draw2d.RelativeBendpoint rbp = new org.eclipse.draw2d.RelativeBendpoint(conn);
        rbp.setRelativeDimensions(
                new Dimension(relativeBendpoint.getSourceX(), relativeBendpoint.getSourceY()),
                new Dimension(relativeBendpoint.getTargetX(), relativeBendpoint.getTargetY()));
        if (pointList.size() == 1) {
            rbp.setWeight(0.5f);
        } else {
            rbp.setWeight(i / ((float) pointList.size() - 1));
        }
        figureConstraint.add(rbp);
    }
    conn.setRoutingConstraint(figureConstraint);
    router.route(conn);
    return conn;
}
 
Example 5
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected IFigure createFigure() {
	PolylineConnection figure = new PolylineConnection();
	figure.setForegroundColor(Link.COLOR);
	figure.setConnectionRouter(getConnectionRouter());
	figure.setTargetDecoration(new PolygonDecoration());
	figure.setVisible(isVisible());
	getModel().figure = figure;
	return figure;
}
 
Example 6
Source File: CommentConnectionEditPart.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
	boolean bezier = this.getDiagram().getDiagramContents().getSettings()
			.isUseBezierCurve();
	PolylineConnection connection = new ERDiagramConnection(bezier);
	connection.setConnectionRouter(new BendpointConnectionRouter());

	connection.setLineStyle(SWT.LINE_DASH);

	return connection;
}
 
Example 7
Source File: RelationEditPart.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
	boolean bezier = this.getDiagram().getDiagramContents().getSettings()
			.isUseBezierCurve();
	PolylineConnection connection = new ERDiagramConnection(bezier);
	connection.setConnectionRouter(new BendpointConnectionRouter());

	ConnectionEndpointLocator targetLocator = new ConnectionEndpointLocator(
			connection, true);
	this.targetLabel = new Label("");
	connection.add(targetLabel, targetLocator);

	return connection;
}