Skip to main content



      Home
Home » Eclipse Projects » GEF » Hiding/showing figures on separate layer when scrolling
Hiding/showing figures on separate layer when scrolling [message #155994] Thu, 28 October 2004 09:35 Go to next message
Eclipse UserFriend
Hi,

I have a diagram with a shape that has a scrollable compartment that
contains subshapes. I have decorations that may or may not appear on
shapes. These decorations are on a different layer than that of the shapes
(this is the way it was designed). My problem was that when I decorated one
of the subshapes, the decoration would still appear even if the subshape was
outside the visible area in the scrollable compartment. To solve this, I
have overridden the decoration's isVisible() to return false if the
decoration falls outside of all its parent figures' bounds. This seems to
work, but I'm wondering if there is an easier way to do this.

Specifically:
1. Are there any methods on a figure that I can use to ask if a location is
outside its viewable area? The methods isVisible() and isShowing() return
true even if the figure isn't showing.
2. I originally put the code in the validate() method. This worked fine for
decorating shapes inside subshapes with scrollable compartments (i.e. when I
scrolled to reveal the subshape, the decoration would then appear). This
does not work if the decorated shape is outside the visible area of the
diagram. When I scroll on the diagram to reveal the decorated shape, the
decoration does not appear.

Thanks,
Cherie
Re: Hiding/showing figures on separate layer when scrolling [message #156495 is a reply to message #155994] Mon, 01 November 2004 15:02 Go to previous message
Eclipse UserFriend
"Cherie Mahoney" <cmahoney@rational.com> wrote in message
news:clqs47$ua2$1@eclipse.org...
> Hi,
>
> I have a diagram with a shape that has a scrollable compartment that
> contains subshapes. I have decorations that may or may not appear on
> shapes. These decorations are on a different layer than that of the
shapes
> (this is the way it was designed). My problem was that when I decorated
one
> of the subshapes, the decoration would still appear even if the subshape
was
> outside the visible area in the scrollable compartment. To solve this, I
> have overridden the decoration's isVisible() to return false if the
> decoration falls outside of all its parent figures' bounds. This seems to
> work, but I'm wondering if there is an easier way to do this.
>
> Specifically:
> 1. Are there any methods on a figure that I can use to ask if a location
is
> outside its viewable area? The methods isVisible() and isShowing() return
> true even if the figure isn't showing.

No. isVisible() is comparable to SWT's getVisible(), and isShowing() is
comparable to SWT's isVisible(). The only way isVisible() will return false
is if you invoke setVisible(false) on the figure. It has nothing to do with
whether it's located at such a point in the diagram that it cannot be seen.
What you are doing is fine. A more correct way to determine whether or not
the decoration should be shown: intersect parent's client area with the
child's bounds. In fact, you should probably have it intersect with all its
ancestors' client area.

> 2. I originally put the code in the validate() method. This worked fine
for
> decorating shapes inside subshapes with scrollable compartments (i.e. when
I
> scrolled to reveal the subshape, the decoration would then appear). This
> does not work if the decorated shape is outside the visible area of the
> diagram. When I scroll on the diagram to reveal the decorated shape, the
> decoration does not appear.

This decoration is a Figure? You can put it in its paintFigure() method.
Validation only occurs when a Figure has been invalidated because it needs
to be laid out again.

>
> Thanks,
> Cherie
>
>
Previous Topic:Migrate logic example to RCP platform?
Next Topic:Polyline.setPoints()
Goto Forum:
  


Current Time: Wed Jul 23 18:38:06 EDT 2025

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

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

Back to the top