Skip to main content



      Home
Home » Eclipse Projects » GEF » Changing getContentsPane()
Changing getContentsPane() [message #161940] Fri, 17 December 2004 11:34 Go to next message
Eclipse UserFriend
Given all of the un-understanding about addChildVisual(),
setLayoutConstraint(), nested figures in a single EditPart, etc, etc, etc
what if AbstractGraphicalEditPart.getContentPane() was changed to be
getContentPane(EditPart child)? In the default case there would be no
difference (it would effectively ignore the child EditPart). For those that
want to use nested figures the new getContentPane() would return the figure
specific to that child EditPart allowing addChildVisual(),
setLayoutConstraint(), etc to function correctly and without modification.

Thank you.

--
Rob Grzywinski
Re: Changing getContentsPane() [message #161960 is a reply to message #161940] Fri, 17 December 2004 12:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

The indexes would be off if there were more than one contents pane. I would
suggest overriding addChildVisual(child, index), and take the index and do a
contents pane lookup, and index correction, all in one place.
getContentsPane would just be unused.

"Rob Grzywinski" <rgrzywinski@realityinteractive.com> wrote in message
news:cpv1r6$o1f$1@www.eclipse.org...
> Given all of the un-understanding about addChildVisual(),
> setLayoutConstraint(), nested figures in a single EditPart, etc, etc, etc
> what if AbstractGraphicalEditPart.getContentPane() was changed to be
> getContentPane(EditPart child)? In the default case there would be no
> difference (it would effectively ignore the child EditPart). For those
that
> want to use nested figures the new getContentPane() would return the
figure
> specific to that child EditPart allowing addChildVisual(),
> setLayoutConstraint(), etc to function correctly and without modification.
>
> Thank you.
>
> --
> Rob Grzywinski
>
>
Re: Changing getContentsPane() [message #161975 is a reply to message #161960] Fri, 17 December 2004 12:20 Go to previous messageGo to next message
Eclipse UserFriend
> The indexes would be off if there were more than one contents pane. I
> would
> suggest overriding addChildVisual(child, index), and take the index and do
> a
> contents pane lookup, and index correction, all in one place.
> getContentsPane would just be unused.

But then you get nipped with the setLayoutConstraint() "Figure is not a
child" and you have to do the same goop there too (minus the index stuff).
So I ended up writing a getContentPane(EditChild) to use between the two of
them and voila! you have my original post.

I will admit that I'm less than pleased about the whole index problem in
addChildVisual(). Why can't they be sparse?


--
Rob Grzywinski
Re: Changing getContentsPane() [message #162031 is a reply to message #161975] Fri, 17 December 2004 14:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

We can change setLayoutConstraint to get the figure's parent, which should
be the contents pane in general.

"Rob Grzywinski" <rgrzywinski@realityinteractive.com> wrote in message
news:cpv4hf$1rr$1@www.eclipse.org...
> > The indexes would be off if there were more than one contents pane. I
> > would
> > suggest overriding addChildVisual(child, index), and take the index and
do
> > a
> > contents pane lookup, and index correction, all in one place.
> > getContentsPane would just be unused.
>
> But then you get nipped with the setLayoutConstraint() "Figure is not a
> child" and you have to do the same goop there too (minus the index stuff).
> So I ended up writing a getContentPane(EditChild) to use between the two
of
> them and voila! you have my original post.
>
> I will admit that I'm less than pleased about the whole index problem in
> addChildVisual(). Why can't they be sparse?
>
>
> --
> Rob Grzywinski
>
>
Re: Changing getContentsPane() [message #162036 is a reply to message #162031] Fri, 17 December 2004 15:57 Go to previous messageGo to next message
Eclipse UserFriend
> We can change setLayoutConstraint to get the figure's parent, which should
> be the contents pane in general.

public void setLayoutConstraint(EditPart child, IFigure childFigure, Object
constraint) {
childFigure.getParent().getLayoutManager().setConstraint(chi ldFigure,
constraint);
}

That appears to be a general solution to that particular problem, I agree.

--
Rob Grzywinski
Re: Changing getContentsPane() [message #163073 is a reply to message #162036] Thu, 30 December 2004 17:18 Go to previous message
Eclipse UserFriend
> public void setLayoutConstraint(EditPart child, IFigure childFigure,
> Object constraint) {
> childFigure.getParent().getLayoutManager().setConstraint(chi ldFigure,
> constraint);
> }

It ends up that this is not entirely correct as there is no revalidate()
called on the parent figure which would result in the re-bounding of the
child figure. A more correct solution would be:

childFigure.getParent().setConstraint(childFigure, constraint);


--
Rob Grzywinski
Previous Topic:Running GEF Shapes Example in Run-Time Workbench: java.lang.ExceptionInInitializerError
Next Topic:how to disable posibility to resize elements?
Goto Forum:
  


Current Time: Tue Jul 15 22:36:47 EDT 2025

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

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

Back to the top