I did as you said, and have the unit tests, and read the wiki on chaining
models... something still isn't clicking though.  BTW, I have Wicket in
action and it is fantastic, perhaps there is still something elduing me
though...  I still can't wrap my head around why that property model doesn't
update in the first case you show me.  If the property model is calling that
object, and doing a get description each time it's called it's own
getObject() method, why doesn't changing the reference externally work?

If you simply point me to a page number and tell me to read until I
understand, I would be greatful!

Thanks again!
Justin


Martijn Dashorst wrote:
> 
> No defensive copying happening. Just your plain old references
> updating. Read the models page on the wiki about chaining models.
> 
> Put this in a unit test case:
> 
> State s = new State();
> s.setDescription("I haven't read Wicket in Action but hear it helps
> solve these questions");
> PropertyModel pm = new PropertyModel(s, "description");
> assertEquals("I haven't read Wicket in Action but hear it helps solve
> these questions", pm.getObject());
> 
> s = new State();
> s.setDescription("I'll buy Wicket in Action, just because I now get
> why my property model doesn't know this new state yet.");
> assertEquals("I'll buy Wicket in Action, just because I now get why my
> property model doesn't know this new state yet.", pm.getObject());
> 
> This is basically what you are doing in your panel.
> 
> but if you did:
> State s = new State("Foo");
> Model m = new Model();
> m.setObject(s);
> PropertyModel pm = new PropertyModel(m, "description");
> assertEquals("Foo", pm.getObject());
> 
> and now for the coup de grace:
> 
> s = new State("Bar");
> m.setObject(s);
> assertEquals("Bar", pm.getObject());
> 
> Martijn
> 
> On Fri, Oct 24, 2008 at 3:57 PM, walnutmon <[EMAIL PROTECTED]>
> wrote:
>>
>> I have two panels, a view panel where you can look for news and an edit
>> panel.  The edit panel has a reference to a "news" object and all of it's
>> form elements have property models that use that object.
>>
>> When I pass a news object into the panel on creation all of the form
>> elements fill as expected.  However, if I set that object through a
>> setter
>> in the panel class, the elements do not update.  My theory (which may be
>> wrong) is that the property model makes a defensive copy and therefore is
>> not linked to the object in the class.  If this is true, can I resend the
>> object to the property model?
>>
>> If that's not true, any insight as to what I may be doing wrong?
>> --
>> View this message in context:
>> http://www.nabble.com/Forcing-property-models-to-update-tp20150693p20150693.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]
>>
>>
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Forcing-property-models-to-update-tp20150693p20216529.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