On Mon, Jun 7, 2010 at 4:15 PM, Pierce Wetter <pie...@paceap.com> wrote:

>
> On Jun 7, 2010, at 3:00 PM, Howard Lewis Ship wrote:
>
> > Yes, the basic rule for pages is that the name, beneath the root pages
> > package, is the logical page name.  The logical page name appears in
> URLs.
>
> What is the rule for components?
>

The exact same rules, except for the "/Index" part.


>
> >
> > So class appname.pages.EditUsers will have a logical name of "EditUsers".
> >
> > You can also create a subpackage (or sub-sub-package), for example:
> >
> > appname.pages.users.EditUsers --> "users/EditUsers"
> > appname.pages.edit.EditUsers --> "edit/EditUsers"
> >
> > I tend to prefer the former, to group related pages by the data object
> > (User) that they operate upon.
>
>  Splitting by verb is working better for me. To each his own. :-) For my
> components, splitting by data object might be more logical, but I'm working
> that out.
>
> >
> > Tapestry will do a little processing on the logical name to create
> aliases
> > for the name.  As you noted, it sees the redundancy in the name, so
> >
> > appname.pages.users.EditUsers --> "users/EditUsers" --> "users/Edit"
> > appname.pages.edit.EditUsers --> "edit/EditUsers"  --> "edit/Users"
> >
> > Tapestry looks for a suffix or a prefix that matches the containing
> package
> > name.
>
>   Ok, so two conclusions.
>
>
>  #1: if I move things down a package, that means that I'm changing the
> logical page name to include the new package name; that implies that
> references to the old name in .tml files will need "newpackage/" prepended
> to any references.
>
>   That is with pages.EditUser.java -> pages.edit.EditUser.java:
>
>     <t:pagelink page="EditUser" />
>
>   Must be changed to one of the following:
>
>     <t:pagelink page="edit/User" />
>     <t:pagelink page="edit/EditUser" />
>
>  That's not such a bad thing after all, that's similar to what happens if I
> pushed all the edit pages into a component library.
>
>  #2: Tapestry will process the package name against the class name to
> reduce redundancy, so after the split I can leave the new package name in
> the class name so that I don't end up with multiple files named "User.java"
> for "edit/User.java", "list/User.java", but rather I can keep with
> EditUser.java, ListUser.java, and then it is more clear which is which.
>
>
> And that's the intent; although Java support having the exact same class
name in multiple packages, it's something to be avoided. The naming
transformations allow you to use reasonable class names AND have reasonable
URLs.


>  Are the rules similar for components?
>
> Pierce
>
>
>
> ---------------------------------------------------------------------
> 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

Reply via email to