[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gef-dev] FanRouter and ShortestPathConnectionRouter together


The EDiagram example uses the two together.  Extract from EDiagramEditor#initializeGraphicalViewer():

        // add the router
        ScalableFreeformRootEditPart root =
                        (ScalableFreeformRootEditPart)viewer.getRootEditPart();
        ConnectionLayer connLayer =
                        (ConnectionLayer)root.getLayer(LayerConstants.CONNECTION_LAYER);
        GraphicalEditPart contentEditPart = (GraphicalEditPart)root.getContents();
        FanRouter router = new FanRouter();
        router.setSeparation(20);
        ShortestPathConnectionRouter spRouter =
                        new ShortestPathConnectionRouter(contentEditPart.getFigure());
        router.setNextRouter(spRouter);
        connLayer.setConnectionRouter(router);
        contentEditPart.getContentPane().addLayoutListener(spRouter.getLayoutListener());


Please keep in mind that such questions should be posted on the newsgroup, not to the gef-dev mailing list.

Pratik Shah
Graphical Editing Framework (GEF)
http://www.eclipse.org/gef
Ph: (919) 254-5043
Fx: (919) 254-8169



Christian Dupuis <spring@xxxxxxxxxxxxxxxxxx>
Sent by: gef-dev-bounces@xxxxxxxxxxx

04/28/2005 04:58 AM

Please respond to
GEF development

To
gef-dev@xxxxxxxxxxx
cc
Subject
Re: [gef-dev] FanRouter and ShortestPathConnectionRouter together





Hi,

first of all thanks for your answer Randy.

Unfortunatly the shapes example only uses the SPCR standalone. If I try to
extend the logic example in order to use FanRouter with SPCR I don't see any
connections anymore.

I changed the refreshVisualls() in LogicDiagramEditPart to the following

else {
       AutomaticRouter fanrouter = new FanRouter();
       ShortestPathConnectionRouter router =
                                                  new ShortestPathConnectionRouter(getFigure());
       fanrouter.setNextRouter(router);
                cLayer.setConnectionRouter(fanrouter);
                getFigure().setLayoutManager(new    
ShortestPathConnectionRouter.LayoutWrapper(
                                                                   layout,router));
                }

Is there a way to extend the SPCR to handle overlapping/same connections like
FanRouter? Any hints would be great.

Greetings
Christian

Quoting Randy Hudson <hudsonr@xxxxxxxxxx>:

> I think that the shapes example uses both routers together.  It should
> work fine.  The exception looks like you have a Connection with 0 points.
> This should not be possible since SPCR always sets at least the start and
> end points.
>
> - Randy
>
>
>
>
> Christian Dupuis <spring@xxxxxxxxxxxxxxxxxx>
> Sent by: gef-dev-bounces@xxxxxxxxxxx
> 04/27/2005 06:05 PM
> Please respond to
> GEF development
>
>
> To
> gef-dev@xxxxxxxxxxx
> cc
>
> Subject
> [gef-dev] FanRouter and ShortestPathConnectionRouter together
>
>
>
>
>
>
> Hello,
>
> is there a way to use FanRouter and ShortestPathConnectionRouter together?
> Because after using the routing of ShortestPathConnectionRouter I still
> have
> connections between the same nodes which are overlapping.
>
> If I use the to routers together
>
> ConnectionLayer cLayer = (ConnectionLayer) getLayer(CONNECTION_LAYER);
> FanRouter fanRouter = new FanRouter();
> ShortestPathConnectionRouter router = new
> ShortestPathConnectionRouter(getFigure());
> fanRouter.setNextRouter(router);
> cLayer.setConnectionRouter(fanRouter);
>
> I'll get the following stacktrace:
>
> java.lang.IndexOutOfBoundsException: Index: -1, Size: 0
>        at
> org.eclipse.draw2d.geometry.PointList.getPoint(PointList.java:183)
>        at
> org.eclipse.draw2d.ConnectionLocator.getLocation(ConnectionLocator.java:120)
>        at org.eclipse.draw2d.ArrowLocator.relocate(ArrowLocator.java:42)
>        at
> org.eclipse.draw2d.DelegatingLayout.layout(DelegatingLayout.java:71)
>        at org.eclipse.draw2d.Figure.layout(Figure.java:928)
>        at
> org.eclipse.draw2d.PolylineConnection.layout(PolylineConnection.java:156)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1604)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
>        at org.eclipse.draw2d.Viewport.validate(Viewport.java:357)
>        at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
>        at
> org.eclipse.draw2d.DeferredUpdateManager.validateFigures(DeferredUpdateManager.java:237)
>
> Greetings Christian
> _______________________________________________
> gef-dev mailing list
> gef-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/gef-dev
>
>


_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev