John,

It'd be news to me too!

BTW, you probably spotted the typo:
"(no setModel call)" should say "(no setModelObject call)".

Regards - Cemal http://www.jWeekend.co.uk 
http://jWeekend.co.uk 



John Krasnay wrote:
> 
> Cemal, I think you may be a closet Lisp programmer :-)
> 
> jk
> 
> On Thu, Aug 21, 2008 at 12:32:00PM -0700, jWeekend wrote:
>> 
>> Ritesh,
>> 
>> I wouldn't call it a bug because the model is updated, albeit indirectly,
>> but perhaps in a slightly inconsistent way as you've pointed out (no
>> setModel call), in the name of optimisation (ie reusing the existing
>> collection) and functional consistency (the implementation of the
>> collection
>> will not change after the programmer has set it (*)). 
>> 
>> This (slightly special) component may have been treated a little
>> differently
>> because it is not actually updated by any changes to its own
>> representation
>> in the browser (there is no browser widget representing it) but by
>> changes
>> to its child Checks. The main reason must be the fact that there is
>> already
>> a collection (so, just reuse it) in place before the else block is ever
>> exercised. This extra indirection is what is causing the dilemma. 
>> 
>> (*)You can also imagine scenarios where the collection is replaced on
>> every
>> update that cause problems because you may have used a special collection
>> implementation (the object your "whatever" variable refers to) that, for
>> example, logs all add/removes or notifies interested parties ... 
>> 
>> Regards - Cemal
>> http://www.jWeekend.co.uk  http://jWeekend.co.uk  
>> 
>> 
>> Ritesh Trivedi wrote:
>> > 
>> > Cemel,
>> > 
>> > Yes, it does make sense in that respect - as the original collection is
>> > modified. But the fact that setObject() method of the underlying model
>> is
>> > not called, when the object is set, is the problem I am referring to. I
>> > had overridden getObject() and setObject() of the adapter Model class
>> and
>> > was expecting that setObject be called - which I think would have been
>> > called if setModelObject(collection) was there in the else block. When
>> I
>> > get a chance I will modify the code to see if that is the case but for
>> now
>> > I have a work around.
>> > 
>> > Thanks for the response.
>> > 
>> > 
>> > jWeekend wrote:
>> >> 
>> >> Ritesh,
>> >> 
>> >> There is no need for the else block in the code you have included to
>> call
>> >> setModelObject as it will only be exercised if there is a collection
>> set
>> >> already.
>> >> 
>> >> Double check that somewhere in your code you are not explicitly or
>> >> implicitly setting the modelObject to null or setting the model to one
>> >> whose getObject returns null (and, of course, that your "whatever",
>> which
>> >> must be a Collection, is not null).
>> >> 
>> >> Regards - Cemal
>> >>  http://www.jWeekend.co.uk http://jWeekend.co.uk 
>> >> 
>> >> 
>> >> 
>> >> Ritesh Trivedi wrote:
>> >>> 
>> >>> Hi,
>> >>> 
>> >>> Is there a reason why CheckGroup.updateModel() does not call
>> >>> setModelObject()? If I create Checkgroup with the following 
>> >>> 
>> >>> CheckGroup myCheckGroup = new CheckGroup("id", new Model() { public
>> >>> Object getObject() { return whatever;}}); 
>> >>> 
>> >>> Later on - call to myCheckGroup.getModelObject() returns null ! 
>> >>> 
>> >>> Not sure if this is intended behavior - but its definitely strange.
>> >>> 
>> >>> 
>> >>> Here is an excerpt from CheckGroup.java - else block is not setting
>> the
>> >>> model object.
>> >>> 
>> >>> public void updateModel()
>> >>>  {
>> >>>          Collection collection = (Collection)getModelObject();
>> >>>          if (collection == null)
>> >>>          {
>> >>>                  collection = (Collection)getConvertedInput();
>> >>>                  setModelObject(collection);
>> >>>          }
>> >>>          else
>> >>>          {
>> >>>                  modelChanging();
>> >>>                  collection.clear();
>> >>>                  collection.addAll((Collection)getConvertedInput());
>> >>>                  modelChanged();
>> >>>          }
>> >>>  }
>> >>> 
>> >> 
>> >> 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/CheckGroup-updateModel%28%29-bug--tp19083157p19095333.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/CheckGroup-updateModel%28%29-bug--tp19083157p19095672.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]

Reply via email to