Return-Path: Delivered-To: apmail-struts-commits-archive@locus.apache.org Received: (qmail 95697 invoked from network); 6 Jan 2007 01:04:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jan 2007 01:04:15 -0000 Received: (qmail 56736 invoked by uid 500); 6 Jan 2007 01:04:19 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 56689 invoked by uid 500); 6 Jan 2007 01:04:19 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 56677 invoked by uid 99); 6 Jan 2007 01:04:19 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jan 2007 17:04:19 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jan 2007 17:04:11 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 1D91E1A981A; Fri, 5 Jan 2007 17:03:13 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r493264 - in /struts/sandbox/trunk/overdrive/PhoneBook2: ./ projects/Core/ projects/Core/Commands/ projects/Test/ projects/Web/ Date: Sat, 06 Jan 2007 01:03:12 -0000 To: commits@struts.apache.org From: husted@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070106010313.1D91E1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: husted Date: Fri Jan 5 17:03:09 2007 New Revision: 493264 URL: http://svn.apache.org/viewvc?view=rev&rev=493264 Log: PhoneBook2 - Add formatting test, conform AppEntry with latest Nexus, refine workflow. Modified: struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntry.cs struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntryList.cs struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/Commands/BaseEntry.cs struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/TelephoneProcessor.cs struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Objects.xml struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.ashx struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.html Modified: struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln Fri Jan 5 17:03:09 2007 @@ -27,6 +27,11 @@ VWDPort = "3594" EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F5B697F2-0FFC-4459-BCBB-5F6F4DB01D64}" + ProjectSection(SolutionItems) = preProject + ..\Nexus\Core\Validators\DateTimeProcessor.cs = ..\Nexus\Core\Validators\DateTimeProcessor.cs + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntry.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntry.cs?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntry.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntry.cs Fri Jan 5 17:03:09 2007 @@ -15,6 +15,7 @@ */ using System; using System.Collections; +using Nexus.Core; namespace PhoneBook.Core { @@ -23,73 +24,41 @@ /// /// [Serializable] - public class AppEntry + public class AppEntry : EntryDictionary { - /// - /// Internal storage. - /// - /// - private IDictionary _Value = new Hashtable(5); - /// - /// Add each source entry to our internal store. - /// - ///

- /// Entries with keys that match the property names will be exposed. - /// Other entries may be added, but can only be retrieved via Get. - ///

- /// Entries to add - /// - public void AddAll(IDictionary sources) + public AppEntry() { - ICollection keys = sources.Keys; - foreach (string key in keys) - { - Add(key, sources[key] as string); - } + // Default contstructor } - /// - /// Add a single entry to our internal store. - /// - ///

- /// Entries with keys that match the property names will be exposed. - /// Other entries may be added, but can only be retrieved via Get. - ///

- /// ID for entry - /// Content for entry - /// - public void Add(string key, string value) + public AppEntry(IDictionary sources) { - _Value.Add(key, value); + AddAll(sources); } - /// - /// Provide the value corresponding to key from the internal store. - /// - /// ID for entry - /// Content for entry - /// - public string Get(string key) + public AppEntry(AppEntry row) { - return _Value[key] as string; + AddAll(row); } /// - /// Set an entry to the internal store, overwriting any existing entry. + /// Add each source entry to our internal store. /// ///

- /// This is a protected method used by the Properties. - /// Use an existing Property to set values, - /// or extend the class to include other Properties. + /// Entries with keys that match the property names will be exposed. + /// Other entries may be added, but can only be retrieved via Get. ///

- /// - /// - protected void Set(string key, string value) + /// Entries to add + /// + public void AddAll(AppEntry row) { - _Value[key] = value; + ICollection keys = row.Keys; + foreach (string key in keys) + { + Add(key, row.Get(key)); + } } - /* public string Property Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntryList.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntryList.cs?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntryList.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/AppEntryList.cs Fri Jan 5 17:03:09 2007 @@ -1,3 +1,4 @@ +using System; using System.Collections; using Nexus.Core; @@ -21,7 +22,11 @@ { AppEntry entry = new AppEntry(); foreach (DictionaryEntry col in row) - entry.Add(col.Key.ToString(), col.Value.ToString()); + { + string key = Convert.ToString(col.Key); + string value = Convert.ToString(col.Value); + entry.Add(key, value); + } Add(entry); } @@ -30,4 +35,4 @@ return (AppEntry[])ToArray(typeof(AppEntry)); } } -} \ No newline at end of file +} Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/Commands/BaseEntry.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/Commands/BaseEntry.cs?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/Commands/BaseEntry.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/Commands/BaseEntry.cs Fri Jan 5 17:03:09 2007 @@ -29,13 +29,18 @@ public override bool RequestExecute(IRequestContext context) { object o = Mapper.QueryForObject(QueryID, context); - context[ID] = o; - IDictionary entry = o as IDictionary; - foreach (DictionaryEntry e in entry) - { - context[e.Key] = e.Value; - } - return CONTINUE; + IDictionary result = o as IDictionary; + + ICollection keys = result.Keys; + foreach (string key in keys) + { + context[key] = result[key]; + } + + AppEntry entry = new AppEntry(result); + context[ID] = entry; + + return CONTINUE; } } } Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/TelephoneProcessor.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/TelephoneProcessor.cs?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/TelephoneProcessor.cs (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Core/TelephoneProcessor.cs Fri Jan 5 17:03:09 2007 @@ -43,7 +43,7 @@ string mark = "-"; if (output == null) return false; - string buffer = null; + string buffer; if (output.Length == 10) { Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Objects.xml URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Objects.xml?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Objects.xml (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Objects.xml Fri Jan 5 17:03:09 2007 @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd"> - - - - + + + + Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj Fri Jan 5 17:03:09 2007 @@ -73,6 +73,7 @@ + Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.ashx URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.ashx?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.ashx (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.ashx Fri Jan 5 17:03:09 2007 @@ -48,13 +48,13 @@ [JsonRpcMethod(App.ENTRY_LIST, Idempotent = true)] [JsonRpcHelp("Returns the complete directory as an array of formatted IDictionary objects.")] - public AppEntry[] entry_list() + public AppEntryList entry_list() { IViewHelper helper = GetCatalog().GetHelperFor(App.ENTRY_LIST); helper.Execute(); // if helper.IsNominal ... AppEntryList list = helper.Outcome as AppEntryList; - return list.ToAppEntryArray(); + return list; } [JsonRpcMethod(App.ENTRY, Idempotent = true)] @@ -65,18 +65,20 @@ helper.Criteria[App.ENTRY_KEY] = key; helper.Execute(); // if helper.IsNominal ... - return helper.Outcome[0] as AppEntry; + AppEntry entry = new AppEntry(helper.Criteria); + return entry; } [JsonRpcMethod(App.ENTRY_SAVE, Idempotent = true)] [JsonRpcHelp("Saves the entry, insert or updating as appropriate.")] - public IDictionary entry_save(IDictionary input) + public AppEntry entry_save(IDictionary input) { IViewHelper helper = GetCatalog().GetHelperFor(App.ENTRY_SAVE); helper.Read(input,true); helper.Execute(); // if helper.IsNominal ... - return helper.Outcome[0] as IDictionary; + AppEntry entry = new AppEntry(helper.Criteria); + return entry; } } Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.html URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.html?view=diff&rev=493264&r1=493263&r2=493264 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.html (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/PhoneBook.html Fri Jan 5 17:03:09 2007 @@ -21,7 +21,7 @@ { var bindArgs = { url: call.url+'?rpc', - error: function(type, data, evt){alert("Error Communicating with Server: " + data);}, + error: function(type, data, evt){alert("Error Communicating with Server: " + data.result);}, method: "POST", mimetype: "text/json", handle: call.callback, @@ -47,10 +47,7 @@ function entry_list_select_result(evt) { var table = dojo.widget.byId("entry_list"); - var row = table.getSelectedData(); - var user_name = row.user_name; - var entry_key = row.entry_key; - alert(user_name + " (" + entry_key + ") is selected."); + entry_edit(table.getSelectedData().entry_key); } function entry_list_select() { dojo.event.connect(dojo.byId("entry_list"), "onSelect", entry_list_select_result); @@ -83,6 +80,17 @@ /* editor */ + function entry_edit_result(type, data, evt) + { + var w = dojo.widget.byId("entry_form"); + w.setValues(data.result); + + } + function entry_edit(entry_key) + { + PhoneBook.rpc.entry(entry_key,entry_edit_result).call(server); + } + function entry_save_result(type, data, evt) { alert ( "Added: " + data.result.user_name + " (" + data.result.entry_key + ")" ); @@ -158,29 +166,8 @@ - -
-
- - - - - - - - - - - - - - -
First Name
Last Name
Extension
User Name
Hired
Hours
- - -
-
-
+ +
- +

+
+ +
+
+
+ + + + + + + + + + + + + +
First Name
Last Name
Extension
User Name
Hired
Hours
+ + +
+ +
+