Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Scrollable figures
Scrollable figures [message #1712619] Mon, 26 October 2015 19:16 Go to next message
Rafal Filipiuk is currently offline Rafal FilipiukFriend
Messages: 14
Registered: September 2015
Junior Member
Hi,

So I've been doing some research into my 'canvas within canvas' problem and one possible solution for me would be to have a shape with scrollbars.

From a previous post from a few years ago, it seems like there is no support for scrollable components out of the box.

I did some more digging and here I found that Graphiti supports the display of GEF/Draw2d figures in Graphiti diagrams. Draw2d has ScrollPane/ScrollBar/ViewPort Figures. Does that mean that there should be a way for me to display a scrollpane?

Is my idea at all possible? If so, can someone (Michael?) point me in the right direction for an implementation?

Thanks again!

Raf
Re: Scrollable figures [message #1713067 is a reply to message #1712619] Fri, 30 October 2015 14:44 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Rafal,

yes, there is an option to add so-called platform graphics algorithms, a small example is the can figure in our Sketch test tool. The shape is defined here:
http://git.eclipse.org/c/graphiti/org.eclipse.graphiti.git/tree/tests/org.eclipse.graphiti.testtool.sketch/src/org/eclipse/graphiti/testtool/sketch/CanFigure.java

and provide it in the renderer factory
http://git.eclipse.org/c/graphiti/org.eclipse.graphiti.git/tree/tests/org.eclipse.graphiti.testtool.sketch/src/org/eclipse/graphiti/testtool/sketch/SketchGraphicsAlgorithmRendererFactory.java

The renderer factory needs to be provided by your diagram type provider.

However, I would really be hesitant to display scrolling shapes inside a diagram as this will probably cause usability issues (not everything visible, multiple scolling levels, etc.). But maybe there are good arguments in your case.

HTH,
Michael
Re: Scrollable figures [message #1713515 is a reply to message #1713067] Wed, 04 November 2015 17:27 Go to previous messageGo to next message
Rafal Filipiuk is currently offline Rafal FilipiukFriend
Messages: 14
Registered: September 2015
Junior Member
So I figured it out if anyone is interested. Probably far from idiomatic and a little wonky, but works for now.

I created a ScrollFigure class that extends draw2d.ScrollPane and implements IGraphicsAlgorithmRenderer, and a custom rendererFactory class (that's registered) whose createGraphicsAlgorithmRenderer(context) method instantiates my scrollFigure. Note that the implementation of my ScrollFigure is essentially creating a CanFigure (from the Sketch test tool example) and calling scrollFigure.setContents(canFigure). Other draw2d figures should work as well.

So far so good, but popping the figure on a graphiti diagram produces a gray rectangle as if not rendered properly. It turns out that Graphiti's PictogramElementDelegate sets figure's layoutManager to XYLayout() if the figure's pictogramElement is a ContainerShape (it is for me). This is problematic because our scrollFigure is instantiated with a ScrollPaneLayout(), and the delegate changes it to XYLayout() before the scrollFigure has a chance to lay out its contents appropriately. My current (naive?) solution was to override ScrollPane's setLayoutManager(manager) method to set the manager to ScrollPaneLayout() regardless of what's passed in.

Not sure how the contents of the scrollFigure will behave down the line, but just wanted to share my initial implementation. Hope this helps someone.

Raf
Re: Scrollable figures [message #1713729 is a reply to message #1713515] Fri, 06 November 2015 08:53 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Raf,

the issue you describe sounds like a bug to me. In case of a platform graphics algorithm Graphiti should not enforce the XY layout but stick to what the platform algorithm provides. Would you file o Bugzilla against Graphiti to track this?

Thanks,
Michael
Re: Scrollable figures [message #1713827 is a reply to message #1713729] Fri, 06 November 2015 18:14 Go to previous messageGo to next message
Rafal Filipiuk is currently offline Rafal FilipiukFriend
Messages: 14
Registered: September 2015
Junior Member
Michael Wenz wrote on Fri, 06 November 2015 08:53
Raf,

the issue you describe sounds like a bug to me. In case of a platform graphics algorithm Graphiti should not enforce the XY layout but stick to what the platform algorithm provides. Would you file o Bugzilla against Graphiti to track this?

Thanks,
Michael


Done!

https://bugs.eclipse.org/bugs/show_bug.cgi?id=481619

First time I'm filing a bug on BugZilla. Let me know if there's any way I can improve the submission.
Re: Scrollable figures [message #1725596 is a reply to message #1713827] Fri, 04 March 2016 16:24 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 528
Registered: November 2009
Senior Member
I am also trying to utilize ScrollPane in my figures and Rafal's post was helpful.

Michael,

You say Quote:
However, I would really be hesitant to display scrolling shapes inside a diagram as this will probably cause usability issues (not everything visible, multiple scolling levels, etc.). But maybe there are good arguments in your case.


Is there a reason why all these issues would be caused by utilizing ScrollPane? And what does not everything visible and multiple scrolling level mean? I started my implementation for this, but don't want to commit only to find out down the line that my diagram is worthless with ScrollPane because of these issues.

Thanks,
Alex
Re: Scrollable figures [message #1725900 is a reply to message #1725596] Tue, 08 March 2016 12:23 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Alex,

well, what I meant is that introducing scroll panes inside a diagram will mean you have to think about a lot of new usability aspects. Having scroll bars inside a shape means that not everything that is inside the shape is initially visible. In case of nesting of shapes you might have to deal with an outer shape using a scroll bar and an inner shape also having a scroll bar. Using the mouse you will have to care about focus to scroll the right component, also keyboard interaction for navigating between the shapes (inside or accross several hioerarchy levels) will be something to consider. There are for sure many more things to consider, these are just some points from the top of my head...

These things are why we from Graphitoi framework do not offer scrollbars, however it might make sense in some usecases, so I'm not opposed to doing that.

Michael
Re: Scrollable figures [message #1725982 is a reply to message #1725900] Tue, 08 March 2016 19:59 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 528
Registered: November 2009
Senior Member
Thanks Michael,

There are good points that I am ok with working on to have scrolling capabilities. Regarding bugzilla that Rafal opened - https://bugs.eclipse.org/bugs/show_bug.cgi?id=481619, will there be a consideration about working on it?

Thanks,
Alex
Re: Scrollable figures [message #1726049 is a reply to message #1725982] Wed, 09 March 2016 09:44 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Alex,

I will try to have a look at that bug, but I cannot promise anything because I'm currently a little restricted in the time I can invest.

Michael
Re: Scrollable figures [message #1726236 is a reply to message #1726049] Thu, 10 March 2016 16:24 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 528
Registered: November 2009
Senior Member
Thanks Michael.
Re: Scrollable figures [message #1732010 is a reply to message #1726236] Wed, 11 May 2016 16:22 Go to previous message
Oleksiy Bulhakov is currently offline Oleksiy BulhakovFriend
Messages: 5
Registered: May 2016
Junior Member
I am sorry to bother you, but can you provide more detailed explanation on how to implement scroll bar in a shape, please. I still have some difficulties with understanding these Layout isssues, and I still get brown rectangular area instead of scrollable area.
Thanks in advance.

UPD: I've already understood the problem, and fixed it.
That's an answer:
public class ScrollFigure extends ScrollPane implements IGraphicsAlgorithmRenderer {
@Override
public void setLayoutManager(LayoutManager manager) {
super.setLayoutManager(new ScrollPaneLayout());
}
}

[Updated on: Fri, 13 May 2016 11:53]

Report message to a moderator

Previous Topic:What is the best approach to implement a palette with a tree view
Next Topic:FlyoutPalette in DiagramComposite
Goto Forum:
  


Current Time: Thu Jun 21 12:39:54 GMT 2018

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

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

Back to the top