Author: mhabersack
Date: 2007-05-10 08:34:52 -0400 (Thu, 10 May 2007)
New Revision: 77127

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/Wizard.cs
Log:
2007-05-10  Marek Habersack  <[EMAIL PROTECTED]>

        * Wizard.cs: if a next/previous step handler modifies
        ActiveStepIndex do not, respectively, increase/decrease the
        current step, but use whatever was set in the handler.

Also set eol-style to native and removed CRLFs, plus some reformatting.


Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-05-10 12:33:31 UTC (rev 77126)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-05-10 12:34:52 UTC (rev 77127)
@@ -1,3 +1,9 @@
+2007-05-10  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * Wizard.cs: if a next/previous step handler modifies
+       ActiveStepIndex do not, respectively, increase/decrease the
+       current step, but use whatever was set in the handler.
+
 2007-05-09  Marek Habersack  <[EMAIL PROTECTED]>
 
        * TreeNodeStyleCollection.cs: do not set font's underline flag to

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Wizard.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Wizard.cs      
2007-05-10 12:33:31 UTC (rev 77126)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Wizard.cs      
2007-05-10 12:34:52 UTC (rev 77127)
@@ -206,10 +206,9 @@
                    set {
                            if (value < -1 || (value > WizardSteps.Count && 
(inited || WizardSteps.Count > 0)))
                                    throw new ArgumentOutOfRangeException ("The 
ActiveStepIndex must be less than WizardSteps.Count and at least -1");
-                           
                            if (inited && !AllowNavigationToStep (value))
                                    return;
-                           
+
                            if(activeStepIndex != value) {
                                    activeStepIndex = value;
                                    
@@ -558,7 +557,7 @@
                [DefaultValue (null)]
                [TemplateContainer (typeof(Wizard), BindingDirection.OneWay)]
                [PersistenceMode (PersistenceMode.InnerProperty)]
-           [Browsable (false)]
+               [Browsable (false)]
                public virtual ITemplate SideBarTemplate {
                        get { return sideBarTemplate; }
                        set { sideBarTemplate = value; UpdateViews (); }
@@ -849,72 +848,72 @@
                protected internal override void CreateChildControls ()
                {
                        CreateControlHierarchy ();
-               }
-
-               protected virtual void CreateControlHierarchy ()
-               {
-                       styles.Clear ();
-
-                       wizardTable = new ContainedTable (this);
-
-                       Table contentTable = wizardTable;
-
-                       if (DisplaySideBar) {
-                               contentTable = new Table ();
-                               contentTable.CellPadding = 0;
-                               contentTable.CellSpacing = 0;
-                               contentTable.Height = new Unit ("100%");
-                               contentTable.Width = new Unit ("100%");
-
-                               TableRow row = new TableRow ();
-
-                               TableCellNamingContainer sideBarCell = new 
TableCellNamingContainer ();
-                               sideBarCell.ID = "SideBarContainer";
-                               sideBarCell.ControlStyle.Height = 
Unit.Percentage (100);
-                               CreateSideBar (sideBarCell);
-                               row.Cells.Add (sideBarCell);
-
-                               TableCell contentCell = new TableCell ();
-                               contentCell.Controls.Add (contentTable);
-                               contentCell.Height = new Unit ("100%");
-                               row.Cells.Add (contentCell);
-
-                               wizardTable.Rows.Add (row);
-                       }
-
-                       AddHeaderRow (contentTable);
-
-                       TableRow viewRow = new TableRow ();
-                       TableCell viewCell = new TableCell ();
-
-                       customNavigation = null;
-                       multiView = new MultiView ();
-                       foreach (View v in WizardSteps) {
-                               if (v is TemplatedWizardStep)
-                                       InstantiateTemplateStep 
((TemplatedWizardStep) v);
-                               multiView.Views.Add (v);
-                       }
-                       multiView.ActiveViewIndex = ActiveStepIndex;
-
-                       RegisterApplyStyle (viewCell, StepStyle);
-                       viewCell.Controls.Add (multiView);
-                       viewRow.Cells.Add (viewCell);
-                       viewRow.Height = new Unit ("100%");
-                       contentTable.Rows.Add (viewRow);
-
-                       TableRow buttonRow = new TableRow ();
-                       _navigationCell = new TableCell ();
-                       _navigationCell.HorizontalAlign = HorizontalAlign.Right;
-                       RegisterApplyStyle (_navigationCell, NavigationStyle);
-                       CreateButtonBar (_navigationCell);
-                       buttonRow.Cells.Add (_navigationCell);
-                       contentTable.Rows.Add (buttonRow);
-
-                       Controls.SetReadonly (false);
-                       Controls.Add (wizardTable);
-                       Controls.SetReadonly (true);
                }
 
+               protected virtual void CreateControlHierarchy ()
+               {
+                       styles.Clear ();
+
+                       wizardTable = new ContainedTable (this);
+
+                       Table contentTable = wizardTable;
+
+                       if (DisplaySideBar) {
+                               contentTable = new Table ();
+                               contentTable.CellPadding = 0;
+                               contentTable.CellSpacing = 0;
+                               contentTable.Height = new Unit ("100%");
+                               contentTable.Width = new Unit ("100%");
+
+                               TableRow row = new TableRow ();
+
+                               TableCellNamingContainer sideBarCell = new 
TableCellNamingContainer ();
+                               sideBarCell.ID = "SideBarContainer";
+                               sideBarCell.ControlStyle.Height = 
Unit.Percentage (100);
+                               CreateSideBar (sideBarCell);
+                               row.Cells.Add (sideBarCell);
+
+                               TableCell contentCell = new TableCell ();
+                               contentCell.Controls.Add (contentTable);
+                               contentCell.Height = new Unit ("100%");
+                               row.Cells.Add (contentCell);
+
+                               wizardTable.Rows.Add (row);
+                       }
+
+                       AddHeaderRow (contentTable);
+
+                       TableRow viewRow = new TableRow ();
+                       TableCell viewCell = new TableCell ();
+
+                       customNavigation = null;
+                       multiView = new MultiView ();
+                       foreach (View v in WizardSteps) {
+                               if (v is TemplatedWizardStep)
+                                       InstantiateTemplateStep 
((TemplatedWizardStep) v);
+                               multiView.Views.Add (v);
+                       }
+                       multiView.ActiveViewIndex = ActiveStepIndex;
+
+                       RegisterApplyStyle (viewCell, StepStyle);
+                       viewCell.Controls.Add (multiView);
+                       viewRow.Cells.Add (viewCell);
+                       viewRow.Height = new Unit ("100%");
+                       contentTable.Rows.Add (viewRow);
+
+                       TableRow buttonRow = new TableRow ();
+                       _navigationCell = new TableCell ();
+                       _navigationCell.HorizontalAlign = HorizontalAlign.Right;
+                       RegisterApplyStyle (_navigationCell, NavigationStyle);
+                       CreateButtonBar (_navigationCell);
+                       buttonRow.Cells.Add (_navigationCell);
+                       contentTable.Rows.Add (buttonRow);
+
+                       Controls.SetReadonly (false);
+                       Controls.Add (wizardTable);
+                       Controls.SetReadonly (true);
+               }
+
                internal virtual void 
InstantiateTemplateStep(TemplatedWizardStep step)
                {
                        BaseWizardContainer contentTemplateContainer = new 
BaseWizardContainer ();
@@ -979,9 +978,9 @@
                        }
                        else {
                                TableRow row;
-                               AddNavButtonsTable (_stepNavContainer, out row);
+                               AddNavButtonsTable (_stepNavContainer, out row);
                                AddButtonCell (row, CreateButtonSet 
(StepPreviousButtonID, MovePreviousCommandName, false));
-                               AddButtonCell (row, CreateButtonSet 
(StepNextButtonID, MoveNextCommandName));
+                               AddButtonCell (row, CreateButtonSet 
(StepNextButtonID, MoveNextCommandName));
                                AddButtonCell (row, CreateButtonSet 
(CancelButtonID, CancelCommandName, false));
                                _stepNavContainer.ConfirmDefaultTemplate ();
                        }
@@ -997,9 +996,9 @@
                        }
                        else {
                                TableRow row;
-                               AddNavButtonsTable (_finishNavContainer, out 
row);
+                               AddNavButtonsTable (_finishNavContainer, out 
row);
                                AddButtonCell (row, CreateButtonSet 
(FinishPreviousButtonID, MovePreviousCommandName, false));
-                               AddButtonCell (row, CreateButtonSet 
(FinishButtonID, MoveCompleteCommandName));
+                               AddButtonCell (row, CreateButtonSet 
(FinishButtonID, MoveCompleteCommandName));
                                AddButtonCell (row, CreateButtonSet 
(CancelButtonID, CancelCommandName, false));
                                _finishNavContainer.ConfirmDefaultTemplate ();
                        }
@@ -1019,13 +1018,13 @@
                Control [] CreateButtonSet (string id, string command)
                {
                        return CreateButtonSet (id, command, true, null);
-               }
-
-               Control [] CreateButtonSet (string id, string command, bool 
causesValidation)
-               {
-                       return CreateButtonSet (id, command, causesValidation, 
null);
-               }
-
+               }
+
+               Control [] CreateButtonSet (string id, string command, bool 
causesValidation)
+               {
+                       return CreateButtonSet (id, command, causesValidation, 
null);
+               }
+
                internal Control [] CreateButtonSet (string id, string command, 
bool causesValidation, string validationGroup)
                {
                        return new Control [] { 
@@ -1056,7 +1055,7 @@
                        b.EnableTheming = false;
                        ((IButtonControl) b).CommandName = command;
                        ((IButtonControl) b).CausesValidation = 
causesValidation;
-                       if(!String.IsNullOrEmpty(validationGroup))
+                       if(!String.IsNullOrEmpty(validationGroup))
                                ((IButtonControl) b).ValidationGroup = 
validationGroup;
 
                        RegisterApplyStyle (b, NavigationButtonStyle);
@@ -1167,8 +1166,8 @@
                void AddHeaderRow (Table table)
                {
                        TableRow row = new TableRow ();
-                       _headerCell = new WizardHeaderCell ();
-                       _headerCell.ID = "HeaderContainer";
+                       _headerCell = new WizardHeaderCell ();
+                       _headerCell.ID = "HeaderContainer";
                        RegisterApplyStyle (_headerCell, HeaderStyle);
                        if (headerTemplate != null) {
                                headerTemplate.InstantiateIn (_headerCell);
@@ -1363,8 +1362,9 @@
                                case "MoveNext":
                                        if (ActiveStepIndex < WizardSteps.Count 
- 1) {
                                                WizardNavigationEventArgs args 
= new WizardNavigationEventArgs (ActiveStepIndex, ActiveStepIndex + 1);
+                                               int curStep = ActiveStepIndex;
                                                OnNextButtonClick (args);
-                                               if (!args.Cancel)
+                                               if (!args.Cancel && curStep == 
activeStepIndex)
                                                        ActiveStepIndex++;
                                        }
                                        break;
@@ -1372,11 +1372,13 @@
                                case "MovePrevious":
                                        if (ActiveStepIndex > 0) {
                                                WizardNavigationEventArgs args 
= new WizardNavigationEventArgs (ActiveStepIndex, ActiveStepIndex - 1);
+                                               int curStep = ActiveStepIndex;
                                                OnPreviousButtonClick (args);
                                                if (!args.Cancel) {
-                                                       if (history != null)
+                                                       if (history != null && 
activeStepIndex < curStep)
                                                                history.Remove 
(ActiveStepIndex);
-                                                       ActiveStepIndex--;
+                                                       if (curStep == 
activeStepIndex)
+                                                               
ActiveStepIndex--;
                                                }
                                        }
                                        break;
@@ -1408,9 +1410,9 @@
                                        _headerCell.Parent.Visible = false;
                                else
                                        _headerCell.Text = HeaderText;
-                       }
-
-                       if (ActiveStep.StepType == WizardStepType.Complete)
+                       }
+
+                       if (ActiveStep.StepType == WizardStepType.Complete)
                                _headerCell.Parent.Visible = false;
 
                        // sidebar
@@ -1521,13 +1523,13 @@
 
                        public bool Initialized {
                                get { return _initialized; }
-                       }
-                       
-                       public WizardHeaderCell ()
-                       {
-                               SetBindingContainer (false);
                        }
                        
+                       public WizardHeaderCell ()
+                       {
+                               SetBindingContainer (false);
+                       }
+                       
                        public void ConfirmInitState ()
                        {
                                _initialized = true;


Property changes on: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/Wizard.cs
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to