If I understand correctly, you're question is where to ultimately put the upDate(c);, In your example you put it on the setYear() but that relies on setYear being called last which I don't think is a guarantee. Alternatively you could put it on all of them (but this would be inneficient). I believ you can also override
protected void cleanupAfterRender(IRequestCycle cycle); from the AbstractComponent class. I believe this is called after the render so all properties should have been set and you can save the date binding. You might also be able to do it through overriding finishLoad() or enterActivState(). But I am not sure if by that time the request has already been rewound. On 10/24/06, Matt Kerr <[EMAIL PROTECTED]> wrote:
I find Tapestry ok for generating html, but I'm struggling on the request processing. I don't think I'm alone .. I see many references to this topic on the mailing list archive -- and it's not very well described in the documentation :-? Specifically, reusable components participating in request processing. How can my component gather information in the request, and return an object to its caller (eg. the page, or another component). I'm looking at the point in time *after* my component has received it's request values, but *before* the page has invoked the listener action. Also, I'd like to use an html template .. (What's the point in using Tapestry if I'm writing my html *in the Java*??) ~~~ public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { writer.begin("a"); writer.attribute("href", . . .); writer.attribute("title", getTitle()); ~~ I'm imagining something like .. FooPage and DatePicker component -- where the DatePicker hands a Date object to the page. A Date object which the DatePicker creates from the FORM/request values sent to the app. eg. .. http://host:port/foo/blah?year=2006&month=10&day=24 What does DatePicker.java implementation look like ?? Can I use a template ? (Or do I have to write the html *in* the java with IMarkupWriter, etc??) Is there a callback for the point in time I mention above? .. where the component is filled in by the framework, and it has an opportunity to perform it's purpose, and then processing continues elsewhere--like in the caller. I believe "listener" callback isn't an option because you're not guaranteed of the order. The examples I'm reading online all break encapsulation and just have the caller get the M/D/Y from the component so that the *caller* creates the date. That's completely wrong -- and defeats the purpose of a "reusable component" .. since the caller is doing the work. Any ideas greatly appreciated. My sketch goes something like this (below). I'm really wondering what DatePicker.java does to push a value back to the caller *before* the caller's action() method is called. Thanks, Matt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ FooPage.html ~~~~~~~~~~~~ .. Start- <span jwcid="@DatePicker" date="ognl:startDate" /> End- <span jwcid="@DatePicker" date="ognl:endDate" /> .. ~~~~~~~~~~~~ FooPage.java ~~~~~~~~~~~~ .. public abstract Date getStartDate(); public abstract void setStartDate(Date value); public abstract Date getEndDate(); public abstract void setEndDate(Date value); .. public void submitAction() { Date d = getStartDate(); // THIS SHOULD BE VALID HERE - no work needed by caller FooPage } .. ~~~~~~~~~~~~ DatePicker.jwc ~~~~~~~~~~~~~~ .. <parameter name="date" required="yes" /> .. ~~~~~~~~~~~~~~ DatePicker.java ~~~~~~~~~~~~~~ * don't want to use Listener -- it could be called out of order * don't want to use renderComponent() -- i'd rather just write the html than bury the html *in* java * .. ??? what's the trick ? ~~~~~~~~~~~~~~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]