| Confused with Policies [message #247609] | 
Wed, 04 March 2009 11:17   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: bruno.pereira.alert.pt 
 
Hello, 
 
I'm developing my first application using GEF, as expected I'm still green  
about the subject. 
I'm starting to implement a LayoutPolicy for re-ordering the childs of a  
AbstractGraphicalEditPart. I extend the XYLayoutEditPolicy and override the  
method getMoveChildrenCommand... the problems started here: 
    1 - I can easily know the "parent" EditPart thanks to the getHost, but  
what about the currently selected EditPart? 
            I "solve" this getting the childs of the parent and check witch  
one was getSelected() == AbstractGraphicalEditPart.SELECTED_PRIMARY. Is this  
the best way? Shouldn't the request retrieve the EditPart i'm currently  
moving? 
 
    2 - When I drop the Figure I'm dragging on top of other Figure (with the  
same parent) I want to move the first Figure to the place of the second and  
shift the position of the others. Theres any way of knowing the  
Figure/EditPart located where i drop the Figure i was dragging, without  
checking for every Figure if the area occupied contains the point where I  
drop the Figure (currently I'm doing this :\)? 
 
    3 - My EditPart, that has installed the MyXYLayoutEditPolicy, can have  
as child other EditParts that also has installed a XYLayoutEditPolicy. When  
I drag a Figure and position it over its brother, if that brother had a  
XYLayoutEditPolicy installed the frameworks think I want to add the dragged  
Figure to the EditPart of his brother. Start firing the  
getAddCommand(Request generic), the thing is that I might want to just  
re-order the "brothers" or I might really want to add the first one inside  
the last one. It's possible to detect, when the getAddCommand is firing, if  
the user as the CTRL pressed? And have different behavior if it is pressed  
or not? If it's possible the next question is how? 
 
Any tips are welcome. 
 
Thanks, 
Bruno Pereira
 |  
 |  
  | 
| Re: Confused with Policies [message #247630 is a reply to message #247609] | 
Thu, 05 March 2009 05:37   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: bruno.pereira.alert.pt 
 
Forget the fist doubt, found the answer after digging the API a little more: 
ChangeBoundsRequest request = (ChangeBoundsRequest)generic; 
List editParts = request.getEditParts(); 
 
-- 
Bruno Pereira 
 
"Bruno Pereira" <bruno.pereira@alert.pt> wrote in message  
news:gom9im$sui$1@build.eclipse.org... 
> Hello, 
> 
> I'm developing my first application using GEF, as expected I'm still green  
> about the subject. 
> I'm starting to implement a LayoutPolicy for re-ordering the childs of a  
> AbstractGraphicalEditPart. I extend the XYLayoutEditPolicy and override  
> the method getMoveChildrenCommand... the problems started here: 
>    1 - I can easily know the "parent" EditPart thanks to the getHost, but  
> what about the currently selected EditPart? 
>            I "solve" this getting the childs of the parent and check witch  
> one was getSelected() == AbstractGraphicalEditPart.SELECTED_PRIMARY. Is  
> this the best way? Shouldn't the request retrieve the EditPart i'm  
> currently moving? 
> 
>    2 - When I drop the Figure I'm dragging on top of other Figure (with  
> the same parent) I want to move the first Figure to the place of the  
> second and shift the position of the others. Theres any way of knowing the  
> Figure/EditPart located where i drop the Figure i was dragging, without  
> checking for every Figure if the area occupied contains the point where I  
> drop the Figure (currently I'm doing this :\)? 
> 
>    3 - My EditPart, that has installed the MyXYLayoutEditPolicy, can have  
> as child other EditParts that also has installed a XYLayoutEditPolicy.  
> When I drag a Figure and position it over its brother, if that brother had  
> a XYLayoutEditPolicy installed the frameworks think I want to add the  
> dragged Figure to the EditPart of his brother. Start firing the  
> getAddCommand(Request generic), the thing is that I might want to just  
> re-order the "brothers" or I might really want to add the first one inside  
> the last one. It's possible to detect, when the getAddCommand is firing,  
> if the user as the CTRL pressed? And have different behavior if it is  
> pressed or not? If it's possible the next question is how? 
> 
> Any tips are welcome. 
> 
> Thanks, 
> Bruno Pereira 
> 
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03929 seconds