Re: Making a WO app look pretty
Re: Making a WO app look pretty
- Subject: Re: Making a WO app look pretty
- From: "Jerry W. Walker" <email@hidden>
- Date: Tue, 5 Jun 2007 07:18:37 -0400
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'll send you a small sample WO app to demo
the concepts. I tried to send a compressed version with this email,
but the message was rejected last night because of size. The app was
created with Xcode, but I've removed the build folder, so you can
rebuild it in Xcode or import the project into Eclipse/WOLips.
Good luck.
Regards,
Jerry
HeaderComponent.html
----------------------
(HTML and WO tag stuff that lay out your header, but no <html>, <header> or <body> tags)
----------------------
FooterComponent.html
----------------------
(HTML and WO tag stuff that lay out your footer, but no <html>, <header> or <body> tags)
----------------------
PageWrapperComponent.html
----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<!-- Begin PageWrapper Component -->
<head>
(header html)
</head>
<body>
<webobject name=HeaderComponent> </webobject>
<webobject name="PageComponentContent"> </webobject>
<webobject name=FooterComponent> </webobject>
</body>
</html>
----------------------
MyPageOne.html
----------------------
<webobject name=PageWrapper>
(HTML and WO tag stuff that lay out your first page, but no <html>, <header> or <body> tags)
</webobject>
----------------------
MyPageTwo.html
----------------------
<webobject name=PageWrapper>
(HTML and WO tag stuff that lay out your second page, but no <html>, <header> or <body> tags)
</webobject>
----------------------
PageWrapperComponent.wod
----------------------
PageHeader: PageHeader {
(maybe some bindings)
}
PageComponentContent: WOComponentContent {
}
PageFooter: PageFooter {
(maybe some bindings)
}
----------------------
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