Tapestry just supports a ValueEncoder for String and Enum. If you want 
additional
encoders you have to implement them yourself:

class LongValueEncoder implements ValueEncoder<Long>
{
        public String toClient(Long value)
        {
                return value == null ? "" : value.toString();
        }

        public Long toValue(String clientValue)
        {
                try
                {
                        return new Long(clientValue);
                }
                catch (NumberFormatException e)
                {
                        return null;
                }
        }
}

To use the encoder either add them to your AppModule:

    public static void contributeValueEncoderSource(
            MappedConfiguration<Class, ValueEncoderFactory> configuration)
    {
        configuration.add(Long.class, new 
GenericValueEncoderFactory<Long>(new LongValueEncoder()));
    } 

or add the encoder directly to your RadioGroup (or Select) components (see 

http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html)

See:
http://issues.apache.org/jira/browse/TAPESTRY-1598

-- 
Chris

Reply via email to