Reuse Edit/Create for Query by Example
Search is next step from the following thread whereby an UPDATE form may be REUSED to ADD a database record: http://tapestry.1045711.n5.nabble.com/Reuse-Edit-Create-td5643323.html The same form should do Query By Example (QBE) supported as by Hibernate: http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch17.html#querycriteria-examples So the same exact form is now used to ADD, UPDATE or QBE. For the sake of completeness, here is EditPerson from http://tapestry.apache.org/hibernate-user-guide.html modified for dual service as Edit/Create public class EditPerson { @Inject private Session session; @PageActivationContext @Property private Person person; @InjectPage private Persons persons; void onActivate(Person person) { this.person = person; } Object onPassivate() { return person; } @CommitAfter Object onSuccess() { session.saveOrUpdate(person); return persons; } } Persons.java is simply doing listing public class Persons { @Property private Person person; @Inject private Session session; public ListPerson getPersons() { return session.createCriteria(Person.class).list(); } } Corresponding tmls are: EditPerson: t:beaneditform object=person / Persons: t:grid source=persons / which are inserted between the usual html t:type=layout title=Persons xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd; xmlns:p=tapestry:parameter /html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reuse-Edit-Create-for-Query-by-Example-tp5655916p5655916.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reuse Edit/Create for Query by Example
To do QBE, I would simply modify the getPersons method in Persons.java public ListPerson getPersons() { return session.createCriteria(Person.class).add( Example.create(person) ).list(); } This would use the person property to list persons list. Of course, I would check for person=nulls etc to protect the above and list all if so...the above is just to simplify. However, the input form needs another button in addition to Create/Update. Lets say I even manually add it - and call it Search. How does the EditPerson NOT end up creating a new Person? In the Struts world this would simply be a search method within same PersonAction class. And the same Person object on the Valuestack would be used as an Hibernate Example to drive search instead of ending up as parameter of AddPerson and creating a new record. And so on..., generally, how does one single form submit be wired to support multiple actions? Or is this frowned upon as bad practice? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reuse-Edit-Create-for-Query-by-Example-tp5655916p5655931.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reuse Edit/Create for Query by Example
Most likely, the solution is to simply segregate Search (QBE) from Create/Update using EventLink. That is, segregate the Search workflow instead of overloading Create/Update. This is to bypass the (default?) onSuccess and therefore prevent the EditPage from Adding a Person instead of doing QBE. # QBE Search To style this as a Search BUTTON instead of a link, use ChenilleKit as in: http://jumpstart.doublenegative.com.au/jumpstart/examples/styling/linksandsubmits1 -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reuse-Edit-Create-for-Query-by-Example-tp5655916p5656016.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reuse Edit/Create for Query by Example
Instead of eventlinks and the ch kit wrapper for button...just use: t:submit t:id=search value=QBE Search / http://tapestry.apache.org/current/apidocs/index.html?org/apache/tapestry5/corelib/components/EventLink.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reuse-Edit-Create-for-Query-by-Example-tp5655916p5656051.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: PlasticClass.getMethods() doesn't include introduced methods.
On 20 Apr 2012, at 19:00, Howard Lewis Ship wrote: On Fri, Apr 20, 2012 at 9:39 AM, Luke Wilson l...@viscri.co.uk wrote: More is described here: http://stackoverflow.com/questions/10249254/tapestry-5-3-plasticclass-getmethods-doesnt-include-introduced-methods. Ah, yes, I can see what you are going there. I think, perhaps, PlasticField and PlasticMethod may need a makeVisible() method that makes the introduced members visible inside PlasticClass.getMethods() and PlasticClass.getFields(). I don't think there's a way to extricate things so that member access within the introduced method is not transformed, but that's probably fine ... in your case, you want to make sure that the ParameterWorker sees your defaultValidate() method, and that method will be a stub with advice. What's the reason that introduced methods aren't visible by default like in in the old ClassTransformation? Are there consequences to just adding a line in PlasticClassImpl.createNewMethod() to add the new method onto the end of the methods list? I'm not all too familiar with the Plastic API but I could imagine using it for a whole bunch of things Kind regards, Luke - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org Luke Wilson-Mawer Director, Viscri Limited l...@viscri.co.uk Registered address: Cawley House, 149-155 Canal Street, Nottingham, NG1 7HR Postal address: 804, Eurotower, Courland Grove, London, SW8 2PX Registered number: 07031070
Re: Tree leaf not selectable
I didn't realise you can click on the label! That works fine. The javascript error occurs when you click on the leaf's icon. On 21/04/2012, at 12:10 AM, Lance Java wrote: Are you sure that you are returning consistent values for hasChildren() and getChildren(). It sounds like you might be returning true for hasChildren() but getChildren() is returning an empty list. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Better Looking Input Form
Problem: Default styles are too clunky. Need to bolt a better style wrapper. I would like to use better looking forms generated by, say, http://www.appnitro.com/ Is there some documentation, best practice or cookbook, somewhere, on MERGING styles with default Tapestry styles? The only way, right now, seems to be to reverse engineer every use-case (like form errors etc) and capture each CSS class to redefine it according to the new style. Even then, session management glue code like the hidden t:formdata can only be discovered by accident in view-source. With so much dependency on stuff showing up only after maven build in /assets/1.0-SNAPSHOT-DEV/tapestry/ ... there seems to be a lot going on to even bother creating your own look-and-feel (and also have tapestry form functionality). This would push back the project quite a bit...unless I am missing something? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Better-Looking-Input-Form-tp5656603p5656603.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Better Looking Input Form
Bummer. Having both tapestry and non-tapestry styling is probably not a realistic option. From http://tapestry.apache.org/integration-with-existing-applications.html quote author=netdawg Tapestry's Form component does a lot of work while an HTML form is rendering to store all the information needed to handle the form submission in a later request; this is all very specific to Tapestry and the particular construction of your pages and forms; it can't be reproduced from a JSP. Well if it cannot be reproduced from JSP, plain HTML would be same thing. This is a serious problem. So either use your own form and roll your own validation etc - or use tapestry form with limited (default ) styles, or painful reconstruction in your styles to capture everything generated by tapestry (which itself can change). Am I understanding correctly? Ugh. This is why PHP ended up ruling the planet. I think what is probably needed is some sort of wizard to generate form a la appnitro.com or use some sort of decorator approach like Sitemesh does to augment plain HTML forms. Not sureany help/pointers would be appreciated. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Better-Looking-Input-Form-tp5656603p5656680.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Why @EagerLoad services come before @Startup methods?
Thanks for the information, Howard. It's a shame that @Startup wasn't added /at the top/ of RegistryImpl.performRegistryStartup(). :) -- View this message in context: http://tapestry.1045711.n5.nabble.com/Why-EagerLoad-services-come-before-Startup-methods-tp5651302p5656756.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[t5.3.2] Inject hibernate Session problem
Hi guys, I have clean quickstart archetype app, and added tapestry-hibernate to pom. And hibernate.cfg.xml to resources. And after I injected Session to index page I got: No service implements the interface org.hibernate.classic.Session. Is this something new to T5.3 because Session before was in org.hibernate.Session and not in classic package!? -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-3-2-Inject-hibernate-Session-problem-tp5656809p5656809.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [t5.3.2] Inject hibernate Session problem
Hi You can inject org.hibernate.Session not org.hibernate.classic.Session as only the former is exposed as a tapestry service. regards Taha On Apr 22, 2012, at 3:21 AM, badluck13 wrote: Hi guys, I have clean quickstart archetype app, and added tapestry-hibernate to pom. And hibernate.cfg.xml to resources. And after I injected Session to index page I got: No service implements the interface org.hibernate.classic.Session. Is this something new to T5.3 because Session before was in org.hibernate.Session and not in classic package!? -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-3-2-Inject-hibernate-Session-problem-tp5656809p5656809.html Sent from the Tapestry - User mailing list archive at Nabble.com. - 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