CVS: Tapestry/examples/Tutorial/src/tutorial/portal Stocks.java,1.11,1.11.2.1 Home.java,1.7,1.7.2.1 PortletChannel.java,1.2,1.2.2.1 Slashdot.java,1.10.2.1,1.10.2.2 PortletModel.java,1.5,1.5.2.1 PortletSelectionModel.java,1.5,1.5.2.1 Portlet.java,1.7,1.7.2.1 Stock.java,1.5,1.5.2.1 Visit.java,1.7,1.7.2.1 Weather.page,1.5.2.1,NONE Portlet.jwc,1.6,NONE Stocks.page,1.4.2.2,NONE Home.page,1.4.2.1,NONE Border.html,1.7.2.1,NONE Portlet.html,1.5,NONE Slashdot.page,1.4.2.1,NONE Border.jwc,1.7.2.2,NONE Portal.application,1.9.2.1,NONE Weather.html,1.3.4.1,NONE Stocks.html,1.4.4.1,NONE Home.html,1.5.2.1,NONE Slashdot.html,1.4.4.1,NONE

Howard Lewis Ship <[email protected]>
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal
In directory sc8-pr-cvs1:/tmp/cvs-serv10583/examples/Tutorial/src/tutorial/portal

Modified Files:
      Tag: hship-2-3
	Stocks.java Home.java PortletChannel.java Slashdot.java 
	PortletModel.java PortletSelectionModel.java Portlet.java 
	Stock.java Visit.java 
Removed Files:
      Tag: hship-2-3
	Weather.page Portlet.jwc Stocks.page Home.page Border.html 
	Portlet.html Slashdot.page Border.jwc Portal.application 
	Weather.html Stocks.html Home.html Slashdot.html 
Log Message:
Reorganize the tutorials to use new 2.4 features.

Index: Stocks.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/Stocks.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** Stocks.java	27 Nov 2002 17:58:43 -0000	1.11
--- Stocks.java	2 Jan 2003 03:15:26 -0000	1.11.2.1
***************
*** 28,42 ****
       **/
  
!     private static Stock[] stockBase =
!         {
!             new Stock("DJIA", 11005.37, -117.05),
!             new Stock("NASDAQ", 2251.03, -30.99),
!             new Stock("NYSE", 647.13, -5.85)};
  
!     private static Stock[] otherStocks = { new Stock("PMIX", 12.73, 1.01), // Wishful thinking
          new Stock("MSFT", 70.91, -0.81), new Stock("SUN", 41.32, .2)};
  
!     private String tickerId;
!     private Stock stock;
  
      /**
--- 28,39 ----
       **/
  
!     private static Stock[] _stockBase =
!         { new Stock("DJIA", 11005.37, -117.05), new Stock("NASDAQ", 2251.03, -30.99), new Stock("NYSE", 647.13, -5.85)};
  
!     private static Stock[] _otherStocks = { new Stock("PMIX", 12.73, 1.01), // Wishful thinking
          new Stock("MSFT", 70.91, -0.81), new Stock("SUN", 41.32, .2)};
  
!     private String _tickerId;
!     private Stock _stock;
  
      /**
***************
*** 46,82 ****
       **/
  
!     private List stocks;
  
      /**
!      *  The list of stocks for this user.
       *
       **/
  
!     private List userStocks;
  
!     public void detach()
      {
!         tickerId = null;
!         stock = null;
!         stocks = null;
!         userStocks = null;
! 
!         super.detach();
      }
  
      public List getStocks()
      {
!         if (stocks == null)
          {
!             stocks = new ArrayList();
  
!             for (int i = 0; i < stockBase.length; i++)
!                 stocks.add(stockBase[i]);
  
!             if (userStocks != null)
!                 stocks.addAll(userStocks);
          }
  
!         return stocks;
      }
  
--- 43,77 ----
       **/
  
!     private List _stocks;
  
      /**
!      *  The list of stocks for this user, which is stored persistently.
       *
       **/
  
!     private List _userStocks;
  
!     public void initialize()
      {
!         _tickerId = null;
!         _stock = null;
!         _stocks = null;
!         _userStocks = null;
      }
  
      public List getStocks()
      {
!         if (_stocks == null)
          {
!             _stocks = new ArrayList();
  
!             for (int i = 0; i < _stockBase.length; i++)
!                 _stocks.add(_stockBase[i]);
  
!             if (_userStocks != null)
!                 _stocks.addAll(_userStocks);
          }
  
!         return _stocks;
      }
  
***************
*** 96,106 ****
              return;
  
!         String newId = tickerId.toUpperCase();
          List existingStocks = getStocks();
          int count = existingStocks.size();
          for (int i = 0; i < count; i++)
          {
              Stock s = (Stock) existingStocks.get(i);
!             if (s.tickerId.equals(newId))
              {
                  setErrorField(delegate, "inputTickerId", "Already in list.");
--- 91,102 ----
              return;
  
!         String newId = _tickerId.toUpperCase();
          List existingStocks = getStocks();
          int count = existingStocks.size();
+ 
          for (int i = 0; i < count; i++)
          {
              Stock s = (Stock) existingStocks.get(i);
!             if (s.getTickerId().equals(newId))
              {
                  setErrorField(delegate, "inputTickerId", "Already in list.");
***************
*** 109,124 ****
          }
  
!         for (int i = 0; i < otherStocks.length; i++)
          {
!             if (otherStocks[i].tickerId.equals(newId))
              {
!                 stocks = null;
  
                  if (userStocks == null)
!                     setUserStocks(new ArrayList());
  
!                 userStocks.add(otherStocks[i]);
  
!                 tickerId = null;
  
                  return;
--- 105,129 ----
          }
  
!         for (int i = 0; i < _otherStocks.length; i++)
          {
!             if (_otherStocks[i].getTickerId().equals(newId))
              {
! 
!                 List userStocks = getUserStocks();
  
                  if (userStocks == null)
!                     userStocks = new ArrayList();
  
!                 userStocks.add(_otherStocks[i]);
  
!                 // Don't set a persistant property until its final value
!                 // is determined; then don't change it.
!                 
!                 setUserStocks(userStocks);
! 
!                 // Force a recompute of the stock list, on redisplay
! 
!                 _stocks = null;
!                 _tickerId = null;
  
                  return;
***************
*** 134,168 ****
      public void setStock(Stock value)
      {
!         stock = value;
      }
  
      public Stock getStock()
      {
!         return stock;
!     }
! 
!     public DecimalFormat getDecimalFormat()
!     {
!         return null;
      }
  
      public void setTickerId(String value)
      {
!         tickerId = value;
      }
  
      public String getTickerId()
      {
!         return tickerId;
      }
  
      public List getUserStocks()
      {
!         return userStocks;
      }
  
      public void setUserStocks(List value)
      {
!         userStocks = value;
  
          fireObservedChange("userStocks", value);
--- 139,168 ----
      public void setStock(Stock value)
      {
!         _stock = value;
      }
  
      public Stock getStock()
      {
!         return _stock;
      }
  
      public void setTickerId(String value)
      {
!         _tickerId = value;
      }
  
      public String getTickerId()
      {
!         return _tickerId;
      }
  
      public List getUserStocks()
      {
!         return _userStocks;
      }
  
      public void setUserStocks(List value)
      {
!         _userStocks = value;
  
          fireObservedChange("userStocks", value);

Index: Home.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/Home.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** Home.java	27 Nov 2002 17:58:43 -0000	1.7
--- Home.java	2 Jan 2003 03:15:26 -0000	1.7.2.1
***************
*** 16,84 ****
  public class Home extends BasePage
  {
!     private PortletModel model;
!     private int newPortletId;
  
!     public void detach()
      {
!         model = null;
!         newPortletId = 0;
! 
!         super.detach();
      }
  
      public void setModel(PortletModel value)
      {
!         model = value;
      }
  
      public PortletModel getModel()
      {
!         return model;
      }
  
      public void setNewPortletId(int value)
      {
!         newPortletId = value;
      }
  
      public int getNewPortletId()
      {
!         return newPortletId;
!     }
! 
!     public IActionListener getCloseListener()
!     {
!         return new IActionListener()
!         {
!             public void actionTriggered(IComponent component, IRequestCycle cycle)
!             {
!                 closeModel();
!             }
!         };
      }
  
!     private void closeModel()
!     {
          Visit visit = (Visit) getVisit();
  
!         visit.removeModel(model);
!     }
! 
!     public IActionListener getFormListener()
!     {
!         return new IActionListener()
!         {
!             public void actionTriggered(IComponent component, IRequestCycle cycle)
!             {
!                 addModel();
!             }
!         };
      }
  
!     private void addModel()
      {
          Visit visit = (Visit) getVisit();
  
!         visit.addModel(newPortletId);
      }
  }
--- 16,72 ----
  public class Home extends BasePage
  {
!     private PortletModel _model;
!     private int _newPortletId;
  
!     public void initialize()
      {
!         _model = null;
!         _newPortletId = 0;
      }
  
      public void setModel(PortletModel value)
      {
!         _model = value;
      }
  
      public PortletModel getModel()
      {
!         return _model;
      }
  
      public void setNewPortletId(int value)
      {
!         _newPortletId = value;
      }
  
      public int getNewPortletId()
      {
!         return _newPortletId;
      }
  
!     /**
!      *  Listener for the close button.  Closes the portlet currently
!      *  being rendered.
!      * 
!      **/
!     
!     public void closeModel(IRequestCycle cycle)
!     {        
          Visit visit = (Visit) getVisit();
  
!         visit.removeModel(_model);
      }
  
!     /**
!      *  Adds the selected portlet (by requesting that the Visit
!      *  add the portlet with the identified portlet id.
!      *
!      **/
!     
!     public void addModel(IRequestCycle cycle)
      {
          Visit visit = (Visit) getVisit();
  
!         visit.addModel(_newPortletId);
      }
  }

Index: PortletChannel.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/PortletChannel.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** PortletChannel.java	27 Nov 2002 17:58:43 -0000	1.2
--- PortletChannel.java	2 Jan 2003 03:15:26 -0000	1.2.2.1
***************
*** 14,43 ****
  public class PortletChannel
  {
!     private int id;
!     private String title;
!     private String pageName;
!     private String componentPath;
  
      public PortletChannel(int id, String title, String pageName, String componentPath)
      {
!         this.id = id;
!         this.title = title;
!         this.pageName = pageName;
!         this.componentPath = componentPath;
      }
  
      public PortletModel getModel()
      {
!         return new PortletModel(id, title, pageName, componentPath);
      }
  
      public int getId()
      {
!         return id;
      }
  
      public String getTitle()
      {
!         return title;
      }
  }
--- 14,43 ----
  public class PortletChannel
  {
!     private int _id;
!     private String _title;
!     private String _pageName;
!     private String _componentPath;
  
      public PortletChannel(int id, String title, String pageName, String componentPath)
      {
!         _id = id;
!         _title = title;
!         _pageName = pageName;
!         _componentPath = componentPath;
      }
  
      public PortletModel getModel()
      {
!         return new PortletModel(_id, _title, _pageName, _componentPath);
      }
  
      public int getId()
      {
!         return _id;
      }
  
      public String getTitle()
      {
!         return _title;
      }
  }

Index: Slashdot.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/Slashdot.java,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C2 -d -r1.10.2.1 -r1.10.2.2
*** Slashdot.java	7 Dec 2002 13:26:15 -0000	1.10.2.1
--- Slashdot.java	2 Jan 2003 03:15:26 -0000	1.10.2.2
***************
*** 32,38 ****
       **/
  
!     private List stories;
!     private SlashdotStory story;
!     private long lastRefresh = 0;
  
      private static final int REFRESH_INTERVAL = 30 * 1024;
--- 32,38 ----
       **/
  
!     private List _stories;
!     private SlashdotStory _story;
!     private long _lastRefresh = 0;
  
      private static final int REFRESH_INTERVAL = 30 * 1024;
***************
*** 40,58 ****
      private static String RESOURCE_PATH = "http://slashdot.org/slashdot.xml";
  
!     public void detach()
      {
!         story = null;
! 
!         super.detach();
      }
  
      public void setStory(SlashdotStory value)
      {
!         story = value;
      }
  
      public SlashdotStory getStory()
      {
!         return story;
      }
  
--- 40,62 ----
      private static String RESOURCE_PATH = "http://slashdot.org/slashdot.xml";
  
!     /**
!      *  The page acts like a cache of parsed stories, so we leave the stories and lastRefresh
!      *  properties alone.  This is bending the rules, but valid.
!      * 
!      **/
!     
!     public void initialize()
      {
!         _story = null;
      }
  
      public void setStory(SlashdotStory value)
      {
!         _story = value;
      }
  
      public SlashdotStory getStory()
      {
!         return _story;
      }
  
***************
*** 61,76 ****
          long now = System.currentTimeMillis();
  
!         if (now - lastRefresh > REFRESH_INTERVAL)
          {
              if (LOG.isDebugEnabled())
                  LOG.debug("Forcing refresh");
  
!             stories = null;
          }
  
!         if (stories == null)
              readStories();
  
!         return stories;
      }
  
--- 65,80 ----
          long now = System.currentTimeMillis();
  
!         if (now - _lastRefresh > REFRESH_INTERVAL)
          {
              if (LOG.isDebugEnabled())
                  LOG.debug("Forcing refresh");
  
!             _stories = null;
          }
  
!         if (_stories == null)
              readStories();
  
!         return _stories;
      }
  
***************
*** 94,98 ****
          try
          {
!             stories = parser.parseStories(url);
          }
          catch (DocumentParseException ex)
--- 98,102 ----
          try
          {
!             _stories = parser.parseStories(url);
          }
          catch (DocumentParseException ex)
***************
*** 101,105 ****
          }
  
!         lastRefresh = System.currentTimeMillis();
      }
  
--- 105,109 ----
          }
  
!         _lastRefresh = System.currentTimeMillis();
      }
  

Index: PortletModel.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/PortletModel.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** PortletModel.java	27 Nov 2002 17:58:44 -0000	1.5
--- PortletModel.java	2 Jan 2003 03:15:26 -0000	1.5.2.1
***************
*** 20,41 ****
  public class PortletModel implements Serializable
  {
!     private int id;
!     private boolean expanded = true;
!     private String title;
!     private String bodyPage;
!     private String bodyIdPath;
  
      public PortletModel(int id, String title, String bodyPage, String bodyIdPath)
      {
!         this.id = id;
!         this.title = title;
!         this.bodyPage = bodyPage;
!         this.bodyIdPath = bodyIdPath;
      }
  
      public Block getBodyBlock(IRequestCycle cycle)
      {
!         IPage page = cycle.getPage(bodyPage);
!         IComponent component = page.getNestedComponent(bodyIdPath);
  
          return (Block) component;
--- 20,41 ----
  public class PortletModel implements Serializable
  {
!     private int _id;
!     private boolean _expanded = true;
!     private String _title;
!     private String _bodyPage;
!     private String _bodyIdPath;
  
      public PortletModel(int id, String title, String bodyPage, String bodyIdPath)
      {
!         _id = id;
!         _title = title;
!         _bodyPage = bodyPage;
!         _bodyIdPath = bodyIdPath;
      }
  
      public Block getBodyBlock(IRequestCycle cycle)
      {
!         IPage page = cycle.getPage(_bodyPage);
!         IComponent component = page.getNestedComponent(_bodyIdPath);
  
          return (Block) component;
***************
*** 44,68 ****
      public void toggleExpanded()
      {
!         expanded = !expanded;
      }
  
      public boolean isExpanded()
      {
!         return expanded;
      }
  
!     public void setExpanded(boolean value)
      {
!         expanded = value;
      }
  
      public String getTitle()
      {
!         return title;
      }
  
      public int getId()
      {
!         return id;
      }
  }
--- 44,68 ----
      public void toggleExpanded()
      {
!         _expanded = !_expanded;
      }
  
      public boolean isExpanded()
      {
!         return _expanded;
      }
  
!     public void setExpanded(boolean expanded)
      {
!         _expanded = expanded;
      }
  
      public String getTitle()
      {
!         return _title;
      }
  
      public int getId()
      {
!         return _id;
      }
  }

Index: PortletSelectionModel.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/PortletSelectionModel.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** PortletSelectionModel.java	27 Nov 2002 17:58:43 -0000	1.5
--- PortletSelectionModel.java	2 Jan 2003 03:15:26 -0000	1.5.2.1
***************
*** 17,64 ****
  public class PortletSelectionModel implements IPropertySelectionModel
  {
! 	private List list = new ArrayList();
  
  	private static class Entry
  	{
! 		int id;
! 		String title;
  
  		Entry(int id, String title)
  		{
! 			this.id = id;
! 			this.title = title;
  		}
  	}
  
! 	public void add(PortletChannel def)
  	{
! 		Entry e = new Entry(def.getId(), def.getTitle());
! 		list.add(e);
  	}
  
  	public int getOptionCount()
  	{
! 		return list.size();
  	}
  
  	public Object getOption(int index)
  	{
! 		Entry e = (Entry) list.get(index);
  
! 		return new Integer(e.id);
  	}
  
  	public String getLabel(int index)
  	{
! 		Entry e = (Entry) list.get(index);
  
! 		return e.title;
  	}
  
  	public String getValue(int index)
  	{
! 		Entry e = (Entry) list.get(index);
  
! 		return Integer.toString(e.id);
  	}
  
--- 17,76 ----
  public class PortletSelectionModel implements IPropertySelectionModel
  {
! 	private List _list = new ArrayList();
  
  	private static class Entry
  	{
! 		private int _id;
! 		private String _title;
  
  		Entry(int id, String title)
  		{
! 			_id = id;
! 			_title = title;
  		}
+         
+         public int getId()
+         {
+             return _id;
+         }
+ 
+         public String getTitle()
+         {
+             return _title;
+         }
+ 
  	}
  
! 	public void add(PortletChannel channel)
  	{
! 		Entry e = new Entry(channel.getId(), channel.getTitle());
!         
! 		_list.add(e);
  	}
  
  	public int getOptionCount()
  	{
! 		return _list.size();
  	}
  
  	public Object getOption(int index)
  	{
! 		Entry e = (Entry) _list.get(index);
  
! 		return new Integer(e.getId());
  	}
  
  	public String getLabel(int index)
  	{
! 		Entry e = (Entry) _list.get(index);
  
! 		return e.getTitle();
  	}
  
  	public String getValue(int index)
  	{
! 		Entry e = (Entry) _list.get(index);
  
! 		return Integer.toString(e.getId());
  	}
  

Index: Portlet.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/Portlet.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** Portlet.java	27 Nov 2002 17:58:43 -0000	1.7
--- Portlet.java	2 Jan 2003 03:15:26 -0000	1.7.2.1
***************
*** 4,10 ****
  import net.sf.tapestry.IActionListener;
  import net.sf.tapestry.IAsset;
- import net.sf.tapestry.IBinding;
  import net.sf.tapestry.IComponent;
- import net.sf.tapestry.IMarkupWriter;
  import net.sf.tapestry.IRequestCycle;
  import net.sf.tapestry.RequestCycleException;
--- 4,8 ----
***************
*** 22,77 ****
  public class Portlet extends BaseComponent
  {
!     private IBinding modelBinding;
!     private PortletModel model;
! 
!     public IBinding getModelBinding()
!     {
!         return modelBinding;
!     }
! 
!     public void setModelBinding(IBinding value)
!     {
!         modelBinding = value;
!     }
! 
!     public Object getModel()
!     {
!         return model;
!     }
! 
! 	// Simplify for new scheme
!     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException
!     {
!         try
!         {
!             model = (PortletModel) modelBinding.getObject("model", PortletModel.class);
! 
!             super.renderComponent(writer, cycle);
!         }
!         finally
!         {
!             model = null;
!         }
!     }
  
      public IAsset getChangeStateImage()
      {
!         return getAsset(model.isExpanded() ? "minimize" : "maximize");
      }
  
      public IAsset getChangeStateFocus()
      {
!         return getAsset(model.isExpanded() ? "minimizeFocus" : "maximizeFocus");
      }
  
      public String getChangeStateLabel()
      {
!         return model.isExpanded() ? "[Minimize]" : "[Maximize]";
      }
  
      public Block getBodyBlock()
      {
!         if (model.isExpanded())
!             return model.getBodyBlock(getPage().getRequestCycle());
  
          // If minimized, return null to prevent any display.
--- 20,44 ----
  public class Portlet extends BaseComponent
  {
!     private PortletModel _model;
  
      public IAsset getChangeStateImage()
      {
!         return getAsset(_model.isExpanded() ? "minimize" : "maximize");
      }
  
      public IAsset getChangeStateFocus()
      {
!         return getAsset(_model.isExpanded() ? "minimizeFocus" : "maximizeFocus");
      }
  
      public String getChangeStateLabel()
      {
!         return _model.isExpanded() ? "[Minimize]" : "[Maximize]";
      }
  
      public Block getBodyBlock()
      {
!         if (_model.isExpanded())
!             return _model.getBodyBlock(getPage().getRequestCycle());
  
          // If minimized, return null to prevent any display.
***************
*** 80,97 ****
      }
  
!     private void changeState()
      {
!         model.toggleExpanded();
      }
  
!     public IActionListener getChangeStateListener()
      {
!         return new IActionListener()
!         {
!             public void actionTriggered(IComponent component, IRequestCycle cycle) throws RequestCycleException
!             {
!                 changeState();
!             }
!         };
      }
  }
--- 47,64 ----
      }
  
!     public void changeState(IRequestCycle cycle)
      {
!         _model.toggleExpanded();        
      }
  
!     public PortletModel getModel()
      {
!         return _model;
!     }
! 
!     public void setModel(PortletModel model)
!     {
!         _model = model;
      }
+ 
  }

Index: Stock.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/Stock.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** Stock.java	27 Nov 2002 17:58:44 -0000	1.5
--- Stock.java	2 Jan 2003 03:15:26 -0000	1.5.2.1
***************
*** 3,8 ****
  import java.io.Serializable;
  
- import net.sf.tapestry.util.prop.IPublicBean;
- 
  /**
   *  Stores information about a single Stock.
--- 3,6 ----
***************
*** 13,21 ****
   **/
  
! public class Stock implements Serializable, IPublicBean
  {
!     public String tickerId;
!     public double price;
!     public double change;
  
      public Stock()
--- 11,19 ----
   **/
  
! public class Stock implements Serializable
  {
!     private String _tickerId;
!     private double _price;
!     private double _change;
  
      public Stock()
***************
*** 25,31 ****
      public Stock(String tickerId, double price, double change)
      {
!         this.tickerId = tickerId;
!         this.price = price;
!         this.change = change;
      }
  
--- 23,29 ----
      public Stock(String tickerId, double price, double change)
      {
!         _tickerId = tickerId;
!         _price = price;
!         _change = change;
      }
  
***************
*** 33,44 ****
      {
          StringBuffer buffer = new StringBuffer("Stock[");
!         buffer.append(tickerId);
          buffer.append(' ');
!         buffer.append(price);
          buffer.append(' ');
!         buffer.append(change);
          buffer.append(']');
  
          return buffer.toString();
      }
  }
--- 31,58 ----
      {
          StringBuffer buffer = new StringBuffer("Stock[");
!         buffer.append(_tickerId);
          buffer.append(' ');
!         buffer.append(_price);
          buffer.append(' ');
!         buffer.append(_change);
          buffer.append(']');
  
          return buffer.toString();
      }
+     
+     public double getChange()
+     {
+         return _change;
+     }
+ 
+     public double getPrice()
+     {
+         return _price;
+     }
+ 
+     public String getTickerId()
+     {
+         return _tickerId;
+     }
+ 
  }

Index: Visit.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/examples/Tutorial/src/tutorial/portal/Visit.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** Visit.java	27 Nov 2002 17:58:43 -0000	1.7
--- Visit.java	2 Jan 2003 03:15:26 -0000	1.7.2.1
***************
*** 19,23 ****
  public class Visit implements Serializable
  {
!     private static PortletChannel[] channels =
          {
              new PortletChannel(87, "Slashdot Headlines", "Slashdot", "content"),
--- 19,23 ----
  public class Visit implements Serializable
  {
!     private static PortletChannel[] _channels =
          {
              new PortletChannel(87, "Slashdot Headlines", "Slashdot", "content"),
***************
*** 25,46 ****
              new PortletChannel(373, "Weather", "Weather", "content")};
  
!     private List models;
  
      public void removeModel(PortletModel model)
      {
!         if (models != null)
!             models.remove(model);
      }
  
      public Collection getModels()
      {
!         return models;
      }
  
      public void addModel(int id)
      {
!         for (int i = 0; i < channels.length; i++)
          {
!             PortletChannel channel = channels[i];
  
              if (channel.getId() == id)
--- 25,46 ----
              new PortletChannel(373, "Weather", "Weather", "content")};
  
!     private List _models;
  
      public void removeModel(PortletModel model)
      {
!         if (_models != null)
!             _models.remove(model);
      }
  
      public Collection getModels()
      {
!         return _models;
      }
  
      public void addModel(int id)
      {
!         for (int i = 0; i < _channels.length; i++)
          {
!             PortletChannel channel = _channels[i];
  
              if (channel.getId() == id)
***************
*** 48,55 ****
                  PortletModel model = channel.getModel();
  
!                 if (models == null)
!                     models = new ArrayList();
  
!                 models.add(model);
  
                  return;
--- 48,55 ----
                  PortletModel model = channel.getModel();
  
!                 if (_models == null)
!                     _models = new ArrayList();
  
!                 _models.add(model);
  
                  return;
***************
*** 72,78 ****
          PortletSelectionModel model = new PortletSelectionModel();
  
!         for (int i = 0; i < channels.length; i++)
          {
!             PortletChannel channel = channels[i];
  
              if (!inUse(channel.getId()))
--- 72,78 ----
          PortletSelectionModel model = new PortletSelectionModel();
  
!         for (int i = 0; i < _channels.length; i++)
          {
!             PortletChannel channel = _channels[i];
  
              if (!inUse(channel.getId()))
***************
*** 85,95 ****
      private boolean inUse(int id)
      {
!         if (models == null)
              return false;
  
!         int count = models.size();
          for (int i = 0; i < count; i++)
          {
!             PortletModel model = (PortletModel) models.get(i);
  
              if (model.getId() == id)
--- 85,95 ----
      private boolean inUse(int id)
      {
!         if (_models == null)
              return false;
  
!         int count = _models.size();
          for (int i = 0; i < count; i++)
          {
!             PortletModel model = (PortletModel) _models.get(i);
  
              if (model.getId() == id)
***************
*** 109,116 ****
      public boolean getMaySelectPortlet()
      {
!         if (models == null)
              return true;
  
!         return models.size() < channels.length;
      }
  }
--- 109,116 ----
      public boolean getMaySelectPortlet()
      {
!         if (_models == null)
              return true;
  
!         return _models.size() < _channels.length;
      }
  }

--- Weather.page DELETED ---

--- Portlet.jwc DELETED ---

--- Stocks.page DELETED ---

--- Home.page DELETED ---

--- Border.html DELETED ---

--- Portlet.html DELETED ---

--- Slashdot.page DELETED ---

--- Border.jwc DELETED ---

--- Portal.application DELETED ---

--- Weather.html DELETED ---

--- Stocks.html DELETED ---

--- Home.html DELETED ---

--- Slashdot.html DELETED ---



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.