Skip to main content


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 21:06 Go to next message
Peter Neorr is currently offline Peter NeorrFriend
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 09:49 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
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: Fri Mar 29 04:38:34 GMT 2024

Powered by FUDForum. Page generated in 0.03247 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top