Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Change Position of ContextButtonPad
Change Position of ContextButtonPad [message #1798837] Mon, 26 November 2018 13:56 Go to next message
Felix Buehler is currently offline Felix BuehlerFriend
Messages: 15
Registered: July 2017
Junior Member
Hi there!

I have added some elements to the ContextButtonPad by overwriting the getContextButtonPad() in DefaultToolBehaviorProvider and there modifying the data.getDomainSpecificContextButtons() (where data is the IContextButtonPadData).
Until here everything works fine. The Buttons get added and are clickable.

What doesn't work is when the elements on which the ContextButtonPad can by seen are placed at the border of the editor window, like this:
index.php/fa/34405/0/
Now the ContextButtonPad is expanding to the left and i would have to scroll horizontally to see the other 3 context buttons.
I read in another post that the PadLocation can be modified via
data.getPadLocation().setRectangle(rectangle);

but the change wouldn't reflect in the UI.
Is there a way to always expand the ButtonPad to the right?

Thanks in advance and best regards!
Felix
Re: Change Position of ContextButtonPad [message #1798922 is a reply to message #1798837] Tue, 27 November 2018 13:25 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Felix,

there is some limitation in GEF3 behind this behavior. The scrollbars cannot be updated for showing the context button pad, but there is an option that ou might try to get this. Graphiti can switch GEF into a mode where the scrollbars are always shown; in that mode the diagram can be scrolled in case the context button pad requires it. Please note that this could not be achieved via GEF3 APIs but only using some internal functionality so there is no guarantee that it will continue to work in the future.

Please implement the method getDiagramScrollingBehavior() in your tool behavior provider and return DiagramScrollingBehavior.SCROLLBARS_ALWAYS_VISIBLE instead of GEF_DEFAULT.

Michael
Re: Change Position of ContextButtonPad [message #1798967 is a reply to message #1798922] Wed, 28 November 2018 06:48 Go to previous messageGo to next message
Felix Buehler is currently offline Felix BuehlerFriend
Messages: 15
Registered: July 2017
Junior Member
Hi Michael!

If I return DiagramScrollingBehavior.SCROLLBARS_ALWAYS_VISIBLE, the scrollbars are always visible.
This doesn't solve the problem though, because, while I could scroll to see the other context buttons, I really can't because the context buttons disappear if I'm not hovering over the point.

Is there a way to let the context button pad extend to right instead of to the left?

Cheers und thank you!
Felix
Re: Change Position of ContextButtonPad [message #1798969 is a reply to message #1798967] Wed, 28 November 2018 07:32 Go to previous messageGo to next message
Felix Buehler is currently offline Felix BuehlerFriend
Messages: 15
Registered: July 2017
Junior Member
Hi Michael,

I solved the Issue by adjusting width and height of the ContextButtonPad.
int x = context.getPictogramElement().getGraphicsAlgorithm().getX();
int y = context.getPictogramElement().getGraphicsAlgorithm().getY();

data.getPadLocation().setRectangle(x + 5, y, 5, 120);


By reducing the width and increasing the heigth, the buttons seem to be forced into the vertical, which is good enough for me.
My initial fault was to not set x and y correctly, so the pad wouldn't display.

Here's the result:
index.php/fa/34414/0/

Thanks for your help!

Best regards,
Felix

[Updated on: Wed, 28 November 2018 07:38]

Report message to a moderator

Re: Change Position of ContextButtonPad [message #1798970 is a reply to message #1798969] Wed, 28 November 2018 07:59 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Good to hear you got that solved.

Michael
Previous Topic:how to increase quality of zoomed diagrams
Next Topic:Let Connection end at midpoint of ContainerShape
Goto Forum:
  


Current Time: Fri Apr 19 11:59:03 GMT 2024

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

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

Back to the top