You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Patrick Petermair <pa...@openforce.com> on 2010/08/24 17:37:43 UTC

Best practice for component interaction

Hi!

Let's say I have a page with 2 panels. CalendarPanel shows a simple 
calendar, FormPanel a basic form. Whenever the user clicks on a date in 
the calendar, the textfield of the form should show the selected date.

What is the best practice for this kind of interaction?
Right now we hold a reference to the FormPanel in CalendarPanel and 
attach our custom CalendarAjaxBehavior to it. Whenever the 
CalendarAjaxBehavior gets a request / click, it updates the FormPanel's 
model directly.

I don't really know if this is some ugly hack or if there is a better 
way of different panels to update / communicate with each other - other 
than holding references to one another...

Cheers,
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by Bilgin Ibryam <bi...@gmail.com>.
Not sure about the best practice, but instead of passing a reference I use
getParent or getPage methods, then find the target component by its id.

Bilgin

On Tue, Aug 24, 2010 at 4:37 PM, Patrick Petermair <
patrick.petermair@openforce.com> wrote:

> Hi!
>
> Let's say I have a page with 2 panels. CalendarPanel shows a simple
> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
> calendar, the textfield of the form should show the selected date.
>
> What is the best practice for this kind of interaction?
> Right now we hold a reference to the FormPanel in CalendarPanel and attach
> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
> gets a request / click, it updates the FormPanel's model directly.
>
> I don't really know if this is some ugly hack or if there is a better way
> of different panels to update / communicate with each other - other than
> holding references to one another...
>
> Cheers,
> Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Best practice for component interaction

Posted by MattyDE <uf...@gmail.com>.
Share your genius with us ;)

For serious: I'am really looking forward to see and example implementation!
:)
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338213.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by jcgarciam <jc...@gmail.com>.
I guess we are targeting different things here,

a) You want to control on each Interfaces implementation what component
should be added by passing the [target] around

b) I want to just add the component automatically to the ajax response if it
just implement the Event Interface, imagine a Very rich component UI and
where a lots of component get added to the AjaxTarget, and later you need to
add another component for what ever reason. After that you need to go an
manually push the component to the target, i would just let the component
implement the market interfaces and get re-render automatically.

Thanks for sharing your thoughts.


On Wed, Aug 25, 2010 at 12:27 PM, James Carman [via Apache Wicket] <
ml-node+2338421-1360946432-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Not exactly.  Here's how I would implement your example
>
> 1.  You'd have three interfaces AjaxEventListener,
> MyHomePageListener1, MyHomePageListener2.
> 2.  Then you'd have the panels that implement the interfaces.
> 3.  Then, in your home page, you'd do:
>
> add(new AjaxLink<Integer>("counterInc1") {
>   public void onClick( AjaxRequestTarget target ) {
>     updateCounter();
>     fire(MyHomePageListener1.class).event1Happened(target);
>   }
> } );
> add(new AjaxLink<Integer>("counterInc2") {
>   public void onClick(AjaxRequestTarget target ) {
>     updateCounter();
>     fire(MyHomePageListener2.class).event2Happened(target);
>   }
> } );
> add(new AjaxLink<Integer>("counterInc3") {
>   public void onClick(AjaxRequestTarget target ) {
>     updateCounter();
>     fire(AjaxEventListener.class).onAjaxEvent(target);
>   }
> } );
>
> I wouldn't use "marker" interfaces.  I'd use real listener interfaces
> with method names that reflect what the event is.  It makes the code
> more readable.
>
> On Wed, Aug 25, 2010 at 11:09 AM, jcgarciam <[hidden email]<http://user/SendEmail.jtp?type=node&node=2338421&i=0>>
> wrote:
>
> >
> > 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] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=2338421&i=1><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=2338421&i=2>>
> >> 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>>>>
>
> >>
> >> >>
> >> >> >>> <
> >> >> >>>
> >> >>
> >>
> 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>>>
>
> >>
> >> >> <
> >> >>
> >>
> 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>>
>
> >> <
> >>
> 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>
> <
> 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<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&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>>>
>
> >>
> >> >> <
> >> >>
> >>
> 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>>
>
> >> <
> >>
> 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>
> <
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html?by-user=t&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&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>>>
>
> >>
> >> >> <
> >> >>
> >>
> 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>>
>
> >> <
> >>
> 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>
> <
> 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<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&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>>>
>
> >>
> >> >> <
> >> >>
> >>
> 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>>
>
> >> <
> >>
> 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>
> <
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.html?by-user=t&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&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>>
>
> >> <
> >>
> 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>
> <
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338212.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338212.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-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>>
>
> >> <
> >>
> 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>
> <
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.html?by-user=t&by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.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=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>
> <
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338298.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338298.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-tp2336888p2338354.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338354.html?by-user=t>
> <
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338354.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338354.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=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<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338371.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-tp2336888p2338394.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338394.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=2338421&i=3>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2338421&i=4>
>
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338421.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-tp2336888p2338503.html
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
Not exactly.  Here's how I would implement your example

1.  You'd have three interfaces AjaxEventListener,
MyHomePageListener1, MyHomePageListener2.
2.  Then you'd have the panels that implement the interfaces.
3.  Then, in your home page, you'd do:

add(new AjaxLink<Integer>("counterInc1") {
  public void onClick( AjaxRequestTarget target ) {
    updateCounter();
    fire(MyHomePageListener1.class).event1Happened(target);
  }
} );
add(new AjaxLink<Integer>("counterInc2") {
  public void onClick(AjaxRequestTarget target ) {
    updateCounter();
    fire(MyHomePageListener2.class).event2Happened(target);
  }
} );
add(new AjaxLink<Integer>("counterInc3") {
  public void onClick(AjaxRequestTarget target ) {
    updateCounter();
    fire(AjaxEventListener.class).onAjaxEvent(target);
  }
} );

I wouldn't use "marker" interfaces.  I'd use real listener interfaces
with method names that reflect what the event is.  It makes the code
more readable.

On Wed, Aug 25, 2010 at 11:09 AM, jcgarciam <jc...@gmail.com> wrote:
>
> 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-65838@n4.nabble.com<ml...@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.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by jcgarciam <jc...@gmail.com>.
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-65838@n4.nabble.com<ml...@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.

Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
What if you have different event types that happen on a page?

On Wed, Aug 25, 2010 at 10:47 AM, jcgarciam <jc...@gmail.com> 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] <
> ml-node+2338298-400135988-65838@n4.nabble.com<ml...@n4.nabble.com>
>> 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>>>
>>
>> >>>
>> >>> >> > 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>>
>>
>> >>> >> 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-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>>
>>
>> >>>
>> >>> > 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>
>> >>> 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-tp2336888p2338215.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.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=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
>> 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-tp2336888p2338354.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by jcgarciam <jc...@gmail.com>.
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] <
ml-node+2338298-400135988-65838@n4.nabble.com<ml...@n4.nabble.com>
> 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>>>
>
> >>>
> >>> >> > 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>>
>
> >>> >> 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-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>>
>
> >>>
> >>> > 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>
> >>> 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-tp2336888p2338215.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.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=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
> 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-tp2336888p2338354.html
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
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
<ja...@carmanconsulting.com> 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 <jc...@gmail.com> 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] <
>> ml-node+2338212-617428318-65838@n4.nabble.com<ml...@n4.nabble.com>
>>> 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>>
>>>
>>> >> > 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>
>>> >> 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-tp2336888p2338205.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.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=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
>>> 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-tp2336888p2338215.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
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 <jc...@gmail.com> 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] <
> ml-node+2338212-617428318-65838@n4.nabble.com<ml...@n4.nabble.com>
>> 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>>
>>
>> >> > 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>
>> >> 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-tp2336888p2338205.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.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=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
>> 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-tp2336888p2338215.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by jcgarciam <jc...@gmail.com>.
Thanks Igor, i will review that Item.

On Wed, Aug 25, 2010 at 11:46 AM, Igor Vaynberg-2 [via Apache Wicket] <
ml-node+2338351-880928828-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> already done
>
> https://issues.apache.org/jira/browse/WICKET-1312
>
> -igor
>
> On Wed, Aug 25, 2010 at 6:12 AM, jcgarciam <[hidden email]<http://user/SendEmail.jtp?type=node&node=2338351&i=0>>
> 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=2338351&i=1><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=2338351&i=2>>
> >> 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>>>
>
> >>
> >> >> > 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>>
>
> >> >> 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-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>>
>
> >>
> >> > 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>
> >> 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-tp2336888p2338215.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338215.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=2338351&i=3>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2338351&i=4>
>
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338351.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-tp2336888p2338355.html
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: Best practice for component interaction

Posted by Igor Vaynberg <ig...@gmail.com>.
already done

https://issues.apache.org/jira/browse/WICKET-1312

-igor

On Wed, Aug 25, 2010 at 6:12 AM, jcgarciam <jc...@gmail.com> 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] <
> ml-node+2338212-617428318-65838@n4.nabble.com<ml...@n4.nabble.com>
>> 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>>
>>
>> >> > 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>
>> >> 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-tp2336888p2338205.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.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=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
>> 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-tp2336888p2338215.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by jcgarciam <jc...@gmail.com>.
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] <
ml-node+2338212-617428318-65838@n4.nabble.com<ml...@n4.nabble.com>
> 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>>
>
> >> > 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>
> >> 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-tp2336888p2338205.html<http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338205.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=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
> 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-tp2336888p2338215.html
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
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 <jc...@gmail.com> 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] <
> ml-node+2338119-2003757039-65838@n4.nabble.com<ml...@n4.nabble.com>
>> 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>
>> > 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
>> 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-tp2336888p2338205.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by jcgarciam <jc...@gmail.com>.
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] <
ml-node+2338119-2003757039-65838@n4.nabble.com<ml...@n4.nabble.com>
> 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>
> > 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
> 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-tp2336888p2338205.html
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
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 <ko...@gmail.com> 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
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by "vladimir.kovalyuk" <ko...@gmail.com>.
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
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by Patrick Petermair <pa...@openforce.com>.
Igor Vaynberg schrieb:
> onclick(final AjaxRequestTarget target) {
>    getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
> IVisitor<CaresAboutMyAjaxEvent> () {
>         Object visit(CaresAboutMyAjaxEent object) {
>            object.onMyAjaxEvent(target);
>          }}}
> 

Interesting.
A colleague also found the following blogpost:
http://techblog.molindo.at/2008/09/wicket-loose-coupling-of-componens-for-ajax-updates.html

Cheers,
Patrick



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by Igor Vaynberg <ig...@gmail.com>.
anything way to identify components that subscribe to a topic works.

-igor

On Tue, Aug 24, 2010 at 10:30 AM, James Carman
<ja...@carmanconsulting.com> wrote:
> So, you're saying you'd introduce an interface that you'd have all of
> the components implement if they're interested in a certain event.
> Interesting.  What about just using a metadata key?
>
> On Tue, Aug 24, 2010 at 1:24 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>> onclick(final AjaxRequestTarget target) {
>>   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
>> IVisitor<CaresAboutMyAjaxEvent> () {
>>        Object visit(CaresAboutMyAjaxEent object) {
>>           object.onMyAjaxEvent(target);
>>         }}}
>>
>> -igor
>>
>> On Tue, Aug 24, 2010 at 10:19 AM, James Carman
>> <ja...@carmanconsulting.com> wrote:
>>> What do you mean?  What would the visitor look for?
>>>
>>> On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>>>> you can accomplish it using a simple visitor. 1.5 has a more
>>>> formalized approach for managing events between components.
>>>>
>>>> -igor
>>>>
>>>> On Tue, Aug 24, 2010 at 10:07 AM, James Carman
>>>> <ja...@carmanconsulting.com> wrote:
>>>>> Yes, but how do you make sure all the components that need to be
>>>>> updated via ajax are updated?  They can point to the same model, but
>>>>> if they're not added to the AjaxRequestTarget, then they won't be
>>>>> updated when their values change.  You'd need some sort of event
>>>>> listener I would think (unless you want to pass around references to
>>>>> the components that need updating).
>>>>>
>>>>> On Tue, Aug 24, 2010 at 12:56 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>>>>>> usually this kind of linkage is created by pointing both the calendar
>>>>>> and the textfield to the same model object, like a property of a
>>>>>> common parent, etc.
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
>>>>>> <pa...@openforce.com> wrote:
>>>>>>> Hi!
>>>>>>>
>>>>>>> Let's say I have a page with 2 panels. CalendarPanel shows a simple
>>>>>>> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
>>>>>>> calendar, the textfield of the form should show the selected date.
>>>>>>>
>>>>>>> What is the best practice for this kind of interaction?
>>>>>>> Right now we hold a reference to the FormPanel in CalendarPanel and attach
>>>>>>> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
>>>>>>> gets a request / click, it updates the FormPanel's model directly.
>>>>>>>
>>>>>>> I don't really know if this is some ugly hack or if there is a better way of
>>>>>>> different panels to update / communicate with each other - other than
>>>>>>> holding references to one another...
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Patrick
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
So, you're saying you'd introduce an interface that you'd have all of
the components implement if they're interested in a certain event.
Interesting.  What about just using a metadata key?

On Tue, Aug 24, 2010 at 1:24 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> onclick(final AjaxRequestTarget target) {
>   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
> IVisitor<CaresAboutMyAjaxEvent> () {
>        Object visit(CaresAboutMyAjaxEent object) {
>           object.onMyAjaxEvent(target);
>         }}}
>
> -igor
>
> On Tue, Aug 24, 2010 at 10:19 AM, James Carman
> <ja...@carmanconsulting.com> wrote:
>> What do you mean?  What would the visitor look for?
>>
>> On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>>> you can accomplish it using a simple visitor. 1.5 has a more
>>> formalized approach for managing events between components.
>>>
>>> -igor
>>>
>>> On Tue, Aug 24, 2010 at 10:07 AM, James Carman
>>> <ja...@carmanconsulting.com> wrote:
>>>> Yes, but how do you make sure all the components that need to be
>>>> updated via ajax are updated?  They can point to the same model, but
>>>> if they're not added to the AjaxRequestTarget, then they won't be
>>>> updated when their values change.  You'd need some sort of event
>>>> listener I would think (unless you want to pass around references to
>>>> the components that need updating).
>>>>
>>>> On Tue, Aug 24, 2010 at 12:56 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>>>>> usually this kind of linkage is created by pointing both the calendar
>>>>> and the textfield to the same model object, like a property of a
>>>>> common parent, etc.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
>>>>> <pa...@openforce.com> wrote:
>>>>>> Hi!
>>>>>>
>>>>>> Let's say I have a page with 2 panels. CalendarPanel shows a simple
>>>>>> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
>>>>>> calendar, the textfield of the form should show the selected date.
>>>>>>
>>>>>> What is the best practice for this kind of interaction?
>>>>>> Right now we hold a reference to the FormPanel in CalendarPanel and attach
>>>>>> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
>>>>>> gets a request / click, it updates the FormPanel's model directly.
>>>>>>
>>>>>> I don't really know if this is some ugly hack or if there is a better way of
>>>>>> different panels to update / communicate with each other - other than
>>>>>> holding references to one another...
>>>>>>
>>>>>> Cheers,
>>>>>> Patrick
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by Igor Vaynberg <ig...@gmail.com>.
onclick(final AjaxRequestTarget target) {
   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
IVisitor<CaresAboutMyAjaxEvent> () {
        Object visit(CaresAboutMyAjaxEent object) {
           object.onMyAjaxEvent(target);
         }}}

-igor

On Tue, Aug 24, 2010 at 10:19 AM, James Carman
<ja...@carmanconsulting.com> wrote:
> What do you mean?  What would the visitor look for?
>
> On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>> you can accomplish it using a simple visitor. 1.5 has a more
>> formalized approach for managing events between components.
>>
>> -igor
>>
>> On Tue, Aug 24, 2010 at 10:07 AM, James Carman
>> <ja...@carmanconsulting.com> wrote:
>>> Yes, but how do you make sure all the components that need to be
>>> updated via ajax are updated?  They can point to the same model, but
>>> if they're not added to the AjaxRequestTarget, then they won't be
>>> updated when their values change.  You'd need some sort of event
>>> listener I would think (unless you want to pass around references to
>>> the components that need updating).
>>>
>>> On Tue, Aug 24, 2010 at 12:56 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>>>> usually this kind of linkage is created by pointing both the calendar
>>>> and the textfield to the same model object, like a property of a
>>>> common parent, etc.
>>>>
>>>> -igor
>>>>
>>>> On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
>>>> <pa...@openforce.com> wrote:
>>>>> Hi!
>>>>>
>>>>> Let's say I have a page with 2 panels. CalendarPanel shows a simple
>>>>> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
>>>>> calendar, the textfield of the form should show the selected date.
>>>>>
>>>>> What is the best practice for this kind of interaction?
>>>>> Right now we hold a reference to the FormPanel in CalendarPanel and attach
>>>>> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
>>>>> gets a request / click, it updates the FormPanel's model directly.
>>>>>
>>>>> I don't really know if this is some ugly hack or if there is a better way of
>>>>> different panels to update / communicate with each other - other than
>>>>> holding references to one another...
>>>>>
>>>>> Cheers,
>>>>> Patrick
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
What do you mean?  What would the visitor look for?

On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> you can accomplish it using a simple visitor. 1.5 has a more
> formalized approach for managing events between components.
>
> -igor
>
> On Tue, Aug 24, 2010 at 10:07 AM, James Carman
> <ja...@carmanconsulting.com> wrote:
>> Yes, but how do you make sure all the components that need to be
>> updated via ajax are updated?  They can point to the same model, but
>> if they're not added to the AjaxRequestTarget, then they won't be
>> updated when their values change.  You'd need some sort of event
>> listener I would think (unless you want to pass around references to
>> the components that need updating).
>>
>> On Tue, Aug 24, 2010 at 12:56 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>>> usually this kind of linkage is created by pointing both the calendar
>>> and the textfield to the same model object, like a property of a
>>> common parent, etc.
>>>
>>> -igor
>>>
>>> On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
>>> <pa...@openforce.com> wrote:
>>>> Hi!
>>>>
>>>> Let's say I have a page with 2 panels. CalendarPanel shows a simple
>>>> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
>>>> calendar, the textfield of the form should show the selected date.
>>>>
>>>> What is the best practice for this kind of interaction?
>>>> Right now we hold a reference to the FormPanel in CalendarPanel and attach
>>>> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
>>>> gets a request / click, it updates the FormPanel's model directly.
>>>>
>>>> I don't really know if this is some ugly hack or if there is a better way of
>>>> different panels to update / communicate with each other - other than
>>>> holding references to one another...
>>>>
>>>> Cheers,
>>>> Patrick
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by Igor Vaynberg <ig...@gmail.com>.
you can accomplish it using a simple visitor. 1.5 has a more
formalized approach for managing events between components.

-igor

On Tue, Aug 24, 2010 at 10:07 AM, James Carman
<ja...@carmanconsulting.com> wrote:
> Yes, but how do you make sure all the components that need to be
> updated via ajax are updated?  They can point to the same model, but
> if they're not added to the AjaxRequestTarget, then they won't be
> updated when their values change.  You'd need some sort of event
> listener I would think (unless you want to pass around references to
> the components that need updating).
>
> On Tue, Aug 24, 2010 at 12:56 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>> usually this kind of linkage is created by pointing both the calendar
>> and the textfield to the same model object, like a property of a
>> common parent, etc.
>>
>> -igor
>>
>> On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
>> <pa...@openforce.com> wrote:
>>> Hi!
>>>
>>> Let's say I have a page with 2 panels. CalendarPanel shows a simple
>>> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
>>> calendar, the textfield of the form should show the selected date.
>>>
>>> What is the best practice for this kind of interaction?
>>> Right now we hold a reference to the FormPanel in CalendarPanel and attach
>>> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
>>> gets a request / click, it updates the FormPanel's model directly.
>>>
>>> I don't really know if this is some ugly hack or if there is a better way of
>>> different panels to update / communicate with each other - other than
>>> holding references to one another...
>>>
>>> Cheers,
>>> Patrick
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by James Carman <ja...@carmanconsulting.com>.
Yes, but how do you make sure all the components that need to be
updated via ajax are updated?  They can point to the same model, but
if they're not added to the AjaxRequestTarget, then they won't be
updated when their values change.  You'd need some sort of event
listener I would think (unless you want to pass around references to
the components that need updating).

On Tue, Aug 24, 2010 at 12:56 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> usually this kind of linkage is created by pointing both the calendar
> and the textfield to the same model object, like a property of a
> common parent, etc.
>
> -igor
>
> On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
> <pa...@openforce.com> wrote:
>> Hi!
>>
>> Let's say I have a page with 2 panels. CalendarPanel shows a simple
>> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
>> calendar, the textfield of the form should show the selected date.
>>
>> What is the best practice for this kind of interaction?
>> Right now we hold a reference to the FormPanel in CalendarPanel and attach
>> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
>> gets a request / click, it updates the FormPanel's model directly.
>>
>> I don't really know if this is some ugly hack or if there is a better way of
>> different panels to update / communicate with each other - other than
>> holding references to one another...
>>
>> Cheers,
>> Patrick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice for component interaction

Posted by Igor Vaynberg <ig...@gmail.com>.
usually this kind of linkage is created by pointing both the calendar
and the textfield to the same model object, like a property of a
common parent, etc.

-igor

On Tue, Aug 24, 2010 at 8:37 AM, Patrick Petermair
<pa...@openforce.com> wrote:
> Hi!
>
> Let's say I have a page with 2 panels. CalendarPanel shows a simple
> calendar, FormPanel a basic form. Whenever the user clicks on a date in the
> calendar, the textfield of the form should show the selected date.
>
> What is the best practice for this kind of interaction?
> Right now we hold a reference to the FormPanel in CalendarPanel and attach
> our custom CalendarAjaxBehavior to it. Whenever the CalendarAjaxBehavior
> gets a request / click, it updates the FormPanel's model directly.
>
> I don't really know if this is some ugly hack or if there is a better way of
> different panels to update / communicate with each other - other than
> holding references to one another...
>
> Cheers,
> Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org