Home » Eclipse Projects » GEF » LayoutManagers and figure visibility
LayoutManagers and figure visibility [message #108241] |
Mon, 08 December 2003 14:57  |
Eclipse User |
|
|
|
Hello,
I have a general question regarding layout managers. What should they do
with invisible child figures? Should they ignore these children? Should they
treat them normally as if they were visible? This could make a difference to
some layouts like FlowLayout, where an invisible child could introduce a gap
in the flow of the children. Should this handling be dealt with at a figure
level where it should return (0, 0) as its preferred size and minimum size
in this case? I appreciate insight into this.
Maged
|
|
|
Re: LayoutManagers and figure visibility [message #108286 is a reply to message #108241] |
Mon, 08 December 2003 17:16   |
Eclipse User |
|
|
|
To answer your general question: I would expect most layouts to completely
ignore the hidden components. However, for some layouts (such as a
GridLayout), this might produce undesired effects, and hence maybe such a
layout can leave empty space for hidden components. Or better yet, maybe
the layout should allow the client to specify whether to ignore hidden
components or allocate space for them. You can take a look at the various
SWT and Swing layouts to see how they behave.
Having said that, I should let you know (in case you don't already) that the
Draw2D layouts don't respect visibility.
If you are using GEF (and not just Draw2D), you can achieve the desired
effect by having the getModelChildren() method in your edit parts return the
filtered list (i.e., it wouldn't include the hidden children).
Otherwise, you'll either have to manipulate the layout or your figures. One
way might be to have getChildren() in your figures return just the visible
children. You can then add a new method called getAllChildren() or
something for your manipulation of all children. Needless to say, you would
have to be very careful when using a hack such as this. More appropriate
(albeit a little more time-consuming) would be to write your own layout, or
tweak the existing ones.
"Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
news:br2kta$rcq$1@eclipse.org...
> Hello,
>
> I have a general question regarding layout managers. What should they do
> with invisible child figures? Should they ignore these children? Should
they
> treat them normally as if they were visible? This could make a difference
to
> some layouts like FlowLayout, where an invisible child could introduce a
gap
> in the flow of the children. Should this handling be dealt with at a
figure
> level where it should return (0, 0) as its preferred size and minimum size
> in this case? I appreciate insight into this.
>
> Maged
>
>
|
|
| |
Re: LayoutManagers and figure visibility [message #108737 is a reply to message #108383] |
Wed, 10 December 2003 11:58   |
Eclipse User |
|
|
|
The usecase is the following:
I am using a FlowLayout in a container of Labels. However, some labels could
have no text, and in this case their editparts make them invisible. I had
expected that the layout manager handles this case by skipping over this
label but it did not. The Label has a preferred height of one line of text
even though the text could be empty. I also expected the
GraphialViewerKeyHandler to ignore invisible children or otherwise it will
be weird to select an invisible child.
So the solution would be to either change the Label to allow a preferred
size of (0, 0) if the text was empty, which will only fix the layout not the
key handler problem or change the layout manager and the key handler to
handle the invisible case.
I appreciate any input on this
Maged
"Randy Hudson" <none@us.ibm.com> wrote in message
news:br3974$is8$1@eclipse.org...
> The behavior is undefined ;-)
> Just out of curiosity, what is your use case of invisible figures?
> Currently we do what SWT does, which is completely ignore whether a child
is
> visible. AWT does the opposite.
>
> "Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
> news:br2kta$rcq$1@eclipse.org...
> > Hello,
> >
> > I have a general question regarding layout managers. What should they do
> > with invisible child figures? Should they ignore these children? Should
> they
> > treat them normally as if they were visible? This could make a
difference
> to
> > some layouts like FlowLayout, where an invisible child could introduce a
> gap
> > in the flow of the children. Should this handling be dealt with at a
> figure
> > level where it should return (0, 0) as its preferred size and minimum
size
> > in this case? I appreciate insight into this.
> >
> > Maged
> >
> >
>
>
|
|
|
Re: LayoutManagers and figure visibility [message #108752 is a reply to message #108737] |
Wed, 10 December 2003 13:13   |
Eclipse User |
|
|
|
Just have getModelChildren() for the container editpart return a filtered
list of elements (elements that have no label text would be removed). We do
a similar thing in PaletteEditPart.
"Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
news:br7j5d$icu$1@eclipse.org...
> The usecase is the following:
>
> I am using a FlowLayout in a container of Labels. However, some labels
could
> have no text, and in this case their editparts make them invisible. I had
> expected that the layout manager handles this case by skipping over this
> label but it did not. The Label has a preferred height of one line of text
> even though the text could be empty. I also expected the
> GraphialViewerKeyHandler to ignore invisible children or otherwise it will
> be weird to select an invisible child.
>
> So the solution would be to either change the Label to allow a preferred
> size of (0, 0) if the text was empty, which will only fix the layout not
the
> key handler problem or change the layout manager and the key handler to
> handle the invisible case.
>
> I appreciate any input on this
>
> Maged
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:br3974$is8$1@eclipse.org...
> > The behavior is undefined ;-)
> > Just out of curiosity, what is your use case of invisible figures?
> > Currently we do what SWT does, which is completely ignore whether a
child
> is
> > visible. AWT does the opposite.
> >
> > "Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
> > news:br2kta$rcq$1@eclipse.org...
> > > Hello,
> > >
> > > I have a general question regarding layout managers. What should they
do
> > > with invisible child figures? Should they ignore these children?
Should
> > they
> > > treat them normally as if they were visible? This could make a
> difference
> > to
> > > some layouts like FlowLayout, where an invisible child could introduce
a
> > gap
> > > in the flow of the children. Should this handling be dealt with at a
> > figure
> > > level where it should return (0, 0) as its preferred size and minimum
> size
> > > in this case? I appreciate insight into this.
> > >
> > > Maged
> > >
> > >
> >
> >
>
>
|
|
|
Re: LayoutManagers and figure visibility [message #108785 is a reply to message #108752] |
Wed, 10 December 2003 14:40   |
Eclipse User |
|
|
|
In this case, you also have to treat child visibility change event as a
children change event on the parent, which is kind of ugly. What do you
think?
"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:br7nhi$o62$1@eclipse.org...
> Just have getModelChildren() for the container editpart return a filtered
> list of elements (elements that have no label text would be removed). We
do
> a similar thing in PaletteEditPart.
>
>
> "Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
> news:br7j5d$icu$1@eclipse.org...
> > The usecase is the following:
> >
> > I am using a FlowLayout in a container of Labels. However, some labels
> could
> > have no text, and in this case their editparts make them invisible. I
had
> > expected that the layout manager handles this case by skipping over this
> > label but it did not. The Label has a preferred height of one line of
text
> > even though the text could be empty. I also expected the
> > GraphialViewerKeyHandler to ignore invisible children or otherwise it
will
> > be weird to select an invisible child.
> >
> > So the solution would be to either change the Label to allow a preferred
> > size of (0, 0) if the text was empty, which will only fix the layout not
> the
> > key handler problem or change the layout manager and the key handler to
> > handle the invisible case.
> >
> > I appreciate any input on this
> >
> > Maged
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:br3974$is8$1@eclipse.org...
> > > The behavior is undefined ;-)
> > > Just out of curiosity, what is your use case of invisible figures?
> > > Currently we do what SWT does, which is completely ignore whether a
> child
> > is
> > > visible. AWT does the opposite.
> > >
> > > "Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
> > > news:br2kta$rcq$1@eclipse.org...
> > > > Hello,
> > > >
> > > > I have a general question regarding layout managers. What should
they
> do
> > > > with invisible child figures? Should they ignore these children?
> Should
> > > they
> > > > treat them normally as if they were visible? This could make a
> > difference
> > > to
> > > > some layouts like FlowLayout, where an invisible child could
introduce
> a
> > > gap
> > > > in the flow of the children. Should this handling be dealt with at a
> > > figure
> > > > level where it should return (0, 0) as its preferred size and
minimum
> > size
> > > > in this case? I appreciate insight into this.
> > > >
> > > > Maged
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Re: LayoutManagers and figure visibility [message #109077 is a reply to message #108785] |
Thu, 11 December 2003 10:29  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Hiding the figure isn't going to be enough. If it is selected, you need to
deselect it. You need to prevent keyboard handlers from selecting it. If
you have a treeviewer, you need to hide the treeitem too.
It is a little bit ugly, but you can either have the parent observing the
children, or I think what we did in the palette is to propogate the
visibility change to the parent object, which then fires children changed
event.
"Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
news:br7sm4$v15$1@eclipse.org...
> In this case, you also have to treat child visibility change event as a
> children change event on the parent, which is kind of ugly. What do you
> think?
>
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:br7nhi$o62$1@eclipse.org...
> > Just have getModelChildren() for the container editpart return a
filtered
> > list of elements (elements that have no label text would be removed).
We
> do
> > a similar thing in PaletteEditPart.
> >
> >
> > "Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
> > news:br7j5d$icu$1@eclipse.org...
> > > The usecase is the following:
> > >
> > > I am using a FlowLayout in a container of Labels. However, some labels
> > could
> > > have no text, and in this case their editparts make them invisible. I
> had
> > > expected that the layout manager handles this case by skipping over
this
> > > label but it did not. The Label has a preferred height of one line of
> text
> > > even though the text could be empty. I also expected the
> > > GraphialViewerKeyHandler to ignore invisible children or otherwise it
> will
> > > be weird to select an invisible child.
> > >
> > > So the solution would be to either change the Label to allow a
preferred
> > > size of (0, 0) if the text was empty, which will only fix the layout
not
> > the
> > > key handler problem or change the layout manager and the key handler
to
> > > handle the invisible case.
> > >
> > > I appreciate any input on this
> > >
> > > Maged
> > >
> > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > news:br3974$is8$1@eclipse.org...
> > > > The behavior is undefined ;-)
> > > > Just out of curiosity, what is your use case of invisible figures?
> > > > Currently we do what SWT does, which is completely ignore whether a
> > child
> > > is
> > > > visible. AWT does the opposite.
> > > >
> > > > "Maged Elaasar" <melaasar@ca.ibm.com> wrote in message
> > > > news:br2kta$rcq$1@eclipse.org...
> > > > > Hello,
> > > > >
> > > > > I have a general question regarding layout managers. What should
> they
> > do
> > > > > with invisible child figures? Should they ignore these children?
> > Should
> > > > they
> > > > > treat them normally as if they were visible? This could make a
> > > difference
> > > > to
> > > > > some layouts like FlowLayout, where an invisible child could
> introduce
> > a
> > > > gap
> > > > > in the flow of the children. Should this handling be dealt with at
a
> > > > figure
> > > > > level where it should return (0, 0) as its preferred size and
> minimum
> > > size
> > > > > in this case? I appreciate insight into this.
> > > > >
> > > > > Maged
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 08:15:26 EDT 2025
Powered by FUDForum. Page generated in 0.07932 seconds
|