-----Original Message-----
From: Phil Surette [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 10:00 AM
To: 'Tom Davies'; Tapestry Developer (E-mail)
Subject: RE: [Tapestry-developer] request for help with rewindI don't have a problem with pages calling other pages.
Only with pages calling themselves.Will your pattern work to allow a page to call itself?
If not, why not? It would be nice if a page could call
itself and get the same kind of behaviour as if it
called a different page. For instance, in the IActionListener,
it would be nice to be able to call cycle.setPage(getName())
and the page would actually be rebuilt.-----Original Message-----
From: Tom Davies [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 8:32 PM
To: Tapestry Developer (E-mail)
Subject: Re: [Tapestry-developer] request for help with rewind
Phil Surette wrote:
> Thanks very much Tom, the beginResponse thing was exactly
> what I needed. I'll have to go through and remove misguided
> references to the attach method.Phil,
To confuse you again I don't use beginResponse in real applications when
a page is called from another page. I do this: (pseudocode)/* function in calling page */
/* choose the next page and give it its parameters */
public void gotoNextPage(IRequestCycle cycle)
{
cycle.setPage("NameOfNextPage");
InitializablePage page = (InitializablePage)cycle.getPage();
page.init(keyOfThing);
}
...
/* init function in called page */
/* accept parameters from calling page and set them as
* persistent page state */
public void init(KeyType keyOfThing)
{
setKey(keyOfThing);
fireObservedChange("key", keyOfThing);
// use the key to get data to be shown from the DB
// and set that as persistent page state too
}/* listener function in called page */
public void someListener(...)
{
try
{
// save the data to the DB/do business logic
...
gotoNextPage(cycle); // move to another page
}
catch (BusinessException be)
{
// something bad happened in the business logic,
// set a property of this page to show an error message
// and *don't* move to a new one
}
}In fact these are all functions in my base page class, and they are more
general. Most of my pages use exactly the same Java class, and hold
their state and behaviour in a Command object.The interface of a command is:
/*
* (c) Copyright 2002 Oakton Computing
* All Rights Reserved.
*/
package au.com.oakton.wf;import java.io.Serializable;
import java.util.Locale;import javax.jdo.PersistenceManager;
import au.com.oakton.authentication.User;
import au.com.oakton.security.Capability;/**
* @version 1.0
* @author
*/
public interface Command extends Serializable
{
/**
* Get the command ready to interact with the user interface.
* This involves loading any data to be displayed from the
* back end, and setting any defaults. This takes place here
* rather than when the Command is created because it may be
* an expensive process.
*
* This method is executed in the middle tier.
*
* @param user The User who will be viewing the user interface.
* @param l The Locale of the user.
* @param pm The PersistenceManager to be used.
*/
public void init(User user, Locale l, PersistenceManager pm);/**
* Carry out the task the command implements.
* Load any items which have been edited, apply the changes to
* them, and call business methods to perform this command.
*
* This method is executed in the middle tier.
*
* @param user The User on whose behalf the command is being executed.
* @param l The Locale this user is currently operating in.
* @param pm The PersistenceManager to be used.
* <b>Does this need to be visible here?</b>
*/
public void execute(User user, Locale l, PersistenceManager pm);/**
* Get the description of this command for display to the user.
* Uses the locale set for this command.
Title: RE: [Tapestry-developer] request for help with rewind
Sorry,
I meant to say IDirectListener. IActionListener already
does
what you'd expect.
- Re: [Tapestry-developer] request for help with rewind Tom Davies
- Re: [Tapestry-developer] request for help with rewind hlship
- Re: [Tapestry-developer] request for help with rewind hlship
- Re: [Tapestry-developer] request for help with rewind hlship
- RE: [Tapestry-developer] request for help with rewind Phil Surette
- Re: [Tapestry-developer] request for help with rew... Tom Davies
- [Tapestry-developer] two targets Ara Abrahamian
- RE: [Tapestry-developer] request for help with rewind hlship
- RE: [Tapestry-developer] request for help with rewind Dorothy Gantenbein
- RE: [Tapestry-developer] request for help with rewind Phil Surette
- Re: [Tapestry-developer] request for help with rewind Phil Surette
- RE: [Tapestry-developer] request for help with rewind Phil Surette
- RE: [Tapestry-developer] request for help with rewind hlship
