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/19 16:28:04 UTC

svn commit: r290171 - in /struts/sandbox/trunk/overdrive/PhoneBook: Core/AppEntry.cs Core/AppUserProfile.cs Web/Controls/Finder2.ascx.cs Web/Controls/Lister2.ascx.cs Web/Forms/Directory2.aspx Web/Forms/Directory2.aspx.cs

Author: husted
Date: Mon Sep 19 07:27:55 2005
New Revision: 290171

URL: http://svn.apache.org/viewcvs?rev=290171&view=rev
Log:
OVR-21
* Bind events from code-behind. Other changes to synch with r290168.

Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs?rev=290171&r1=290170&r2=290171&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppEntry.cs Mon Sep 19 07:27:55 2005
@@ -23,7 +23,6 @@
 	/// 
 	public class AppEntry
 	{
-
 		private IDictionary _Value = new Hashtable(5);
 
 		public void AddAll(IDictionary sources)
@@ -31,10 +30,10 @@
 			ICollection keys = sources.Keys;
 			foreach (string key in keys)
 			{
-				Add (key,sources[key] as string);
+				Add(key, sources[key] as string);
 			}
 		}
-		
+
 		public void Add(string key, string value)
 		{
 			_Value.Add(key, value);

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs?rev=290171&r1=290170&r2=290171&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppUserProfile.cs Mon Sep 19 07:27:55 2005
@@ -25,7 +25,7 @@
 			set
 			{
 				_Entry = value;
-				if (_Entry!=null)
+				if (_Entry != null)
 				{
 					StringBuilder sb = new StringBuilder();
 					sb.Append(_Entry.first_name);

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs?rev=290171&r1=290170&r2=290171&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs Mon Sep 19 07:27:55 2005
@@ -9,7 +9,6 @@
 {
 	public class Finder2 : ViewControl
 	{
-
 		protected Button find;
 
 		/// <summary>
@@ -70,7 +69,8 @@
 				if (IsListControl(c))
 				{
 					DropDownList x = (DropDownList) c;
-					x.SelectedIndexChanged += new EventHandler(Filter_Changed);;
+					x.SelectedIndexChanged += new EventHandler(Filter_Changed);
+					;
 					x.AutoPostBack = true;
 				}
 			}

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs?rev=290171&r1=290170&r2=290171&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs Mon Sep 19 07:27:55 2005
@@ -25,15 +25,9 @@
 			}
 		}
 
-		public void Reset(IDictionary criteria)
-		{
-			list_ResetIndex();
-			Open(criteria);			
-		}
-
 		private static string LABEL = "_label";
 
-		private void SetProperties()
+		private void Grid_Load()
 		{
 			FindCommand = App.ENTRY_FIND;
 			ListCommand = App.ENTRY_LIST;
@@ -71,7 +65,7 @@
 
 		private void Page_Load(object sender, EventArgs e)
 		{
-			SetProperties();
+			Grid_Load();
 			add.Click += new EventHandler(list_Add);
 			add.Text = GetMessage(add.ID);
 		}

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx?rev=290171&r1=290170&r2=290171&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx Mon Sep 19 07:27:55 2005
@@ -31,9 +31,9 @@
 			<hr>
 			</asp:Panel>
 						
-			<app:Finder id="finder" Runat="server" OnClick="finder_Click"></app:Finder>
+			<app:Finder id="finder" Runat="server"></app:Finder>
 			
- 			<app:Lister id="lister" runat="server" OnClick="lister_Click"></app:Lister>
+ 			<app:Lister id="lister" runat="server"></app:Lister>
 			
 		</form>
 	</body>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs?rev=290171&r1=290170&r2=290171&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs Mon Sep 19 07:27:55 2005
@@ -18,14 +18,7 @@
 	/// 
 	public class Directory2 : Page
 	{
-		#region Page Properties 
-
-		protected HtmlGenericControl title;
-		protected HtmlGenericControl heading;
-		protected Label greeting;
-		protected Label profile_label;
-		protected Panel error_panel;
-		protected Label error_label;
+		#region Base Page members
 
 		private AppUserProfile _Profile;
 
@@ -65,7 +58,7 @@
 				// ISSUE: Need constant for "1" (true)
 				bool isEditor = ((editor != null) && (editor.Equals("1")));
 				profile.IsEditor = isEditor;
-				if (editor!=null)
+				if (editor != null)
 				{
 					AppEntry entry = new AppEntry();
 					entry.AddAll(helper.Criteria);
@@ -114,6 +107,39 @@
 			set { _Catalog = value; }
 		}
 
+		private void View_Error(object sender, EventArgs e)
+		{
+			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)");
+		}
+
+		private void View_Init(ViewControl c)
+		{
+			c.View_Error += new EventHandler(View_Error);
+			c.Catalog = this.Catalog; // ISSUE: Why isn't control injection working?
+		}
+
+		private void Page_PreRender(object sender, EventArgs e)
+		{
+			greeting.Text = GetMessage(greeting.ID);
+			title.InnerText = GetMessage(App.DIRECTORY_TITLE);
+			heading.InnerText = GetMessage(App.DIRECTORY_HEADING);
+		}
+
+		#endregion
+
+		#region Page Properties 
+
+		protected HtmlGenericControl title;
+		protected HtmlGenericControl heading;
+		protected Label greeting;
+		protected Label profile_label;
+		protected Panel error_panel;
+		protected Label error_label;
+
 		#endregion
 
 		#region Event handlers
@@ -132,26 +158,14 @@
 
 		#region Page Events
 
-		private void View_Error(object sender, EventArgs e)
-		{
-			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)");
-		}
-
-		private void View_Init(ViewControl c)
-		{
-			c.View_Error += new EventHandler(View_Error);
-			c.Catalog = this.Catalog; // ISSUE: Why isn't control injection working?
-		}
-
 		private void Page_Init()
 		{
 			Profile = Session[UserProfile.USER_PROFILE] as AppUserProfile;
+			this.PreRender += new EventHandler(this.Page_PreRender);
+
 			View_Init(finder);
 			View_Init(lister);
+			finder.Click += new EventHandler(finder_Click);
 		}
 
 		private void Page_Load(object sender, EventArgs e)
@@ -161,22 +175,15 @@
 			{
 				Page_Prompt = GetMessage(App.DIRECTORY_PROMPT);
 				string name = Profile.FullName;
-				if (name==null)			
-					profile_label.Text = Profile.UserId;					
-				else 
+				if (name == null)
+					profile_label.Text = Profile.UserId;
+				else
 					profile_label.Text = name;
 				// UserLocale = Profile.Locale;
 				finder.Open();
 			}
 		}
 
-		private void Page_PreRender(object sender, EventArgs e)
-		{
-			greeting.Text = GetMessage(greeting.ID);
-			title.InnerText = GetMessage(App.DIRECTORY_TITLE);
-			heading.InnerText = GetMessage(App.DIRECTORY_HEADING);
-		}
-
 		#endregion
 
 		#region Web Form Designer generated code
@@ -198,7 +205,6 @@
 		private void InitializeComponent()
 		{
 			this.Load += new EventHandler(this.Page_Load);
-			this.PreRender += new EventHandler(this.Page_PreRender);
 		}
 
 		#endregion



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