Thanks Thiago,

we were trying to avoid rebuilding the beanModelSource on each render, because 
it is backed by a large dataset. We have modified your suggestion as  shown 
below. Is this the best technique to persist this value like we have here, 
instead of constantly creating?

    @Persist
    private BeanModel beanModel;

    @Inject
    private Messages messages;
        
        public BeanModel getBeanModel() {
                //setup the model for this user
                if (beanModel == null) {
                        
beanModel=beanModelSource.createDisplayModel(License.class, messages);
                        beanModel.include("entered","endDate");
                        
beanModel.add("purchase.orgUnit.name").label("Organization");
                        beanModel.add("purchase.product.name").label("Product");
                        
beanModel.add("purchase.licenseType.name").label("License");
                        
                        //sorting
                        if (_grid.getSortModel().getSortConstraints().isEmpty() 
) {
                                _grid.getSortModel().updateSort("entered");
                                //this is still not exposed in tapestry 5.2 so 
you can't change order
                                //_grid.setSortAscending(false);
                    }
                }
                return beanModel;
        }


On Aug 12, 2010, at 1:46 PM, Thiago wrote:

> Hi!
> 
> Try this:
> 
>       public BeanModel getBeanModel() {
>               beanModel=beanModelSource.createDisplayModel(License.class, 
> messages);
>               beanModel.include("entered","endDate");
>               beanModel.add("purchase.orgUnit.name").label("Organization");
>               beanModel.add("purchase.product.name").label("Product");
>               beanModel.add("purchase.licenseType.name").label("License");
>               
>               //sorting
>               if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
>                       logger.warn("sort constraints");
>                       _grid.getSortModel().updateSort("entered");
>                       //this is still not exposed in tapestry 5.2 so you 
> can't change order
>                       //_grid.setSortAscending(false);
>           }
>       }
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br

_____________________
Darren Williams
LiveTime Software Inc.
http://www.livetime.com
(949) 777 5800



Reply via email to