You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by danielepiras <da...@tiscali.it> on 2008/06/12 10:22:13 UTC

Modify model value before rendering

Hi,

I've an object with a boolean properties. I have mapped this object with a
wicket's label using a PropertyModel.
All work's fine but I read in the label true/false. Instead of this value, I
want to see another message (for example "User enabled" and "User not
enabled". How can I do that?

Thank you very much for any help..
Daniele
-- 
View this message in context: http://www.nabble.com/Modify-model-value-before-rendering-tp17794855p17794855.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Modify model value before rendering

Posted by richardwilko <ri...@gmail.com>.
something like this might work (untested)

PropertyModel pm = new PropertyModel(this,""){
			@Override
			public Object getObject()
			{
				return (Boolean) super.getObject() ? "User enabled" : "User not
enabled";
			}
		};





danielepiras wrote:
> 
> Hi,
> 
> I've an object with a boolean properties. I have mapped this object with a
> wicket's label using a PropertyModel.
> All work's fine but I read in the label true/false. Instead of this value,
> I want to see another message (for example "User enabled" and "User not
> enabled". How can I do that?
> 
> Thank you very much for any help..
> Daniele
> 

-- 
View this message in context: http://www.nabble.com/Modify-model-value-before-rendering-tp17794855p17795114.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Modify model value before rendering

Posted by Igor Vaynberg <ig...@gmail.com>.
or just write your own model in an inner class...

-igor

On Thu, Jun 12, 2008 at 1:45 AM, Martijn Dashorst
<ma...@gmail.com> wrote:
> Either use a converter or create an adapter model that takes the
> propertymodel and retrieves the nested model object, and returns the
> appropriate string.
>
> Martijn
>
> On Thu, Jun 12, 2008 at 10:22 AM, danielepiras
> <da...@tiscali.it> wrote:
>>
>> Hi,
>>
>> I've an object with a boolean properties. I have mapped this object with a
>> wicket's label using a PropertyModel.
>> All work's fine but I read in the label true/false. Instead of this value, I
>> want to see another message (for example "User enabled" and "User not
>> enabled". How can I do that?
>>
>> Thank you very much for any help..
>> Daniele
>> --
>> View this message in context: http://www.nabble.com/Modify-model-value-before-rendering-tp17794855p17794855.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>
> ---------------------------------------------------------------------
> 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: Modify model value before rendering

Posted by Martijn Dashorst <ma...@gmail.com>.
Either use a converter or create an adapter model that takes the
propertymodel and retrieves the nested model object, and returns the
appropriate string.

Martijn

On Thu, Jun 12, 2008 at 10:22 AM, danielepiras
<da...@tiscali.it> wrote:
>
> Hi,
>
> I've an object with a boolean properties. I have mapped this object with a
> wicket's label using a PropertyModel.
> All work's fine but I read in the label true/false. Instead of this value, I
> want to see another message (for example "User enabled" and "User not
> enabled". How can I do that?
>
> Thank you very much for any help..
> Daniele
> --
> View this message in context: http://www.nabble.com/Modify-model-value-before-rendering-tp17794855p17794855.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org