Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problems with figure's parent
Problems with figure's parent [message #91739] Sat, 30 August 2003 01:11 Go to next message
Eclipse UserFriend
Originally posted by: gg.decisionsoft.co.uk

I am implementing an action that positions the children of a freeform layer when run.

I am having problems with the following line of code:

childPart.getFigure().getParent().setConstraint(childPart.ge tFigure(), new Rectangle(hOffset, vOffset, -1, -1));

This is throwing a null point exception as the figure's parent is null, but the figure appears in the display within the parent figure. What's wrong?

I have also tried:
getFigure().setConstraint(childPart.getFigure(), new Rectangle(hOffset, vOffset, -1, -1));

from within the parent edit part, but this produces "Figure.setConstraint(..): Figure is not a child"

--
Geoff
Re: Problems with figure's parent [message #91789 is a reply to message #91739] Fri, 29 August 2003 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Where are you running this code from? Hopefully not inside the action or a
command. Are you running this code inside your refresh()?

"Geoff Gibbs" <gg@decisionsoft.co.uk> wrote in message
news:binjdu$m6p$1@eclipse.org...
> I am implementing an action that positions the children of a freeform
layer when run.
>
> I am having problems with the following line of code:
>
> childPart.getFigure().getParent().setConstraint(childPart.ge tFigure(), new
Rectangle(hOffset, vOffset, -1, -1));
>
> This is throwing a null point exception as the figure's parent is null,
but the figure appears in the display within the parent figure. What's
wrong?
>
> I have also tried:
> getFigure().setConstraint(childPart.getFigure(), new Rectangle(hOffset,
vOffset, -1, -1));
>
> from within the parent edit part, but this produces
"Figure.setConstraint(..): Figure is not a child"
>
> --
> Geoff
>
Re: Problems with figure's parent [message #91815 is a reply to message #91789] Sat, 30 August 2003 02:49 Go to previous message
Eclipse UserFriend
Originally posted by: gg.decisionsoft.co.uk

> Where are you running this code from? Hopefully not inside the action or a
> command. Are you running this code inside your refresh()?

Er. Yes. It's being run from an action.
Is that a bad thing?

Where should I be putting the code for an action that repositions figures?

>>I am implementing an action that positions the children of a freeform
>
> layer when run.
>
>>I am having problems with the following line of code:
>>
>> childPart.getFigure().getParent().setConstraint(childPart.ge tFigure(), new
>
> Rectangle(hOffset, vOffset, -1, -1));
>
>>This is throwing a null point exception as the figure's parent is null,
>
> but the figure appears in the display within the parent figure. What's
> wrong?
>
>>I have also tried:
>>getFigure().setConstraint(childPart.getFigure(), new Rectangle(hOffset,
>
> vOffset, -1, -1));
>
>>from within the parent edit part, but this produces
>
> "Figure.setConstraint(..): Figure is not a child"
>

--
Geoff
Re: Problems with figure's parent [message #91860 is a reply to message #91815] Fri, 29 August 2003 17:22 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Geoff Gibbs" <gg@decisionsoft.co.uk> wrote in message
news:binp5m$sn1$1@eclipse.org...
> > Where are you running this code from? Hopefully not inside the action
or a
> > command. Are you running this code inside your refresh()?
>
> Er. Yes. It's being run from an action.
> Is that a bad thing?
>
> Where should I be putting the code for an action that repositions figures?

Well, how are you persisting the figure's locations? Their locations should
be stored in the model. The model's values should be reflected (copied)
into the figures, but that is not where you should store them.

If you delete an object, and undo the delete, a new editpart and new figure
are created, so you'll have to use the model to retain location info.
Perhaps you started using GEF more than a month ago. Recently, we've
published a tutorial on GEF that explains these concept. Please see our
homepage.

>
> >>I am implementing an action that positions the children of a freeform
> >
> > layer when run.
> >
> >>I am having problems with the following line of code:
> >>
> >> childPart.getFigure().getParent().setConstraint(childPart.ge tFigure(),
new
> >
> > Rectangle(hOffset, vOffset, -1, -1));
> >
> >>This is throwing a null point exception as the figure's parent is null,
> >
> > but the figure appears in the display within the parent figure. What's
> > wrong?
> >
> >>I have also tried:
> >>getFigure().setConstraint(childPart.getFigure(), new Rectangle(hOffset,
> >
> > vOffset, -1, -1));
> >
> >>from within the parent edit part, but this produces
> >
> > "Figure.setConstraint(..): Figure is not a child"
> >
>
> --
> Geoff
>
Previous Topic:Articles page updated
Next Topic:Nonresizable edit parts
Goto Forum:
  


Current Time: Sat Oct 19 21:04:49 GMT 2024

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

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

Back to the top