little refactor moving onPopulate() to populate(), and make first called by second, and overridable?
hi, i would appreciate having the choice to do something on DataView.onPopulate (at end of populating process), but cannot override this method (final at RefreshingView). i know i have the choice to compare Item.getIndex() to DataView.getItemsPerPage() to determine the end of populating process, but what about getting this execution point by refactoring a bit, so: AbstractRepeater { @Override protected void onBeforeRender() { // onPopulate(); not anymore... populate(); ... } // protected abstract void onPopulate(); not anymore... protected abstract void populate(); } RefreshingView { @Override protected final void populate() { ... // do same stuff... ... onPopulate(); } protected void onPopulate() { // not final anymore, and overridable to do something on populating process ends } } moreover, using the method name populate to exactly do that, populate, when onBeforeRender seems to be more semantic-precise; and then, the same onBeforeRender responds to beforeRender, onPopulate now would respond to populate. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: little refactor moving onPopulate() to populate(), and make first called by second, and overridable?
onpopulate() is called every time dataview/repeater is rendered,you can do the same thing after overriding onbeforerender, pseducode below new DataView(){ public void onbeforerender(){ super.onbeforerender(); //this will create/populate children too //now my code } } On Tue, Dec 18, 2012 at 5:36 PM, manuelbarzi manuelba...@gmail.com wrote: hi, i would appreciate having the choice to do something on DataView.onPopulate (at end of populating process), but cannot override this method (final at RefreshingView). i know i have the choice to compare Item.getIndex() to DataView.getItemsPerPage() to determine the end of populating process, but what about getting this execution point by refactoring a bit, so: AbstractRepeater { @Override protected void onBeforeRender() { // onPopulate(); not anymore... populate(); ... } // protected abstract void onPopulate(); not anymore... protected abstract void populate(); } RefreshingView { @Override protected final void populate() { ... // do same stuff... ... onPopulate(); } protected void onPopulate() { // not final anymore, and overridable to do something on populating process ends } } moreover, using the method name populate to exactly do that, populate, when onBeforeRender seems to be more semantic-precise; and then, the same onBeforeRender responds to beforeRender, onPopulate now would respond to populate. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: little refactor moving onPopulate() to populate(), and make first called by second, and overridable?
sure, vineet, there are other ways... know that. the question focus more on providing a bit+ intuitiveness to code, but this fact may result quite relative, that's all. thx, anyway. . On Tue, Dec 18, 2012 at 2:17 PM, vineet semwal vineetsemwa...@gmail.com wrote: onpopulate() is called every time dataview/repeater is rendered,you can do the same thing after overriding onbeforerender, pseducode below new DataView(){ public void onbeforerender(){ super.onbeforerender(); //this will create/populate children too //now my code } } On Tue, Dec 18, 2012 at 5:36 PM, manuelbarzi manuelba...@gmail.com wrote: hi, i would appreciate having the choice to do something on DataView.onPopulate (at end of populating process), but cannot override this method (final at RefreshingView). i know i have the choice to compare Item.getIndex() to DataView.getItemsPerPage() to determine the end of populating process, but what about getting this execution point by refactoring a bit, so: AbstractRepeater { @Override protected void onBeforeRender() { // onPopulate(); not anymore... populate(); ... } // protected abstract void onPopulate(); not anymore... protected abstract void populate(); } RefreshingView { @Override protected final void populate() { ... // do same stuff... ... onPopulate(); } protected void onPopulate() { // not final anymore, and overridable to do something on populating process ends } } moreover, using the method name populate to exactly do that, populate, when onBeforeRender seems to be more semantic-precise; and then, the same onBeforeRender responds to beforeRender, onPopulate now would respond to populate. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal - 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