Skip to main content



      Home
Home » Eclipse Projects » GEF » DnD - droppping parts inside other parts
DnD - droppping parts inside other parts [message #171823] Tue, 15 March 2005 05:44 Go to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

Hi!

I am new to GEF and have struggled somewhat to find a decent example of
how to be able to drop parts inside other parts (for example, to be able
to creat or drop graphical elements like radiobuttons inside a group box).

Any help would be greatly appreciated!

// sidney
Re: DnD - droppping parts inside other parts [message #171832 is a reply to message #171823] Tue, 15 March 2005 07:40 Go to previous messageGo to next message
Eclipse UserFriend
You couldn't find a decent example that does that? Just about every example
does that.

The parent EditPart's LayoutEditPolicy will be passed a CreateRequest when a
new part is being added to it from the palette. Look at
LogicXYLayoutEditPolicy#getCreateCommand() in the logic example.

"Sidney Lee" <sidus68@yahoo.com> wrote in message
news:d16e9h$d30$1@www.eclipse.org...
> Hi!
>
> I am new to GEF and have struggled somewhat to find a decent example of
> how to be able to drop parts inside other parts (for example, to be able
> to creat or drop graphical elements like radiobuttons inside a group box).
>
> Any help would be greatly appreciated!
>
> // sidney
>
Re: DnD - droppping parts inside other parts [message #171855 is a reply to message #171832] Tue, 15 March 2005 10:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

hi! thanks for your prompt response. However, I think there has been a
misunderstanding: I am not interested in parts being added from the
palette but rather being able to drop EXISTING parts inside other parts
(for example, graphical elements like radiobuttons inside a group box), or
being able to move them back out onto the move again. (My original
question was perhaps misleading in that I said 'create or drop' - my
apologies).

Have looked at the example u mentioned below as I noticed there was a
getAddCommand equivalent. However, this left duplicate elements - the
original as well as the new element inside the group - both at the new
location (I noticed both elements once I relocated the group box). What
have I forgotten to do?

Many Thanks!

Pratik Shah wrote:

> You couldn't find a decent example that does that? Just about every example
> does that.

> The parent EditPart's LayoutEditPolicy will be passed a CreateRequest when a
> new part is being added to it from the palette. Look at
> LogicXYLayoutEditPolicy#getCreateCommand() in the logic example.

> "Sidney Lee" <sidus68@yahoo.com> wrote in message
> news:d16e9h$d30$1@www.eclipse.org...
>> Hi!
>>
>> I am new to GEF and have struggled somewhat to find a decent example of
>> how to be able to drop parts inside other parts (for example, to be able
>> to creat or drop graphical elements like radiobuttons inside a group box).
>>
>> Any help would be greatly appreciated!
>>
>> // sidney
>>
Re: DnD - droppping parts inside other parts [message #171885 is a reply to message #171855] Tue, 15 March 2005 11:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Same thing. The items in the pallette are EditParts, and the drawing
itself is also an EditPart. thus you have parts being added to parts.

For specific 'drop' behavior you want to look at the
TemplateDropTargetListener and DragSourceListener. You can also drag
items from the palette and drop them on the drawing. You dont have to
select them and use as a tool with left click and drag. In this case
you would see the TemplateDroptargetListener in action. That listener
is going to create the factory that is going to be passed into the
CreateRequest which will be received by the LayoutEditPolicy mentioned
in the prior post.


Sidney Lee wrote:
> hi! thanks for your prompt response. However, I think there has been a
> misunderstanding: I am not interested in parts being added from the
> palette but rather being able to drop EXISTING parts inside other parts
> (for example, graphical elements like radiobuttons inside a group box),
> or being able to move them back out onto the move again. (My original
> question was perhaps misleading in that I said 'create or drop' - my
> apologies).
> Have looked at the example u mentioned below as I noticed there was a
> getAddCommand equivalent. However, this left duplicate elements - the
> original as well as the new element inside the group - both at the new
> location (I noticed both elements once I relocated the group box). What
> have I forgotten to do?
>

There is only one thing being dropped, how are you getting duplicates?
and duplicate of what? Are you trying to drag one EditPart into another
EditPart when they were originally side by side?


> Many Thanks!
>
> Pratik Shah wrote:
>
>> You couldn't find a decent example that does that? Just about every
>> example
>> does that.
>
>
>> The parent EditPart's LayoutEditPolicy will be passed a CreateRequest
>> when a
>> new part is being added to it from the palette. Look at
>> LogicXYLayoutEditPolicy#getCreateCommand() in the logic example.
>
>
>> "Sidney Lee" <sidus68@yahoo.com> wrote in message
>> news:d16e9h$d30$1@www.eclipse.org...
>>
>>> Hi!
>>>
>>> I am new to GEF and have struggled somewhat to find a decent example of
>>> how to be able to drop parts inside other parts (for example, to be able
>>> to creat or drop graphical elements like radiobuttons inside a group
>>> box).
>>>
>>> Any help would be greatly appreciated!
>>>
>>> // sidney
>>>
>
>
Re: DnD - droppping parts inside other parts [message #171908 is a reply to message #171855] Tue, 15 March 2005 11:48 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> Have looked at the example u mentioned below as I noticed there was a
> getAddCommand equivalent. However, this left duplicate elements - the
> original as well as the new element inside the group - both at the new
> location (I noticed both elements once I relocated the group box). What
> have I forgotten to do?

You have forgotten to Orphan the object from its previous parent. A
separate request is sent to the old parent to "orphan" it.
Previous Topic:Making GEF appear in Eclipse
Next Topic:A question about lisence
Goto Forum:
  


Current Time: Fri Apr 25 21:27:55 EDT 2025

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

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

Back to the top