You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/09/10 21:18:20 UTC

svn commit: r280030 - in /struts/sandbox/trunk/overdrive/PhoneBook: Core/ Test/ Test/Commands/ Test/Resources/Command/ Web/ Web/Controls/ Web/Forms/ Web/Resources/Command/

Author: husted
Date: Sat Sep 10 12:18:01 2005
New Revision: 280030

URL: http://svn.apache.org/viewcvs?rev=280030&view=rev
Log:
OVR-21
* First round of refactorings toward a user-control centric architecture.

Added:
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.resx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.resx
Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/FilterLists.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj
    struts/sandbox/trunk/overdrive/PhoneBook/Web/default.htm

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj Sat Sep 10 12:18:01 2005
@@ -82,17 +82,17 @@
                 <Reference
                     Name = "Nexus.Core"
                     AssemblyName = "Nexus.Core"
-                    HintPath = "..\..\Nexus\Core\bin\Debug\Nexus.Core.dll"
-                />
-                <Reference
-                    Name = "Agility.Core"
-                    AssemblyName = "Agility.Core"
-                    HintPath = "..\..\Nexus\Core\bin\Debug\Agility.Core.dll"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Core.dll"
                 />
                 <Reference
                     Name = "IBatisNet.DataMapper"
                     AssemblyName = "IBatisNet.DataMapper"
-                    HintPath = "..\..\iBatisNet.bin\IBatisNet.DataMapper.dll"
+                    HintPath = "..\..\local-cache\iBatisNet\IBatisNet.DataMapper.dll"
+                />
+                <Reference
+                    Name = "Agility.Core"
+                    AssemblyName = "Agility.Core"
+                    HintPath = "..\..\local-cache\Agility\Agility.Core.dll"
                 />
             </References>
         </Build>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/DirectoryViewTest.cs Sat Sep 10 12:18:01 2005
@@ -11,14 +11,16 @@
 	[TestFixture]
 	public class DirectoryViewTest : BaseTest
 	{
+
 		/// <summary>
-		/// Confirm that Context contains the expected attributes for the list filters.
+		/// Confirm that Context contains the expected attributes for the list filter-0ps.
 		/// </summary>
 		/// 
 		[Test]
 		public void ContainsFilters ()
 		{
 			IRequestContext context = catalog.ExecuteRequest (App.DIRECTORY_VIEW);
+			this.AssertNominal(context);
 			string[] FILTERS = {App.LAST_NAME_LIST, App.FIRST_NAME_LIST, App.EXTENSION_LIST, App.USER_NAME_LIST, App.HIRED_LIST, App.HOURS_LIST};
 			foreach (string filter in FILTERS)
 			{
@@ -32,7 +34,7 @@
 		[Test]
 		public void HelperContains ()
 		{
-			IViewHelper helper = catalog.GetHelper (App.DIRECTORY_FIND_HELPER);
+			IViewHelper helper = catalog.GetHelperFor (App.DIRECTORY_VIEW);
 			IRequestCommand command = helper.Command;
 			Assert.IsNotNull (command, "Expected Helper to have a Command");
 			Assert.AreEqual (App.DIRECTORY_VIEW, command.ID, "Expected Helper to have View Command.");

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/FilterLists.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/FilterLists.cs?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/FilterLists.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/FilterLists.cs Sat Sep 10 12:18:01 2005
@@ -71,7 +71,7 @@
 
 		private IKeyValueList FilterList (string key)
 		{
-			IViewHelper helper = catalog.GetHelper (App.DIRECTORY_FIND_HELPER);
+			IViewHelper helper = catalog.GetHelperFor (App.DIRECTORY_VIEW);
 			helper.Execute ();
 			IKeyValueList list = helper.Criteria [key] as IKeyValueList;
 			Assert.IsNotNull (list, "Expected KeyValueList");

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs Sat Sep 10 12:18:01 2005
@@ -27,6 +27,7 @@
 	[TestFixture]
 	public class SelectAllTest : BaseTest
 	{
+		
 		/// <summary>
 		/// Assert result of SelectAll, after another method runs the command.
 		/// </summary>
@@ -61,8 +62,9 @@
 		[Test]
 		public void FilterHelper_Format ()
 		{
-			IViewHelper helper = catalog.GetHelper (App.DIRECTORY_LIST_HELPER);
+			IViewHelper helper = catalog.GetHelperFor (App.ENTRY_LIST);
 			helper.Execute ();
+			AssertNominal(helper);
 			AppEntryList list = helper.Outcome as AppEntryList;
 			Assert.IsNotNull (list, "Expected list to be AppEntryList");
 			AppEntry row = list [0] as AppEntry;

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml Sat Sep 10 12:18:01 2005
@@ -156,7 +156,7 @@
 	  <property name="FieldTable"><ref object="FieldTable"/></property>
 	  <property name="PreOp"><ref object="pre-op"/></property>
 	  <property name="PostOp"><ref object="post-op"/></property>
+	  <property name="ViewHelper"><object type="Nexus.Web.WebHelper" singleton="false"/></property>
   </object>
  
-
 </objects>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Test.csproj Sat Sep 10 12:18:01 2005
@@ -16,7 +16,7 @@
                 DefaultTargetSchema = "IE50"
                 DelaySign = "false"
                 OutputType = "Library"
-                PreBuildEvent = ""
+                PreBuildEvent = "$(SolutionDir)prebuild $(SolutionDir)"
                 PostBuildEvent = ""
                 RootNamespace = "PhoneBook.Core"
                 RunPostBuildEvent = "OnBuildSuccess"
@@ -86,26 +86,6 @@
                     AssemblyFolderKey = "hklm\dn\nunit.framework"
                 />
                 <Reference
-                    Name = "Nexus.Core"
-                    AssemblyName = "Nexus.Core"
-                    HintPath = "..\..\Nexus\Core\bin\Debug\Nexus.Core.dll"
-                />
-                <Reference
-                    Name = "Nexus.Test"
-                    AssemblyName = "Nexus.Test"
-                    HintPath = "..\..\Nexus\Test\bin\Debug\Nexus.Test.dll"
-                />
-                <Reference
-                    Name = "Agility.Core"
-                    AssemblyName = "Agility.Core"
-                    HintPath = "..\..\Nexus\Core\bin\Debug\Agility.Core.dll"
-                />
-                <Reference
-                    Name = "ByteFX.MySqlClient"
-                    AssemblyName = "ByteFX.MySqlClient"
-                    HintPath = "..\..\iBatisNet.bin\ByteFX.MySqlClient.dll"
-                />
-                <Reference
                     Name = "Core"
                     Project = "{3150F3E8-9A04-4FED-B16F-CEA57756E934}"
                     Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
@@ -113,17 +93,32 @@
                 <Reference
                     Name = "NUnitAspTest"
                     AssemblyName = "NUnitAspTest"
-                    HintPath = "..\..\NUnitAsp.bin\NUnitAspTest.dll"
+                    HintPath = "..\..\local-cache\NUnitAsp\NUnitAspTest.dll"
                 />
                 <Reference
                     Name = "NUnitAsp"
                     AssemblyName = "NUnitAsp"
-                    HintPath = "..\..\NUnitAsp.bin\NUnitAsp.dll"
+                    HintPath = "..\..\local-cache\NUnitAsp\NUnitAsp.dll"
                 />
                 <Reference
-                    Name = "Web"
-                    Project = "{948EE344-D033-4358-88E8-77FDE080D93C}"
-                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+                    Name = "Nexus.Core"
+                    AssemblyName = "Nexus.Core"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Core.dll"
+                />
+                <Reference
+                    Name = "Nexus.Test"
+                    AssemblyName = "Nexus.Test"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Test.dll"
+                />
+                <Reference
+                    Name = "Agility.Core"
+                    AssemblyName = "Agility.Core"
+                    HintPath = "..\..\local-cache\Agility\Agility.Core.dll"
+                />
+                <Reference
+                    Name = "Nexus.Web"
+                    AssemblyName = "Nexus.Web"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Web.dll"
                 />
             </References>
         </Build>

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx?rev=280030&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx Sat Sep 10 12:18:01 2005
@@ -0,0 +1,24 @@
+<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Finder.ascx.cs" Inherits="PhoneBook.Web.Controls.Finder" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
+<table>
+	<tr>
+		<td colspan="6" >
+			<asp:Button ID="find" Runat="server"></asp:Button>
+			<INPUT onclick="javascript:window.print();" type="button" value="PRINT" name="print" id="print">
+		</td>
+	<tr>
+		<td>Last Name</td>
+		<td>First Name</td>
+		<td>Extension</td>
+		<td>User</td>
+		<td>Hire Date</td>
+		<td>Hours</td>			  
+	</tr>
+	<tr>
+		<td><asp:DropDownList ID="last_name_list" Runat=server></asp:DropDownList></td>
+		<td><asp:DropDownList ID="first_name_list" Runat=server></asp:DropDownList></td>
+		<td><asp:DropDownList ID="extension_list" Runat=server></asp:DropDownList></td>
+		<td><asp:DropDownList ID="user_name_list" Runat=server></asp:DropDownList></td>
+		<td><asp:DropDownList ID="hired_list" Runat=server></asp:DropDownList></td>
+		<td><asp:DropDownList ID="hours_list" Runat=server></asp:DropDownList></td>
+	 </tr>
+</table>

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs?rev=280030&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.cs Sat Sep 10 12:18:01 2005
@@ -0,0 +1,105 @@
+using System;
+using System.Web.UI.WebControls;
+using Nexus.Core.Helpers;
+using Nexus.Web.Controls;
+using PhoneBook.Core;
+using PhoneBook.Web.Forms;
+
+namespace PhoneBook.Web.Controls
+{
+	public class Finder : ViewControl
+	{
+
+		protected DropDownList last_name_list;
+		protected DropDownList first_name_list;
+		protected DropDownList extension_list;
+		protected DropDownList user_name_list;
+		protected DropDownList hired_list;
+		protected DropDownList hours_list;
+		protected Button find;
+
+		/// <summary>
+		/// Fires when search criteria is input.
+		/// </summary>
+		public event EventHandler Click;
+
+		private DropDownList[] FilterList ()
+		{
+			DropDownList[] lists = {last_name_list, first_name_list, extension_list, user_name_list, hired_list, hours_list};
+			return lists;
+		}
+
+		private void Filter_Reset (DropDownList except)
+		{
+			int exceptIndex = 0;
+			if (except != null) exceptIndex = except.SelectedIndex;
+			foreach (DropDownList filter in FilterList ())
+			{
+				filter.SelectedIndex = 0;
+			}
+			if (except != null) except.SelectedIndex = exceptIndex;
+		}
+
+		private void Filter_Changed (object sender, EventArgs e)
+		{
+			IViewHelper helper = Catalog.GetHelperFor(App.ENTRY_LIST);
+			DropDownList list = sender as DropDownList;
+			string id = list.ID;
+			int v = id.LastIndexOf (helper.ListSuffix);
+			string key = id.Substring (0, v);
+			helper.Criteria [key] = list.SelectedValue;
+			Filter_Reset (list);
+			Click(this, new ViewArgs(helper));
+		}
+
+		public void Open ()
+		{
+			IViewHelper h = this.ExecuteBind(App.DIRECTORY_VIEW);
+			bool ok = (h.IsNominal);
+			if (!ok)
+				Page_Error = h;
+		}
+
+		private void find_Click (object sender, EventArgs e)
+		{
+			if (Click == null) return;
+			Filter_Reset (null);
+			IViewHelper helper = Read(App.DIRECTORY_VIEW);
+			Click(this, new ViewArgs(helper));
+		}
+
+		private void Page_Load(object sender, System.EventArgs e)
+		{
+			find.Text = Directory.msg_LIST_ALL_CMD;
+			find.Click += new EventHandler (find_Click);
+
+			foreach (DropDownList filter in FilterList ())
+			{
+				filter.AutoPostBack = true;
+				filter.SelectedIndexChanged += new EventHandler (Filter_Changed);
+			}
+
+			Open();
+		}
+
+		#region Web Form Designer generated code
+		override protected void OnInit(EventArgs e)
+		{
+			//
+			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
+			//
+			InitializeComponent();
+			base.OnInit(e);
+		}
+		
+		/// <summary>
+		///		Required method for Designer support - do not modify
+		///		the contents of this method with the code editor.
+		/// </summary>
+		private void InitializeComponent()
+		{
+			this.Load += new System.EventHandler(this.Page_Load);
+		}
+		#endregion
+	}
+}

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.resx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.resx?rev=280030&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.resx (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder.ascx.resx Sat Sep 10 12:18:01 2005
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+	<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+		<xsd:element name="root" msdata:IsDataSet="true">
+			<xsd:complexType>
+				<xsd:choice maxOccurs="unbounded">
+					<xsd:element name="data">
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+								<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+							</xsd:sequence>
+							<xsd:attribute name="name" type="xsd:string" />
+							<xsd:attribute name="type" type="xsd:string" />
+							<xsd:attribute name="mimetype" type="xsd:string" />
+						</xsd:complexType>
+					</xsd:element>
+					<xsd:element name="resheader">
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+							</xsd:sequence>
+							<xsd:attribute name="name" type="xsd:string" use="required" />
+						</xsd:complexType>
+					</xsd:element>
+				</xsd:choice>
+			</xsd:complexType>
+		</xsd:element>
+	</xsd:schema>
+	<resheader name="ResMimeType">
+		<value>text/microsoft-resx</value>
+	</resheader>
+	<resheader name="Version">
+		<value>1.0.0.0</value>
+	</resheader>
+	<resheader name="Reader">
+		<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+	</resheader>
+	<resheader name="Writer">
+		<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+	</resheader>
+</root>

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx?rev=280030&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx Sat Sep 10 12:18:01 2005
@@ -0,0 +1,13 @@
+<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Lister.ascx.cs" Inherits="PhoneBook.Web.Controls.Lister" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
+<asp:DataGrid id="list" Runat="server" AutoGenerateColumns=False>
+	<HeaderStyle CssClass="HeaderStyle" BackColor="#CCCC99"></HeaderStyle>
+	<AlternatingItemStyle CssClass="AlternatingItemStyle" BackColor="#CCCC99"></AlternatingItemStyle>
+	<Columns>
+		<asp:BoundColumn DataField="last_name" HeaderText="Last Name"></asp:BoundColumn>
+		<asp:BoundColumn DataField="first_name" HeaderText="First Name"></asp:BoundColumn>
+		<asp:BoundColumn DataField="extension" HeaderText="Extension"></asp:BoundColumn>
+		<asp:BoundColumn DataField="user_name" HeaderText="User"></asp:BoundColumn>
+		<asp:BoundColumn DataField="hired" HeaderText="Hire Date"></asp:BoundColumn>
+		<asp:BoundColumn DataField="hours" HeaderText="Hours"></asp:BoundColumn>
+		</Columns>
+</asp:DataGrid>

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs?rev=280030&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.cs Sat Sep 10 12:18:01 2005
@@ -0,0 +1,54 @@
+using System;
+using System.Collections;
+using System.Web.UI.WebControls;
+using Nexus.Core.Helpers;
+using Nexus.Web.Controls;
+using PhoneBook.Core;
+
+namespace PhoneBook.Web.Controls
+{
+	public class Lister : ViewControl
+	{
+
+		protected DataGrid list;
+
+		public void Open(IDictionary criteria)
+		{
+			IViewHelper helper = ReadExecute(App.ENTRY_LIST, criteria);
+			bool ok = helper.IsNominal;
+			if (!ok) Page_Error = helper;
+			else
+			{
+				IList result = helper.Outcome;
+				list.DataSource = result;
+				list.DataBind ();
+			}			
+		}
+
+		private void Page_Load(object sender, System.EventArgs e)
+		{
+			if (IsPostBack) return;
+			Open(null);
+		}
+
+		#region Web Form Designer generated code
+		override protected void OnInit(EventArgs e)
+		{
+			//
+			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
+			//
+			InitializeComponent();
+			base.OnInit(e);
+		}
+		
+		/// <summary>
+		///		Required method for Designer support - do not modify
+		///		the contents of this method with the code editor.
+		/// </summary>
+		private void InitializeComponent()
+		{
+			this.Load += new System.EventHandler(this.Page_Load);
+		}
+		#endregion
+	}
+}

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.resx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.resx?rev=280030&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.resx (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister.ascx.resx Sat Sep 10 12:18:01 2005
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+	<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+		<xsd:element name="root" msdata:IsDataSet="true">
+			<xsd:complexType>
+				<xsd:choice maxOccurs="unbounded">
+					<xsd:element name="data">
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+								<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+							</xsd:sequence>
+							<xsd:attribute name="name" type="xsd:string" />
+							<xsd:attribute name="type" type="xsd:string" />
+							<xsd:attribute name="mimetype" type="xsd:string" />
+						</xsd:complexType>
+					</xsd:element>
+					<xsd:element name="resheader">
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+							</xsd:sequence>
+							<xsd:attribute name="name" type="xsd:string" use="required" />
+						</xsd:complexType>
+					</xsd:element>
+				</xsd:choice>
+			</xsd:complexType>
+		</xsd:element>
+	</xsd:schema>
+	<resheader name="ResMimeType">
+		<value>text/microsoft-resx</value>
+	</resheader>
+	<resheader name="Version">
+		<value>1.0.0.0</value>
+	</resheader>
+	<resheader name="Reader">
+		<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+	</resheader>
+	<resheader name="Writer">
+		<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+	</resheader>
+</root>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx Sat Sep 10 12:18:01 2005
@@ -1,4 +1,7 @@
 <%@ Page language="c#" Codebehind="Directory.aspx.cs" AutoEventWireup="true" Inherits="PhoneBook.Web.Forms.Directory" %>
+<%@ Register TagPrefix="my" TagName="Finder" Src="../Controls/Finder.ascx" %>
+<%@ Register TagPrefix="my" TagName="Lister" Src="../Controls/Lister.ascx" %>
+
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 <HTML>
 	<HEAD>
@@ -22,45 +25,9 @@
 			<!-- PROMPT -->
 			<p>Select a filter to display fewer entries.</p>	
 
-			<!-- FIND -->
-			<asp:Panel ID="pnlFind" Runat="server">
-			  <table><tr>
-			  <td colspan="6" >
-				  <asp:Button ID="cmdListAll" Runat="server"></asp:Button>
-				  <INPUT onclick="javascript:window.print();" type="button" value="PRINT" name="cmd_print" id="cmd_print">
-			  </td>
-			  <tr>
-			  <td>Last Name</td>
-			  <td>First Name</td>
-			  <td>Extension</td>
-			  <td>User</td>
-			  <td>Hire Date</td>
-			  <td>Hours</td>			  
-			  </tr><tr>
-			  <td><asp:DropDownList ID="last_name_list" Runat=server></asp:DropDownList></td>
-			  <td><asp:DropDownList ID="first_name_list" Runat=server></asp:DropDownList></td>
-			  <td><asp:DropDownList ID="extension_list" Runat=server></asp:DropDownList></td>
-			  <td><asp:DropDownList ID="user_name_list" Runat=server></asp:DropDownList></td>
-			  <td><asp:DropDownList ID="hired_list" Runat=server></asp:DropDownList></td>
-			  <td><asp:DropDownList ID="hours_list" Runat=server></asp:DropDownList></td>
-			  </tr></table>
-			</asp:panel>
+			<my:Finder id="finder" Runat="server" OnClick="finder_Click"></my:Finder>
 			
-			<!-- LIST -->			
-			<asp:Panel ID="pnlList" Runat="server">
-            	<asp:DataGrid id="repList" Runat="server" AutoGenerateColumns=False>
-					<HeaderStyle CssClass="HeaderStyle" BackColor="#CCCC99"></HeaderStyle>
-					<AlternatingItemStyle CssClass="AlternatingItemStyle" BackColor="#CCCC99"></AlternatingItemStyle>
-					<Columns>
-						<asp:BoundColumn DataField="last_name" HeaderText="Last Name"></asp:BoundColumn>
-						<asp:BoundColumn DataField="first_name" HeaderText="First Name"></asp:BoundColumn>
-						<asp:BoundColumn DataField="extension" HeaderText="Extension"></asp:BoundColumn>
-						<asp:BoundColumn DataField="user_name" HeaderText="User"></asp:BoundColumn>
-						<asp:BoundColumn DataField="hired" HeaderText="Hire Date"></asp:BoundColumn>
-						<asp:BoundColumn DataField="hours" HeaderText="Hours"></asp:BoundColumn>
-					</Columns>
-            	</asp:DataGrid>
-			</asp:Panel>
+ 			<my:Lister id="lister" runat="server" OnClick="lister_Click"></my:Lister>
 
 		</form>
 	</body>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs Sat Sep 10 12:18:01 2005
@@ -1,8 +1,10 @@
 using System;
-using System.Collections;
 using System.Web.UI;
 using System.Web.UI.WebControls;
+using Nexus.Core;
 using Nexus.Core.Helpers;
+using Nexus.Web.Controls;
+using PhoneBook.Web.Controls;
 
 namespace PhoneBook.Web.Forms
 {
@@ -14,7 +16,7 @@
 	{
 		#region Messages
 
-		private const string msg_LIST_ALL_CMD = "SHOW ALL";
+		public const string msg_LIST_ALL_CMD = "SHOW ALL";
 
 		#endregion
 
@@ -35,137 +37,65 @@
 			}
 		}
 
-		#endregion
-
-		#region Helpers
+		private IRequestCatalog _Catalog;
 
-		private IViewHelper _FindHelper;
 		/// <summary>
-		/// Display the filter lists.
+		/// Helper passed by an enclosing control (e.g. Page).
 		/// </summary>
-		///
-		public virtual IViewHelper FindHelper
+		/// <remarks><p>
+		/// Subclasses adding EventHandlers 
+		/// should pass a reference to themselves with a ViewArgs instance, 
+		/// encapsulating the Helper.
+		/// </p></remarks>
+		public virtual IRequestCatalog Catalog
 		{
-			get { return _FindHelper; }
-			set { _FindHelper = value; }
-		}
-
-		/// <summary>
-		/// Apply filter and display matching entries.
-		/// </summary>
-		///
-		private IViewHelper _ListHelper;
-		public virtual IViewHelper ListHelper
-		{
-			get { return _ListHelper; }
-			set { _ListHelper = value; }
+			get { return _Catalog; }
+			set { _Catalog = value; }
 		}
 
 		#endregion
 
-		#region Find
-
-		protected Panel pnlFind;
-		protected DropDownList last_name_list;
-		protected DropDownList first_name_list;
-		protected DropDownList extension_list;
-		protected DropDownList user_name_list;
-		protected DropDownList hired_list;
-		protected DropDownList hours_list;
-		protected Button cmdListAll;
-
-		private DropDownList[] FilterList ()
-		{
-			DropDownList[] lists = {last_name_list, first_name_list, extension_list, user_name_list, hired_list, hours_list};
-			return lists;
-		}
+		#region Control Events
 
-		private void Find_Init ()
-		{
-			cmdListAll.Text = msg_LIST_ALL_CMD;
-			cmdListAll.Click += new EventHandler (ListAll_Click);
+		protected Lister lister;
+		protected Finder finder;
 
-			foreach (DropDownList filter in FilterList ())
-			{
-				filter.AutoPostBack = true;
-				filter.SelectedIndexChanged += new EventHandler (Filter_Changed);
-			}
-		}
-
-		private void Filter_Reset (DropDownList except)
+		protected void finder_Click(object sender, EventArgs e)
 		{
-			int exceptIndex = 0;
-			if (except != null) exceptIndex = except.SelectedIndex;
-			foreach (DropDownList filter in FilterList ())
-			{
-				filter.SelectedIndex = 0;
-			}
-			if (except != null) except.SelectedIndex = exceptIndex;
+			ViewArgs a = e as ViewArgs;
+			IViewHelper helper = a.Helper;
+			lister.Open(helper.Criteria);
 		}
 
-		private void Filter_Changed (object sender, EventArgs e)
-		{
-			DropDownList list = sender as DropDownList;
-			string id = list.ID;
-			int v = id.LastIndexOf (ListHelper.ListSuffix);
-			string key = id.Substring (0, v);
-			ListHelper.Criteria [key] = list.SelectedValue;
-			Filter_Reset (list);
-			List_Load (ListHelper);
-		}
+		#endregion
 
-		private void Find_Load ()
-		{
-			IViewHelper h = FindHelper;
-			h.ExecuteBind (pnlFind.Controls);
-			bool ok = (h.IsNominal);
-			if (!ok)
-				Page_Error = h;
-		}
+		#region Page Events
 
-		private void ListAll_Click (object sender, EventArgs e)
+		private void View_Error(object sender, EventArgs e)
 		{
-			Filter_Reset (null);
-			List_Load (ListHelper);
+			ViewArgs v = e as ViewArgs;
+			if (v==null) throw new ArgumentException("View_Error: !(e is ViewArgs)");
+			IViewHelper helper = v.Helper;
+			if (helper != null) Page_Error = helper;
+			else throw new ArgumentException("View_Error: (e.helper==null)");
 		}
 
-		#endregion
-
-		#region List
-
-		protected Panel pnlList;
-		protected DataGrid repList;
-
-		private void List_Load (IViewHelper helper)
+		private void View_Init(ViewControl c)
 		{
-			helper.Execute ();
-			bool ok = helper.IsNominal;
-			if (!ok) Page_Error = helper;
-			else
-			{
-				IList result = helper.Outcome;
-				repList.DataSource = result;
-				repList.DataBind ();
-			}
+			c.View_Error += new EventHandler(View_Error);
+			c.Catalog = this.Catalog; // ISSUE: Why isn't control injection working?
 		}
 
-		#endregion
-
-		#region Page Events
-
 		protected void Page_Init ()
 		{
 			pnlError.Visible = false;
-			Find_Init ();
+			View_Init(finder);
+			View_Init(lister);
 		}
 
 		protected void Page_Load (object sender, EventArgs e)
 		{
-			if (!IsPostBack)
-			{
-				Find_Load ();
-				List_Load (ListHelper);
-			}
+			// Put user code to initialize the page here
 		}
 
 		#endregion

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config Sat Sep 10 12:18:01 2005
@@ -16,14 +16,25 @@
     <objects xmlns="http://www.springframework.net">
     
 		<object id="Directory" type="Directory.aspx">
-			<property name="FindHelper"><ref object="directory_find_helper"/></property>		
-			<property name="ListHelper"><ref object="directory_list_helper"/></property>		
+			<property name="Catalog">
+				<ref object="Catalog"/>
+			</property>		
 		</object>
               
 		<object id="Directory2" type="Directory2.aspx">
 			<property name="GridHelper"><ref object="directory_grid_helper"/></property>
 			<property name="UserHelper"><ref object="directory_entry_helper"/></property>
 		</object>
+
+	   <!-- User Controls -->
+	   
+		<object id="ViewControl" abstract="true">
+			<property name="Catalog">
+				<ref object="Catalog"/>
+			</property>		
+		</object>
+		<object id="PhoneBook.Web.Controls.Finder" abstract="true" parent="ViewControl"/>	   	    		              
+		<object id="PhoneBook.Web.Controls.Lister" abstract="true" parent="ViewControl"/>
 
    </objects>
 

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml Sat Sep 10 12:18:01 2005
@@ -161,7 +161,7 @@
 	  <property name="FieldTable"><ref object="FieldTable"/></property>
 	  <property name="PreOp"><ref object="pre-op"/></property>
 	  <property name="PostOp"><ref object="post-op"/></property>
-  </object>
+	  <property name="ViewHelper"><object type="Nexus.Web.WebHelper" singleton="false"/></property>
+ </object>
  
-
 </objects>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj Sat Sep 10 12:18:01 2005
@@ -16,7 +16,7 @@
                 DefaultTargetSchema = "IE50"
                 DelaySign = "false"
                 OutputType = "Library"
-                PreBuildEvent = ""
+                PreBuildEvent = "$(SolutionDir)prebuild $(SolutionDir)"
                 PostBuildEvent = ""
                 RootNamespace = "PhoneBook.Web"
                 RunPostBuildEvent = "OnBuildSuccess"
@@ -90,44 +90,44 @@
                     HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
                 />
                 <Reference
+                    Name = "Nexus.Core"
+                    AssemblyName = "Nexus.Core"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Core.dll"
+                />
+                <Reference
                     Name = "Core"
                     Project = "{3150F3E8-9A04-4FED-B16F-CEA57756E934}"
                     Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
                 />
                 <Reference
-                    Name = "Agility.Core"
-                    AssemblyName = "Agility.Core"
-                    HintPath = "..\..\Agility\Core\bin\Debug\Agility.Core.dll"
-                />
-                <Reference
-                    Name = "Nexus.Core"
-                    AssemblyName = "Nexus.Core"
-                    HintPath = "..\..\Nexus\Core\bin\Debug\Nexus.Core.dll"
+                    Name = "Nexus.Web"
+                    AssemblyName = "Nexus.Web"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Web.dll"
                 />
                 <Reference
                     Name = "Spring.Core"
                     AssemblyName = "Spring.Core"
-                    HintPath = "..\..\SpringNet.bin\Spring.Core.dll"
+                    HintPath = "..\..\local-cache\SpringNet\Spring.Core.dll"
                 />
                 <Reference
                     Name = "Spring.Web"
                     AssemblyName = "Spring.Web"
-                    HintPath = "..\..\SpringNet.bin\Spring.Web.dll"
+                    HintPath = "..\..\local-cache\SpringNet\Spring.Web.dll"
                 />
                 <Reference
-                    Name = "Nexus.Extras"
-                    AssemblyName = "Nexus.Extras"
-                    HintPath = "..\..\Nexus\Extras\bin\Debug\Nexus.Extras.dll"
+                    Name = "ByteFX.MySqlClient"
+                    AssemblyName = "ByteFX.MySqlClient"
+                    HintPath = "..\..\local-cache\iBatisNet\ByteFX.MySqlClient.dll"
                 />
                 <Reference
-                    Name = "Nexus.Web"
-                    AssemblyName = "Nexus.Web"
-                    HintPath = "..\..\Nexus\Web\bin\Nexus.Web.dll"
+                    Name = "Agility.Core"
+                    AssemblyName = "Agility.Core"
+                    HintPath = "..\..\local-cache\Agility\Agility.Core.dll"
                 />
                 <Reference
-                    Name = "ByteFX.MySqlClient"
-                    AssemblyName = "ByteFX.MySqlClient"
-                    HintPath = "..\..\iBatisNet.bin\ByteFX.MySqlClient.dll"
+                    Name = "Nexus.Extras"
+                    AssemblyName = "Nexus.Extras"
+                    HintPath = "..\..\local-cache\Nexus\Nexus.Extras.dll"
                 />
             </References>
         </Build>
@@ -182,6 +182,38 @@
                 <File
                     RelPath = "Web.config"
                     BuildAction = "Content"
+                />
+                <File
+                    RelPath = "Controls\Finder.ascx"
+                    SubType = "UserControl"
+                    BuildAction = "Content"
+                />
+                <File
+                    RelPath = "Controls\Finder.ascx.cs"
+                    DependentUpon = "Finder.ascx"
+                    SubType = "ASPXCodeBehind"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Controls\Finder.ascx.resx"
+                    DependentUpon = "Finder.ascx.cs"
+                    BuildAction = "EmbeddedResource"
+                />
+                <File
+                    RelPath = "Controls\Lister.ascx"
+                    SubType = "UserControl"
+                    BuildAction = "Content"
+                />
+                <File
+                    RelPath = "Controls\Lister.ascx.cs"
+                    DependentUpon = "Lister.ascx"
+                    SubType = "ASPXCodeBehind"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Controls\Lister.ascx.resx"
+                    DependentUpon = "Lister.ascx.cs"
+                    BuildAction = "EmbeddedResource"
                 />
                 <File
                     RelPath = "Forms\default.css"

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/default.htm
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/default.htm?rev=280030&r1=280029&r2=280030&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/default.htm (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/default.htm Sat Sep 10 12:18:01 2005
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
 	<head>
-		<META HTTP-EQUIV="Refresh" CONTENT="0;URL=./Forms/Directory2.aspx">
+		<META HTTP-EQUIV="Refresh" CONTENT="0;URL=./Forms/Directory.aspx">
 	</head>
 	<body>
 		<p>Loading...</p>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org