Home » Eclipse Projects » GEF » Telling parent EditPart to also handle request.
Telling parent EditPart to also handle request. [message #133379] |
Fri, 21 May 2004 06:51 |
Thomas Maier Messages: 117 Registered: July 2009 |
Senior Member |
|
|
Hi all,
Say, I have one figure (CompartmentFigure) inside another figure
(ContainerFigure). Both have an EditPart, CompartmentEditPart and
ContainerEditPart, respectively. I have installed
SELECTION_FEEDBACK_ROLE EditPolicies on both of them. Now, when the
mouse is inside a container but not inside a compartment, the
container feedback is displayed. When the mouse is inside a
compartment, the compartment's selection fedback is displayed, fine.
I would like to also display the container's feedback when the mouse
is in a compartment. So I thought in showTargetFeedback(Request r) I
just say getHost().getParent().performRequest(r);. Unfortunately this
does not work. So I am saying
(MyContainerHighlightEditPolicy) getHost().getParent().
getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
showTargetFeedback(request);
But I can't imagine this is the way it is supposed to be. I rather
like the idea of saying "hey parent, handle that request here, too"
instead of saying "I know that my parent's SELCTION_FEEDBACK_ROLE
Editpolicy is a MyContainerHighlightEditPolicy and so I'll call
showTargetFeedback on it". Isn't that the performRequest() thing?
What do I have to do to use that? Or is it something completely
different? TIA, Thomas.
--
Thomas Maier <Thomas.Maier@uni-kassel.de>
|
|
|
Re: Telling parent EditPart to also handle request. [message #133474 is a reply to message #133379] |
Fri, 21 May 2004 14:20 |
Eclipse User |
|
|
|
Originally posted by: rlemaigr.ulb.ac.be
On Fri, 21 May 2004 08:51:19 +0200, Thomas Maier =
<Thomas.Maier@uni-kassel.de> wrote:
> Hi all,
>
> Say, I have one figure (CompartmentFigure) inside another figure =
> (ContainerFigure). Both have an EditPart, CompartmentEditPart and =
> ContainerEditPart, respectively. I have installed =
> SELECTION_FEEDBACK_ROLE EditPolicies on both of them. Now, when the =
> mouse is inside a container but not inside a compartment, the containe=
r =
> feedback is displayed. When the mouse is inside a compartment, the =
> compartment's selection fedback is displayed, fine. I would like to al=
so =
> display the container's feedback when the mouse is in a compartment. =
So =
> I thought in showTargetFeedback(Request r) I just say =
> getHost().getParent().performRequest(r);. Unfortunately this does not=
=
> work. So I am saying
>
> (MyContainerHighlightEditPolicy) getHost().getParent().
> getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
> showTargetFeedback(request);
>
> But I can't imagine this is the way it is supposed to be. I rather li=
ke =
> the idea of saying "hey parent, handle that request here, too" instead=
=
> of saying "I know that my parent's SELCTION_FEEDBACK_ROLE Editpolicy i=
s =
> a MyContainerHighlightEditPolicy and so I'll call showTargetFeedback o=
n =
> it". Isn't that the performRequest() thing? What do I have to do to u=
se =
> that? Or is it something completely different? TIA, Thomas.
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
|
Re: Telling parent EditPart to also handle request. [message #133487 is a reply to message #133379] |
Fri, 21 May 2004 14:27 |
Eclipse User |
|
|
|
Originally posted by: rlemaigr.ulb.ac.be
hello thomas,
why not just write:
getHost().getParent().showTargetFeedback(request);
instead of
(MyContainerHighlightEditPolicy) getHost().getParent().
getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
showTargetFeedback(request);
?
The container EditPart will iterate over all its EditPolicies, and calli=
ng =
on each of them showTargetFeedback(request), so the =
MyContainerHighlightEditPolicy should also get the message, I think. And=
=
this way, you don't make any hypothesis on the type of the EditPolicy =
installed on the SELECTION_FEEDBACK_ROLE of the parent, wich seems to be=
=
what was bothering you.
Maybe there is a better way to do this, I don't know...
r=E9gis
On Fri, 21 May 2004 08:51:19 +0200, Thomas Maier =
<Thomas.Maier@uni-kassel.de> wrote:
> Hi all,
>
> Say, I have one figure (CompartmentFigure) inside another figure =
> (ContainerFigure). Both have an EditPart, CompartmentEditPart and =
> ContainerEditPart, respectively. I have installed =
> SELECTION_FEEDBACK_ROLE EditPolicies on both of them. Now, when the =
> mouse is inside a container but not inside a compartment, the containe=
r =
> feedback is displayed. When the mouse is inside a compartment, the =
> compartment's selection fedback is displayed, fine. I would like to al=
so =
> display the container's feedback when the mouse is in a compartment. =
So =
> I thought in showTargetFeedback(Request r) I just say =
> getHost().getParent().performRequest(r);. Unfortunately this does not=
=
> work. So I am saying
>
> (MyContainerHighlightEditPolicy) getHost().getParent().
> getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
> showTargetFeedback(request);
>
> But I can't imagine this is the way it is supposed to be. I rather li=
ke =
> the idea of saying "hey parent, handle that request here, too" instead=
=
> of saying "I know that my parent's SELCTION_FEEDBACK_ROLE Editpolicy i=
s =
> a MyContainerHighlightEditPolicy and so I'll call showTargetFeedback o=
n =
> it". Isn't that the performRequest() thing? What do I have to do to u=
se =
> that? Or is it something completely different? TIA, Thomas.
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
|
Re: Telling parent EditPart to also handle request. [message #133499 is a reply to message #133379] |
Fri, 21 May 2004 14:55 |
Thomas Maier Messages: 117 Registered: July 2009 |
Senior Member |
|
|
Thomas Maier wrote:
> Hi all,
>
> Say, I have one figure (CompartmentFigure) inside another figure
> (ContainerFigure). Both have an EditPart, CompartmentEditPart and
> ContainerEditPart, respectively. I have installed
> SELECTION_FEEDBACK_ROLE EditPolicies on both of them. Now, when the
> mouse is inside a container but not inside a compartment, the container
> feedback is displayed. When the mouse is inside a compartment, the
> compartment's selection fedback is displayed, fine. I would like to also
> display the container's feedback when the mouse is in a compartment. So
> I thought in showTargetFeedback(Request r) I just say
> getHost().getParent().performRequest(r);. Unfortunately this does not
> work. So I am saying
>
> (MyContainerHighlightEditPolicy) getHost().getParent().
> getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
> showTargetFeedback(request);
>
> But I can't imagine this is the way it is supposed to be. I rather like
> the idea of saying "hey parent, handle that request here, too" instead
> of saying "I know that my parent's SELCTION_FEEDBACK_ROLE Editpolicy is
> a MyContainerHighlightEditPolicy and so I'll call showTargetFeedback on
> it". Isn't that the performRequest() thing? What do I have to do to use
> that? Or is it something completely different? TIA, Thomas.
Ok, I took a look at some GEF source code. First, performRequest does
not seem to be that "universal request multiplexer" I thought it is.
Its default implementation is empty. Second, it seems that selection
requests are a bit different. showTargetFeedback is called directly
on the editpart. I guess this is because no Command is involved? So
I guess (again) that the proper way of doing what I want is saying
getHost().getParent().showTargetFeedback(request);
because I saw that the default implementation forwards that to all the
installed edit policies. Am I guessing right?
--
Thomas Maier <Thomas.Maier@uni-kassel.de>
|
|
|
Re: Telling parent EditPart to also handle request. [message #133525 is a reply to message #133487] |
Fri, 21 May 2004 15:02 |
Thomas Maier Messages: 117 Registered: July 2009 |
Senior Member |
|
|
rlemaigr@ulb.ac.be wrote:
> hello thomas,
>
> why not just write:
>
> getHost().getParent().showTargetFeedback(request);
>
> instead of
>
> (MyContainerHighlightEditPolicy) getHost().getParent().
> getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
> showTargetFeedback(request);
>
> ?
Thanks régis, I should probably have waited for a follow up :).
>
> The container EditPart will iterate over all its EditPolicies, and
> calling on each of them showTargetFeedback(request), so the
> MyContainerHighlightEditPolicy should also get the message, I think.
> And this way, you don't make any hypothesis on the type of the
> EditPolicy installed on the SELECTION_FEEDBACK_ROLE of the parent, wich
> seems to be what was bothering you.
Yes. I even thought one (little) step further. I thought there is
some "central request gate" every request has to pass in order to get
sent to the correct place. At least now I know that it is not
performRequest. Anyway, that's way better than my first try.
> Maybe there is a better way to do this, I don't know...
I'd be interested, but for now it is good enough. Thanks again, Thomas.
--
Thomas Maier <Thomas.Maier@uni-kassel.de>
|
|
|
Re: Telling parent EditPart to also handle request. [message #133836 is a reply to message #133499] |
Mon, 24 May 2004 12:53 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Yes, your guess is correct. performRequest() is a way to ask an editpart to
perform some "action". For example, direct edit does not always result in a
commond. The user may press ESC and cancel.
"Thomas Maier" <Thomas.Maier@uni-kassel.de> wrote in message
news:40AE1848.4070304@uni-kassel.de...
> Thomas Maier wrote:
> > Hi all,
> >
> > Say, I have one figure (CompartmentFigure) inside another figure
> > (ContainerFigure). Both have an EditPart, CompartmentEditPart and
> > ContainerEditPart, respectively. I have installed
> > SELECTION_FEEDBACK_ROLE EditPolicies on both of them. Now, when the
> > mouse is inside a container but not inside a compartment, the container
> > feedback is displayed. When the mouse is inside a compartment, the
> > compartment's selection fedback is displayed, fine. I would like to also
> > display the container's feedback when the mouse is in a compartment. So
> > I thought in showTargetFeedback(Request r) I just say
> > getHost().getParent().performRequest(r);. Unfortunately this does not
> > work. So I am saying
> >
> > (MyContainerHighlightEditPolicy) getHost().getParent().
> > getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE).
> > showTargetFeedback(request);
> >
> > But I can't imagine this is the way it is supposed to be. I rather like
> > the idea of saying "hey parent, handle that request here, too" instead
> > of saying "I know that my parent's SELCTION_FEEDBACK_ROLE Editpolicy is
> > a MyContainerHighlightEditPolicy and so I'll call showTargetFeedback on
> > it". Isn't that the performRequest() thing? What do I have to do to use
> > that? Or is it something completely different? TIA, Thomas.
>
> Ok, I took a look at some GEF source code. First, performRequest does
> not seem to be that "universal request multiplexer" I thought it is.
> Its default implementation is empty. Second, it seems that selection
> requests are a bit different. showTargetFeedback is called directly
> on the editpart. I guess this is because no Command is involved? So
> I guess (again) that the proper way of doing what I want is saying
>
> getHost().getParent().showTargetFeedback(request);
>
> because I saw that the default implementation forwards that to all the
> installed edit policies. Am I guessing right?
>
> --
> Thomas Maier <Thomas.Maier@uni-kassel.de>
|
|
|
Goto Forum:
Current Time: Thu Apr 25 04:25:54 GMT 2024
Powered by FUDForum. Page generated in 0.02977 seconds
|