Merge pull request #1936 from esdrubal/DotNetRelativeOrAbsolute
[mono.git] / mcs / class / System.Web / Test / System.Web.UI.WebControls / BoundFieldTest.cs
1 //
2 // Tests for System.Web.UI.WebControls.BoundFieldTest.cs
3 //
4 // Author:
5 //      Yoni Klein (yonik@mainsoft.com)
6 //
7 //
8 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
29
30
31 using System;
32 using System.Collections.Generic;
33 using System.Text;
34 using System.Web;
35 using System.Web.UI;
36 using System.Web.UI.WebControls;
37 using System.IO;
38 using System.Drawing;
39 using System.Collections;
40 using System.Collections.Specialized;
41 using Image = System.Web.UI.WebControls.Image;
42 using NUnit.Framework;
43 using System.Globalization;
44 using MonoTests.SystemWeb.Framework;
45 using MonoTests.stand_alone.WebHarness;
46
47
48
49 namespace MonoTests.System.Web.UI.WebControls
50 {
51         class EncodingTest
52         {
53                 public override string ToString ()
54                 {
55                         return "<EncodingTest>&";
56                 }
57         }
58
59         class PokerBoundField : BoundField
60         {
61                 public Button bindbutoon;
62
63                 public PokerBoundField () {
64                         TrackViewState ();
65                         bindbutoon = new Button ();
66                         bindbutoon.DataBinding += new EventHandler (OnDataBindField);
67                 }
68
69
70                 public StateBag StateBag {
71                         get { return base.ViewState; }
72                 }
73
74                 public bool DoSupportsHtmlEncode {
75                         get {
76                                 return base.SupportsHtmlEncode;
77                         }
78                 }
79
80                 public void DoCopyProperties (DataControlField newField) {
81                         base.CopyProperties (newField);
82                 }
83
84                 public DataControlField DoCreateField () {
85                         return base.CreateField ();
86                 }
87
88                 public string DoFormatDataValue (object dataValue, bool encode) {
89                         return this.FormatDataValue (dataValue, encode);
90                 }
91
92                 public object DoGetDesignTimeValue () {
93                         return base.GetDesignTimeValue ();
94                 }
95
96                 public object DoGetValue (Control controlContainer) {
97                         return base.GetValue (controlContainer);
98                 }
99
100                 public void DoInitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState) {
101                         base.InitializeDataCell (cell, rowState);
102                 }
103
104                 public void DoOnDataBindField (object sender, EventArgs e) {
105                         base.OnDataBindField (sender, e);
106                 }
107
108                 public Control GetControl {
109                         get { return base.Control; }
110                 }
111
112                 public object DoSaveViewState ()
113                 {
114                         return SaveViewState ();
115                 }
116         }
117
118
119         [Serializable]
120         [TestFixture]
121         public class BoundFieldTest
122         {
123                 [TestFixtureSetUp]
124                 public void SetUp ()
125                 {
126                         WebTest.CopyResource (GetType (), "BoundField_Bug646505.aspx", "BoundField_Bug646505.aspx");
127                         WebTest.CopyResource (GetType (), "BoundField_Bug646505.aspx.cs", "BoundField_Bug646505.aspx.cs");
128                 }
129
130                 [Test (Description="Bug 646505")]
131                 public void BoundField_Bug646505 ()
132                 {
133                         string originalHtml = "<div>\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\n\t\t<tr>\n\t\t\t<th scope=\"col\">&nbsp;</th><th scope=\"col\">&nbsp;</th>\n\t\t</tr><tr>\n\t\t\t<td><a href=\"javascript:__doPostBack(&#39;gridView$ctl02$ctl00&#39;,&#39;&#39;)\">Update</a>&nbsp;<a href=\"javascript:__doPostBack(&#39;gridView&#39;,&#39;Cancel$0&#39;)\">Cancel</a></td><td><input name=\"gridView$ctl02$ctl02\" type=\"text\" value=\"False\" /></td>\n\t\t</tr><tr>\n\t\t\t<td><a href=\"javascript:__doPostBack(&#39;gridView&#39;,&#39;Edit$1&#39;)\">Edit</a></td><td>False</td>\n\t\t</tr>\n\t</table>\n</div>\n";
134                         WebTest t = new WebTest ("BoundField_Bug646505.aspx");
135                         t.Run ();
136
137                         FormRequest fr = new FormRequest (t.Response, "form1");
138                         fr.Controls.Add ("__EVENTTARGET");
139                         fr.Controls.Add ("__EVENTARGUMENT");
140                         fr.Controls ["__EVENTTARGET"].Value = "gridView";
141                         fr.Controls ["__EVENTARGUMENT"].Value = "Edit$0";
142                         t.Request = fr;
143                         string pageHtml = t.Run ();
144                         string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
145
146                         HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
147                 }
148                 
149                 [Test]
150                 public void BoundField_DefaultProperty () {
151                         PokerBoundField bf = new PokerBoundField ();
152                         Assert.AreEqual ("!", PokerBoundField.ThisExpression, "StaticThisExpression");
153                         Assert.AreEqual ("", bf.DataField, "DataField");
154                         Assert.AreEqual ("", bf.DataFormatString, "DataFormatString");
155                         Assert.AreEqual ("", bf.HeaderText, "HeaderText");
156                         Assert.AreEqual (true, bf.HtmlEncode, "HtmlEncode");
157                         Assert.AreEqual ("", bf.NullDisplayText, "NullDisplayText");
158                         Assert.AreEqual (false, bf.ReadOnly, "ReadOnly");
159
160                         //Protected 
161                         Assert.AreEqual (true, bf.DoSupportsHtmlEncode, "SupportsHtmlEncode");
162                 }
163
164                 [Test]
165                 public void BoundField_DefaultPropertyNotWorking () {
166                         PokerBoundField bf = new PokerBoundField ();
167                         Assert.AreEqual (false, bf.ApplyFormatInEditMode, "ApplyFormatInEditMode");
168                         Assert.AreEqual (true, bf.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
169                 }
170
171                 [Test]
172                 public void BoundField_AssignProperty () {
173                         PokerBoundField bf = new PokerBoundField ();
174                         bf.ConvertEmptyStringToNull = false;
175                         Assert.AreEqual (false, bf.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
176                         bf.DataField = "test";
177                         Assert.AreEqual ("test", bf.DataField, "DataField");
178                         bf.DataFormatString = "test";
179                         Assert.AreEqual ("test", bf.DataFormatString, "DataFormatString");
180                         bf.HeaderText = "test";
181                         Assert.AreEqual ("test", bf.HeaderText, "HeaderText");
182                         bf.HtmlEncode = false;
183                         Assert.AreEqual (false, bf.HtmlEncode, "HtmlEncode");
184                         bf.NullDisplayText = "test";
185                         Assert.AreEqual ("test", bf.NullDisplayText, "NullDisplayText");
186                         bf.ReadOnly = true;
187                         Assert.AreEqual (true, bf.ReadOnly, "ReadOnly");
188                 }
189
190                 [Test]
191                 public void BoundField_AssignPropertyNotWorking () {
192                         PokerBoundField bf = new PokerBoundField ();
193                         bf.ApplyFormatInEditMode = true;
194                         Assert.AreEqual (true, bf.ApplyFormatInEditMode, "ApplyFormatInEditMode");
195                 }
196
197                 [Test]
198                 public void BoundField_ExtractValuesFromCell () {
199                         PokerBoundField bf = new PokerBoundField ();
200                         OrderedDictionary dictionary = new OrderedDictionary ();
201                         DataControlFieldCell cell = new DataControlFieldCell (null);
202                         cell.Text = "test";
203                         bf.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true);
204                         Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount");
205                         Assert.AreEqual ("test", dictionary [0].ToString (), "ExtractValuesFromCellValue");
206                 }
207
208                 [Test]
209                 public void BoundField_Initialize () {
210                         // This method initilize to private fields in a base class DataControlField 
211                         // Always return false
212                         PokerBoundField bf = new PokerBoundField ();
213                         Control control = new Control ();
214                         control.ID = "test";
215                         bool res = bf.Initialize (true, control);
216                         // Assert.AreEqual (false, res, "InitializeResult");
217                         Assert.AreEqual ("test", bf.GetControl.ID, "InitializeControl");
218                 }
219
220                 [Test]
221                 public void BoundField_InitializeCell () {
222                         PokerBoundField bf = new PokerBoundField ();
223                         // Header text
224                         DataControlFieldCell cell = new DataControlFieldCell (null);
225                         bf.HeaderText = "headertext";
226
227                         bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1);
228                         Assert.AreEqual ("headertext", cell.Text, "InitializeCellHeaderText");
229                         // Empty header text
230                         bf.HeaderText = "";
231                         bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1);
232                         Assert.AreEqual ("&nbsp;", cell.Text, "InitializeCellEmpty");
233
234                         bf.HeaderText = "headertext";
235                         // Header image url not empty
236                         bf.HeaderImageUrl = "headerurl";
237                         bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1);
238                         if (cell.Controls [0] is Image) {
239                                 Image image = (Image) cell.Controls [0];
240                                 Assert.AreEqual ("headerurl", image.ImageUrl, "InitializeCellHeaderImageUrl");
241                         }
242                         else {
243                                 Assert.Fail ("Header Image dos not created");
244                         }
245
246                         // Footer empty
247                         bf.FooterText = "footertext";
248                         bf.InitializeCell (cell, DataControlCellType.Footer, DataControlRowState.Edit, 1);
249                         Assert.AreEqual ("footertext", cell.Text, "InitializeCellFooterText");
250                         bf.FooterText = "";
251                         bf.InitializeCell (cell, DataControlCellType.Footer, DataControlRowState.Edit, 1);
252                         Assert.AreEqual ("&nbsp;", cell.Text, "InitializeCellFooterEmpty");
253                 }
254
255                 [Test]
256                 public void BoundField_ValidateSupportsCallback () {
257                         //This method has been implemented as an empty method           
258                 }
259
260                 [Test]
261                 public void BoundField_SortExpression () {
262                         // Sorting enable = true , link button must be created
263                         PokerBoundField bf = new PokerBoundField ();
264                         // Header text
265                         DataControlFieldCell cell = new DataControlFieldCell (null);
266
267                         bf.HeaderImageUrl = "";
268                         bf.SortExpression = "a";
269                         bf.HeaderText = "sortbutton";
270                         bf.Initialize (true, new Control ());    // _base._sortingenable set to true
271                         bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1);
272                         if (cell.Controls [0] is Button) { // mono
273                                 Button lb = (Button) cell.Controls [0];
274                                 Assert.AreEqual ("Sort", lb.CommandName, "InitializeCellHeaderSortButtonCommand");
275                                 Assert.AreEqual ("a", lb.CommandArgument, "InitializeCellHeaderSortButtonArgument");
276                                 Assert.AreEqual ("sortbutton", lb.Text, "InitializeCellHeaderSortButtonText");
277
278                         }
279                         else if (cell.Controls [0] is LinkButton) { // .net
280                                 LinkButton lb = (LinkButton) cell.Controls [0];
281                                 Assert.AreEqual ("Sort", lb.CommandName, "InitializeCellHeaderSortButtonCommand");
282                                 Assert.AreEqual ("a", lb.CommandArgument, "InitializeCellHeaderSortButtonArgument");
283                                 Assert.AreEqual ("sortbutton", lb.Text, "InitializeCellHeaderSortButtonText");
284
285                         }
286                         else {
287                                 Assert.Fail ("Sort button does not created");
288                         }
289                 }
290
291
292                 [Test]
293                 public void BoundField_CopyProperties () {
294                         PokerBoundField bf = new PokerBoundField ();
295                         BoundField copy = new BoundField ();
296                         // Look not working property
297                         // bf.ApplyFormatInEditMode = true;
298                         bf.ConvertEmptyStringToNull = true;
299                         bf.DataField = "test";
300                         bf.DataFormatString = "test";
301                         bf.HtmlEncode = true;
302                         bf.NullDisplayText = "test";
303                         bf.ReadOnly = true;
304                         bf.DoCopyProperties (copy);
305                         // Look not working property
306                         // Assert.AreEqual (true, copy.ApplyFormatInEditMode, "ApplyFormatInEditMode");
307                         Assert.AreEqual (true, copy.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
308                         Assert.AreEqual ("test", copy.DataField, "DataField");
309                         Assert.AreEqual ("test", copy.DataFormatString, "DataFormatString");
310                         Assert.AreEqual (true, copy.HtmlEncode, "HtmlEncode");
311                         Assert.AreEqual ("test", copy.NullDisplayText, "NullDisplayText");
312                         Assert.AreEqual (true, copy.ReadOnly, "ReadOnly");
313                 }
314
315                 [Test]
316                 public void BoundField_CreateField () {
317                         PokerBoundField bf = new PokerBoundField ();
318                         BoundField newfield = (BoundField) bf.DoCreateField ();
319                         Assert.IsNotNull (newfield, "CreateField");
320                 }
321
322                 [Test]
323                 public void BoundField_FormatDataValue () {
324                         string result;
325                         PokerBoundField bf = new PokerBoundField ();
326
327                         bf.NullDisplayText = "NullDisplayText";
328                         result = bf.DoFormatDataValue (null, false);
329                         Assert.AreEqual ("NullDisplayText", result, "FormatDataValueNullDataValue");
330
331                         result = bf.DoFormatDataValue ("test", true);
332                         Assert.AreEqual ("test", result, "FormatDataValueTextDataValue");
333
334                         result = bf.DoFormatDataValue ("", true);
335                         Assert.AreEqual ("NullDisplayText", result, "FormatEmptyDataValue");
336
337                         bf.DataFormatString = "-{0,8:G}-";
338                         result = bf.DoFormatDataValue (10, false);
339                         Assert.AreEqual ("-      10-", result, "FormatDataValueWithFormat");
340
341                         bf.DataFormatString = "-{0:X}-";
342                         result = bf.DoFormatDataValue (10, true);
343                         Assert.AreEqual ("-A-", result, "FormatDataValueWithFormatAndHtmlEncode");
344
345                         bf.DataFormatString = "-{0:X}-";
346                         result = bf.DoFormatDataValue (10, false);
347                         Assert.AreEqual ("-A-", result, "FormatDataValueWithFormatAndNoHtmlEncode");
348
349                         bf.HtmlEncodeFormatString = false;
350                         bf.DataFormatString = "-{0:X}-";
351                         result = bf.DoFormatDataValue (10, true);
352                         Assert.AreEqual ("-10-", result, "NoHtmlEncodeFormatString_HtmlEncode");
353
354                         bf.DataFormatString = "-{0:X}-";
355                         result = bf.DoFormatDataValue (10, false);
356                         Assert.AreEqual ("-A-", result, "NoHtmlEncodeFormatString_NoHtmlEncode");
357                 }
358
359                 [Test]
360                 public void HtmlEncodeFormatString ()
361                 {
362                         string formatString = "<script>alert ('{0}');</script>"; 
363                         var bf = new PokerBoundField ();
364
365                         Assert.IsTrue (bf.HtmlEncodeFormatString, "#A1-2");
366                         Assert.IsTrue (bf.HtmlEncode, "#A1-2");
367                         Assert.IsTrue (bf.DoSupportsHtmlEncode, "#A1-3");
368
369                         bf.DataFormatString = formatString;
370                         Assert.AreEqual ("&lt;script&gt;alert (&#39;&lt;test&gt;&#39;);&lt;/script&gt;", bf.DoFormatDataValue ("<test>", true), "#A2");
371                         Assert.AreEqual (String.Format (formatString, "<test>"), bf.DoFormatDataValue ("<test>", false), "#A3");
372
373                         bf.HtmlEncodeFormatString = false;
374                         Assert.AreEqual ("<script>alert ('&lt;test&gt;');</script>", bf.DoFormatDataValue ("<test>", true), "#A4");
375
376                         var ec = new EncodingTest ();
377                         bf.HtmlEncodeFormatString = true;
378                         Assert.AreEqual ("&lt;script&gt;alert (&#39;&lt;EncodingTest&gt;&amp;&#39;);&lt;/script&gt;", bf.DoFormatDataValue (ec, true), "#A4");
379                 }
380
381                 [Test]
382                 public void BoundField_GetDesignTimeValue () {
383                         string result;
384                         PokerBoundField bf = new PokerBoundField ();
385                         result = (string) bf.DoGetDesignTimeValue ();
386                         Assert.AreEqual ("Databound", result, "GetDesignTimeValue");
387                 }
388
389                 [Test]
390                 [ExpectedException(typeof(HttpException), ExpectedMessage="A data item was not found in the container. The container must either implement IDataItemContainer, or have a property named DataItem.")]
391                 public void BoundField_GetValueNull () {
392                         PokerBoundField bf = new PokerBoundField ();
393                         SimpleSpreadsheetRow ds = new SimpleSpreadsheetRow (0, null);
394                         bf.DataField = PokerBoundField.ThisExpression;
395                         string result = (string) bf.DoGetValue (ds);
396                 }
397
398                 [Test]
399                 public void BoundField_GetValue () {
400                         PokerBoundField bf = new PokerBoundField ();
401                         SimpleSpreadsheetRow ds = new SimpleSpreadsheetRow (0, "test");
402                         bf.DataField = PokerBoundField.ThisExpression;
403                         string result = (string) bf.DoGetValue (ds);
404                         Assert.AreEqual ("test", result, "GetValueFromIDataItemContainer");
405                 }
406
407                 [Test]
408                 public void BoundField_GetValueDataItem () {
409                         PokerBoundField bf = new PokerBoundField ();
410                         ControlWithDataItem ds = new ControlWithDataItem ("test");
411                         bf.DataField = PokerBoundField.ThisExpression;
412                         string result = (string) bf.DoGetValue (ds);
413                         Assert.AreEqual ("test", result, "GetValueFromIDataItemContainer");
414                 }
415
416                 [Test]
417                 public void BoundField_InitializeDataCell () {
418                         PokerBoundField bf = new PokerBoundField ();
419                         bf.HeaderText = "headertest";
420                         DataControlFieldCell cell = new DataControlFieldCell (null);
421                         DataControlRowState state = DataControlRowState.Edit;
422                         Assert.AreEqual (0, cell.Controls.Count, "InitializeDataCellControlsBeforeInit");
423                         bf.DoInitializeDataCell (cell, state);
424                         Assert.AreEqual (1, cell.Controls.Count, "InitializeDataCellControlsAfterInit");
425                 }
426
427                 [Test]
428                 [ExpectedException (typeof (HttpException))]
429                 public void BoundField_OnDataBindFieldExeption () {
430                         PokerBoundField bf = new PokerBoundField ();
431                         bf.bindbutoon.DataBind ();
432
433                 }
434
435                 [Test]
436                 [ExpectedException (typeof (HttpException))]
437                 public void BoundField_GetValueExeption () {
438                         PokerBoundField bf = new PokerBoundField ();
439                         bf.DoGetValue (null);
440                 }
441
442                 [Test]
443                 [Category ("NunitWeb")]
444                 public void BoundField_NullValueRender ()
445                 {
446                         string html = new WebTest (PageInvoker.CreateOnLoad (new PageDelegate (BasicRenderTestInit))).Run ();
447                         string orightml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">&nbsp;</th><th scope=\"col\">&nbsp;</th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Norway</td><td>Norway</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Sweden</td><td>Sweden</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>EMPTY</td><td>&nbsp;</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Italy</td><td>Italy</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
448                         html = HtmlDiff.GetControlFromPageHtml (html);
449                         HtmlDiff.AssertAreEqual (orightml, html, "NullValueRender");
450                 }
451
452                 public static void BasicRenderTestInit (Page p)
453                 {
454                         ArrayList myds = new ArrayList ();
455                         myds.Add (new myds_data ("Norway"));
456                         myds.Add (new myds_data ("Sweden"));
457                         myds.Add (new myds_data (""));
458                         myds.Add (new myds_data ("Italy"));
459
460                         BoundField bf = new BoundField ();
461                         bf.DataField = "Field1";
462                         bf.NullDisplayText = "EMPTY";
463
464                         BoundField bf2 = new BoundField ();
465                         bf2.DataField = "Field1";
466
467                         GridView GridView1 = new GridView();
468                         GridView1.AutoGenerateColumns = false;
469                         GridView1.Columns.Add (bf);
470                         GridView1.Columns.Add (bf2);
471                         GridView1.DataSource = myds;
472                         GridView1.DataBind ();
473
474                         LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
475                         LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
476
477                         p.Form.Controls.Add (lcb);
478                         p.Form.Controls.Add (GridView1);
479                         p.Form.Controls.Add (lce);
480                 }
481
482                 class myds_data
483                 {
484                         string _s = "";
485                         public myds_data (string s)
486                         {
487                                 _s = s;
488                         }
489
490                         public string Field1
491                         {
492                                 get { return _s; }
493                         }
494                 }
495
496                 
497                 class ControlWithDataItem : Control
498                 {
499                         readonly object _data;
500                         public ControlWithDataItem (object data) {
501                                 _data = data;
502                         }
503
504                         public object DataItem {
505                                 get {
506                                         return _data;
507                                 }
508                         }
509                 }
510
511                 public class SimpleSpreadsheetRow : TableRow, IDataItemContainer
512                 {
513                         private object data;
514                         private int _itemIndex;
515
516                         public SimpleSpreadsheetRow (int itemIndex, object o) {
517                                 data = o;
518                                 _itemIndex = itemIndex;
519                         }
520
521                         public virtual object Data {
522                                 get {
523                                         return data;
524                                 }
525                         }
526
527                         object IDataItemContainer.DataItem {
528                                 get {
529                                         return Data;
530                                 }
531                         }
532
533                         int IDataItemContainer.DataItemIndex {
534                                 get {
535                                         return _itemIndex;
536                                 }
537                         }
538
539                         int IDataItemContainer.DisplayIndex {
540                                 get {
541                                         return _itemIndex;
542                                 }
543                         }
544                 }
545         }
546 }