Re: Fwd: Default values for a grid : concept erroneus ?
On Thu, 24 Nov 2011 08:17:55 -0200, Jose Luis Sanchez wrote: Well, struts 1.x, but since 2009 i'm using tap5.x Hehehe, I was right. :) So, what are your recomendations ? Which is the default/recommended Tapestry5 behaviour ? I always get the data before rendering In this case, I don't think there's a recommended behavior, as it won't make any difference in performance or memory usage. Just do what do you think it's more appropriate in each case. I usually only get data before rendering when it's used in more than one place. Anyway, you can use @Cached in the method and its result will be evaluated just once inside a request. -- 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Fwd: Default values for a grid : concept erroneus ?
Well, struts 1.x, but since 2009 i'm using tap5.x So, what are your recomendations ? Which is the default/recommended Tapestry5 behaviour ? I always get the data before rendering .. which WIKI/DOC do you recommend me to take a look at ? On Thu, 24 Nov 2011 07:27:42 -0200, Jose Luis Sanchez wrote: thanks .. that worked :) Are you a previous user of Struts, WebWork or some other request-oriented Web framework? Your previous code made me think that, as you got all data before rendering starts. Component-oriented frameworks like Tapestry, JSF and Wicket don't need that. :) -- *Jose Luis Sanchez* Senior Developer *E-mail*: joseluis.sanc...@m-centric.com *Phone* : +34 91 277 03 16 mCentric mobilising imagination c/ Jose Echegaray, 8 Building 3 28230 Las Rozas (Madrid). SPAIN. This message may contain confidential information or privileged material, and is intended only for the individual(s) named. If you are not in the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Fwd: Default values for a grid : concept erroneus ?
On Thu, 24 Nov 2011 07:27:42 -0200, Jose Luis Sanchez wrote: thanks .. that worked :) Are you a previous user of Struts, WebWork or some other request-oriented Web framework? Your previous code made me think that, as you got all data before rendering starts. Component-oriented frameworks like Tapestry, JSF and Wicket don't need that. :) -- 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Fwd: Default values for a grid : concept erroneus ?
thanks .. that worked :) Hi! Never persist search results: persist the parameters. ;) Besides that, I'd remove the transactions field and make the getTransactions() method look like this: public List getTransactions() { return (List) theSession.createCriteria(Transaction.class) .add(Restrictions.eq("msisdn", userInfo.getMsisdn())) .add(Restrictions.not(Restrictions.in("transactionType", INVALID_TRANSACTION_TYPES))) .add(Restrictions.ge("transactionDate", startDate(fromDate))) .add(Restrictions.le("transactionDate", endDate(toDate))) .add(Restrictions.ge("partitionDate", Integer.parseInt(tformatter.format(fromDate .add(Restrictions.le("partitionDate", Integer.parseInt(tformatter.format(toDate .addOrder(Order.asc("id")).list(); } -- *Jose Luis Sanchez* Senior Developer *E-mail*: joseluis.sanc...@m-centric.com *Phone* : +34 91 277 03 16 mCentric mobilising imagination c/ Jose Echegaray, 8 Building 3 28230 Las Rozas (Madrid). SPAIN. This message may contain confidential information or privileged material, and is intended only for the individual(s) named. If you are not in the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Fwd: Default values for a grid : concept erroneus ?
Hi! Never persist search results: persist the parameters. ;) Besides that, I'd remove the transactions field and make the getTransactions() method look like this: public List getTransactions() { return (List) theSession.createCriteria(Transaction.class) .add(Restrictions.eq("msisdn", userInfo.getMsisdn())) .add(Restrictions.not(Restrictions.in("transactionType", INVALID_TRANSACTION_TYPES))) .add(Restrictions.ge("transactionDate", startDate(fromDate))) .add(Restrictions.le("transactionDate", endDate(toDate))) .add(Restrictions.ge("partitionDate", Integer.parseInt(tformatter.format(fromDate .add(Restrictions.le("partitionDate", Integer.parseInt(tformatter.format(toDate .addOrder(Order.asc("id")).list(); } -- 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Fwd: Default values for a grid : concept erroneus ?
> >> El 23/11/11 20:06, Thiago H. de Paula Figueiredo escribió: >>> >>> Hi! >>> >>> Template and code please. :) Either way, instead of persisting search >>> results, I just fetch them in getTransactions(). >>> >> >> Well, this is the page .. no special about it >> >> >> >> >> >> >> >> >> >> > value="${message:search}"/> >> >> >> >> Transactions >> >> > t:exclude="id,msisdn,plan,errorCode, country" >> >> t:reorder="transactionDate,transactionType,planName,description,volumeUsed" >> t:rowClass="literal:transactionClass" >> t:rowsPerPage="10"> >> >> >> >> And this is the relevant java code ... >> >> @Property >> @Persist >> private List transactions; >> >> private static Integer [] INVALID_TRANSACTION_TYPES = {0,2,5,9,17,18,24}; >> >> @Property >> private TransactioncurrentTransaction; >> >> >> @Property >> @Validate("required") >> private Date fromDate; >> @Property >> private Date toDate; >> >> >> void onSuccess() { >> if (toDate==null) toDate = Calendar.getInstance().getTime(); >> theTransactions = (List) >> theSession.createCriteria(Transaction.class) >> .add(Restrictions.eq("msisdn", userInfo.getMsisdn())) >> .add(Restrictions.not(Restrictions.in("transactionType", >> INVALID_TRANSACTION_TYPES))) >> .add(Restrictions.ge("transactionDate", startDate(fromDate))) >> .add(Restrictions.le("transactionDate", endDate(toDate))) >> .add(Restrictions.ge("partitionDate", >> Integer.parseInt(tformatter.format(fromDate >> .add(Restrictions.le("partitionDate", >> Integer.parseInt(tformatter.format(toDate >> .addOrder(Order.asc("id")).list(); >> >> } >> >> As i told before, i've managed it using a GridDataSource .. but i'd like >> this to be clarified. >> >> Thanks thiago. >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and > instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate > http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org