Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Correct way to set initial node size?
Correct way to set initial node size? [message #148559] Wed, 25 August 2004 13:37 Go to next message
Eclipse UserFriend
Originally posted by: aprice.nospam.versata.com

Good Day,

I've been unable to fathom the correct way to specify the initial size for a
new node (created by click on palette tool, click at target location).

I'm using a subclass of XYLayoutEditPolicy, whose (inherited)
getConstraintFor(Request) implementation returns an empty Rectangle at the
target point if the Request's size property is null; according to the docs
the 'emptiness' signifies that that figures's preferred size is to be used.
It's not clear to me whether this implies that the framework will somehow
apply the preferred size for the corresponding figure, but it certainly
doesn't seem to behave like that. The only way seems to be to set an
explicit size in the request object, which seems odd because I'd have
thought the obvious place to specify the default size is via
Figure.getPreferredSize() - the problem is that one doesn't have a figure
instance in the call to LayoutEditPolicy.getCreateCommand(CreateRequest).

Is there a recommended way to set an initial size?

Thanks in advance,

Adrian Price
Re: Correct way to set initial node size? [message #148576 is a reply to message #148559] Wed, 25 August 2004 14:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

The size is determined by your model, not the figure. If you want it to be
the preferred size of the figure, you can represent this in your model by
using width/height of -1. The layout manager will then query the figure for
its preferred size at layout time. Otherwise, set it to whatever makes
sense for that model object.

"Adrian Price" <aprice@nospam.versata.com> wrote in message
news:cgi5sj$jjs$1@eclipse.org...
> Good Day,
>
> I've been unable to fathom the correct way to specify the initial size for
a
> new node (created by click on palette tool, click at target location).
>
> I'm using a subclass of XYLayoutEditPolicy, whose (inherited)
> getConstraintFor(Request) implementation returns an empty Rectangle at the
> target point if the Request's size property is null; according to the docs
> the 'emptiness' signifies that that figures's preferred size is to be
used.
> It's not clear to me whether this implies that the framework will somehow
> apply the preferred size for the corresponding figure, but it certainly
> doesn't seem to behave like that. The only way seems to be to set an
> explicit size in the request object, which seems odd because I'd have
> thought the obvious place to specify the default size is via
> Figure.getPreferredSize() - the problem is that one doesn't have a figure
> instance in the call to LayoutEditPolicy.getCreateCommand(CreateRequest).
>
> Is there a recommended way to set an initial size?
>
> Thanks in advance,
>
> Adrian Price
>
>
Re: Correct way to set initial node size? [message #149711 is a reply to message #148576] Thu, 26 August 2004 07:47 Go to previous message
Eclipse UserFriend
Originally posted by: aprice.nospam.versata.com

Aaahh - makes perfect sense now you've pointed that out :-)

Thanks Randy!

best,

Adrian.

"Randy Hudson" <none@us.ibm.com> wrote in message
news:cgi754$mfn$1@eclipse.org...
> The size is determined by your model, not the figure. If you want it to
be
> the preferred size of the figure, you can represent this in your model by
> using width/height of -1. The layout manager will then query the figure
for
> its preferred size at layout time. Otherwise, set it to whatever makes
> sense for that model object.
>
> "Adrian Price" <aprice@nospam.versata.com> wrote in message
> news:cgi5sj$jjs$1@eclipse.org...
> > Good Day,
> >
> > I've been unable to fathom the correct way to specify the initial size
for
> a
> > new node (created by click on palette tool, click at target location).
> >
> > I'm using a subclass of XYLayoutEditPolicy, whose (inherited)
> > getConstraintFor(Request) implementation returns an empty Rectangle at
the
> > target point if the Request's size property is null; according to the
docs
> > the 'emptiness' signifies that that figures's preferred size is to be
> used.
> > It's not clear to me whether this implies that the framework will
somehow
> > apply the preferred size for the corresponding figure, but it certainly
> > doesn't seem to behave like that. The only way seems to be to set an
> > explicit size in the request object, which seems odd because I'd have
> > thought the obvious place to specify the default size is via
> > Figure.getPreferredSize() - the problem is that one doesn't have a
figure
> > instance in the call to
LayoutEditPolicy.getCreateCommand(CreateRequest).
> >
> > Is there a recommended way to set an initial size?
> >
> > Thanks in advance,
> >
> > Adrian Price
> >
> >
>
>
Previous Topic:Ruler/Status bar feedback
Next Topic:GEF Viewer in Dialog
Goto Forum:
  


Current Time: Fri Apr 26 09:52:15 GMT 2024

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

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

Back to the top