Newbie Question, Very Basic Model Use

2008-10-06 Thread walnutmon

After using property models, it's nice to have automatic binding to variables
in objects... However, I can't seem to get the same thing to work with local
variables... as an example...

new CheckBox(toggleSomething, new PropertyModel(someObject,
toggleableProperty));
works beautifully...

However, 
new CheckBox(toggleSomething, new Model(toggleableObject));
//toggleableObject is a Boolean

doesn't seem to change anything on form submit, that toggleable object only
dictates the initial state of the checkbox, but doesn't change with it
What am I missing?

-- 
View this message in context: 
http://www.nabble.com/Newbie-Question%2C-Very-Basic-Model-Use-tp19837933p19837933.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]



Re: Newbie Question, Very Basic Model Use

2008-10-06 Thread Serkan Camurcuoglu
Model assigns a new object as the model object, and I think 
java.lang.Boolean is immutable so it can't change after it's constructed 
anyway. So instead of checking the value of toggleableObject I think you 
can check myCheckbox.getModelObject() == Boolean.TRUE etc..




Ryan Gravener wrote:

If you would like the property model to work with local variables do
new propertymodel(this,property)

On 10/6/08, walnutmon [EMAIL PROTECTED] wrote:
  

After using property models, it's nice to have automatic binding to
variables
in objects... However, I can't seem to get the same thing to work with local
variables... as an example...

new CheckBox(toggleSomething, new PropertyModel(someObject,
toggleableProperty));
works beautifully...

However,
new CheckBox(toggleSomething, new Model(toggleableObject));
//toggleableObject is a Boolean

doesn't seem to change anything on form submit, that toggleable object only
dictates the initial state of the checkbox, but doesn't change with it
What am I missing?

--
View this message in context:
http://www.nabble.com/Newbie-Question%2C-Very-Basic-Model-Use-tp19837933p19837933.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]



Re: Newbie Question, Very Basic Model Use

2008-10-06 Thread Ryan Gravener
If you would like the property model to work with local variables do
new propertymodel(this,property)

On 10/6/08, walnutmon [EMAIL PROTECTED] wrote:

 After using property models, it's nice to have automatic binding to
 variables
 in objects... However, I can't seem to get the same thing to work with local
 variables... as an example...

 new CheckBox(toggleSomething, new PropertyModel(someObject,
 toggleableProperty));
 works beautifully...

 However,
 new CheckBox(toggleSomething, new Model(toggleableObject));
 //toggleableObject is a Boolean

 doesn't seem to change anything on form submit, that toggleable object only
 dictates the initial state of the checkbox, but doesn't change with it
 What am I missing?

 --
 View this message in context:
 http://www.nabble.com/Newbie-Question%2C-Very-Basic-Model-Use-tp19837933p19837933.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]




-- 
Ryan Gravener
http://twitter.com/ryangravener

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Newbie Question, Very Basic Model Use

2008-10-06 Thread Martijn Dashorst
see the models page on the wiki and read the javadoc for CompoundPropertyModel

Martijn

On Mon, Oct 6, 2008 at 3:26 PM, walnutmon [EMAIL PROTECTED] wrote:

 After using property models, it's nice to have automatic binding to variables
 in objects... However, I can't seem to get the same thing to work with local
 variables... as an example...

 new CheckBox(toggleSomething, new PropertyModel(someObject,
 toggleableProperty));
 works beautifully...

 However,
 new CheckBox(toggleSomething, new Model(toggleableObject));
 //toggleableObject is a Boolean

 doesn't seem to change anything on form submit, that toggleable object only
 dictates the initial state of the checkbox, but doesn't change with it
 What am I missing?

 --
 View this message in context: 
 http://www.nabble.com/Newbie-Question%2C-Very-Basic-Model-Use-tp19837933p19837933.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]