On Sun, Jun 15, 2008 at 1:57 PM, Martin Makundi <[EMAIL PROTECTED]> wrote: >> if you chain your models properly (make child's model depend on >> parent's model) this should work transparently. > > Say I have a Person with properties Person.country and Person.city. > Then I have a countryCombo = dropDown... and a cityCombo = > dropDown().. > > Now if I change the country, I must change the list of allowed values > for cityCombo. > > What is your idea of nice chaining?
http://wicketstuff.org/wicket13/ajax/choice > >> if the parent component repaints itself then all child components are >> repainted as well... > > They are not hierarchical in the DOM sense. I have: > countryCombo.add(onChangeAjaxBehavior() { > // .... > reloadCityCombo(); > ajaxRefreshCityCombo(); > } > > All this is manual repeating work... I would rather just have > hierarchicalUpdate.attachChangeListener(CITY); > hierarchicalUpdate.reload(CITY); > hierarchicalUpdate.ajaxRefresh(CITY, target); > > .. or something. Haven't quite wrapped up my idea yet, but I see a lot > of reload-refresh pattern happening which would suggest some > centralized functionality. My greatest oncern is when I have more than > two chained components, I sometimes get confused with the > chain-of-command and sometimes some elements forget to refresh. If I > had a hierarchicalUpdateManager or something, all I would need to do > is just to attach the child component into the proper node ("on a > global scale" instead of finding the proper line-of-code). interface statechangedlistener { protected void onstatechanged(ajaxrequesttarget t); } city.onupdate() { getpage().visitchildren(statechangedlistener.class) {...}} there is your basic listener support. then you just let your city dropdown implement statechangedlistener and do the right thing in onstatechanged() -igor > > ** > Martin > >>> Has someone found a generic eventlistener-like solution to this? >> >> there is a patch in jira for a generic event/listener mechanism, but >> it wont happen until 1.5 because it requires api breaks. >> >> -igor >> > > --------------------------------------------------------------------- > 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]