Let see if this answer your question, in my example i have this Interface: [AjaxEventResponseListener] as root Event interface
Then i have 2 more specifics interfaces named: [MyHomePageEvent1] and [MyHomePageEvent2] Now i have 2 panels component: 1-> CounterPanel extends Panel implements MyHomePageEvent1 2-> MessagePanel extends Panel implements MyHomePageEvent2 And in finally in HomePage i added them and provide several link to test them: <code> add(new AjaxLink<Integer>("counterInc1") { @Override public void onClick(final AjaxRequestTarget target) { HomePage.this.updateCounter(); propagateAjaxEvent(MyHomePageEvent1.class, target); //Only CounterPanel get Updated } }); add(new AjaxLink<Integer>("counterInc2") { @Override public void onClick(final AjaxRequestTarget target) { HomePage.this.updateCounter(); propagateAjaxEvent(MyHomePageEvent2.class, target); // Only MessagePanel get Updated } }); add(new AjaxLink<Integer>("counterInc3") { @Override public void onClick(final AjaxRequestTarget target) { HomePage.this.updateCounter(); propagateAjaxEvent(AjaxEventResponseListener.class, target); // Both Panel get Updated } }); </code> Are we on the same page? On Wed, Aug 25, 2010 at 12:00 PM, James Carman [via Apache Wicket] < ml-node+2338371-595955556-65...@n4.nabble.com<ml-node%2b2338371-595955556-65...@n4.nabble.com> > wrote: > What if you have different event types that happen on a page? > > On Wed, Aug 25, 2010 at 10:47 AM, jcgarciam <[hidden > email]<http://user/SendEmail.jtp?type=node&node=2338371&i=0>> > wrote: > > > > > James, taking Igor example why not providing simple marking interfaces in > > > the Core and then something like this in the Page implementation, (i was > > thinking of the Dynamic Proxy approach you mention, but i'm not seeing > why > > it would be needed here since all you want is to propagate the Component > > re-rendering into the current AjaxRequestTarget) > > > > i.e: Defining a root Event named: AjaxEventResponseListener > > > > then defining a simple method in base page: > > > > > > protected void propagateAjaxEvent(Class<? extends > AjaxEventResponseListener> > > listener, final AjaxRequestTarget target) { > > getPage().visitChildren(listener, > > new IVisitor<Component>() { > > public Object component(Component component) { > > target.addComponent(component); > > return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; > > } > > }); > > } > > > > > > > > On Wed, Aug 25, 2010 at 11:08 AM, James Carman [via Apache Wicket] < > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=2338371&i=1><[hidden > email] <http://user/SendEmail.jtp?type=node&node=2338371&i=2>> > >> wrote: > > > >> There's an issue in trunk where they nail down the type parameter to > >> extend Component on the visitChildren() method. If you're looking for > >> a listener interface, that's not possible, because Component is a > >> class and your listener interface can't extend that. Why the > >> restriction? > >> > >> On Wed, Aug 25, 2010 at 9:35 AM, James Carman > >> <[hidden email] <http://user/SendEmail.jtp?type=node&node=2338298&i=0>> > > >> wrote: > >> > >> > So, submit a JIRA with a patch once you get it working. It would be > >> > good to have this on the Page class so that it's portable (no > >> > casting). > >> > > >> > On Wed, Aug 25, 2010 at 9:12 AM, jcgarciam <[hidden email]< > http://user/SendEmail.jtp?type=node&node=2338298&i=1>> > >> wrote: > >> >> > >> >> Thanks for expressing your help on this, im already working on it > :-), > >> since > >> >> is not that hard to implement, but i would like to see this kind of > >> >> functionality in the core . :) > >> >> > >> >> On Wed, Aug 25, 2010 at 10:09 AM, James Carman [via Apache Wicket] < > >> >> [hidden email] > >> >> <http://user/SendEmail.jtp?type=node&node=2338298&i=2><[hidden > > >> email] <http://user/SendEmail.jtp?type=node&node=2338298&i=3>> > >> >>> wrote: > >> >> > >> >>> Do you want an example of how it would work or are you confident in > >> >>> how to implement it yourself? > >> >>> > >> >>> On Wed, Aug 25, 2010 at 9:05 AM, jcgarciam <[hidden email]< > >> http://user/SendEmail.jtp?type=node&node=2338212&i=0>> > >> >>> wrote: > >> >>> > >> >>> > > >> >>> > Hi James, I like the idea of having a way of automatically > includes > >> >>> > components in the AjaxRequestTarget without the need to do it > >> explicitly > >> >>> > (target.add(..)), by using a Marking Interface and the Visitor, it > > >> really > >> >>> > >> >>> > would make things easier when you want to add a new component to > the > >> >>> current > >> >>> > Ajax Response. > >> >>> > > >> >>> > The idea of the DynamicProxy seems very promising and i thinks it > >> >>> something > >> >>> > way much better of having Pub/Sub event implementation. > >> >>> > > >> >>> > Just my +0.05 cents :) > >> >>> > > >> >>> > On Wed, Aug 25, 2010 at 9:11 AM, James Carman [via Apache Wicket] > < > >> >>> > [hidden email] < > http://user/SendEmail.jtp?type=node&node=2338212&i=1><[hidden > >> > >> >>> email] <http://user/SendEmail.jtp?type=node&node=2338212&i=2>> > >> >>> >> wrote: > >> >>> > > >> >>> >> What about if we modify this idea a bit? What if we use dynamic > >> >>> >> proxies to make it more generic? So, your onclick method would > look > >> > >> >>> >> like: > >> >>> >> > >> >>> >> public void onClick(AjaxRequestTarget target) { > >> >>> >> fire(MyCustomEventListener.class).someAjaxEvent(target); > >> >>> >> } > >> >>> >> > >> >>> >> Then, the fire() method would return an object (a dynamic proxy) > >> that > >> >>> >> implements the MyCustomEventListener interface. The method > >> >>> >> implementation would do the visitor thing by looking for all > >> >>> >> components implementing the MyCustomEventListener interface and > then > >> > >> >>> >> call the someAjaxEvent() method. > >> >>> >> > >> >>> >> On Wed, Aug 25, 2010 at 5:10 AM, vladimir.kovalyuk <[hidden > email]< > >> >>> http://user/SendEmail.jtp?type=node&node=2338119&i=0>> > >> >>> >> wrote: > >> >>> >> > >> >>> >> > > >> >>> >> > I don't like subscriptions implementation. Somewhen it becomes > >> >>> difficult > >> >>> >> to > >> >>> >> > realize when to add/remove observers. It depends on the order > of > >> >>> >> > instantiations. Visitor pattern seems to be much more reliable. > > >> >>> >> > -- > >> >>> >> > View this message in context: > >> >>> >> > >> >>> > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t>> > > >> < > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t&by-user=t>>> > > >> > >> >>> < > >> >>> > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t&by-user=t>> > > >> < > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2337874.html?by-user=t&by-user=t&by-user=t&by-user=t>>>> > > >> > >> >>> > >> >>> >> > Sent from the Wicket - User mailing list archive at Nabble.com. > > >> >>> >> > > >> >>> >> > > >> --------------------------------------------------------------------- > >> >>> >> > To unsubscribe, e-mail: [hidden email]< > >> >>> http://user/SendEmail.jtp?type=node&node=2338119&i=1> > >> >>> >> > For additional commands, e-mail: [hidden email]< > >> >>> http://user/SendEmail.jtp?type=node&node=2338119&i=2> > >> >>> >> > > >> >>> >> > > >> >>> >> > >> >>> >> > >> --------------------------------------------------------------------- > >> >>> >> To unsubscribe, e-mail: [hidden email]< > >> >>> http://user/SendEmail.jtp?type=node&node=2338119&i=3> > >> >>> >> For additional commands, e-mail: [hidden email]< > >> >>> http://user/SendEmail.jtp?type=node&node=2338119&i=4> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> ------------------------------ > >> >>> >> View message @ > >> >>> >> > >> >>> > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t&by-user=t>> > > >> < > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t&by-user=t&by-user=t>>> > > >> > >> >>> >> To unsubscribe from Apache Wicket, click here< > >> >>> > >> > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t&by-user=t>> > > >> < > >> > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t&by-user=t&by-user=t>>>>. > > >> > >> >>> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> > > >> >>> > > >> >>> > -- > >> >>> > Sincerely, > >> >>> > JC (http://www.linkedin.com/in/jcgarciam) > >> >>> > Work smarter, not harder!. > >> >>> > > >> >>> > -- > >> >>> > View this message in context: > >> >>> > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t&by-user=t>> > > >> < > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t&by-user=t&by-user=t>>> > > >> > >> >>> > >> >>> > Sent from the Wicket - User mailing list archive at Nabble.com. > >> >>> > > >> >>> > >> >>> > --------------------------------------------------------------------- > >> >>> To unsubscribe, e-mail: [hidden email]< > >> http://user/SendEmail.jtp?type=node&node=2338212&i=3> > >> >>> For additional commands, e-mail: [hidden email]< > >> http://user/SendEmail.jtp?type=node&node=2338212&i=4> > >> >>> > >> >>> > >> >>> > >> >>> ------------------------------ > >> >>> View message @ > >> >>> > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338212.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338212.html?by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338212.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338212.html?by-user=t&by-user=t>> > > >> >>> To unsubscribe from Apache Wicket, click here< > >> > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t&by-user=t>>>. > > >> > >> >>> > >> >>> > >> >>> > >> >> > >> >> > >> >> -- > >> >> Sincerely, > >> >> JC (http://www.linkedin.com/in/jcgarciam) > >> >> Work smarter, not harder!. > >> >> > >> >> -- > >> >> View this message in context: > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.html?by-user=t> > < > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.html?by-user=t&by-user=t>> > > >> >> Sent from the Wicket - User mailing list archive at Nabble.com. > >> >> > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [hidden email]< > http://user/SendEmail.jtp?type=node&node=2338298&i=4> > >> For additional commands, e-mail: [hidden email]< > http://user/SendEmail.jtp?type=node&node=2338298&i=5> > >> > >> > >> > >> ------------------------------ > >> View message @ > >> > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338298.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338298.html?by-user=t> > >> To unsubscribe from Apache Wicket, click here< > http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t>>. > > >> > >> > >> > > > > > > -- > > Sincerely, > > JC (http://www.linkedin.com/in/jcgarciam) > > Work smarter, not harder!. > > > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338354.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338354.html?by-user=t> > > > Sent from the Wicket - User mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2338371&i=3> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2338371&i=4> > > > > ------------------------------ > View message @ > http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338371.html > To unsubscribe from Apache Wicket, click > here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>. > > > -- Sincerely, JC (http://www.linkedin.com/in/jcgarciam) Work smarter, not harder!. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338394.html Sent from the Wicket - User mailing list archive at Nabble.com.