|
Re: Mechanism for child drop validation [message #221720 is a reply to message #221659] |
Thu, 17 August 2006 15:00 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
How do you handle this problem when C2 is being created and there is no
editpart for it? Generally the parent must decide. Maybe mhis means that
your application delegates to some metainfo in your model for the child
object type (whether the child exists or is being created), and then that
child type determines if it can live inside the parent [type].
"Cameron Bateman" <cameron.bateman@oracle.com> wrote in message
news:2687e9b0a8178507fb10f47c86ed057c$1@www.eclipse.org...
>I am looking for a general way to validate canvas drag and drop of child
>edit parts from one parent edit part to another from the child.
> Consider the situation where I have three edit parts: P1, C1 and P2. C1
> is presently a child part of P1. When the user drags C1 from P1 to P2 I
> want to validate that P2 is a valid place for C1 to be BUT I want C1 to
> decide this, not P2.
> However, when I try to implement this validation I run into a problem: C1
> never gets an event (in the form of a request) when it is dropped in P2.
> It is P2 that gets the request (usually in the form of a REQ_ADD or
> REQ_MOVE_CHILDREN). So, from an edit policy-driven perspective, it seems
> there is no way to do what I want without enforcing that all possible
> parent edit parts query the part being dropped (added or moved into) to
> see if it is happy with the new state of affairs.
>
> Or is there a mechanism already provided for this in the framework?
>
>
> --Cam
>
|
|
|
Re: Mechanism for child drop validation [message #221728 is a reply to message #221720] |
Thu, 17 August 2006 18:06 |
Cameron Bateman Messages: 481 Registered: July 2009 |
Senior Member |
|
|
The problem arises because I am trying design an extensible editor where
the parent may have no a priori knowledge of the child being dropped
because they are contributed by different extenders of the editor and know
nothing about one another.
To make it more tangible, consider a concrete example I'm working with.
The target application is a JSF visual editor. In JSF, there are
components like tables. Tables can contain columns. Columns can be
considered "children" of the table. Columns can be moved within the table
(so a drop validation can check for a parent it knows about), but it can't
be dropped outside the table, since it has no meaning in say, a Panel Grid
(like an SWT Composite with grid layout). But the Panel knows nothing
specific about the column. It can't be pre-programmed with the infinite
set of components that could be dragged into it. However, the column does
know this (by exclusion rather than inclusion), so it would be nice to
delegate this knowledge where it belongs -- it could belong in either the
child or the parent depending on the situation.
As you suggest, my meta-model could solve problem, but it means that I
must enforce that all edit parts that can have children must use a
particular sub-class of EditPolicy that ensures that all drops query the
child as well as the parent before allowing the drop.
--Cam
Randy Hudson wrote:
> How do you handle this problem when C2 is being created and there is no
> editpart for it? Generally the parent must decide. Maybe mhis means that
> your application delegates to some metainfo in your model for the child
> object type (whether the child exists or is being created), and then that
> child type determines if it can live inside the parent [type].
|
|
|
Re: Mechanism for child drop validation [message #221735 is a reply to message #221728] |
Thu, 17 August 2006 20:34 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"Cameron Bateman" <cameron.bateman@oracle.com> wrote in message
news:8e2b3e3bd414ac479964a702bc808cb7$1@www.eclipse.org...
> The problem arises because I am trying design an extensible editor where
> the parent may have no a priori knowledge of the child being dropped
> because they are contributed by different extenders of the editor and know
> nothing about one another.
>
> To make it more tangible, consider a concrete example I'm working with.
> The target application is a JSF visual editor. In JSF, there are
> components like tables. Tables can contain columns. Columns can be
> considered "children" of the table. Columns can be moved within the table
> (so a drop validation can check for a parent it knows about), but it can't
> be dropped outside the table, since it has no meaning in say, a Panel Grid
> (like an SWT Composite with grid layout). But the Panel knows nothing
> specific about the column. It can't be pre-programmed with the infinite
> set of components that could be dragged into it. However, the column does
> know this (by exclusion rather than inclusion), so it would be nice to
> delegate this knowledge where it belongs -- it could belong in either the
> child or the parent depending on the situation.
>
> As you suggest, my meta-model could solve problem, but it means that I
> must enforce that all edit parts that can have children must use a
> particular sub-class of EditPolicy that ensures that all drops query the
> child as well as the parent before allowing the drop.
And my argument is that you already have to do this for creation, when the
column doesn't exist yet.
>
>
> --Cam
>
> Randy Hudson wrote:
>
>> How do you handle this problem when C2 is being created and there is no
>> editpart for it? Generally the parent must decide. Maybe mhis means that
>> your application delegates to some metainfo in your model for the child
>> object type (whether the child exists or is being created), and then that
>> child type determines if it can live inside the parent [type].
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04052 seconds