Call SetEndOfSendNotification
[mono.git] / mcs / class / System.Web / System.Web / SiteMapNode.cs
index 07608b87d588303661fbd2a93882d66453578599..e1fb52011f9f6017f96a3eb4f6ee86fbda1e9d2f 100644 (file)
@@ -28,7 +28,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System.Collections;
 using System.Collections.Specialized;
 using System.Text;
@@ -40,7 +39,7 @@ using System.Resources;
 namespace System.Web {
        public class SiteMapNode : IHierarchyData, INavigateUIData, ICloneable {
        
-               private SiteMapNode () {}
+               SiteMapNode () {}
                
                public SiteMapNode (SiteMapProvider provider, string key)
                        : this (provider, key, null, null, null, null, null, null, null) {}
@@ -68,7 +67,7 @@ namespace System.Web {
                        this.roles = roles;
                        this.attributes = attributes;
                        this.resourceKeys = explicitResourceKeys;
-                       this.implicitResourceKey = implicitResourceKey;
+                       this.resourceKey = implicitResourceKey;
                }
 
                public SiteMapDataSourceView GetDataSourceView (SiteMapDataSource owner, string viewName)
@@ -92,7 +91,10 @@ namespace System.Web {
                }
 
                public virtual bool HasChildNodes {
-                       get { return ChildNodes != null && ChildNodes.Count != 0; }
+                       get {
+                               SiteMapNodeCollection childNodes = ChildNodes;
+                               return childNodes != null && childNodes.Count > 0;
+                       }
                }
 
                public SiteMapNodeCollection GetAllNodes ()
@@ -172,11 +174,12 @@ namespace System.Web {
                                parent = value;
                        }
                }
-               
+
                public virtual SiteMapNodeCollection ChildNodes {
                        get {
-                               if (childNodes != null) return childNodes;
-                               return provider.GetChildNodes (this);
+                               if (childNodes == null)
+                                       childNodes = provider.GetChildNodes (this);
+                               return childNodes;
                        } 
                        set {
                                CheckWritable ();
@@ -224,21 +227,15 @@ namespace System.Web {
                        if (attributeName == null)
                                throw new ArgumentNullException ("attributeName");
 
-                       if (String.IsNullOrEmpty (implicitResourceKey))
+                       string resourceKey = ResourceKey;
+                       if (String.IsNullOrEmpty (resourceKey))
                                return null;
 
                        try {
-                               string reskey = provider.ResourceKey;
-
-                               if (!String.IsNullOrEmpty (reskey))
-                                       reskey = reskey + "." + implicitResourceKey + "." + attributeName;
-                               else
-                                       reskey = String.Concat (implicitResourceKey, ".", attributeName);
-                               object o = HttpContext.GetGlobalResourceObject ("Web.sitemap", reskey);
+                               object o = HttpContext.GetGlobalResourceObject (provider.ResourceKey, resourceKey + "." + attributeName);
                                if (o is string)
                                        return (string) o;
-                       }
-                       catch (MissingManifestResourceException) {
+                       } catch (MissingManifestResourceException) {
                        }
                        
                        return null;
@@ -398,7 +395,11 @@ namespace System.Web {
                
                public string ResourceKey {
                        get { return resourceKey; }
-                       set { resourceKey = value; }
+                       set {
+                               if (ReadOnly)
+                                       throw new InvalidOperationException ("The node is read-only.");
+                               resourceKey = value;
+                       }
                }
                
                public string Key { get { return key; } }
@@ -437,11 +438,10 @@ namespace System.Web {
                bool readOnly;
                string resourceKey;
                SiteMapNode parent;
-               string implicitResourceKey;
                SiteMapNodeCollection childNodes;
                #endregion
                
        }
 }
-#endif
+