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/11/15 19:01:51 UTC

svn commit: r344404 - in /struts/sandbox/trunk/overdrive/PhoneBook/Web: Controls/Lister2.ascx.cs Web.csproj

Author: husted
Date: Tue Nov 15 10:01:43 2005
New Revision: 344404

URL: http://svn.apache.org/viewcvs?rev=344404&view=rev
Log:
OVR-21
* Utilize KeyValueTemplate class. 
* Utilize new form of DataControl.Save

Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj

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=344404&r1=344403&r2=344404&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Lister2.ascx.cs Tue Nov 15 10:01:43 2005
@@ -2,6 +2,7 @@
 using System.Collections;
 using System.Web.UI;
 using System.Web.UI.WebControls;
+using Nexus.Core;
 using Nexus.Core.Helpers;
 using Nexus.Core.Profile;
 using PhoneBook.Core;
@@ -28,31 +29,16 @@
 
 		protected override IViewHelper Save(string key, ControlCollection controls)
 		{
-			IViewHelper h = GetHelperFor(SaveCommand);
+			IViewHelper h = base.Save(key,controls,false);
 			if (h.IsNominal)
 			{
-				IList configs = Configs;
-				h.Criteria[DataKeyField] = key;
-				int cols = configs.Count;
-				string[] keys = new string[2 + cols];
-				// reconstruct the standard edit column keys
-				// just as placeholders, really
-				keys[0] = SaveText;
-				keys[1] = QuitText;
-				int index = 2;
-				// append our field names to the array of keys
-				for (int i = 0; i < cols; i++)
-					keys[index++] = (configs[i] as IGridConfig).DataField;
-				ReadGridControls(controls, h.Criteria, keys, true);
-
 				bool needEditorValue = (null==h.Criteria[App.EDITOR]); 
-					// FIXME: [OVR-24] - Template columns not passed by DataGridCommandEventArgs
+				// FIXME: [OVR-24] - Template columns not passed by DataGridCommandEventArgs
 				if (needEditorValue)
 				{
 					h.Criteria[App.EDITOR] = FindControlValue(App.EDITOR);
 				}
-
-				h.Execute();
+				h.Execute();				
 			}
 			return h;
 		}
@@ -99,12 +85,27 @@
 			HasEditColumn = profile.IsEditor;
 		}
 
+
+		private IKeyValueList _EditorKeys = null;
+		private IKeyValueList EditorKeys
+		{
+			get
+			{
+				if (_EditorKeys==null)
+				{
+					IKeyValueList data = new KeyValueList();
+					// FIXME: Obtain from Spring?
+					data.Add(new KeyValue("0","NO"));
+					data.Add(new KeyValue("1","YES"));
+					_EditorKeys = data;					
+				}
+				return _EditorKeys;
+			}
+		}
+
 		private ITemplate GetList()
 		{
-			IList data = new ArrayList();
-			data.Add("0");
-			data.Add("1");
-			DropDownListTemplate list = new DropDownListTemplate(App.EDITOR,data);
+			DropDownListTemplate list = new DropDownListTemplate(App.EDITOR,EditorKeys);
 			return list;
 		}
 
@@ -137,7 +138,7 @@
 			AllowCustomPaging = true;
 
 			ITemplate editor = GetList();
-			ITemplate literal = new LiteralTemplate(App.EDITOR);
+			ITemplate literal = new KeyValueTemplate(App.EDITOR,EditorKeys);
 
 			IList list = new ArrayList(7);
 			list.Add(GetConfig(App.LAST_NAME));

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj?rev=344404&r1=344403&r2=344404&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj Tue Nov 15 10:01:43 2005
@@ -186,7 +186,7 @@
                 <File
                     RelPath = "Controls\AppGridControl.ascx.cs"
                     DependentUpon = "AppGridControl.ascx"
-                    SubType = "ASPXCodeBehind"
+                    SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
@@ -202,7 +202,7 @@
                 <File
                     RelPath = "Controls\Finder.ascx.cs"
                     DependentUpon = "Finder.ascx"
-                    SubType = "ASPXCodeBehind"
+                    SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
@@ -218,7 +218,7 @@
                 <File
                     RelPath = "Controls\Finder2.ascx.cs"
                     DependentUpon = "Finder2.ascx"
-                    SubType = "ASPXCodeBehind"
+                    SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
@@ -250,7 +250,7 @@
                 <File
                     RelPath = "Controls\Lister.ascx.cs"
                     DependentUpon = "Lister.ascx"
-                    SubType = "ASPXCodeBehind"
+                    SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
@@ -302,7 +302,7 @@
                 <File
                     RelPath = "Forms\Directory2.aspx.cs"
                     DependentUpon = "Directory2.aspx"
-                    SubType = "ASPXCodeBehind"
+                    SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File



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