Search in sources :

Example 1 with ShortestPathConnectionRouter

use of org.eclipse.draw2d.ShortestPathConnectionRouter in project dbeaver by serge-rider.

the class DiagramPart method createFigure.

@Override
protected IFigure createFigure() {
    EntityDiagramFigure figure = new EntityDiagramFigure(this);
    delegatingLayoutManager = new DelegatingLayoutManager(this);
    figure.setLayoutManager(delegatingLayoutManager);
    /*
        ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
        ViewportAwareConnectionLayerClippingStrategy clippingStrategy = new ViewportAwareConnectionLayerClippingStrategy(cLayer);
        figure.setClippingStrategy(clippingStrategy);
*/
    Control control = getViewer().getControl();
    ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
    if ((control.getStyle() & SWT.MIRRORED) == 0) {
        cLayer.setAntialias(SWT.ON);
    }
    FanRouter router = new FanRouter();
    router.setSeparation(15);
    // router.setNextRouter(new BendpointConnectionRouter());
    router.setNextRouter(new ShortestPathConnectionRouter(figure));
    // router.setNextRouter(new ManhattanConnectionRouter());
    // router.setNextRouter(new BendpointConnectionRouter());
    cLayer.setConnectionRouter(router);
    return figure;
}
Also used : EntityDiagramFigure(org.jkiss.dbeaver.erd.ui.figures.EntityDiagramFigure) Control(org.eclipse.swt.widgets.Control) ShortestPathConnectionRouter(org.eclipse.draw2d.ShortestPathConnectionRouter) DelegatingLayoutManager(org.jkiss.dbeaver.erd.ui.layout.DelegatingLayoutManager) FanRouter(org.eclipse.draw2d.FanRouter) ConnectionLayer(org.eclipse.draw2d.ConnectionLayer)

Example 2 with ShortestPathConnectionRouter

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

the class LockGraphEditPart method refreshVisuals.

@Override
protected void refreshVisuals() {
    ConnectionLayer connectionLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
    connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(getFigure()));
}
Also used : ShortestPathConnectionRouter(org.eclipse.draw2d.ShortestPathConnectionRouter) ConnectionLayer(org.eclipse.draw2d.ConnectionLayer)

Aggregations

ConnectionLayer (org.eclipse.draw2d.ConnectionLayer)2 ShortestPathConnectionRouter (org.eclipse.draw2d.ShortestPathConnectionRouter)2 FanRouter (org.eclipse.draw2d.FanRouter)1 Control (org.eclipse.swt.widgets.Control)1 EntityDiagramFigure (org.jkiss.dbeaver.erd.ui.figures.EntityDiagramFigure)1 DelegatingLayoutManager (org.jkiss.dbeaver.erd.ui.layout.DelegatingLayoutManager)1