Re: Making a WO app look pretty
Re: Making a WO app look pretty
- Subject: Re: Making a WO app look pretty
- From: Janine Sisk <email@hidden>
- Date: Tue, 5 Jun 2007 16:02:59 -0700
Thanks to Jerry and everyone else who replied and sent sample code!
Fortunately this is one of the few concepts I've encountered in WO
World which was actually familiar; I've used a very similar sort of
nested templating in the past.
I really appreciate all the help, though - this community is by far
and away the most supportive one I have ever been a part of. I love
you guys! :)
janine
On Jun 4, 2007, at 10:37 PM, Jerry W. Walker wrote:
Hi, Janine,
The advice you've gotten is good advice but may be a bit hard to
chew on your first WO app.
To make it easier, I'm providing a sample textual schematic of a
simple WO application with:
* a page header
* a page footer
* a page wrapper (that invokes the header, the footer and the
content of the pages it wraps
* two "MyPage"s that reference the page wrapper
I've only included a sketch of the .wod file for the PageWrapper,
since it's the only one that is particularly relevant to the issue
at hand.
We would presume that the code for one of your pages (say,
MyPageOne) would transfer to another of your pages (say, MyPageTwo)
using pageWithName("MyPageTwo").
The difficult thing to wrap your head around the first couple times
is the fact that although you are instantiating MyPageTwo directly
from MyPageOne, MyPageTwo instantiates the PageWrapper (with the WO
PageWrapperComponent tag), and the PageWrapperComponent starts
rendering the actual page by first instantiating the
HeaderComponent, THEN (and here's the tricky part) rendering all
the content of MyPageTwo that your MyPageTwo has included between
it's PageWrapper tags. PageWrapperComponent ends by rendering the
HTML of FooterComponent.
So what tends to turn a WO newbie's head upside down is the fact
that you call MyPageTwo which calls PageWrapperComponent, but
PageWrapperComponent is in charge of the actual html rendering,
only including the CONTENT of your MyPageTwo when it's ready to.
It's that inversion of control that tends to wreck your mind the
first couple times out. Once you've got that part down and are
comfortable with it, then you can start making your apps more
efficient with such things as stateless components and such.
The three important concepts here are:
* the WOComponentContent dynamic element
* the whole WO subcomponent concept (which can be used just like
a WODynamicElement)
* the removal of the <html>, <head> and <body> tags from every
component except the PageWrapper.
I recommend that you build the small project that I've lain out
schematically, adding tiny amounts of your own content on each of
the components to see what happens to it. Keep all the components
incredibly simple so it's easy to see how the pieces are
interacting. When you've succeeded at that, then map the concepts
back onto your original project.
To make it even easier, I've included a small sample WO app to demo
the concepts. It was created with Xcode, but I've removed the build
folder, so you can rebuild it in Xcode or import the pieces into
Eclipse/WOLips.
Good luck.
Regards,
Jerry
<PageWrapperProject.zip>
<SamplePages.txt>
On Jun 5, 2007, at 12:20 AM, Janine Sisk wrote:
Thanks, Kieran (and David)!
This is the first WO app I've built, so although I do have a lot
to learn, I also don't have too much to unlearn. Let's hope that's
an advantage here. ;)
janine
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden