Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Draw2D Resize Question
Draw2D Resize Question [message #80581] Fri, 23 May 2003 05:11 Go to next message
Justin Kilimnik is currently offline Justin KilimnikFriend
Messages: 12
Registered: July 2009
Junior Member
I might be missing something simple here but I want to be responsible for
the location of Figure but I want that Figure to be as large as all of the
figures placed inside it. For instance if I place 10 labels in vertical flow
layout I want to be able to see all of the labels (ie the Figure is large
enought to encapsulate all the label). How do I do this? The functionality
doesn't seem to be there but I would expect the maximum size to be set
automatically to show all of the items I placed in...

Should use the DelegatingLayout? How?

Thanks
Re: Draw2D Resize Question [message #80656 is a reply to message #80581] Fri, 23 May 2003 13:36 Go to previous messageGo to next message
Eric Bordeau is currently offline Eric BordeauFriend
Messages: 259
Registered: July 2009
Senior Member
You want the container figure to be its preferred size (not maximum size) and
this can be done by setting the container figure's size to -1, -1. This
indicates to the layout manager that its preferred size should be used (just big
enough to fit all of its children, plus borders and insets). Not all layout
managers care about preferred size, though. If your container figure's children
are layed out using XYLayout, setting the container's size to -1, -1 will do
nothing. Some *only* care about preferred size. In the logic example, if you
place a flow figure inside of another flow figure, the inner figure will
automatically be at its preferred size.

Eric


Justin Kilimnik wrote:
> I might be missing something simple here but I want to be responsible for
> the location of Figure but I want that Figure to be as large as all of the
> figures placed inside it. For instance if I place 10 labels in vertical flow
> layout I want to be able to see all of the labels (ie the Figure is large
> enought to encapsulate all the label). How do I do this? The functionality
> doesn't seem to be there but I would expect the maximum size to be set
> automatically to show all of the items I placed in...
>
> Should use the DelegatingLayout? How?
>
> Thanks
>
>
Re: Draw2D Resize Question [message #80719 is a reply to message #80656] Fri, 23 May 2003 14:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
news:bal83v$itj$1@rogue.oti.com...
> You want the container figure to be its preferred size (not maximum size)
and
> this can be done by setting the container figure's size to -1, -1. This

By size, Eric means its constraint's size, not its bounds. You should never
call setBounds unless you are writing a layout manager.

So:
Figure container = new Figure();
container.setLayoutManager(new XYLayoutManager());
Figure childWithLabels = new Figure();
container.add(childWithLabels, new Rectangle (x, y, -1, -1));


> indicates to the layout manager that its preferred size should be used
(just big
> enough to fit all of its children, plus borders and insets). Not all
layout
> managers care about preferred size, though. If your container figure's
children
> are layed out using XYLayout, setting the container's size to -1, -1 will
do
> nothing. Some *only* care about preferred size. In the logic example, if
you
> place a flow figure inside of another flow figure, the inner figure will
> automatically be at its preferred size.
>
> Eric
>
>
> Justin Kilimnik wrote:
> > I might be missing something simple here but I want to be responsible
for
> > the location of Figure but I want that Figure to be as large as all of
the
> > figures placed inside it. For instance if I place 10 labels in vertical
flow
> > layout I want to be able to see all of the labels (ie the Figure is
large
> > enought to encapsulate all the label). How do I do this? The
functionality
> > doesn't seem to be there but I would expect the maximum size to be set
> > automatically to show all of the items I placed in...
> >
> > Should use the DelegatingLayout? How?
> >
> > Thanks
> >
> >
>
Re: Draw2D Resize Question [message #80855 is a reply to message #80719] Fri, 23 May 2003 15:29 Go to previous messageGo to next message
Eric Bordeau is currently offline Eric BordeauFriend
Messages: 259
Registered: July 2009
Senior Member
Randy Hudson wrote:
> "Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
> news:bal83v$itj$1@rogue.oti.com...
>
>>You want the container figure to be its preferred size (not maximum size)
>
> and
>
>>this can be done by setting the container figure's size to -1, -1. This
>
>
> By size, Eric means its constraint's size, not its bounds. You should never
> call setBounds unless you are writing a layout manager.

Sorry, I should've worded my reply better. Thanks, Randy.

> So:
> Figure container = new Figure();
> container.setLayoutManager(new XYLayoutManager());
> Figure childWithLabels = new Figure();
> container.add(childWithLabels, new Rectangle (x, y, -1, -1));
>
>
>
>>indicates to the layout manager that its preferred size should be used
>
> (just big
>
>>enough to fit all of its children, plus borders and insets). Not all
>
> layout
>
>>managers care about preferred size, though. If your container figure's
>
> children
>
>>are layed out using XYLayout, setting the container's size to -1, -1 will
>
> do
>
>>nothing. Some *only* care about preferred size. In the logic example, if
>
> you
>
>>place a flow figure inside of another flow figure, the inner figure will
>>automatically be at its preferred size.
>>
>>Eric
>>
>>
>>Justin Kilimnik wrote:
>>
>>>I might be missing something simple here but I want to be responsible
>
> for
>
>>>the location of Figure but I want that Figure to be as large as all of
>
> the
>
>>>figures placed inside it. For instance if I place 10 labels in vertical
>
> flow
>
>>>layout I want to be able to see all of the labels (ie the Figure is
>
> large
>
>>>enought to encapsulate all the label). How do I do this? The
>
> functionality
>
>>>doesn't seem to be there but I would expect the maximum size to be set
>>>automatically to show all of the items I placed in...
>>>
>>>Should use the DelegatingLayout? How?
>>>
>>>Thanks
>>>
>>>
>>
>
>
Re: Draw2D Resize Question [message #80918 is a reply to message #80719] Tue, 27 May 2003 02:47 Go to previous messageGo to next message
Justin Kilimnik is currently offline Justin KilimnikFriend
Messages: 12
Registered: July 2009
Junior Member
Cannot seem to get it to work. What I have is a XYLayout (I want to pin the
X,Y coords but make the Figure grow to everything that is inside it). I add
the items to a figure inside a scroll pane by using:

getContentsFigure().add(item, new Rectangle(x, y, -1, -1));

The item is a Figure, with FlowLayout, and labels added one after another
using the standard add command.

The figure is only large enough to see the first label. How can I fix
this????

Thanks.

"Randy Hudson" <none@us.ibm.com> wrote in message
news:balbbq$o17$1@rogue.oti.com...
>
> "Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
> news:bal83v$itj$1@rogue.oti.com...
> > You want the container figure to be its preferred size (not maximum
size)
> and
> > this can be done by setting the container figure's size to -1, -1. This
>
> By size, Eric means its constraint's size, not its bounds. You should
never
> call setBounds unless you are writing a layout manager.
>
> So:
> Figure container = new Figure();
> container.setLayoutManager(new XYLayoutManager());
> Figure childWithLabels = new Figure();
> container.add(childWithLabels, new Rectangle (x, y, -1, -1));
>
>
> > indicates to the layout manager that its preferred size should be used
> (just big
> > enough to fit all of its children, plus borders and insets). Not all
> layout
> > managers care about preferred size, though. If your container figure's
> children
> > are layed out using XYLayout, setting the container's size to -1, -1
will
> do
> > nothing. Some *only* care about preferred size. In the logic example,
if
> you
> > place a flow figure inside of another flow figure, the inner figure will
> > automatically be at its preferred size.
> >
> > Eric
> >
> >
> > Justin Kilimnik wrote:
> > > I might be missing something simple here but I want to be responsible
> for
> > > the location of Figure but I want that Figure to be as large as all of
> the
> > > figures placed inside it. For instance if I place 10 labels in
vertical
> flow
> > > layout I want to be able to see all of the labels (ie the Figure is
> large
> > > enought to encapsulate all the label). How do I do this? The
> functionality
> > > doesn't seem to be there but I would expect the maximum size to be set
> > > automatically to show all of the items I placed in...
> > >
> > > Should use the DelegatingLayout? How?
> > >
> > > Thanks
> > >
> > >
> >
>
>
Re: Draw2D Resize Question [message #80930 is a reply to message #80918] Tue, 27 May 2003 06:41 Go to previous messageGo to next message
Justin Kilimnik is currently offline Justin KilimnikFriend
Messages: 12
Registered: July 2009
Junior Member
Have got it working now, the only problem now is now you cannot drag with
the mouse (ie set the bounds) of the figure when using XYLayout. Is there a
way around this.

Also, when drawing on the canvas like this, what is the best way to make the
ScollPane expand/contract the size of the Figure?

"Justin Kilimnik" <justink@au.ibm.com> wrote in message
news:baujkc$2i8$1@rogue.oti.com...
> Cannot seem to get it to work. What I have is a XYLayout (I want to pin
the
> X,Y coords but make the Figure grow to everything that is inside it). I
add
> the items to a figure inside a scroll pane by using:
>
> getContentsFigure().add(item, new Rectangle(x, y, -1, -1));
>
> The item is a Figure, with FlowLayout, and labels added one after another
> using the standard add command.
>
> The figure is only large enough to see the first label. How can I fix
> this????
>
> Thanks.
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:balbbq$o17$1@rogue.oti.com...
> >
> > "Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
> > news:bal83v$itj$1@rogue.oti.com...
> > > You want the container figure to be its preferred size (not maximum
> size)
> > and
> > > this can be done by setting the container figure's size to -1, -1.
This
> >
> > By size, Eric means its constraint's size, not its bounds. You should
> never
> > call setBounds unless you are writing a layout manager.
> >
> > So:
> > Figure container = new Figure();
> > container.setLayoutManager(new XYLayoutManager());
> > Figure childWithLabels = new Figure();
> > container.add(childWithLabels, new Rectangle (x, y, -1, -1));
> >
> >
> > > indicates to the layout manager that its preferred size should be used
> > (just big
> > > enough to fit all of its children, plus borders and insets). Not all
> > layout
> > > managers care about preferred size, though. If your container
figure's
> > children
> > > are layed out using XYLayout, setting the container's size to -1, -1
> will
> > do
> > > nothing. Some *only* care about preferred size. In the logic
example,
> if
> > you
> > > place a flow figure inside of another flow figure, the inner figure
will
> > > automatically be at its preferred size.
> > >
> > > Eric
> > >
> > >
> > > Justin Kilimnik wrote:
> > > > I might be missing something simple here but I want to be
responsible
> > for
> > > > the location of Figure but I want that Figure to be as large as all
of
> > the
> > > > figures placed inside it. For instance if I place 10 labels in
> vertical
> > flow
> > > > layout I want to be able to see all of the labels (ie the Figure is
> > large
> > > > enought to encapsulate all the label). How do I do this? The
> > functionality
> > > > doesn't seem to be there but I would expect the maximum size to be
set
> > > > automatically to show all of the items I placed in...
> > > >
> > > > Should use the DelegatingLayout? How?
> > > >
> > > > Thanks
> > > >
> > > >
> > >
> >
> >
>
>
Re: Draw2D Resize Question [message #80947 is a reply to message #80930] Tue, 27 May 2003 06:43 Go to previous messageGo to next message
Justin Kilimnik is currently offline Justin KilimnikFriend
Messages: 12
Registered: July 2009
Junior Member
Got that working now! Just needed to change the Constraint information.

Sorry for your time.

"Justin Kilimnik" <justink@au.ibm.com> wrote in message
news:bav1a1$9pa$1@rogue.oti.com...
> Have got it working now, the only problem now is now you cannot drag with
> the mouse (ie set the bounds) of the figure when using XYLayout. Is there
a
> way around this.
>
> Also, when drawing on the canvas like this, what is the best way to make
the
> ScollPane expand/contract the size of the Figure?
>
> "Justin Kilimnik" <justink@au.ibm.com> wrote in message
> news:baujkc$2i8$1@rogue.oti.com...
> > Cannot seem to get it to work. What I have is a XYLayout (I want to pin
> the
> > X,Y coords but make the Figure grow to everything that is inside it). I
> add
> > the items to a figure inside a scroll pane by using:
> >
> > getContentsFigure().add(item, new Rectangle(x, y, -1, -1));
> >
> > The item is a Figure, with FlowLayout, and labels added one after
another
> > using the standard add command.
> >
> > The figure is only large enough to see the first label. How can I fix
> > this????
> >
> > Thanks.
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:balbbq$o17$1@rogue.oti.com...
> > >
> > > "Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
> > > news:bal83v$itj$1@rogue.oti.com...
> > > > You want the container figure to be its preferred size (not maximum
> > size)
> > > and
> > > > this can be done by setting the container figure's size to -1, -1.
> This
> > >
> > > By size, Eric means its constraint's size, not its bounds. You should
> > never
> > > call setBounds unless you are writing a layout manager.
> > >
> > > So:
> > > Figure container = new Figure();
> > > container.setLayoutManager(new XYLayoutManager());
> > > Figure childWithLabels = new Figure();
> > > container.add(childWithLabels, new Rectangle (x, y, -1, -1));
> > >
> > >
> > > > indicates to the layout manager that its preferred size should be
used
> > > (just big
> > > > enough to fit all of its children, plus borders and insets). Not
all
> > > layout
> > > > managers care about preferred size, though. If your container
> figure's
> > > children
> > > > are layed out using XYLayout, setting the container's size to -1, -1
> > will
> > > do
> > > > nothing. Some *only* care about preferred size. In the logic
> example,
> > if
> > > you
> > > > place a flow figure inside of another flow figure, the inner figure
> will
> > > > automatically be at its preferred size.
> > > >
> > > > Eric
> > > >
> > > >
> > > > Justin Kilimnik wrote:
> > > > > I might be missing something simple here but I want to be
> responsible
> > > for
> > > > > the location of Figure but I want that Figure to be as large as
all
> of
> > > the
> > > > > figures placed inside it. For instance if I place 10 labels in
> > vertical
> > > flow
> > > > > layout I want to be able to see all of the labels (ie the Figure
is
> > > large
> > > > > enought to encapsulate all the label). How do I do this? The
> > > functionality
> > > > > doesn't seem to be there but I would expect the maximum size to be
> set
> > > > > automatically to show all of the items I placed in...
> > > > >
> > > > > Should use the DelegatingLayout? How?
> > > > >
> > > > > Thanks
> > > > >
> > > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Draw2D Resize Question [message #80990 is a reply to message #80947] Tue, 27 May 2003 11:09 Go to previous message
Eclipse UserFriend
Originally posted by: frankc.colconsulting.com

Can you tell us what you did to solve these things?

Appreciated,

Frank V. Castellucci

"Justin Kilimnik" <justink@au.ibm.com> wrote in message
news:bav1f4$9s6$1@rogue.oti.com...
> Got that working now! Just needed to change the Constraint
information.
>
> Sorry for your time.
>
> "Justin Kilimnik" <justink@au.ibm.com> wrote in message
> news:bav1a1$9pa$1@rogue.oti.com...
> > Have got it working now, the only problem now is now you cannot drag
with
> > the mouse (ie set the bounds) of the figure when using XYLayout. Is
there
> a
> > way around this.
> >
> > Also, when drawing on the canvas like this, what is the best way to
make
> the
> > ScollPane expand/contract the size of the Figure?
> >
> > "Justin Kilimnik" <justink@au.ibm.com> wrote in message
> > news:baujkc$2i8$1@rogue.oti.com...
> > > Cannot seem to get it to work. What I have is a XYLayout (I want
to pin
> > the
> > > X,Y coords but make the Figure grow to everything that is inside
it). I
> > add
> > > the items to a figure inside a scroll pane by using:
> > >
> > > getContentsFigure().add(item, new Rectangle(x, y, -1, -1));
> > >
> > > The item is a Figure, with FlowLayout, and labels added one after
> another
> > > using the standard add command.
> > >
> > > The figure is only large enough to see the first label. How can I
fix
> > > this????
> > >
> > > Thanks.
> > >
> > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > news:balbbq$o17$1@rogue.oti.com...
> > > >
> > > > "Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
> > > > news:bal83v$itj$1@rogue.oti.com...
> > > > > You want the container figure to be its preferred size (not
maximum
> > > size)
> > > > and
> > > > > this can be done by setting the container figure's size
to -1, -1.
> > This
> > > >
> > > > By size, Eric means its constraint's size, not its bounds. You
should
> > > never
> > > > call setBounds unless you are writing a layout manager.
> > > >
> > > > So:
> > > > Figure container = new Figure();
> > > > container.setLayoutManager(new XYLayoutManager());
> > > > Figure childWithLabels = new Figure();
> > > > container.add(childWithLabels, new Rectangle (x, y, -1, -1));
> > > >
> > > >
> > > > > indicates to the layout manager that its preferred size should
be
> used
> > > > (just big
> > > > > enough to fit all of its children, plus borders and insets).
Not
> all
> > > > layout
> > > > > managers care about preferred size, though. If your container
> > figure's
> > > > children
> > > > > are layed out using XYLayout, setting the container's size
to -1, -1
> > > will
> > > > do
> > > > > nothing. Some *only* care about preferred size. In the logic
> > example,
> > > if
> > > > you
> > > > > place a flow figure inside of another flow figure, the inner
figure
> > will
> > > > > automatically be at its preferred size.
> > > > >
> > > > > Eric
> > > > >
> > > > >
> > > > > Justin Kilimnik wrote:
> > > > > > I might be missing something simple here but I want to be
> > responsible
> > > > for
> > > > > > the location of Figure but I want that Figure to be as large
as
> all
> > of
> > > > the
> > > > > > figures placed inside it. For instance if I place 10 labels
in
> > > vertical
> > > > flow
> > > > > > layout I want to be able to see all of the labels (ie the
Figure
> is
> > > > large
> > > > > > enought to encapsulate all the label). How do I do this? The
> > > > functionality
> > > > > > doesn't seem to be there but I would expect the maximum size
to be
> > set
> > > > > > automatically to show all of the items I placed in...
> > > > > >
> > > > > > Should use the DelegatingLayout? How?
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:Connection creation
Next Topic:Connection
Goto Forum:
  


Current Time: Sun Nov 03 12:09:31 GMT 2024

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

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

Back to the top