Home » Eclipse Projects » GEF » Problems with figure's parent 
| Problems with figure's parent [message #91739] | 
Fri, 29 August 2003 21:11   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 10:13    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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] | 
Fri, 29 August 2003 22:49   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 13:22   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 
>
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Tue Nov 04 01:07:57 EST 2025 
 Powered by  FUDForum. Page generated in 0.04208 seconds  
 |