Hi. In my editor I'm looking to make the editing area (the FigureCanvas within the GraphitiScrollingGraphicalViewer) larger by x units or maybe by x% instead of the default minimum area to contain all pictogram elements so there is a buffer around the diagram where users can scroll. This would give users more room to work. I think a lot of users of my editor (myself included) will drag out a random pictogram element and place it some far distance from where they are editing just to make the diagram larger so there isn't the feeling the diagram is closing in on the work area and it also makes it easier to drag and organize elements within the space.
The only way I can see of doing this would be to do something similar to what was done in GFFigureCanvas and GFScrollingGraphicalViewer where I would have to make my own class of both and override createGraphicalViewer (at least) in my editor and then do some magic in my extended Canvas which would provide a buffer around the editing area. Anybody have any better ideas, or maybe this warrants a feature request? I would go ahead and use GFScrollingGraphicalViewer (by setting scroll bars to always visible through my ToolBehaviorProvider) since it has an infinite space, but the comments and depricated functions along that path seem to indicate this would not be a future-proof plan.
Michael Wenz Messages: 1714 Registered: July 2009 Location: Walldorf, Germany
That's a difficult spot... :-(
There have already been extensive discussion (already starting in the time
Graphiti was an SAP-internal framework). As it seems there's no really good
solution from the framework side to replace the current behavior. The stuff
you found around infinite canvas (scrollbars always visible) is more or less
a workaround to enable certain tooling scenarios we have today (used heavily
within SAP). But it's rather a hack than a clean solution and changes in GEF
might easily break this. That's why all the warnings are there...
Any ideas on this topic are highly welcome, so if you or anybody else in the
community has ideas how to improve this, please either post it here or open
an enhancement bugzilla.
(If I did understand the problem:) Maybe an (invisible) Rectangle that dynamically changes its size could help: calculate the bounding box of the "real" pictogram elements, then add the amount of additional margin (additional space around the pictogram elements) and set it as its size.