Skip to main content



      Home
Home » Eclipse Projects » GEF » How to move a figure
How to move a figure [message #8078] Thu, 06 June 2002 08:13 Go to next message
Eclipse UserFriend
Hi
I'm creating an editpart that may contain other edit parts. i have a
canvas for the parent and i want ot allow the user to drag figures within
the canvas to different locations. I can't figure out from the
documentation what kind of role and editpolicy are taking part in this
action. It looks like that the reqeust is REQ_MOVE_CHILDREN, but i'm not
sure.
thanks
yoav
Re: How to move a figure [message #8109 is a reply to message #8078] Thu, 06 June 2002 10:20 Go to previous messageGo to next message
Eclipse UserFriend
You need to install a LayoutEditPolicy as the LAYOUT_ROLE on your container
EditPart. In the Logic example, the LogicContainerEditPart installs a
LogicXYLayoutEditPolicy as the LAYOUT_ROLE. That EditPolicy implements
createChildEditPolicy(EditPart), which returns the EditPolicy that will be
installed on the children as the PRIMARY_DRAG_ROLE.

Eric


"Yoav Rubin" <yoav@il.ibm.com> wrote in message
news:adnjkc$6mb$1@rogue.oti.com...
> Hi
> I'm creating an editpart that may contain other edit parts. i have a
> canvas for the parent and i want ot allow the user to drag figures within
> the canvas to different locations. I can't figure out from the
> documentation what kind of role and editpolicy are taking part in this
> action. It looks like that the reqeust is REQ_MOVE_CHILDREN, but i'm not
> sure.
> thanks
> yoav
>
Re: How to move a figure [message #8139 is a reply to message #8109] Thu, 06 June 2002 10:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

"Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
news:adnq2q$apu$1@rogue.oti.com...
> You need to install a LayoutEditPolicy as the LAYOUT_ROLE on your
container
> EditPart. In the Logic example, the LogicContainerEditPart installs a
> LogicXYLayoutEditPolicy as the LAYOUT_ROLE. That EditPolicy implements
> createChildEditPolicy(EditPart), which returns the EditPolicy that will be
> installed on the children as the PRIMARY_DRAG_ROLE.

(Just adding some more info)
The container's layout determines how the children are dragged.
Specifically, XYLayout allows the children to be resized, whereas other
layouts don't allow this. You can ignore the details when trying to get
MOVE to work. REQ_MOVE_CHILDREN will get sent to your XYLayoutEditPolicy
subclass. You will need to implement the abstract methods in that
editpolicy to return the Commands necessary to move your model.

> > Hi
> > I'm creating an editpart that may contain other edit parts. i have a
> > canvas for the parent and i want ot allow the user to drag figures
within
> > the canvas to different locations. I can't figure out from the
> > documentation what kind of role and editpolicy are taking part in this
> > action. It looks like that the reqeust is REQ_MOVE_CHILDREN, but i'm not
> > sure.
> > thanks
> > yoav
Re: How to move a figure [message #8170 is a reply to message #8139] Thu, 06 June 2002 10:46 Go to previous message
Eclipse UserFriend
Originally posted by: none.ibm.com

> > You need to install a LayoutEditPolicy as the LAYOUT_ROLE on your
> container
> > EditPart. In the Logic example, the LogicContainerEditPart installs a
> > LogicXYLayoutEditPolicy as the LAYOUT_ROLE. That EditPolicy implements
> > createChildEditPolicy(EditPart), which returns the EditPolicy that will
be
> > installed on the children as the PRIMARY_DRAG_ROLE.

Oops. Eric is right, you need to return a new ResizableEditPolicy in
MyXYLayout#createChildEditPolicy(EditPart).
I just opened http://bugs.eclipse.org/bugs/show_bug.cgi?id=19492 because we
should be assuming that with XY layout you want to use a resizable policy,
which you could still override if you want.
Previous Topic:more documentation/ressources for writing an editor
Next Topic:installing gef plugin on 2.0
Goto Forum:
  


Current Time: Fri Apr 25 21:13:06 EDT 2025

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

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

Back to the top