Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Detecting scrolling events
Detecting scrolling events [message #222971] Sat, 16 September 2006 09:19 Go to next message
Eclipse UserFriend
Originally posted by: dstamkokeng.gmail.com

Hi,

Can some one help me with detecting scrolling event? I am extending the
Shapes example of GEF. It comes with a FreeformLayer which enables
scrolling in all 4 directions.

I have a painted a timeline figure which is required to be displayed all
the time. Thus I will need to detect scrolling events so that I can
repaint the figure.

Or is there any other way I can get thru this problem? Thanks in advance!
Re: Detecting scrolling events [message #222981 is a reply to message #222971] Sat, 16 September 2006 09:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dstamkokeng.gmail.com

I think its has to do with the GraphicalViewer of the editor, which is
ScrollingGraphicalViewer. But I cannot find where to detect if scrolling
has occur. Help needed.....
Re: Detecting scrolling events [message #223091 is a reply to message #222981] Tue, 19 September 2006 15:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mateu.yabar.justinmind.com

My solution is the following:
you first need the Viewport:
if viewer is your viewer, you have to do
Viewport port=((FigureCanvas)getControl()).getViewPort();

afterwards you need to add listeners to the port; I don't remember which is
which, but one enables to listen to the move of the scroll and the other to
the size of the window:
port.addFigureListener()
port.addPropertyChangeListener()

You can get the client area by:
port.getClientArea()

Mateu Y
Re: Detecting scrolling events [message #223203 is a reply to message #223091] Thu, 21 September 2006 00:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

If you're only interested in scrolling events, add a listener to the
Viewport's horizontal and vertical range models. But for what you want to
do, you could get away with adding the timeline figure to the Viewport
instead of its contents.

"Mateu Y
Re: Detecting scrolling events [message #223211 is a reply to message #223203] Thu, 21 September 2006 08:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mateu.yabar.justinmind.com

Hi,

I have tried to add a figure to the view port, but it reacts to the
scrolling events (it is moved like the rest of the figure). Is there a
better way to have a figure allways in the same position (bottom-left) of
the screen even when the window is redimensioned or the scrollbars are used,
that listening to the viewport?

Thanks

"Pratik Shah" <none@unknown.com> escribi
Re: Detecting scrolling events [message #223575 is a reply to message #223211] Fri, 29 September 2006 13:02 Go to previous messageGo to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
Hi Mateu,

why don't you add another layer to your RootEditPart and adapt the
layer's paintFigure method?
What about this:

protected void paintFigure(Graphics graphics){

Rectangle clip = g.getClip(Rectangle.SINGLETON);

IFigure parent = getParent();
while (parent != null && !(parent instanceof Viewport)){
parent = parent.getParent();
}
// now you can use the Viewport's bounds:
parent.getBounds()
}

Regards, Andreas

Mateu Yábar Vallès schrieb:
> Hi,
>
> I have tried to add a figure to the view port, but it reacts to the
> scrolling events (it is moved like the rest of the figure). Is there a
> better way to have a figure allways in the same position (bottom-left) of
> the screen even when the window is redimensioned or the scrollbars are used,
> that listening to the viewport?
>
> Thanks
>
> "Pratik Shah" <none@unknown.com> escribió en el mensaje
> news:eesn0n$dsm$1@utils.eclipse.org...
>> If you're only interested in scrolling events, add a listener to the
>> Viewport's horizontal and vertical range models. But for what you want to
>> do, you could get away with adding the timeline figure to the Viewport
>> instead of its contents.
>>
>> "Mateu Yábar Vallès" <mateu.yabar@justinmind.com> wrote in message
>> news:eep340$6cl$1@utils.eclipse.org...
>>> My solution is the following:
>>> you first need the Viewport:
>>> if viewer is your viewer, you have to do
>>> Viewport port=((FigureCanvas)getControl()).getViewPort();
>>>
>>> afterwards you need to add listeners to the port; I don't remember which
>>> is which, but one enables to listen to the move of the scroll and the
>>> other to the size of the window:
>>> port.addFigureListener()
>>> port.addPropertyChangeListener()
>>>
>>> You can get the client area by:
>>> port.getClientArea()
>>>
>>> Mateu Yábar Vallès
>>> Just In Mind
>>> www.justinmind.com
>>>
>>> "Meo Kok Eng" <dstamkokeng@gmail.com> escribió en el mensaje
>>> news:d1fc9c7b14fbbbb853b8889ef62c7d7c$1@www.eclipse.org...
>>>> I think its has to do with the GraphicalViewer of the editor, which is
>>>> ScrollingGraphicalViewer. But I cannot find where to detect if scrolling
>>>> has occur. Help needed.....
>>>>
>>>
>>
>
>
Adding figures to the viewport directly to make them immobile [message #536473 is a reply to message #223203] Fri, 28 May 2010 12:08 Go to previous message
Patrick Oppermann is currently offline Patrick OppermannFriend
Messages: 10
Registered: July 2009
Junior Member
Hello Pratik,

I have a very similar problem: I want to place 4 Text labels in the 4
corners of my editor viewport, they are not supposed to be be moved or
affected otherwise by scrolling or zooming. Only when the editor window
gets resized, they are supposed to adapt their position to be in their
respective editor corner.

Label label = new Label("MY COOL PRODUCT 30-DAY TRIAL");
Rectangle constraint = new Rectangle(10, 10, -1, -1);
viewport.add(label, constraint);

Adding them to the viewport figure, however, has no effect: they are
among the children of the viewport but are not displayed. Setting the
"opaque" value of the viewport and the labels to true does not help,
either. I tried assigning the viewport a XYLayout, still nothing to see.

I also tried different orderings of the viewport's children to check if
the labels were simply behind the viewport's contents.

After some debugging, it seems that the labels do not receive any bounds
from the layout manager. That is why the check
child.intersects(graphics.getClip(clip)
in Figure.paintChildren() keeps failing and why the labels are not
painted by the viewport figure.

Any idea what I might be doing wrong? Any help is appreciated, thanks in
advance!

greetings,
Patrick.

Am 21.09.2006 02:39, schrieb Pratik Shah:
> If you're only interested in scrolling events, add a listener to the
> Viewport's horizontal and vertical range models. But for what you want to
> do, you could get away with adding the timeline figure to the Viewport
> instead of its contents.
>
> "Mateu Yábar Vallès"<mateu.yabar@justinmind.com> wrote in message
> news:eep340$6cl$1@utils.eclipse.org...
>> My solution is the following:
>> you first need the Viewport:
>> if viewer is your viewer, you have to do
>> Viewport port=((FigureCanvas)getControl()).getViewPort();
>>
>> afterwards you need to add listeners to the port; I don't remember which
>> is which, but one enables to listen to the move of the scroll and the
>> other to the size of the window:
>> port.addFigureListener()
>> port.addPropertyChangeListener()
>>
>> You can get the client area by:
>> port.getClientArea()
>>
>> Mateu Yábar Vallès
>> Just In Mind
>> www.justinmind.com
>>
>> "Meo Kok Eng"<dstamkokeng@gmail.com> escribió en el mensaje
>> news:d1fc9c7b14fbbbb853b8889ef62c7d7c$1@www.eclipse.org...
>>> I think its has to do with the GraphicalViewer of the editor, which is
>>> ScrollingGraphicalViewer. But I cannot find where to detect if scrolling
>>> has occur. Help needed.....
>>>
>>
>>
>
>
Previous Topic:disable multi resize
Next Topic:GEF with EMF
Goto Forum:
  


Current Time: Thu Apr 25 14:25:06 GMT 2024

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

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

Back to the top