Re: Good wicket patterns
dont think so see also FormComponentPanel doc On Sun, May 11, 2008 at 3:30 PM, gurgel2 <[EMAIL PROTECTED]> wrote: > > Correct. I hade a formcomponent hierarchy within a formcomponent > hierrarchy. > Sort of a search/criteriea panel. So i wanted to post the search panel and > not the form as a whole. It was like > > 1. search using some criterias in the search component > 2. select stuff from what the search yielded > 3. supply some other form input > 4. post the form. > > ...so I hade to manually call validate and updateModel on all > formcomponents > in the search panel in order to issue the search. So, the search button (as > opposed to the form submit button), had to issue that partial > validate/updateModel work using visitors. Could it have been done better? > > > > Johan Compagner wrote: > > > > About point 1, there you mean that yoiu have formcomponents inside a > > formcomponent like formcomponent panel? > > We dont go further there because that is the responsibility of the > > parent, the childs could be standalone nothing. And only concatted it > > is valid > > > > On 5/9/08, gurgel2 <[EMAIL PROTECTED]> wrote: > >> > >> After some 6 months of wicket ive come accross some wierd scenarios > >> > >> Go'ol request/response > >> > >> 1. Sub FormComponent hierarchies that needed to be manually visited to > >> have > >> thier vaidate and updateModel called. It was a criteria/search "panel" > >> that > >> supplied a form with data. Just a bit awkward to create those visitors > in > >> the middle of the code. Should I have done that with a nested Form? > >> > >> 2. Where should you keep your models? Should a big Component hierarcy > >> have > >> one big model with its parts extracted and passed on to child > components? > >> Analogy - repeaters (lists of object renditions/Label(...,obj.toString) > >> take > >> lists-of-objects. Or, is more advisable to keep a component's model > >> contained within itself? I have yet to find a good practice here. > >> > >> Ajax > >> > >> 3. Now im working with more Ajax. What is a good inter component > >> communication scheme? Swing has its listeners, but in wicket i tend to > >> call > >> methods on dependent components from ajax event handlers. Is this a good > >> approach - (it atleast dont feel so good)? > >> > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Good-wicket-patterns-tp17139005p17139005.html > >> Sent from the Wicket - User mailing list archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: > http://www.nabble.com/Good-wicket-patterns-tp17139005p17170544.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Good wicket patterns
Correct. I hade a formcomponent hierarchy within a formcomponent hierrarchy. Sort of a search/criteriea panel. So i wanted to post the search panel and not the form as a whole. It was like 1. search using some criterias in the search component 2. select stuff from what the search yielded 3. supply some other form input 4. post the form. ...so I hade to manually call validate and updateModel on all formcomponents in the search panel in order to issue the search. So, the search button (as opposed to the form submit button), had to issue that partial validate/updateModel work using visitors. Could it have been done better? Johan Compagner wrote: > > About point 1, there you mean that yoiu have formcomponents inside a > formcomponent like formcomponent panel? > We dont go further there because that is the responsibility of the > parent, the childs could be standalone nothing. And only concatted it > is valid > > On 5/9/08, gurgel2 <[EMAIL PROTECTED]> wrote: >> >> After some 6 months of wicket ive come accross some wierd scenarios >> >> Go'ol request/response >> >> 1. Sub FormComponent hierarchies that needed to be manually visited to >> have >> thier vaidate and updateModel called. It was a criteria/search "panel" >> that >> supplied a form with data. Just a bit awkward to create those visitors in >> the middle of the code. Should I have done that with a nested Form? >> >> 2. Where should you keep your models? Should a big Component hierarcy >> have >> one big model with its parts extracted and passed on to child components? >> Analogy - repeaters (lists of object renditions/Label(...,obj.toString) >> take >> lists-of-objects. Or, is more advisable to keep a component's model >> contained within itself? I have yet to find a good practice here. >> >> Ajax >> >> 3. Now im working with more Ajax. What is a good inter component >> communication scheme? Swing has its listeners, but in wicket i tend to >> call >> methods on dependent components from ajax event handlers. Is this a good >> approach - (it atleast dont feel so good)? >> >> >> -- >> View this message in context: >> http://www.nabble.com/Good-wicket-patterns-tp17139005p17139005.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Good-wicket-patterns-tp17139005p17170544.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Good wicket patterns
About point 1, there you mean that yoiu have formcomponents inside a formcomponent like formcomponent panel? We dont go further there because that is the responsibility of the parent, the childs could be standalone nothing. And only concatted it is valid On 5/9/08, gurgel2 <[EMAIL PROTECTED]> wrote: > > After some 6 months of wicket ive come accross some wierd scenarios > > Go'ol request/response > > 1. Sub FormComponent hierarchies that needed to be manually visited to have > thier vaidate and updateModel called. It was a criteria/search "panel" that > supplied a form with data. Just a bit awkward to create those visitors in > the middle of the code. Should I have done that with a nested Form? > > 2. Where should you keep your models? Should a big Component hierarcy have > one big model with its parts extracted and passed on to child components? > Analogy - repeaters (lists of object renditions/Label(...,obj.toString) take > lists-of-objects. Or, is more advisable to keep a component's model > contained within itself? I have yet to find a good practice here. > > Ajax > > 3. Now im working with more Ajax. What is a good inter component > communication scheme? Swing has its listeners, but in wicket i tend to call > methods on dependent components from ajax event handlers. Is this a good > approach - (it atleast dont feel so good)? > > > -- > View this message in context: > http://www.nabble.com/Good-wicket-patterns-tp17139005p17139005.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Good wicket patterns
Thanx guys... really good answers/feedback there. /Kalle Frank van Lankvelt wrote: > > You could have a look at the "broadcaster" that is discussed in > https://issues.apache.org/jira/browse/WICKET-1312 > > The solution that is proposed there uses a visitor instead of > registration. That has the advantage that you don't have to > _unregister_ at the appropriate time. Because Wicket does not have > lifecycle management of components you would have to do this by hand. > Of course, if your components are never replaced, this is not an issue. > > cheers, Frank > > On Thu, 2008-05-08 at 18:15 -0700, Scott Swank wrote: >> e.g. >> >> public class AjaxEvent >> { >> private Set listeners = new HashSet(); >> >> public void register(Component listener) >> { >> listeners.add(listener); >> } >> >> public void fire(AjaxRequestTarget request) >> { >> for (Component listener : listeners) >> request.addComponent(listener); >> } >> } >> >> On Thu, May 8, 2008 at 6:07 PM, Scott Swank <[EMAIL PROTECTED]> >> wrote: >> > > Ajax >> > > >> > > 3. Now im working with more Ajax. What is a good inter component >> > > communication scheme? Swing has its listeners, but in wicket i tend >> to call >> > > methods on dependent components from ajax event handlers. Is this a >> good >> > > approach - (it atleast dont feel so good)? >> > >> > I try to have my components just be a view of their model. Then it's >> > just a matter of setting the model(s) appropriately and refreshing the >> > components. >> > >> > Alternately, create a AjaxEvent class that you subclass to represent >> > each of the actions in which you're interested. Put a collection of >> > those on your Page. Then have allow each component to register itself >> > as a listener of an event. Then an ajax call would result in >> > SomeAjaxEvent.fire(AjaxTargetRequest) and that would in turn call >> > addComponent() for each registered listener component. >> > >> > - Scott >> > >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > -- > - > Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 > San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA > 94952-3329 +1 (707) 773-4646 > - > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Good-wicket-patterns-tp17139005p17148622.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Good wicket patterns
You could have a look at the "broadcaster" that is discussed in https://issues.apache.org/jira/browse/WICKET-1312 The solution that is proposed there uses a visitor instead of registration. That has the advantage that you don't have to _unregister_ at the appropriate time. Because Wicket does not have lifecycle management of components you would have to do this by hand. Of course, if your components are never replaced, this is not an issue. cheers, Frank On Thu, 2008-05-08 at 18:15 -0700, Scott Swank wrote: > e.g. > > public class AjaxEvent > { > private Set listeners = new HashSet(); > > public void register(Component listener) > { > listeners.add(listener); > } > > public void fire(AjaxRequestTarget request) > { > for (Component listener : listeners) > request.addComponent(listener); > } > } > > On Thu, May 8, 2008 at 6:07 PM, Scott Swank <[EMAIL PROTECTED]> wrote: > > > Ajax > > > > > > 3. Now im working with more Ajax. What is a good inter component > > > communication scheme? Swing has its listeners, but in wicket i tend to > > call > > > methods on dependent components from ajax event handlers. Is this a good > > > approach - (it atleast dont feel so good)? > > > > I try to have my components just be a view of their model. Then it's > > just a matter of setting the model(s) appropriately and refreshing the > > components. > > > > Alternately, create a AjaxEvent class that you subclass to represent > > each of the actions in which you're interested. Put a collection of > > those on your Page. Then have allow each component to register itself > > as a listener of an event. Then an ajax call would result in > > SomeAjaxEvent.fire(AjaxTargetRequest) and that would in turn call > > addComponent() for each registered listener component. > > > > - Scott > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- - Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 94952-3329 +1 (707) 773-4646 - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Good wicket patterns
e.g. public class AjaxEvent { private Set listeners = new HashSet(); public void register(Component listener) { listeners.add(listener); } public void fire(AjaxRequestTarget request) { for (Component listener : listeners) request.addComponent(listener); } } On Thu, May 8, 2008 at 6:07 PM, Scott Swank <[EMAIL PROTECTED]> wrote: > > Ajax > > > > 3. Now im working with more Ajax. What is a good inter component > > communication scheme? Swing has its listeners, but in wicket i tend to > call > > methods on dependent components from ajax event handlers. Is this a good > > approach - (it atleast dont feel so good)? > > I try to have my components just be a view of their model. Then it's > just a matter of setting the model(s) appropriately and refreshing the > components. > > Alternately, create a AjaxEvent class that you subclass to represent > each of the actions in which you're interested. Put a collection of > those on your Page. Then have allow each component to register itself > as a listener of an event. Then an ajax call would result in > SomeAjaxEvent.fire(AjaxTargetRequest) and that would in turn call > addComponent() for each registered listener component. > > - Scott > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Good wicket patterns
> Ajax > > 3. Now im working with more Ajax. What is a good inter component > communication scheme? Swing has its listeners, but in wicket i tend to call > methods on dependent components from ajax event handlers. Is this a good > approach - (it atleast dont feel so good)? I try to have my components just be a view of their model. Then it's just a matter of setting the model(s) appropriately and refreshing the components. Alternately, create a AjaxEvent class that you subclass to represent each of the actions in which you're interested. Put a collection of those on your Page. Then have allow each component to register itself as a listener of an event. Then an ajax call would result in SomeAjaxEvent.fire(AjaxTargetRequest) and that would in turn call addComponent() for each registered listener component. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]