I've overlooked the questions in the end . . .
On Fri, 08 Feb 2013 11:37:09 -0200, sommeralex
<alexander.som...@gmail.com> wrote:
*Q1*
Contributing value encoders to app module wont help, due to the reason
that the value encoders are not really dynamic in my case (e.g. if iam
creating a new attribute-family, i would need to add a value encoder
also for each
attribute family at runtime / but i guess this is not possible, is it?)
What you contribute to ValueEncoderSource is static in the sense that
you're automatically providing a ValueEncoderFactory (which provides
ValueEncoder instances) [1] for a given type (class). This is Java, so you
don't create types on-the-fly. And don't forget that you can use the
encoder parameter of Select to dynamically provide a ValueEncoder and
ValueEncoder implementations can be as dynamic as you want.
[1] It's quite common and valid to implement ValueEncoderFactory and
ValueEncoder in the same class and just return this in
ValueEncodeFactory.create() method.
*Q2*
What i understood so far is that the added value encoders to app module
will populate the option model somehow static so that the model itself
will be
only generated once
ValueEncoder does *not* populate OptionModels nor SelectModels.
ValueEncoder maps Strings to objects and objects to Strings. By the way,
you populate SelectModel, which is a list of options, not OptionModel,
which represents one of the options. *You* populate SelectModel directly
or using SelectModelFactory. I think you're confusing concepts and this is
preventing you to move forward.
/Well, in short, this design allows you to avoid storing (via @Persist,
@SessionAttribute or @SessionState) the entire (potentially large) list
of objects in the session or rebuilding the whole list of objects again
(though only one is needed) when the form is submitted. /
You don't need to rebuild the whole list of objects. You only need to
rebuild the selected object, something which is done by ValueEncoder.
I won't even answer the other questions because I think you should review
what OptionModel, SelectModel and ValueEncoder are. It does seem to me
that you have a wrong understanding of them.
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org