Indeed. Hence the JIRA.
Howard has mentioned the possibility of merging the two type coercion systems.
Cheers,
Nick.
Todd Orr wrote:
Thanks for the info. I'll add that to my component. However, it seems
odd that a simple conversion from Long to String isn't built in. It
seems to me that such standard conversions should be part of the
framework.
On 8/14/07, Christian Koeberl <[EMAIL PROTECTED]> wrote:
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
---------------------------------------------------------------------
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]