That's true, there's another interface, PrimaryKeyEncoder, that is also useful.

Generally, a ValueEncoder that fails will return null.  That null will
be picked up by the validators (say, the Required validator).  So
there is notification.

To me its two seperate use cases; the user will not be typing primary
keys in, those will be stored in hidden fields or elsewhere (i.e.
URLs).  They may not be valid (the underlying record may have been
deleted) ... or they may not be up-to date (there may have been a
conflicting update).  Both of those are cases to be handled by the
application, not by Tapestry, because no one solution is appropriate
to all applications.

On Sun, Mar 30, 2008 at 5:50 PM, Yura Tkachenko
<[EMAIL PROTECTED]> wrote:
> Well in JSF Convertors is a part of validation logic and they are provide a
>  way to notify application that conversion was unsuccessful. In Tapestry I
>  see Translator is almost the same as Converter in JSF. Using Translator I
>  can notify my application that conversion was unsuccessful. I've been
>  looking at
>  
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/ValueEncoder.htmland
>  I didn't find any way in ValueEncoder how I can throw any conversion
>  exception. Maybe someone can provide some more examples how ValueEncoder can
>  be used?
>
>
>
>  On Sun, Mar 30, 2008 at 2:08 PM, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
>
>  > Actually, this looks closer to the ValueEncoder interface.  For
>  > example, the tapestry-hibernate module includes ValueEncoders to
>  > convert between Hibernate entities and their primary keys (as
>  > strings).  The ValueEncoderSource interface is useful here, since it
>  > allows components that need a ValueEncoder to obtain one based on the
>  > type of property bound to their value parameter, automatically.
>  >
>  > On Sun, Mar 30, 2008 at 1:14 PM, Yura Tkachenko
>  > <[EMAIL PROTECTED]> wrote:
>  > > Thank you.
>  > >
>  > >
>  > >
>  > >  On 3/30/08, Thiago HP <[EMAIL PROTECTED]> wrote:
>  > >  >
>  > >  > On 3/30/08, Yura Tkachenko <[EMAIL PROTECTED]> wrote:
>  > >  > >  Does Tapestry 5 have something like converters?
>  > >  >
>  > >  > Yes. Take a look at the Translator interfade
>  > >  > (
>  > >  >
>  > 
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Translator.html
>  > >  > )
>  > >  > and the translate parameter of the TextField component
>  > >  > (
>  > >  >
>  > 
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/TextField.html
>  > >  > )
>  > >  > and other related ones.
>  > >  >
>  > >  > --
>  > >  > Thiago
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > >  > For additional commands, e-mail: [EMAIL PROTECTED]
>  > >  >
>  > >  >
>  > >
>  >
>  >
>  >
>  > --
>  > Howard M. Lewis Ship
>  >
>  > Creator Apache Tapestry and Apache HiveMind
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to