Tapestry 5 Preview
Howard M. Lewis Ship
TWD Consulting, Inc.




                       © 2007 Howard M. Lewis Ship
A few observations

• ❝If ...


   • ... I have to type one more angle bracket I'll chop off my pinkie! ❞


   • ... I hav...
Tapestry 5 Goals and Values

• Less code is better than more code


• Naming conventions are better than explicit configura...
Things Should Be Easy

• How much work to create a form to edit a simple
  object?


                              Session...
Demo #1


Basic BeanEditForm Component
What did we just see?

• Tapestry application starts with a page named quot;Startquot;


• Start page template in WEB-INF/...
What did we just see?

Start.java

public class Start
{
  private SessionEval _eval;

    public SessionEval getEval()
   ...
What did we just see?


                        Start



                  BeanEditForm




                         ...
 ...
Tapestry Applications


                      Application



                                      Page
            Page

...
Connected Objects

 Inside the BeanEditor
      component


                                                          Star...
Component ‘n Stuff

                  Parameters
    Sub-                         Injected
 Components                    ...
What Else?

• Validation would be nice


   • Via @Validation annotation on bean property methods


• Customize the Form

...
Demo #2


Adding validation and customizing the form
Components & Events
                        Start.java


                        String onSuccess()
   Start              ...
Tapestry and IoC

• Keep Business Logic out of the Page


• Inject Services from the IoC Container

      Start.java

    ...
Demo #3


Processing the form submission
More Components

• PageLink: Link to another page


• Grid: Data table with paging & sorting


• ActionLink: Trigger an ac...
Grid Component

• Page navigation & sorting


• Lots of configurability


• Starts very simple
                            ...
Demo #4


Linking to the EvalList page, adding the Grid
Customizing Grid Output

• Customize number of rows per page with rowsperpage parameter


• Move pages around: pagerpositi...
Customizing Grid Output

• Special parameters to change cell renderer:



                   Start.html



               ...
Summarize Component
      Summarize.java

      public class Summarize
      {
        @Parameter(required = true)
       ...
Demo #5


Customizing Grid output
Is it ready yet?




                   © 2007 Howard M. Lewis Ship
Still alpha!

• Stable


• Basic Spring / Hibernate integration


• Many features yet to be implemented


• Code stability...
What's Coming

• Ajax Support


• Improved Hibernate integration


  • Request in Session Pattern


• Spring Web Flow Inte...
IDE Support




         ❝I don’t have time
         for Drag and Drop❞



                              © 2007 Howard M. ...
Ajax: Coming Soon!

  <html>              Page


 <body>               Layout


 <form>               Form


 <input>     ...
Tapestry 4 ➠ Tapestry 5

• Clean Slate


• Not backwards compatible


• T4: Hard ➠ T5: Easy


• T4: Easy ➠ T5: Automatic

...
Overcoming “Steep Learning Curve”


                                                                        Multiple
     ...
More Information

• Home Page:

 http://tapestry.apache.org/tapestry5/

• Dev & User Mailing Lists:

 dev-subscribe@tapest...
How you can help ...

• Give it a whirl!


• Blog!


• Contribute patches!


• JUG talks!




                        © 20...
Q&A




      © 2007 Howard M. Lewis Ship
Upcoming SlideShare
Loading in...5
×

Os Lewisship

803

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
803
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Os Lewisship"

  1. 1. Tapestry 5 Preview Howard M. Lewis Ship TWD Consulting, Inc. © 2007 Howard M. Lewis Ship
  2. 2. A few observations • ❝If ... • ... I have to type one more angle bracket I'll chop off my pinkie! ❞ • ... I have to run Ant/Maven one more time I'll staple myself to death! ❞ • ... I have to restart Tomcat on more @&*$**@! time I'm going to become a sheep farmer! ❞ • ... I have to write any more &%@&^@ boilerplate code I'll start to listen to those voices in my head! ❞ • You have a budget for mental investment © 2007 Howard M. Lewis Ship
  3. 3. Tapestry 5 Goals and Values • Less code is better than more code • Naming conventions are better than explicit configuration • Java annotations are better than XML • Easy is better than hard • Fast is better than slow • Things should Just WorkTM © 2007 Howard M. Lewis Ship
  4. 4. Things Should Be Easy • How much work to create a form to edit a simple object? SessionEval surveyId : long sessionId : String subjectMatter : Rating presentation : Rating materials : Rating comments : String © 2007 Howard M. Lewis Ship
  5. 5. Demo #1 Basic BeanEditForm Component
  6. 6. What did we just see? • Tapestry application starts with a page named quot;Startquot; • Start page template in WEB-INF/Start.html Tapestry Namespace Start.html <html xmlns:t=quot;http://tapestry.apache.org/schema/tapestry_5_0_0.xsdquot;> <head> <title>Survey</title> </head> <body> <p> ... </p> <t:beaneditform object=quot;evalquot;/> </body> </html> Parameter object bound Component type: to property eval BeanEditForm © 2007 Howard M. Lewis Ship
  7. 7. What did we just see? Start.java public class Start { private SessionEval _eval; public SessionEval getEval() { return _eval; } Property bound to object parameter public void setEval(SessionEval eval) { _eval = eval; } } © 2007 Howard M. Lewis Ship
  8. 8. What did we just see? Start BeanEditForm ... Form TextField © 2007 Howard M. Lewis Ship
  9. 9. Tapestry Applications Application Page Page Component Component Component Component Component © 2007 Howard M. Lewis Ship
  10. 10. Connected Objects Inside the BeanEditor component Start eval TextField value SessionEval eval.sessionId sessionEvalId : long sessionId : String subjectMatter : Rating presentation : Rating materials : Rating comments : String © 2007 Howard M. Lewis Ship
  11. 11. Component ‘n Stuff Parameters Sub- Injected Components Services Component Localized Template Messages Resources © 2007 Howard M. Lewis Ship
  12. 12. What Else? • Validation would be nice • Via @Validation annotation on bean property methods • Customize the Form • Use a TextArea component for the comments field • Use a drop-down list for the session id © 2007 Howard M. Lewis Ship
  13. 13. Demo #2 Adding validation and customizing the form
  14. 14. Components & Events Start.java String onSuccess() Start { ... } success BeanEditForm success Form action © 2007 Howard M. Lewis Ship
  15. 15. Tapestry and IoC • Keep Business Logic out of the Page • Inject Services from the IoC Container Start.java private SessionEval _eval; @Inject private SessionEvalDatabase _database; Event Handler String onSuccess() { _database.add(_eval); return quot;Thanksquot;; } © 2007 Howard M. Lewis Ship
  16. 16. Demo #3 Processing the form submission
  17. 17. More Components • PageLink: Link to another page • Grid: Data table with paging & sorting • ActionLink: Trigger an action event © 2007 Howard M. Lewis Ship
  18. 18. Grid Component • Page navigation & sorting • Lots of configurability • Starts very simple EvalList.html <t:grid source=quot;evalsquot;/> EvalList.java public class EvalList { @Inject private SessionEvalDatabase _database; public List<SessionEval> getEvals() { return _database.getSessionEvals(); } } © 2007 Howard M. Lewis Ship
  19. 19. Demo #4 Linking to the EvalList page, adding the Grid
  20. 20. Customizing Grid Output • Customize number of rows per page with rowsperpage parameter • Move pages around: pagerposition parameter • Generates CSS class for each cell • Class name from property name Start.html <style> TH.comments-header { background-color: black; } TD.comments-cell { color: silver; } </style> © 2007 Howard M. Lewis Ship
  21. 21. Customizing Grid Output • Special parameters to change cell renderer: Start.html <t:grid source=quot;evalsquot; row=quot;evalquot; rowsPerPage=quot;10quot; pagerPosition=quot;topquot;> <t:parameter name=quot;commentscellquot;> <t:summarize value=quot;eval.commentsquot;/> </t:parameter> </t:grid> © 2007 Howard M. Lewis Ship
  22. 22. Summarize Component Summarize.java public class Summarize { @Parameter(required = true) private String _value; @Parameter private int _maxLength = 25; boolean beginRender(MarkupWriter writer) { if (_value != null) { String value = _value; if (value.length() > _maxLength) value = value.substring(0, _maxLength) + quot; ...quot;; writer.write(value); } return false; } } © 2007 Howard M. Lewis Ship
  23. 23. Demo #5 Customizing Grid output
  24. 24. Is it ready yet? © 2007 Howard M. Lewis Ship
  25. 25. Still alpha! • Stable • Basic Spring / Hibernate integration • Many features yet to be implemented • Code stability has been great 5.0.1 ➠ 5.0.5 • Rethink on Templates • Rethink on Inversion of Control container • Several people building production applications already! © 2007 Howard M. Lewis Ship
  26. 26. What's Coming • Ajax Support • Improved Hibernate integration • Request in Session Pattern • Spring Web Flow Integration © 2007 Howard M. Lewis Ship
  27. 27. IDE Support ❝I don’t have time for Drag and Drop❞ © 2007 Howard M. Lewis Ship
  28. 28. Ajax: Coming Soon! <html> Page <body> Layout <form> Form <input> TextField © 2007 Howard M. Lewis Ship
  29. 29. Tapestry 4 ➠ Tapestry 5 • Clean Slate • Not backwards compatible • T4: Hard ➠ T5: Easy • T4: Easy ➠ T5: Automatic © 2007 Howard M. Lewis Ship
  30. 30. Overcoming “Steep Learning Curve” Multiple Downloads XML Configuration Base Classes Tapestry 4 Abstract Classes Maven & Archetypes T5 Live Class Reloading Conventions, Annotations & Defaults POJOs © 2007 Howard M. Lewis Ship
  31. 31. More Information • Home Page: http://tapestry.apache.org/tapestry5/ • Dev & User Mailing Lists: dev-subscribe@tapestry.apache.org users-subscribe@tapestry.apache.org • Howard’s Blog: http://tapestryjava.blogspot.com/ • Howard’s Site: http://howardlewisship.com/ © 2007 Howard M. Lewis Ship
  32. 32. How you can help ... • Give it a whirl! • Blog! • Contribute patches! • JUG talks! © 2007 Howard M. Lewis Ship
  33. 33. Q&A © 2007 Howard M. Lewis Ship

×