PS. :)

1) There's an easier way to do this than what I said in my last e-mail. :) A 
ComponentAction is executed in the order in which it is stored.  The problem 
here is that you're storing it in the SetupRender phase, which is before the 
form components store their actions for updating the values.  So change just 
the render phase method from setupRender to afterRender and you should be set.

2)I was thinking about other ways to do this. You might be able to write a 
custom binding that understands your conventions.

Eg: <t:checkbox value="yourbinding:object.newsletter;0;1"/> Now yourbinding can 
extrapolate the information that you need directly from the objects without 
resorting to custom ComponentAcions all over the place. 


Robert

On Aug 23, 2011, at 8/233:23 AM , Jens Breitenstein wrote:

> Hi Robert (and all others),
> 
> sorry to bother you, but
> 
> I implemented a ComponentAction and use FormSupport as you suggested it. And 
> it's near to what I need :-)
> Unfortunately the "execute" method is called before tapestry updates the 
> property thus I see the orginal value not the new one?
> Any idea how to solve the last piece of the puzzle?
> 
> Jens
> 
> 
> 
> ...
>    @Property(write = false)        // ---->> test to see when tapestry 
> reflects changes
>    private boolean _weeklyNewsletter;
> 
>    @Component(id = "weeklyNewsletter", parameters = 
> {"value=weeklyNewsletter"})
>    private Checkbox _weeklyNewsletterCheckbox;
> 
> 
>    @Environmental
>    private FormSupport _formSupport;
> 
>    private static class NewsletterComponentAction implements 
> ComponentAction<Newsletter>
>    {
>        // ---->> called but properties not set yet
>        public void execute(final Newsletter c)
>        {
>            c._userAccount.setNewsLetter("" + (c._dailyNewsletter ? "1" : "0")
>                                              + (c._weeklyNewsletter ? "1" : 
> "0") + (c._monthlyNewsletter ? "1" : "0"));
>        }
>    }
> 
>    public void setupRender()
>    {
> ...
>        _formSupport.store(this, new NewsletterComponentAction());
>    }
> 
>    // ---->> this method is called after execute?
>    public void setWeeklyNewsletter(final boolean b)
>    {
>        _weeklyNewsletter = b;
>    }
> ....
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to