Fix for running against RabbitMQ 2.2
[mono.git] / mcs / class / System.Web / System.Web.UI / PostBackOptions.cs
index 04d45a4e56a5114dd69e34a16e19de4254c7830c..25368becb7220d2f967f2671fa06ba8287a0ba00 100644 (file)
@@ -4,7 +4,7 @@
 // Authors:
 //      Sanjay Gupta (gsanjay@novell.com)
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2010 Novell, Inc (http://www.novell.com)
 //
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System;
+using System.ComponentModel;
 
 namespace System.Web.UI
 {
        public sealed class PostBackOptions
        {
-               private Control control;
-               private string argument;
-               private string actionUrl;
-               private bool autoPostBack;
-               private bool requiresJavaScriptProtocol;
-               private bool trackFocus;
-               private bool clientSubmit;
-               private bool performValidation;
-               private string validationGroup;
-               
-               public PostBackOptions (Control control) : this (control, string.Empty, string.Empty, false, false, false, 
-                                                               false, false, string.Empty)
+               Control control;
+               string argument;
+               string actionUrl;
+               bool autoPostBack;
+               bool requiresJavaScriptProtocol;
+               bool trackFocus;
+               bool clientSubmit;
+               bool performValidation;
+               string validationGroup;
+
+               public PostBackOptions (Control targetControl)
+                       : this (targetControl, null, null, false, false, false, true, false, null)
                {
                }
 
-               public PostBackOptions (Control control, string argument) : this (control, argument, string.Empty, false, 
-                                                                               false, false, false, false, string.Empty)
+               public PostBackOptions (Control targetControl, string argument)
+                       : this (targetControl, argument, null, false, false, false, true, false, null)
                {
                }
 
-               public PostBackOptions (Control control, string argument, string actionUrl, bool isAutoPostBack,
-                                       bool isJavaScriptProtocolRequired, bool isTrackFocus, bool isClientSubmit,
-                                       bool isValidationPerformed, string validatingGroup)
+               public PostBackOptions (Control targetControl, string argument, string actionUrl, bool autoPostBack,
+                                       bool requiresJavaScriptProtocol, bool trackFocus, bool clientSubmit,
+                                       bool performValidation, string validationGroup)
                {
-                       this.control = control;
+                       if (targetControl == null)
+                               throw new ArgumentNullException ("targetControl");
+                       this.control = targetControl;
                        this.argument = argument;
                        this.actionUrl = actionUrl;
-                       this.autoPostBack = isAutoPostBack;
-                       this.requiresJavaScriptProtocol = isJavaScriptProtocolRequired;
-                       this.trackFocus = isTrackFocus;
-                       this.clientSubmit = isClientSubmit;
-                       this.performValidation = isValidationPerformed;
-                       this.validationGroup = validatingGroup;
+                       this.autoPostBack = autoPostBack;
+                       this.requiresJavaScriptProtocol = requiresJavaScriptProtocol;
+                       this.trackFocus = trackFocus;
+                       this.clientSubmit = clientSubmit;
+                       this.performValidation = performValidation;
+                       this.validationGroup = validationGroup;
                }
 
+               [DefaultValue ("")]
                public string ActionUrl {
                        get { return actionUrl; }
                        set { actionUrl = value; }
                }
 
+               [DefaultValue ("")]
                public string Argument {
                        get { return  argument; }
                        set { argument = value; }
                }
 
                [MonoTODO ("Implement support for this in Page")]
+               [DefaultValue (false)]
                public bool AutoPostBack {
                        get { return autoPostBack; }
                        set { autoPostBack = value; }
                }
 
+               [DefaultValue (true)]
                public bool ClientSubmit {
                        get { return clientSubmit; }
                        set { clientSubmit = value; }
                }
                
+               [DefaultValue (false)]
                public bool PerformValidation {
                        get { return performValidation; }
                        set { performValidation = value; }
                }
 
+               [DefaultValue (true)]
                public bool RequiresJavaScriptProtocol {
                        get { return requiresJavaScriptProtocol; }
                        set { requiresJavaScriptProtocol = value; }
                }
 
+               [DefaultValue (null)]
                public Control TargetControl {
                        get { return control; }
-                       set { control = value; }
                }
 
                [MonoTODO ("Implement support for this in Page")]
+               [DefaultValue (false)]
                public bool TrackFocus {
                        get { return trackFocus; }
                        set { trackFocus = value; }
                }
 
                [MonoTODO ("Implement support for this in Page")]
+               [DefaultValue ("")]
                public string ValidationGroup {
                        get { return validationGroup; }
                        set { validationGroup = value; }
@@ -121,14 +131,12 @@ namespace System.Web.UI
                // client script.
                internal bool RequiresSpecialPostBack {
                        get { 
-                               return actionUrl != "" || 
-                                               (validationGroup != "") || 
+                               return actionUrl != null || 
+                                               validationGroup != null || 
                                                trackFocus || 
                                                autoPostBack || 
-                                               argument != "";
+                                               argument != null;
                        }
                }
        }
 }
-
-#endif