thanks, but the code following get something wrong like that:

wrappedModel.getObject();
//The method getObject(Component) in the type IModel is not applicable for the 
arguments ()
wrappedModel.setObject(value);
//The method setObject(Component, Object) in the type IModel is not applicable 
for the arguments 
 (Boolean)
I am a fresh, thanks for instruction.


> Date: Tue, 15 Jan 2008 07:59:27 +0100
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: how to convert wicket-CheckBox's Boolean Type to Character Type!
> 
> I did something similar, converting a boolean radio to the Dutch words "Ja"
> and "Nee" (yes / no).
> This is the code:
> 
> public class JaNeeToBooleanConverterModel extends Model {
> 
>     private IModel wrappedModel;
> 
>     public JaNeeToBooleanConverterModel(IModel model) {
>         wrappedModel = model;
>     }
> 
>     @Override
>     public Object getObject() {
>         Boolean b = (Boolean)wrappedModel.getObject();
>         return b.booleanValue() ? "Ja" : "Nee";
>     }
> 
>     @Override
>     public void setObject(Object object) {
>         Boolean value = "Ja".equals(object) ? Boolean.TRUE : Boolean.FALSE;
>         wrappedModel.setObject(value);
>     }
> }
> 
> 2008/1/15, Mead Lai <[EMAIL PROTECTED]>:
> >
> >
> > Hi, Well,I am use MySql, and there is no boolean type in mysql database.
> > so I use Char(1) in the database, and in html I use CheckBox.but CheckBox
> > only contain Boolean type.
> > How to solve this problem? Use IConverter interface? Thanks
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today it's FREE!
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
> 
> 
> -- 
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> [EMAIL PROTECTED]
> +31 (0)6 18 47 25 29

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Reply via email to