Re: Best practice for component interaction

2010-08-25 Thread jcgarciam

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-65...@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("counterInc1") {
>   public void onClick( AjaxRequestTarget target ) {
> updateCounter();
> fire(MyHomePageListener1.class).event1Happened(target);
>   }
> } );
> add(new AjaxLink("counterInc2") {
>   public void onClick(AjaxRequestTarget target ) {
> updateCounter();
> fire(MyHomePageListener2.class).event2Happened(target);
>   }
> } );
> add(new AjaxLink("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]>
> 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:
> >
> > 
> >
> >   add(new AjaxLink("counterInc1") {
> >  @Override
> > public void onClick(final AjaxRequestTarget target) {
> > HomePage.this.updateCounter();
> >  propagateAjaxEvent(MyHomePageEvent1.class, target);  //Only CounterPanel
>
> > get Updated
> > }
> >  });
> >  add(new AjaxLink("counterInc2") {
> >  @Override
> > public void onClick(final AjaxRequestTarget target) {
> > HomePage.this.updateCounter();
> >  propagateAjaxEvent(MyHomePageEvent2.class, target); // Only MessagePanel
>
> > get Updated
> > }
> >  });
> >  add(new AjaxLink("counterInc3") {
> >  @Override
> > public void onClick(final AjaxRequestTarget target) {
> > HomePage.this.updateCounter();
> >  propagateAjaxEvent(AjaxEventResponseListener.class, target); // Both
> Panel
> > get Updated
> > }
> >  });
> >
> > 
> >
> > Are we on the same page?
> >
> > On Wed, Aug 25, 2010 at 12:00 PM, James Carman [via Apache Wicket] <
> > [hidden email] 
> > <[hidden
> email] >
> >> 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 >> AjaxEventResponseListener>
> >> > listener, final AjaxRequestTarget target) {
> >> >  getPage().visitChildren(listener,
> >> > new IVisitor() {
> >> > 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] 
> >> > <[hidden
>
> >> email] >
> >> >> wrote:
> >> >
> >> >> There's an issue in trunk where they nail down the type parameter to
> >> >> extend Component o

Re: Best practice for component interaction

2010-08-25 Thread James Carman
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("counterInc1") {
  public void onClick( AjaxRequestTarget target ) {
updateCounter();
fire(MyHomePageListener1.class).event1Happened(target);
  }
} );
add(new AjaxLink("counterInc2") {
  public void onClick(AjaxRequestTarget target ) {
updateCounter();
fire(MyHomePageListener2.class).event2Happened(target);
  }
} );
add(new AjaxLink("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  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:
>
> 
>
>               add(new AjaxLink("counterInc1") {
> �...@override
> public void onClick(final AjaxRequestTarget target) {
> HomePage.this.updateCounter();
>  propagateAjaxEvent(MyHomePageEvent1.class, target);  //Only CounterPanel
> get Updated
> }
>  });
>  add(new AjaxLink("counterInc2") {
> �...@override
> public void onClick(final AjaxRequestTarget target) {
> HomePage.this.updateCounter();
>  propagateAjaxEvent(MyHomePageEvent2.class, target); // Only MessagePanel
> get Updated
> }
>  });
>  add(new AjaxLink("counterInc3") {
> �...@override
> public void onClick(final AjaxRequestTarget target) {
> HomePage.this.updateCounter();
>  propagateAjaxEvent(AjaxEventResponseListener.class, target); // Both Panel
> get Updated
> }
>  });
>
> 
>
> Are we on the same page?
>
> On Wed, Aug 25, 2010 at 12:00 PM, James Carman [via Apache Wicket] <
> ml-node+2338371-59596-65...@n4.nabble.com
>> wrote:
>
>> What if you have different event types that happen on a page?
>>
>> On Wed, Aug 25, 2010 at 10:47 AM, jcgarciam <[hidden 
>> email]>
>> 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> AjaxEventResponseListener>
>> > listener, final AjaxRequestTarget target) {
>> >  getPage().visitChildren(listener,
>> > new IVisitor() {
>> > 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] 
>> > <[hidden
>> email] >
>> >> 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] >
>>
>> >> 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] 
>> >> >> <[hidden
>>
>> >> email] >
>> >> >>> wrote:
>> >> >>
>> >> >>> Do

Re: Best practice for component interaction

2010-08-25 Thread jcgarciam

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:



   add(new AjaxLink("counterInc1") {
 @Override
public void onClick(final AjaxRequestTarget target) {
HomePage.this.updateCounter();
 propagateAjaxEvent(MyHomePageEvent1.class, target);  //Only CounterPanel
get Updated
}
 });
 add(new AjaxLink("counterInc2") {
 @Override
public void onClick(final AjaxRequestTarget target) {
HomePage.this.updateCounter();
 propagateAjaxEvent(MyHomePageEvent2.class, target); // Only MessagePanel
get Updated
}
 });
 add(new AjaxLink("counterInc3") {
 @Override
public void onClick(final AjaxRequestTarget target) {
HomePage.this.updateCounter();
 propagateAjaxEvent(AjaxEventResponseListener.class, target); // Both Panel
get Updated
}
 });



Are we on the same page?

On Wed, Aug 25, 2010 at 12:00 PM, James Carman [via Apache Wicket] <
ml-node+2338371-59596-65...@n4.nabble.com
> wrote:

> What if you have different event types that happen on a page?
>
> On Wed, Aug 25, 2010 at 10:47 AM, jcgarciam <[hidden 
> email]>
> 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 AjaxEventResponseListener>
> > listener, final AjaxRequestTarget target) {
> >  getPage().visitChildren(listener,
> > new IVisitor() {
> > 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] 
> > <[hidden
> email] >
> >> 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] >
>
> >> 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] 
> >> >> <[hidden
>
> >> email] >
> >> >>> 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] 

Re: Best practice for component interaction

2010-08-25 Thread James Carman
What if you have different event types that happen on a page?

On Wed, Aug 25, 2010 at 10:47 AM, jcgarciam  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
> listener, final AjaxRequestTarget target) {
>  getPage().visitChildren(listener,
> new IVisitor() {
> 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-65...@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] >
>> 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]>
>> 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] 
>> >> <[hidden
>> email] >
>> >>> 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] 
>> >>> > <[hidden
>>
>> >>> email] >
>> >>> >> 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

Re: Best practice for component interaction

2010-08-25 Thread jcgarciam

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-65...@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]>
> 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] 
> > <[hidden
> email] >
> >> 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] 
> >> > <[hidden
>
> >> email] >
> >> >> 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

Re: Best practice for component interaction

2010-08-25 Thread jcgarciam

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
listener, final AjaxRequestTarget target) {
 getPage().visitChildren(listener,
new IVisitor() {
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-65...@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] >
> 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]>
> 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] 
> >> <[hidden
> email] >
> >>> 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] 
> >>> > <[hidden
>
> >>> email] >
> >>> >> 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

Re: Best practice for component interaction

2010-08-25 Thread Igor Vaynberg
already done

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

-igor

On Wed, Aug 25, 2010 at 6:12 AM, jcgarciam  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-65...@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]>
>> 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] 
>> > <[hidden
>> email] >
>> >> 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: [h

Re: Best practice for component interaction

2010-08-25 Thread James Carman
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
 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  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-65...@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]>
>>> 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] 
>>> > <[hidden
>>> email] >
>>> >> 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

Re: Best practice for component interaction

2010-08-25 Thread James Carman
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  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-65...@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]>
>> 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] 
>> > <[hidden
>> email] >
>> >> 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

2010-08-25 Thread jcgarciam

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-65...@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]>
> 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] 
> > <[hidden
> email] >
> >> 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: [hidden 
> email]
> For additional commands, e-mail: [hidden 
> email]
>
>
>
> --
>  View message @
> http

Re: Best practice for component interaction

2010-08-25 Thread MattyDE

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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practice for component interaction

2010-08-25 Thread James Carman
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  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-65...@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]>
>> 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: [hidden 
>> > email]
>> > For additional commands, e-mail: [hidden 
>> > email]
>> >
>> >
>>
>> -
>> To unsubscribe, e-mail: [hidden 
>> email]
>> For additional commands, e-mail: [hidden 
>> email]
>>
>>
>>
>> --
>>  View message @
>> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html
>> To unsubscribe from Apache Wicket, click 
>> here.
>>
>>
>>
>
>
> --
> 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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practice for component interaction

2010-08-25 Thread jcgarciam

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-65...@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]>
> 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: [hidden 
> > email]
> > For additional commands, e-mail: [hidden 
> > email]
> >
> >
>
> -
> To unsubscribe, e-mail: [hidden 
> email]
> For additional commands, e-mail: [hidden 
> email]
>
>
>
> --
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Best-practice-for-component-interaction-tp2336888p2338119.html
> To unsubscribe from Apache Wicket, click 
> here.
>
>
>


-- 
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

2010-08-25 Thread Bilgin Ibryam
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.peterm...@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-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Best practice for component interaction

2010-08-25 Thread James Carman
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  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-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Best practice for component interaction

2010-08-25 Thread vladimir.kovalyuk

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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practice for component interaction

2010-08-25 Thread Patrick Petermair

Igor Vaynberg schrieb:

onclick(final AjaxRequestTarget target) {
   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
IVisitor () {
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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practice for component interaction

2010-08-24 Thread Igor Vaynberg
anything way to identify components that subscribe to a topic works.

-igor

On Tue, Aug 24, 2010 at 10:30 AM, James Carman
 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  
> wrote:
>> onclick(final AjaxRequestTarget target) {
>>   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
>> IVisitor () {
>>        Object visit(CaresAboutMyAjaxEent object) {
>>           object.onMyAjaxEvent(target);
>>         }}}
>>
>> -igor
>>
>> On Tue, Aug 24, 2010 at 10:19 AM, James Carman
>>  wrote:
>>> What do you mean?  What would the visitor look for?
>>>
>>> On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg  
>>> 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
  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  
> 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
>>  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-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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

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



Re: Best practice for component interaction

2010-08-24 Thread James Carman
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  wrote:
> onclick(final AjaxRequestTarget target) {
>   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
> IVisitor () {
>        Object visit(CaresAboutMyAjaxEent object) {
>           object.onMyAjaxEvent(target);
>         }}}
>
> -igor
>
> On Tue, Aug 24, 2010 at 10:19 AM, James Carman
>  wrote:
>> What do you mean?  What would the visitor look for?
>>
>> On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg  
>> 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
>>>  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  
 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
>  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-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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

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



Re: Best practice for component interaction

2010-08-24 Thread Igor Vaynberg
onclick(final AjaxRequestTarget target) {
   getPage().visitChildren(CaresAboutMyAjaxEvent.class, new
IVisitor () {
Object visit(CaresAboutMyAjaxEent object) {
   object.onMyAjaxEvent(target);
 }}}

-igor

On Tue, Aug 24, 2010 at 10:19 AM, James Carman
 wrote:
> What do you mean?  What would the visitor look for?
>
> On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg  
> 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
>>  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  
>>> 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
  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-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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

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



Re: Best practice for component interaction

2010-08-24 Thread James Carman
What do you mean?  What would the visitor look for?

On Tue, Aug 24, 2010 at 1:12 PM, Igor Vaynberg  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
>  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  
>> 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
>>>  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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


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

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



Re: Best practice for component interaction

2010-08-24 Thread Igor Vaynberg
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
 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  
> 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
>>  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-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Best practice for component interaction

2010-08-24 Thread James Carman
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  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
>  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-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Best practice for component interaction

2010-08-24 Thread Igor Vaynberg
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
 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-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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