CVS: TapestryBook/examples/src/examples/todo1 ToDo.java,1.3,1.4

Howard Lewis Ship <[email protected]> Mon, 21 Apr 2003 12:14:28 -0700
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/TapestryBook/examples/src/examples/todo1
In directory sc8-pr-cvs1:/tmp/cvs-serv24940/examples/src/examples/todo1

Modified Files:
	ToDo.java 
Log Message:
Minor tweaks to reflect recent changes in the framework.

Index: ToDo.java
===================================================================
RCS file: /cvsroot/tapestry/TapestryBook/examples/src/examples/todo1/ToDo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ToDo.java	16 Mar 2003 02:55:41 -0000	1.3
--- ToDo.java	21 Apr 2003 19:14:25 -0000	1.4
***************
*** 8,14 ****
  import org.apache.tapestry.IMarkupWriter;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.html.BasePage;
  
! public abstract class ToDo extends BasePage
  {
      public abstract List getToDoList();
--- 8,16 ----
  import org.apache.tapestry.IMarkupWriter;
  import org.apache.tapestry.IRequestCycle;
+ import org.apache.tapestry.event.PageEvent;
+ import org.apache.tapestry.event.PageRenderListener;
  import org.apache.tapestry.html.BasePage;
  
! public abstract class ToDo extends BasePage implements PageRenderListener
  {
      public abstract List getToDoList();
***************
*** 41,44 ****
--- 43,51 ----
      }
  
+ 	protected ToDoItem createNewItem(String title)
+ 	{
+ 		return new ToDoItem(title);
+ 	}
+ 
      // The Submit for this is after the main loop, so its safe to
      // actually edit the list.
***************
*** 93,112 ****
      }
  
!     // Last chance to set persistent properties before a render.  This is where
!     // we detect the uninitialized ToDo list and set its initial
!     // contents.
! 
!     public void beginResponse(IMarkupWriter writer, IRequestCycle cycle)
      {
!         List list = getToDoList();
  
!         if (list == null)
!         {
!             list = new ArrayList();
!             list.add(new ToDoItem("Finish reading Tapestry Book"));
!             list.add(new ToDoItem("Download latest version of Tapestry"));
  
!             setToDoList(list);
!         }
      }
  
--- 100,115 ----
      }
  
!     public void pageBeginRender(PageEvent event)
      {
! 		List list = getToDoList();
  
! 		if (list == null)
! 		{
! 			list = new ArrayList();
! 			list.add(createNewItem("Finish reading Tapestry Book"));
! 			list.add(createNewItem("Download latest version of Tapestry"));
  
! 			setToDoList(list);
! 		}
      }
  



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf