Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Custom Connection Figures in Zest 2
Custom Connection Figures in Zest 2 [message #885906] Wed, 13 June 2012 17:06 Go to next message
Peter Neorr is currently offline Peter Neorr
Messages: 3
Registered: December 2011
Junior Member
Is it possible to provide custom figures for Zest GraphConnections? I don't want to simply change the style of the default PolylineArcConnection, but I want to instead draw a radically different shape to connect nodes. Can this be done with zest? How?

I have been able to provide custom figures for graph nodes by using a LabelProvider that implements IFigurePprovider like this:

...
    graph = new GraphViewer(new NonMovableGraph(parent, SWT.NONE));
    graph.setLabelProvider(new MyLabelProvider());
...
private class MyLabelProvider extends LabelProvider implements IFigureProvider {
    @Override
    public IFigure getFigure(final Object element) {
      if (element instanceof MyNode) {
        MyNode c = (MyNode) element;
        return new MyNodeFigure(c);
      }
      return null;
    }

    @Override
    public String getText(final Object element) {
      if (element instanceof EntityConnectionData) {
        return null;
      }
      return super.getText(element);
    }
  }



My label provider doesn't seem to be called for anything other than node objects, but I'd really like to provide my own figures for connections.

Thanks for any tips or hints!

-Peter Neorr
Re: Custom Connection Figures in Zest 2 [message #886620 is a reply to message #885906] Fri, 15 June 2012 05:49 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan Ujhelyi
Messages: 175
Registered: July 2009
Senior Member
Hi,

try to also implement the IEntityConnectionStyleProvider interface in your Label Provider. Although I did not try it with a FigureProvider, if you want to have custom labels, etc., then this is the interface to be used.

Cheers,
Zoltán
Previous Topic:max width for GEF Editor
Next Topic:EditPartViewer setProperty(...) method
Goto Forum:
  


Current Time: Sun Apr 20 12:20:42 EDT 2014

Powered by FUDForum. Page generated in 0.02933 seconds