conditional creation and DnD across parts [message #175601] |
Tue, 05 April 2005 09:43  |
Eclipse User |
|
|
|
Originally posted by: sidus68.yahoo.com
Hi!
I have a form which contains one or more containers, and each container
contains various components. The container and the various components are
available from the palette viewer for creation. The container may only be
a child of the form, but not of itself or any other component. Nor must it
be possible to create a component outside of a container (a component must
contain the container as a parent somewhere in its EditPart hierarchy).
- two questions:
(i) am I correct in assuming that a LAYOUT_ROLE with XYLayoutEditPolicy
appropriately subclassed such that getCreateCommand() returns null if the
parent of the container is not the form, or (when creating a component)
the parent is the form?
(ii) components can be dragged within or across containers, but not onto
the form - how do I facilitate this?
Many thanks!
|
|
|
|
Re: conditional creation and DnD across parts [message #175839 is a reply to message #175788] |
Wed, 06 April 2005 13:56  |
Eclipse User |
|
|
|
"Sidney Lee" <sidus68@yahoo.com> wrote in message
news:a2c9d7e4002f37a1573ac2277559537e$1@www.eclipse.org...
> well, I have solved the creation problems, but not sure if my approach is
> correct. Have used the LAYOUT_ROLE with XYLayoutEditPolicy appropriately
> subclassed such that getCreateCommand() returns null if the target parent
> is invappropriate. Further, have removed orphan/add support from the form
> to prevent components being dragged outside the container (across
> containers works fine).
That's good.
>
> However, how do I prevent something form being a child of itself (a
> container withinn a container)?
Same thing as you did earlier. getCreateCommand() and getAddCommand() for
the ContainerEditPart should return null when the part being created is a
Container.
>
> Many thanks!
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.33242 seconds