Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How implement editor where some parts only scroll in one direction?
How implement editor where some parts only scroll in one direction? [message #892150] Wed, 27 June 2012 08:43 Go to next message
Fredrik Attebrant is currently offline Fredrik AttebrantFriend
Messages: 34
Registered: June 2012
Member

Hi,

We are creating a GEF editor where we need to have some parts scrolling in only one direction.
I'm looking for help/hints on how to accomplish this.

See the attached image for the intended layout.

The main area of the editor is to be scrolling normally, i.e. both vertically and horizontally.
At the top and the bottom we will have parts which only scrolls horizontally.
On the left hand side, there will be a part which only scrolls vertically.
And as shown in the image, there will be 2 "dead zones" which doesn't scroll at all.

The vertical scroll for the left hand part shall be the same as for the main area, i.e. when the main area is scrolled vertically the area on the left side is scrolled the same vertical amount.

And the same applies to the horizontal scroll for the top and bottom parts.

Any ideas/suggestions on how to implement this?

TIA!
--Fredrik
Re: How implement editor where some parts only scroll in one direction? [message #892179 is a reply to message #892150] Wed, 27 June 2012 10:14 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi Fredrik,

in the part's addNotify() method you could try to add a property change listener to the viewport's range model and set the figure's bounds accordingly.

final Viewport viewport = (Viewport) ((GraphicalEditPart) getViewer().getRootEditPart()).getFigure();
viewport.getHorizontalRangeModel().addPropertyChangeListener(new PropertyChangeListener() {

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		final PrecisionRectangle rect = new PrecisionRectangle(viewport.getBounds());
		getFigure().translateToRelative(rect);
		getFigure().setBounds(new Rectangle(rect.getBottomLeft(), new Dimension(-1, -1)));
	}
});


This could work for the left side to scroll only vertically.
Re: How implement editor where some parts only scroll in one direction? [message #901246 is a reply to message #892179] Fri, 10 August 2012 13:36 Go to previous message
Fredrik Attebrant is currently offline Fredrik AttebrantFriend
Messages: 34
Registered: June 2012
Member

With a little help I found that the GEF Rulers does pretty much what we need.
So I'm going to dig into how they are implemented and try to reuse that approach.
The Rulers can be tried out in the GEF Logic example, just make them visible using the View > Rulers action when running the example.

Hopefully next post can shed some light on how this went.
Previous Topic:Sharing Edit Domain across application
Next Topic:thumbnail view not as Content outline view
Goto Forum:
  


Current Time: Thu Apr 25 16:05:23 GMT 2024

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

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

Back to the top