You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by manuelbarzi <ma...@gmail.com> on 2012/12/18 13:06:52 UTC
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: little refactor moving onPopulate() to populate(), and make first
called by second, and overridable?
Posted by manuelbarzi <ma...@gmail.com>.
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 <vi...@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 <ma...@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-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> regards,
>
> Vineet Semwal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: little refactor moving onPopulate() to populate(), and make first
called by second, and overridable?
Posted by vineet semwal <vi...@gmail.com>.
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 <ma...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
regards,
Vineet Semwal
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org