Custom Connection Figures in Zest 2 [message #885906] |
Wed, 13 June 2012 17:06  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.08863 seconds