Author: husted
Date: Wed Jun 22 16:33:26 2005
New Revision: 193027

URL: http://svn.apache.org/viewcvs?rev=193027&view=rev
Log:
OVR-7
OVR-11
* Add Constructor to seed Context from an IDictionary
* Correct operation of helper.Outcome to be relative to Criteria. 
** This functionalty implies that a Collection Processor can move the Context 
Outcome to the Criteria (as formatted strings) under the same attribute.

Modified:
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Validators/Validator.cs

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs?rev=193027&r1=193026&r2=193027&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs Wed Jun 22 
16:33:26 2005
@@ -96,12 +96,16 @@
                /// <summary>
                /// Access result of operation as an IList.
                /// </summary>
-               /// <remarks>
+               /// <remarks><p>
                /// If the Helper is designed to return a List result, 
                /// this method saves casting the outcome.
                /// If the Helper is not designed to return the result as a 
IList, 
                /// this method returns a single-value result as a one-entry 
list.
-               /// </remarks>
+               /// </p><p>
+               /// Note this since this is the Helper Outcome, 
+               /// the result is relative to the Criteria, 
+               /// rather than the main Context.
+               /// </p></remarks>
                /// 
                IList Outcome { get; }
 

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs?rev=193027&r1=193026&r2=193027&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs Wed Jun 22 
16:33:26 2005
@@ -95,7 +95,7 @@
                        get
                        {
                                IList result = null;
-                               object o = Context.Outcome;
+                               object o = Context.Criteria[Context.Command];
                                if (o == null)
                                {
                                        result = new ArrayList (1);

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs?rev=193027&r1=193026&r2=193027&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs Wed Jun 22 
16:33:26 2005
@@ -55,6 +55,14 @@
                        Command = command;
                }
 
+               public RequestContext(IDictionary entries)
+               {
+                       foreach (DictionaryEntry entry in entries)
+                       {
+                               Add(entry.Key,entry.Value);
+                       }
+               }
+
                /// <summary>
                /// Default, no argument constructor.
                /// </summary>

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs?rev=193027&r1=193026&r2=193027&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Tables/FieldTable.cs Wed Jun 22 
16:33:26 2005
@@ -37,7 +37,7 @@
                        set
                        {
                                if (value == null)
-                                       throw new ArgumentNullException 
("value", "Nexus.Core.Tables.FieldTable.AddFieldContext");
+                                       throw new ArgumentNullException ("value 
is null or wrong type", "Nexus.Core.Tables.FieldTable.AddFieldContext");
                                Field [value.ID] = value;
                        }
                }
@@ -47,7 +47,7 @@
                        set
                        {
                                if (value == null)
-                                       throw new ArgumentNullException 
("value", "Nexus.Core.Tables.FieldTable.AddFieldContexts");
+                                       throw new ArgumentNullException ("value 
is null or wrong type", "Nexus.Core.Tables.FieldTable.AddFieldContexts");
                                IEnumerator elements = value.GetEnumerator ();
                                while (elements.MoveNext ()) AddFieldContext = 
elements.Current as IFieldContext;
                        }

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Validators/Validator.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Validators/Validator.cs?rev=193027&r1=193026&r2=193027&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Validators/Validator.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Validators/Validator.cs Wed Jun 
22 16:33:26 2005
@@ -33,6 +33,57 @@
                        set { _Template = value; }
                }
 
+               public virtual bool ExecuteConvert (IProcessorContext context)
+               {
+                       bool okay = false;
+                       string id = context.FieldKey;
+                       IFieldTable table = context.FieldTable;
+                       IFieldContext fieldContext = table.GetFieldContext 
(id); // enforces Strict
+
+                       if ((fieldContext == null))
+                       {
+                               context.Target = context.Source;
+                               return true;
+                       }
+
+                       IProcessor processor = table.GetProcessor 
(fieldContext.ProcessorID);
+                       okay = processor.ConvertInput (context);
+                       return okay;
+               }
+
+               public virtual bool ExecuteFormat (IProcessorContext context)
+               {
+                       bool okay = false;
+                       string id = context.FieldKey;
+                       object source = context.Source;
+                       IFieldTable table = context.FieldTable;
+                       IFieldContext fieldContext = table.GetFieldContext 
(id); // Enforces Strict
+
+                       if ((fieldContext == null))
+                       {
+                               if (source == null)
+                                       context.Target = null;
+                               else
+                               {
+                                       // TODO: Remove exception code and 
replace with Collection processors
+                                       Type sourceType = source.GetType ();
+                                       if (IsCollectionType (sourceType)) 
context.Target = source;
+                                       else context.Target = source.ToString 
();
+                               }
+                               return true;
+                       }
+
+                       IProcessor processor = table.GetProcessor 
(fieldContext.ProcessorID);
+                       okay = processor.FormatOutput (context);
+                       return okay;
+               }
+
+               private bool IsCollectionType (Type dataType)
+               {
+                       bool v = (typeof (ICollection)).IsAssignableFrom 
(dataType);
+                       return (v);
+               }
+
                public abstract bool ExecuteProcess (IProcessorContext context);
 
                #endregion
@@ -112,55 +163,5 @@
 
                #endregion
 
-               public virtual bool ExecuteConvert (IProcessorContext context)
-               {
-                       bool okay = false;
-                       string id = context.FieldKey;
-                       IFieldTable table = context.FieldTable;
-                       IFieldContext fieldContext = table.GetFieldContext 
(id); // enforces Strict
-
-                       if ((fieldContext == null))
-                       {
-                               context.Target = context.Source;
-                               return true;
-                       }
-
-                       IProcessor processor = table.GetProcessor 
(fieldContext.ProcessorID);
-                       okay = processor.ConvertInput (context);
-                       return okay;
-               }
-
-               public virtual bool ExecuteFormat (IProcessorContext context)
-               {
-                       bool okay = false;
-                       string id = context.FieldKey;
-                       object source = context.Source;
-                       IFieldTable table = context.FieldTable;
-                       IFieldContext fieldContext = table.GetFieldContext 
(id); // Enforces Strict
-
-                       if ((fieldContext == null))
-                       {
-                               if (source == null)
-                                       context.Target = null;
-                               else
-                               {
-                                       // TODO: Remove exception code and 
replace with Collection processors
-                                       Type sourceType = source.GetType ();
-                                       if (IsCollectionType (sourceType)) 
context.Target = source;
-                                       else context.Target = source.ToString 
();
-                               }
-                               return true;
-                       }
-
-                       IProcessor processor = table.GetProcessor 
(fieldContext.ProcessorID);
-                       okay = processor.FormatOutput (context);
-                       return okay;
-               }
-
-               private bool IsCollectionType (Type dataType)
-               {
-                       bool v = (typeof (ICollection)).IsAssignableFrom 
(dataType);
-                       return (v);
-               }
        }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to