You can't do it using SelectModelFactory unless you'll create some kind of wrapper for Boolean. Try to create SelectModel manually:

        List<OptionModel> tardies = new ArrayList<OptionModel>();
        tardies.add(new OptionModelImpl("Y", true));
        tardies.add(new OptionModelImpl("N", false));

        new SelectModelImpl(null, tardies);

P.S. You don't need encoder for boolean.

19.09.2013 17:40, George Christman пишет:
I'm using a standard select menu nested within a loop. The boolean values
come from my hibernate entity. I took a look at the enumSelectModel, I'm
just not sure how to get it to work with my entity.

.tml

       <t:Loop source="fields" value="field" encoder="encoder">
         <div class="col-xs-15">
             <div>
                 <t:Select value="field.propertyValue"
clientId="${field.propertyName}" model="selectModel"
blankOption="literal:never" encoder="encoderSelect"/>
             </div>
         </div>
     </t:Loop>

.java

     @Property
     private FieldEntity field;

     @Prroperty
     private List<FieldEntity>  fields;

     @Inject
     private SelectModelFactory selectModelFactory

     public SelectModel getSelectModel() {
         List<Boolean>  tardies = new ArrayList<Boolean>();
         tardies.add(true);
         tardies.add(false);
         return this.selectModelFactory.create(tardies);
     }

     public ValueEncoder getEncoderSelect() {
         return new ValueEncoder<Boolean>() {
             public String toClient(Boolean value) {
                 return value.toString();
             }
             public Boolean toValue(String clientValue) {
                 return "true".equals(clientValue) ? true : false;
             }
         };
     }


FieldEntity.class

     @NonVisual
     private boolean tsTardy01;
     @NonVisual
     private boolean tsTardy02;
     @NonVisual
     private boolean tsTardy03;
     @NonVisual
     private boolean tsTardy04;


On Thu, Sep 19, 2013 at 9:03 AM, Eugen<[email protected]>  wrote:

Hi,
which select model are You using?
if You use an EnumSelectModel the client side caption is build as follow:
Enum.class.getSimpleName()+"."+Enum.name()


2013/9/19 George Christman<[email protected]>:
Hello, I'm wondering if anybody knows how to rename the options in a
select
menu using .properties or some other method. I currently have true false
in
the menu and that needs to be changed to Y N.

Thanks,
George
---------------------------------------------------------------------
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]

Reply via email to