Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Bend points and Graphical Editor scroll bars
Bend points and Graphical Editor scroll bars [message #919016] Fri, 21 September 2012 15:51 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
Hi,

I am working with GEF. Lets say in my editor there are different objects and they are connected. All objects are placed in such a manner that scroll is not required.
When i move a bend point to a position where editor should start showing scroll bars then scroll bars do not appear. But when i move the object then scroll bars becomes visible.

Do you have any idea why it is like that?

Cheers,
Re: Bend points and Graphical Editor scroll bars [message #919603 is a reply to message #919016] Sat, 22 September 2012 06:02 Go to previous messageGo to next message
Igor Zapletnev is currently offline Igor Zapletnev
Messages: 32
Registered: September 2012
Member
Hi,

Viewport.class responsible for scrolls behaviour. For example, to move scrolls on x and y I am using next method:
    private void doStep(final Point step) {
        final Viewport viewport = findViewport(owner);
        final Point location = new Point(viewport.getViewLocation());
        viewport.setViewLocation(location.translate(step));
        viewport.revalidate();
    }

To implement custom behavoir for your case you need to define ViewportAutoexposeHelper. Your ScalableFreeformRootEditPart should be adapted to the AutoexposeHelper.class like this:
            public Object getAdapter(final Class key) {
                if (key == AutoexposeHelper.class)
                    return new YourAwareAutoexposeHelper();
                return super.getAdapter(key);
            }

But it is all only for content layer. To implement the same behaviour for connections layer I am defining my own connection creation tool (it also will use your autoexpose helper class). I have attached simple example of that.

[Updated on: Sat, 22 September 2012 06:05]

Report message to a moderator

Re: Bend points and Graphical Editor scroll bars [message #921576 is a reply to message #919603] Mon, 24 September 2012 08:35 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
Hi,

I tried viewer.setRootEditPart(new ScalableFreeformRootEditPart()) then i am able to get the scroll going when i move bend points in connection. But now my main object(source and target of connections) are not visible. If i try to select using outline then it create a selection border for objects but still just selection border is visible not all inside editpart figure. why is that? do you have any idea?

Cheers,
Re: Bend points and Graphical Editor scroll bars [message #922011 is a reply to message #919603] Mon, 24 September 2012 16:46 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
Hi,

i have implemented that in Connection Creation Tool but once connection is created and now user create bend points and when bend point is moved then i want to see the auto scroll.

There is a ConnectionDragCreationTool class avaiable but i am looking for some class like ConnectionBendpointMoveTool....

Any idea?

Cheers
Re: Bend points and Graphical Editor scroll bars [message #922619 is a reply to message #922011] Tue, 25 September 2012 07:11 Go to previous messageGo to next message
Igor Zapletnev is currently offline Igor Zapletnev
Messages: 32
Registered: September 2012
Member
Hi,

For this case (ConnectionBendpointMoveTool) you could look at the GMF ConnectionBendpointEditPolicy (I have attached this file of this class). This policy changes Viewport location when bendpoint change. This policy uses helper class - SelectInDiagramHelper, exposeLocation method (I have attached this file too).

So you just need to register your policy
            installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE,
                new ConnectionBendpointEditPolicy());


Thanks,
Igor
Re: Bend points and Graphical Editor scroll bars [message #922680 is a reply to message #922619] Tue, 25 September 2012 08:20 Go to previous message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
I have figured out quite an easy way of doing it. Use ScalableFreeformRootEditPart as root edit part for your editor. The main canvas's figure should be of type FreeformLayer and set layout as FreeformLayout.

thanks for assistance.
Previous Topic:[Draw2D] How to create ellipse with icon inside
Next Topic:Connections over Nodes Zest
Goto Forum:
  


Current Time: Thu Oct 02 14:49:02 GMT 2014

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

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