I'm implementing a GEF editor and am facing the following problem.
There are two types of EditPart: 1) GraphEditPart, 2) NodeEditPart.
My editor extends GraphicalEditor
, as I'm not needing a palette at all. I use SimpleRootEditPart
for the GraphicalViewer
.
GraphEditPart
has a figure of type Layer
, which is layed out with FlowLayout
. Its model children are Nodes, which should be displayed according to FlowLayout
, i.e., one after the other, with "line breaks" when a node figure (a Label
) would move beyond the visible part of the GraphicalViewer
. This would be the point where usually the horizontal scrollbar appears. To suppress the scrollbars, I have set layer.setPreferredSize(new Dimension(getViewer().getControl().getSize()))
. This works well enough, so that when I resize the application window to a smaller size, the editor are gets smaller, and the node figures perform a quasi "line break" a la FlowLayout.
However, if I have a lot of nodes in the graph, I want to display the vertical scrollbar, because as it is now, the nodes just disappear below the bottom end of the screen.
So basically, the behaviour I want to achieve is like that of a text editor, which scrolls down if you just enter enough text (like the WYSIWYG text editor here on stackoverflow)...
I have tried to set the scrollbar visible by calling ((FigureCanvas) getViewer()).getControl.setVerticalScrollbarVisibility(FigureCanvas.AUTOMATIC))
, but to no avail.