On Wed, 24 Sep 2014 13:37:11 -0300, Daniel Jue <teamp...@gmail.com> wrote:

Your code works as is, but I still stuck it in a custom
MeaningfulBeanDisplay component in it's setupRender method, because I don't want to write this logic for every model for every POJO. Sometimes I'll
have 5-10 of these POJOs on one page.

You can still use BeanDisplay unchanged, put this logic inside a service and use it. I hope your MeaningfulBeanDisplay just wraps BeanDisplay, instead of copying and adapting its source.

A different solution would be to create a binding prefix to provide the BeanModel given the object and use something like <t:beandisplay object="object" model="mymodel:object"/>

From 5.4 on, you can completely replace a component by another automatically by contributing to the ComponentOverride service. Example:

@Contribute(ComponentReplacer.class)
public static void overrideBeanDisplay(MappedConfiguration<Class, Class> configuration) {
        configuration.add(BeanDisplay.class, MeaningfulBeanDisplay.class);
}

Great job Thiago, thank you thank you!

My pleasure! :)

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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

Reply via email to