Re: [Tapestry-contrib] [suggestion] StatefulComponent
"Andrew C. Oliver" <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.devel |
|---|---|
| Message-ID | <[email protected]> |
This is best soley on contrib and not cross posted to both. Mind Bridge wrote: > Hi all, > > I've been thinking about what Phil Surette was saying earlier in the > "Recommended way to clean up a component?" thread. > > I am now convinced that it may be a very good idea to add to the > framework a class called StatefulComponent (or something like that) > that extends BaseComponent and has the following properties: > > - implements PageDetachListener > > - automatically registers itself as a PageDetachListener in finishLoad() > > - defines a protected method initialize() and calls it from both the > constructor and the pageDetached() method. As in AbstractPage, this > method can be used to (re)initialize the default property values of > the component, and ensures that the state would be identical after > creation and after detachment. > > - would adding detach() make sense for consistency or would > pageDetached(PageEvent) be sufficient? > > This class can be used when the component has persistent, > transient, or other properties that need to be reinitialized. Using it > would simplify some very common operations, remove a lot of repeated > code, and decrease the chance of bugs due to different states after > construction and detachment. I am starting to use this internally to > test the idea. > > Obviously, Howard's take on this would be quite important. > > -mb > > P.S. Phil, I guess we wrote our posts in parallel :) How is this? > > > > > ------------------------------------------------------------------------ > Do you Yahoo!? > U2 on LAUNCH > <http://rd.yahoo.com/launch/mailsig/*http://launch.yahoo.com/u2> - > Exclusive medley & videos from Greatest Hits CD ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf