Author: lluis
Date: 2005-05-04 04:53:30 -0400 (Wed, 04 May 2005)
New Revision: 44009
Added:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCommands.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyleCollection.cs
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
Log:
2005-05-04 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* DataControlField.cs:
* CommandField.cs:
* GridView.cs:
* FormView.cs:
* DataControlCommands.cs:
* DetailsView.cs: Use constants to identify commands.
* SubMenuStyle.cs: Use Unit instead of int for padding.
* SubMenuStyleCollection.cs: Implemented.
* DataList.cs:
* Menu.cs: Added some missing methods and properties.
* Literal.cs:
* DataGridPagerStyle.cs: Fixed default value attributes.
* ListControl.cs: Implemented IEditableTextControl interface.
* MenuItemBinding.cs: Added Selectable property.
* CustomValidator.cs: removed interface.
* MenuItem.cs: Added support for custom binding.
* DropDownList.cs: Moved text properties to base class.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2005-05-04 08:53:30 UTC (rev 44009)
@@ -1,3 +1,28 @@
+2005-05-04 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * DataControlField.cs:
+ * CommandField.cs:
+ * GridView.cs:
+ * FormView.cs:
+ * DataControlCommands.cs:
+ * DetailsView.cs: Use constants to identify commands.
+
+ * SubMenuStyle.cs: Use Unit instead of int for padding.
+ * SubMenuStyleCollection.cs: Implemented.
+
+ * DataList.cs:
+ * Menu.cs: Added some missing methods and properties.
+
+ * Literal.cs:
+ * DataGridPagerStyle.cs: Fixed default value attributes.
+ * ListControl.cs: Implemented IEditableTextControl interface.
+
+ * MenuItemBinding.cs: Added Selectable property.
+ * CustomValidator.cs: removed interface.
+
+ * MenuItem.cs: Added support for custom binding.
+ * DropDownList.cs: Moved text properties to base class.
+
2005-04-29 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* Calendar.cs: OnDayRender can toggle IsSelectable on our back.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/CommandField.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -329,33 +329,33 @@
if (cellType == DataControlCellType.DataCell)
{
if ((rowState & DataControlRowState.Edit) != 0)
{
- cell.Controls.Add (new
DataControlButton (Control, UpdateText, UpdateImageUrl, "Update", index,
false));
+ cell.Controls.Add (new
DataControlButton (Control, UpdateText, UpdateImageUrl,
DataControlCommands.UpdateCommandName, index, false));
if (ShowCancelButton) {
AddSeparator (cell);
- cell.Controls.Add (new
DataControlButton (Control, CancelText, CancelImageUrl, "Cancel", index,
false));
+ cell.Controls.Add (new
DataControlButton (Control, CancelText, CancelImageUrl,
DataControlCommands.CancelCommandName, index, false));
}
} else if ((rowState &
DataControlRowState.Insert) != 0) {
- cell.Controls.Add (new
DataControlButton (Control, InsertText, InsertImageUrl, "Insert", index,
false));
+ cell.Controls.Add (new
DataControlButton (Control, InsertText, InsertImageUrl,
DataControlCommands.InsertCommandName, index, false));
if (ShowCancelButton) {
AddSeparator (cell);
- cell.Controls.Add (new
DataControlButton (Control, CancelText, CancelImageUrl, "Cancel", index,
false));
+ cell.Controls.Add (new
DataControlButton (Control, CancelText, CancelImageUrl,
DataControlCommands.CancelCommandName, index, false));
}
} else {
if (ShowEditButton) {
AddSeparator (cell);
- cell.Controls.Add (new
DataControlButton (Control, EditText, EditImageUrl, "Edit", index, false));
+ cell.Controls.Add (new
DataControlButton (Control, EditText, EditImageUrl,
DataControlCommands.EditCommandName, index, false));
}
if (ShowDeleteButton) {
AddSeparator (cell);
- cell.Controls.Add (new
DataControlButton (Control, DeleteText, DeleteImageUrl, "Delete", index,
false));
+ cell.Controls.Add (new
DataControlButton (Control, DeleteText, DeleteImageUrl,
DataControlCommands.DeleteCommandName, index, false));
}
if (ShowSelectButton) {
AddSeparator (cell);
- cell.Controls.Add (new
DataControlButton (Control, SelectText, SelectImageUrl, "Select", index,
false));
+ cell.Controls.Add (new
DataControlButton (Control, SelectText, SelectImageUrl,
DataControlCommands.SelectCommandName, index, false));
}
if (ShowInsertButton) {
AddSeparator (cell);
- cell.Controls.Add (new
DataControlButton (Control, NewText, NewImageUrl, "New", index, false));
+ cell.Controls.Add (new
DataControlButton (Control, NewText, NewImageUrl,
DataControlCommands.NewCommandName, index, false));
}
}
} else
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -42,9 +42,6 @@
+ "ErrorMessage=\"CustomValidator\">"
+ "</{0}:CustomValidator>")]
public class CustomValidator : BaseValidator
-#if NET_2_0
- , IStaticTextControl
-#endif
{
private static readonly object ServerValidateEvent = new
object();
Added:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCommands.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCommands.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlCommands.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -0,0 +1,53 @@
+//
+// System.Web.UI.WebControls.DataControlCommands.cs
+//
+// Authors:
+// Lluis Sanchez Gual ([EMAIL PROTECTED])
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataControlCommands
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string FirstPageCommandArgument = "First";
+ public const string InsertCommandName = "Insert";
+ public const string LastPageCommandArgument = "Last";
+ public const string NextPageCommandArgument = "Next";
+ public const string NewCommandName = "New";
+ public const string PageCommandName = "Page";
+ public const string PreviousPageCommandArgument = "Prev";
+ public const string SelectCommandName = "Select";
+ public const string SortCommandName = "Sort";
+ public const string UpdateCommandName = "Update";
+ }
+}
+#endif
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataControlField.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -86,7 +86,7 @@
{
if (HeaderText.Length > 0 ||
HeaderImageUrl.Length > 0) {
if (sortingEnabled &&
SortExpression.Length > 0)
- cell.Controls.Add (new
DataControlButton (control, HeaderText, HeaderImageUrl, "Sort", SortExpression,
true));
+ cell.Controls.Add (new
DataControlButton (control, HeaderText, HeaderImageUrl,
DataControlCommands.SortCommandName, SortExpression, true));
else
cell.Controls.Add (new
DataControlButton (control, HeaderText, HeaderImageUrl, string.Empty,
string.Empty, true));
}
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -72,7 +72,7 @@
#if !NET_2_0
[Bindable (true)]
#endif
- [DefaultValue (typeof (PagerMode), "NextPrev"), WebCategory
("Misc")]
+ [DefaultValue (PagerMode.NextPrev), WebCategory ("Misc")]
[NotifyParentProperty (true)]
[WebSysDescription ("The mode used for displaying multiple
pages.")]
public PagerMode Mode
@@ -101,7 +101,7 @@
#else
[Bindable (true)]
#endif
- [DefaultValue (">"), WebCategory ("Misc")]
+ [DefaultValue (">"), WebCategory ("Misc")]
[NotifyParentProperty (true)]
[WebSysDescription ("The text for the 'next page' button.")]
public string NextPageText
@@ -126,7 +126,7 @@
#else
[Bindable (true)]
#endif
- [DefaultValue ("<"), WebCategory ("Misc")]
+ [DefaultValue ("<"), WebCategory ("Misc")]
[NotifyParentProperty (true)]
[WebSysDescription ("The text for the 'previous page' button.")]
public string PrevPageText
@@ -175,7 +175,7 @@
#if !NET_2_0
[Bindable (true)]
#endif
- [DefaultValue (typeof (PagerPosition), "Bottom"), WebCategory
("Misc")]
+ [DefaultValue (PagerPosition.Bottom), WebCategory ("Misc")]
[NotifyParentProperty (true)]
[WebSysDescription ("The position for the page display.")]
public PagerPosition Position
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -209,9 +209,13 @@
set { footerTemplate = value; }
}
- [DefaultValue (typeof (GridLines), "None")]
+ [DefaultValue (GridLines.None)]
public override GridLines GridLines {
- get { return base.GridLines; }
+ get {
+ if (ControlStyleCreated)
+ return base.GridLines;
+ return GridLines.None;
+ }
set { base.GridLines = value; }
}
@@ -313,7 +317,7 @@
#if !NET_2_0
[Bindable (true)]
#endif
- [DefaultValue (typeof (RepeatDirection), "Vertical"),
WebCategory ("Layout")]
+ [DefaultValue (RepeatDirection.Vertical), WebCategory
("Layout")]
[WebSysDescription ("Which direction should be used when
filling the columns.")]
public virtual RepeatDirection RepeatDirection {
get {
@@ -334,7 +338,7 @@
#if !NET_2_0
[Bindable (true)]
#endif
- [DefaultValue (typeof (RepeatLayout), "Table"), WebCategory
("Layout")]
+ [DefaultValue (RepeatLayout.Table), WebCategory ("Layout")]
[WebSysDescription ("The type of layout - mechanism that is
used.")]
public virtual RepeatLayout RepeatLayout {
get {
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -1279,19 +1279,19 @@
{
switch (eventName)
{
- case "Page":
+ case DataControlCommands.PageCommandName:
int newIndex = -1;
switch (param) {
- case "First":
+ case
DataControlCommands.FirstPageCommandArgument:
newIndex = 0;
break;
- case "Last":
+ case
DataControlCommands.LastPageCommandArgument:
newIndex = PageCount -
1;
break;
- case "Next":
+ case
DataControlCommands.NextPageCommandArgument:
if (PageIndex <
PageCount - 1) newIndex = PageIndex + 1;
break;
- case "Prev":
+ case
DataControlCommands.PreviousPageCommandArgument:
if (PageIndex > 0)
newIndex = PageIndex - 1;
break;
default:
@@ -1301,45 +1301,45 @@
ShowPage (newIndex);
break;
- case "First":
+ case
DataControlCommands.FirstPageCommandArgument:
ShowPage (0);
break;
- case "Last":
+ case
DataControlCommands.LastPageCommandArgument:
ShowPage (PageCount - 1);
break;
- case "Next":
+ case
DataControlCommands.NextPageCommandArgument:
if (PageIndex < PageCount - 1)
ShowPage (PageIndex + 1);
break;
- case "Prev":
+ case
DataControlCommands.PreviousPageCommandArgument:
if (PageIndex > 0)
ShowPage (PageIndex - 1);
break;
- case "Edit":
+ case DataControlCommands.EditCommandName:
ChangeMode (DetailsViewMode.Edit);
break;
- case "New":
+ case DataControlCommands.NewCommandName:
ChangeMode (DetailsViewMode.Insert);
break;
- case "Update":
+ case DataControlCommands.UpdateCommandName:
UpdateItem (param, true);
break;
- case "Cancel":
+ case DataControlCommands.CancelCommandName:
CancelEdit ();
break;
- case "Delete":
+ case DataControlCommands.DeleteCommandName:
DeleteItem ();
break;
- case "Insert":
+ case DataControlCommands.InsertCommandName:
InsertItem (true);
break;
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -42,13 +42,9 @@
[ValidationProperty("SelectedItem")]
public class DropDownList : ListControl, IPostBackDataHandler
#if NET_2_0
- , ITextControl
+ , IEditableTextControl
#endif
{
-#if NET_2_0
- private static readonly object TextChangedEvent = new object();
-#endif
-
public DropDownList(): base()
{
}
@@ -126,55 +122,6 @@
}
#endif
-#if NET_2_0
-
- [MonoTODO ("Make sure that the following attributes are
correct")]
- [DefaultValue (null)]
- [ThemeableAttribute (false)]
- [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- public string Text {
- get {
- if (SelectedItem != null) return
SelectedItem.Text;
- else return null;
- }
- set {
- for (int n=0; n < Items.Count; n++) {
- if (Items[n].Text == value) {
- SelectedIndex = n;
- return;
- }
- }
- SelectedIndex = -1;
- }
- }
-
- [WebCategory ("Action")]
- public event EventHandler TextChanged
- {
- add {
- Events.AddHandler (TextChangedEvent, value);
- }
- remove {
- Events.RemoveHandler (TextChangedEvent, value);
- }
- }
-
- protected override void OnSelectedIndexChanged (EventArgs e)
- {
- base.OnSelectedIndexChanged (e);
- OnTextChanged (e);
- }
-
- protected virtual void OnTextChanged (EventArgs e)
- {
- if (Events != null) {
- EventHandler eh =
(EventHandler)(Events[TextChangedEvent]);
- if (eh != null)
- eh (this, e);
- }
- }
-#endif
-
protected override void AddAttributesToRender(HtmlTextWriter
writer)
{
if(Page != null)
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -1071,19 +1071,19 @@
{
switch (eventName)
{
- case "Page":
+ case DataControlCommands.PageCommandName:
int newIndex = -1;
switch (param) {
- case "First":
+ case
DataControlCommands.FirstPageCommandArgument:
newIndex = 0;
break;
- case "Last":
+ case
DataControlCommands.LastPageCommandArgument:
newIndex = PageCount -
1;
break;
- case "Next":
+ case
DataControlCommands.NextPageCommandArgument:
if (PageIndex <
PageCount - 1) newIndex = PageIndex + 1;
break;
- case "Prev":
+ case
DataControlCommands.PreviousPageCommandArgument:
if (PageIndex > 0)
newIndex = PageIndex - 1;
break;
default:
@@ -1093,45 +1093,45 @@
ShowPage (newIndex);
break;
- case "First":
+ case
DataControlCommands.FirstPageCommandArgument:
ShowPage (0);
break;
- case "Last":
+ case
DataControlCommands.LastPageCommandArgument:
ShowPage (PageCount - 1);
break;
- case "Next":
+ case
DataControlCommands.NextPageCommandArgument:
if (PageIndex < PageCount - 1)
ShowPage (PageIndex + 1);
break;
- case "Prev":
+ case
DataControlCommands.PreviousPageCommandArgument:
if (PageIndex > 0)
ShowPage (PageIndex - 1);
break;
- case "Edit":
+ case DataControlCommands.EditCommandName:
ChangeMode (FormViewMode.Edit);
break;
- case "New":
+ case DataControlCommands.NewCommandName:
ChangeMode (FormViewMode.Insert);
break;
- case "Update":
+ case DataControlCommands.UpdateCommandName:
UpdateItem (param, true);
break;
- case "Cancel":
+ case DataControlCommands.CancelCommandName:
CancelEdit ();
break;
- case "Delete":
+ case DataControlCommands.DeleteCommandName:
DeleteItem ();
break;
- case "Insert":
+ case DataControlCommands.InsertCommandName:
InsertItem (true);
break;
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -1380,19 +1380,19 @@
{
switch (eventName)
{
- case "Page":
+ case DataControlCommands.PageCommandName:
int newIndex = -1;
switch (param) {
- case "First":
+ case
DataControlCommands.FirstPageCommandArgument:
newIndex = 0;
break;
- case "Last":
+ case
DataControlCommands.LastPageCommandArgument:
newIndex = PageCount -
1;
break;
- case "Next":
+ case
DataControlCommands.NextPageCommandArgument:
if (PageIndex <
PageCount - 1) newIndex = PageIndex + 1;
break;
- case "Prev":
+ case
DataControlCommands.PreviousPageCommandArgument:
if (PageIndex > 0)
newIndex = PageIndex - 1;
break;
default:
@@ -1402,45 +1402,45 @@
ShowPage (newIndex);
break;
- case "First":
+ case
DataControlCommands.FirstPageCommandArgument:
ShowPage (0);
break;
- case "Last":
+ case
DataControlCommands.LastPageCommandArgument:
ShowPage (PageCount - 1);
break;
- case "Next":
+ case
DataControlCommands.NextPageCommandArgument:
if (PageIndex < PageCount - 1)
ShowPage (PageIndex + 1);
break;
- case "Prev":
+ case
DataControlCommands.PreviousPageCommandArgument:
if (PageIndex > 0)
ShowPage (PageIndex - 1);
break;
- case "Select":
+ case DataControlCommands.SelectCommandName:
SelectRow (int.Parse (param));
break;
- case "Edit":
+ case DataControlCommands.EditCommandName:
EditRow (int.Parse (param));
break;
- case "Update":
+ case DataControlCommands.UpdateCommandName:
UpdateRow (EditIndex, true);
break;
- case "Cancel":
+ case DataControlCommands.CancelCommandName:
CancelEdit ();
break;
- case "Delete":
+ case DataControlCommands.DeleteCommandName:
DeleteRow (int.Parse (param));
break;
- case "Sort":
+ case DataControlCommands.SortCommandName:
Sort (param);
break;
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -51,12 +51,15 @@
[ParseChildren(true, "Items")]
public abstract class ListControl :
#if NET_2_0
- DataBoundControl
+ DataBoundControl, IEditableTextControl
#else
WebControl
#endif
{
private static readonly object SelectedIndexChangedEvent = new
object();
+ #if NET_2_0
+ private static readonly object TextChangedEvent = new object();
+ #endif
#if !NET_2_0
private object dataSource;
@@ -286,8 +289,11 @@
#if NET_1_1
#if NET_2_0
[ThemeableAttribute (false)]
- #endif
- [DefaultValue (""), Bindable (true), WebCategory ("Misc")]
+ [Bindable (true, BindingDirection.TwoWay)]
+ #else
+ [Bindable (true)]
+ #endif
+ [DefaultValue (""), WebCategory ("Misc")]
[Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[WebSysDescription ("The value of the currently selected
ListItem.")]
public virtual string SelectedValue {
@@ -399,7 +405,50 @@
{
Items[i].Selected = false;
}
+ }
+
+#if NET_2_0
+
+ [ThemeableAttribute (false)]
+ [DefaultValueAttribute ("")]
+ [DesignerSerializationVisibilityAttribute
(DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ [WebCategoryAttribute ("Behavior")]
+ public string Text {
+ get {
+ if (SelectedItem != null) return
SelectedItem.Text;
+ else return null;
+ }
+ set {
+ for (int n=0; n < Items.Count; n++) {
+ if (Items[n].Text == value) {
+ SelectedIndex = n;
+ return;
+ }
+ }
+ SelectedIndex = -1;
+ }
}
+
+ public event EventHandler TextChanged
+ {
+ add {
+ Events.AddHandler (TextChangedEvent, value);
+ }
+ remove {
+ Events.RemoveHandler (TextChangedEvent, value);
+ }
+ }
+
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ if (Events != null) {
+ EventHandler eh =
(EventHandler)(Events[TextChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+#endif
#if !NET_2_0
protected override void LoadViewState(object savedState)
@@ -523,6 +572,9 @@
if(eh!=null)
eh(this, e);
}
+#if NET_2_0
+ OnTextChanged (e);
+#endif
}
protected override void OnPreRender (EventArgs e)
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -99,6 +99,7 @@
set { literalMode = value; }
}
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
public override void Focus ()
{
throw new NotSupportedException ("The Literal control
does not support the Focus operation");
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -57,6 +57,7 @@
MenuItemStyleCollection levelMenuItemStyles;
MenuItemStyleCollection levelSelectedStyles;
+ SubMenuStyleCollection levelSubMenuStyles;
ITemplate staticItemTemplate;
ITemplate dynamicItemTemplate;
@@ -68,12 +69,20 @@
ArrayList dynamicMenus;
private static readonly object MenuItemClickEvent = new
object();
+ private static readonly object MenuItemDataBoundEvent = new
object();
+ public static readonly string MenuItemClickCommandName =
"Click";
+
public event MenuEventHandler MenuItemClick {
add { Events.AddHandler (MenuItemClickEvent, value); }
remove { Events.RemoveHandler (MenuItemClickEvent,
value); }
}
+ public event MenuEventHandler MenuItemDataBound {
+ add { Events.AddHandler (MenuItemDataBoundEvent,
value); }
+ remove { Events.RemoveHandler (MenuItemDataBoundEvent,
value); }
+ }
+
protected virtual void OnMenuItemClick (MenuEventArgs e)
{
if (Events != null) {
@@ -81,10 +90,19 @@
if (eh != null) eh (this, e);
}
}
+
+ protected virtual void OnMenuItemDataBound (MenuEventArgs e)
+ {
+ if (Events != null) {
+ MenuEventHandler eh = (MenuEventHandler) Events
[MenuItemDataBoundEvent];
+ if (eh != null) eh (this, e);
+ }
+ }
+ [DefaultValueAttribute (null)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
- [Editor ("System.Web.UI.Design.MenuItemBindingsEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [EditorAttribute
("System.Web.UI.Design.WebControls.MenuBindingsEditor, System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [MergablePropertyAttribute (false)]
public virtual MenuItemBindingCollection DataBindings {
get {
if (dataBindings == null) {
@@ -109,7 +127,7 @@
}
}
- [ThemeableAttribute (false)]
+ [ThemeableAttribute (true)]
[DefaultValue ("")]
[UrlProperty]
[Editor ("System.Web.UI.Design.ImageUrlEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
@@ -143,7 +161,7 @@
[UrlProperty]
[WebCategory ("Appearance")]
[Editor ("System.Web.UI.Design.ImageUrlEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- public virtual string StaticBottomSeparatorImageUrl {
+ public string StaticBottomSeparatorImageUrl {
get {
object o = ViewState ["sbsiu"];
if (o != null) return (string)o;
@@ -158,7 +176,7 @@
[UrlProperty]
[WebCategory ("Appearance")]
[Editor ("System.Web.UI.Design.ImageUrlEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- public virtual string StaticTopSeparatorImageUrl {
+ public string StaticTopSeparatorImageUrl {
get {
object o = ViewState ["stsiu"];
if (o != null) return (string)o;
@@ -196,7 +214,7 @@
}
[DefaultValue ("16px")]
- [ThemeableAttribute (false)]
+ [ThemeableAttribute (true)]
public Unit StaticSubMenuIndent {
get {
object o = ViewState ["StaticSubMenuIndent"];
@@ -208,7 +226,7 @@
}
}
- [ThemeableAttribute (false)]
+ [ThemeableAttribute (true)]
[DefaultValue (3)]
public virtual int MaximumDynamicDisplayLevels {
get {
@@ -270,9 +288,10 @@
}
}
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
+ [DefaultValueAttribute (null)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[Editor ("System.Web.UI.Design.MenuItemCollectionEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [MergablePropertyAttribute (false)]
public virtual MenuItemCollection Items {
get {
if (items == null) {
@@ -398,9 +417,9 @@
}
}
+ [DefaultValue (null)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
- [Editor
("System.Web.UI.Design.WebControls.MenuItemStyleCollectionEditor,System.Design,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ [Editor
("System.Web.UI.Design.WebControls.MenuItemStyleCollectionEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public virtual MenuItemStyleCollection LevelMenuItemStyles {
get {
if (levelMenuItemStyles == null) {
@@ -412,8 +431,10 @@
}
}
+ [DefaultValue (null)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
+ [Editor
("System.Web.UI.Design.WebControls.MenuItemStyleCollectionEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public virtual MenuItemStyleCollection LevelSelectedStyles {
get {
if (levelSelectedStyles == null) {
@@ -425,7 +446,22 @@
}
}
+ [DefaultValue (null)]
[PersistenceMode (PersistenceMode.InnerProperty)]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
+ [Editor
("System.Web.UI.Design.WebControls.MenuItemStyleCollectionEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
+ public virtual SubMenuStyleCollection LevelSubMenuStyles {
+ get {
+ if (levelSubMenuStyles == null) {
+ levelSubMenuStyles = new
SubMenuStyleCollection ();
+ if (IsTrackingViewState)
+
((IStateManager)levelSubMenuStyles).TrackViewState();
+ }
+ return levelSubMenuStyles;
+ }
+ }
+
+ [PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DefaultValue (null)]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Content)]
@@ -458,7 +494,7 @@
[DefaultValue ("")]
[UrlProperty]
[Editor ("System.Web.UI.Design.ImageUrlEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- public virtual string ScrollDownImageUrl {
+ public string ScrollDownImageUrl {
get {
object o = ViewState ["sdiu"];
if (o != null) return (string)o;
@@ -472,7 +508,7 @@
[DefaultValue ("")]
[UrlProperty]
[Editor ("System.Web.UI.Design.ImageUrlEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- public virtual string ScrollUpImageUrl {
+ public string ScrollUpImageUrl {
get {
object o = ViewState ["suiu"];
if (o != null) return (string)o;
@@ -524,7 +560,7 @@
[DefaultValue ("")]
[UrlProperty]
[Editor ("System.Web.UI.Design.ImageUrlEditor, " +
Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- public virtual string StaticPopOutImageUrl {
+ public string StaticPopOutImageUrl {
get {
object o = ViewState ["spoiu"];
if (o != null) return (string)o;
@@ -644,9 +680,25 @@
MenuItem item = new MenuItem ();
item.Bind (hdata);
Items.Add (item);
+ OnMenuItemDataBound (new MenuEventArgs (item));
}
}
+ protected void SetItemDataBound (MenuItem node, bool dataBound)
+ {
+ node.SetDataBound (dataBound);
+ }
+
+ protected void SetItemDataPath (MenuItem node, string dataPath)
+ {
+ node.SetDataPath (dataPath);
+ }
+
+ protected void SetItemDataItem (MenuItem node, object dataItem)
+ {
+ node.SetDataItem (dataItem);
+ }
+
public void RaisePostBackEvent (string eventArgument)
{
MenuItem item = FindItemByPos (eventArgument);
@@ -696,6 +748,8 @@
((IStateManager)levelMenuItemStyles).TrackViewState();
if (levelSelectedStyles != null)
((IStateManager)levelSelectedStyles).TrackViewState();
+ if (levelSubMenuStyles != null)
+
((IStateManager)levelSubMenuStyles).TrackViewState();
if (dynamicSelectedStyle != null)
dynamicSelectedStyle.TrackViewState();
if (staticMenuItemStyle != null)
@@ -712,7 +766,7 @@
protected override object SaveViewState()
{
- object[] states = new object [13];
+ object[] states = new object [14];
states[0] = base.SaveViewState ();
states[1] = dataBindings == null ? null :
((IStateManager)dataBindings).SaveViewState();
states[2] = items == null ? null :
((IStateManager)items).SaveViewState();
@@ -726,6 +780,7 @@
states[10] = staticSelectedStyle == null ? null :
staticSelectedStyle.SaveViewState();
states[11] = staticHoverStyle == null ? null :
staticHoverStyle.SaveViewState();
states[12] = dynamicHoverStyle == null ? null :
dynamicHoverStyle.SaveViewState();
+ states[13] = levelSubMenuStyles == null ? null :
((IStateManager)levelSubMenuStyles).SaveViewState();
for (int i = states.Length - 1; i >= 0; i--) {
if (states [i] != null)
@@ -767,6 +822,8 @@
StaticHoverStyle.LoadViewState (states[11]);
if (states[12] != null)
DynamicHoverStyle.LoadViewState (states[12]);
+ if (states[13] != null)
+
((IStateManager)LevelSubMenuStyles).LoadViewState(states[13]);
}
protected override void OnInit (EventArgs e)
@@ -829,18 +886,23 @@
if (staticMenuItemStyle != null)
RegisterItemStyle (staticMenuItemStyle);
- if (staticSelectedStyle != null)
- RegisterItemStyle (staticSelectedStyle);
if (dynamicMenuItemStyle != null)
RegisterItemStyle (dynamicMenuItemStyle);
- if (dynamicSelectedStyle != null)
- RegisterItemStyle (dynamicSelectedStyle);
+ if (levelSubMenuStyles != null)
+ foreach (Style style in levelSubMenuStyles)
+ RegisterItemStyle (style);
+
if (levelMenuItemStyles != null)
foreach (Style style in levelMenuItemStyles)
RegisterItemStyle (style);
+ if (staticSelectedStyle != null)
+ RegisterItemStyle (staticSelectedStyle);
+ if (dynamicSelectedStyle != null)
+ RegisterItemStyle (dynamicSelectedStyle);
+
if (levelSelectedStyles != null)
foreach (Style style in levelSelectedStyles)
RegisterItemStyle (style);
@@ -883,7 +945,7 @@
protected override void AddAttributesToRender (HtmlTextWriter
writer)
{
- RenderMenuBeginTagAttributes (writer, false);
+ RenderMenuBeginTagAttributes (writer, false, 0);
}
public override void RenderBeginTag (HtmlTextWriter writer)
@@ -942,7 +1004,7 @@
writer.AddAttribute ("id", GetItemClientId (item,
"cc")); // Content
writer.RenderBeginTag (HtmlTextWriterTag.Div);
- RenderMenu (writer, item.ChildItems, true, true);
+ RenderMenu (writer, item.ChildItems, true, true,
item.Depth + 1);
writer.RenderEndTag (); // DIV Content
writer.RenderEndTag (); // DIV Scroll container
@@ -966,25 +1028,33 @@
writer.RenderEndTag (); // DIV menu
}
- void RenderMenuBeginTagAttributes (HtmlTextWriter writer, bool
dynamic)
+ void RenderMenuBeginTagAttributes (HtmlTextWriter writer, bool
dynamic, int menuLevel)
{
writer.AddAttribute ("cellpadding", "0");
writer.AddAttribute ("cellspacing", "0");
+ string cls = string.Empty;
+
if (!dynamic && staticMenuStyle != null)
- writer.AddAttribute ("class",
staticMenuStyle.RegisteredCssClass);
+ cls += staticMenuStyle.RegisteredCssClass + " ";
+
+ if (levelSubMenuStyles != null && menuLevel <
levelSubMenuStyles.Count)
+ cls += levelSubMenuStyles
[menuLevel].RegisteredCssClass;
+
+ if (cls.Length != 0)
+ writer.AddAttribute ("class", cls);
}
- void RenderMenu (HtmlTextWriter writer, MenuItemCollection
items, bool vertical, bool dynamic)
+ void RenderMenu (HtmlTextWriter writer, MenuItemCollection
items, bool vertical, bool dynamic, int menuLevel)
{
- RenderMenuBeginTag (writer, dynamic);
+ RenderMenuBeginTag (writer, dynamic, menuLevel);
RenderMenuBody (writer, items, vertical, dynamic);
RenderMenuEndTag (writer);
}
- void RenderMenuBeginTag (HtmlTextWriter writer, bool dynamic)
+ void RenderMenuBeginTag (HtmlTextWriter writer, bool dynamic,
int menuLevel)
{
- RenderMenuBeginTagAttributes (writer, dynamic);
+ RenderMenuBeginTagAttributes (writer, dynamic,
menuLevel);
writer.RenderBeginTag (HtmlTextWriterTag.Table);
}
@@ -1168,7 +1238,7 @@
if (dynamicChildren) dynamicMenus.Add
(item);
else {
writer.AddAttribute ("width",
"100%");
- RenderMenu (writer,
item.ChildItems, true, false);
+ RenderMenu (writer,
item.ChildItems, true, false, item.Depth + 1);
}
}
@@ -1180,7 +1250,7 @@
writer.RenderBeginTag (HtmlTextWriterTag.Td);
if (displayChildren) {
if (dynamicChildren) dynamicMenus.Add
(item);
- else RenderMenu (writer,
item.ChildItems, false, false);
+ else RenderMenu (writer,
item.ChildItems, false, false, item.Depth + 1);
}
writer.RenderEndTag (); // TD
}
@@ -1257,7 +1327,14 @@
void RenderItemHref (HtmlTextWriter writer, MenuItem item)
{
- if (item.NavigateUrl != "") {
+ if (!item.BranchEnabled) {
+ writer.AddAttribute ("disabled", "true");
+ }
+ else if (!item.Selectable) {
+ writer.AddAttribute ("href", "#");
+ writer.AddStyleAttribute ("cursor", "text");
+ }
+ else if (item.NavigateUrl != "") {
writer.AddAttribute ("href", item.NavigateUrl);
if (item.Target != "")
writer.AddAttribute ("target",
item.Target);
@@ -1267,6 +1344,7 @@
else {
writer.AddAttribute ("href", GetClientEvent
(item));
}
+
}
string GetItemClientId (MenuItem item, string sufix)
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItem.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -50,7 +50,11 @@
string path;
int depth = -1;
+ bool dataBound;
+ string dataPath;
+ object dataItem;
IHierarchyData hierarchyData;
+
bool gotBinding;
MenuItemBinding binding;
PropertyDescriptorCollection boundProperties;
@@ -126,15 +130,15 @@
[DefaultValue (false)]
[Browsable (false)]
public bool DataBound {
- get { return hierarchyData != null; }
+ get { return dataBound; }
}
[DefaultValue (null)]
[Browsable (false)]
public object DataItem {
get {
- if (hierarchyData == null) throw new
InvalidOperationException ("MenuItem is not data bound.");
- return hierarchyData.Item;
+ if (!dataBound) throw new
InvalidOperationException ("MenuItem is not data bound.");
+ return dataItem;
}
}
@@ -143,8 +147,8 @@
[Browsable (false)]
public string DataPath {
get {
- if (hierarchyData == null) throw new
InvalidOperationException ("MenuItem is not data bound.");
- return hierarchyData.Path;
+ if (!dataBound) throw new
InvalidOperationException ("MenuItem is not data bound.");
+ return dataPath;
}
}
@@ -267,13 +271,13 @@
else if (bin.Text != "")
text = bin.Text;
else
- text =
hierarchyData.ToString ();
+ text =
GetDefaultBoundText ();
if (bin.FormatString.Length !=
0)
text = string.Format
(bin.FormatString, text);
return text;
}
- return hierarchyData.ToString ();
+ return GetDefaultBoundText ();
}
return "";
}
@@ -317,7 +321,7 @@
if (bin.Value != "")
return bin.Value;
}
- return hierarchyData.ToString ();
+ return GetDefaultBoundText ();
}
return "";
}
@@ -347,6 +351,52 @@
ViewState ["SeparatorImageUrl"] = value;
}
}
+
+ [BrowsableAttribute (true)]
+ [DefaultValueAttribute (true)]
+ public bool Selectable {
+ get {
+ object o = ViewState ["Selectable"];
+ if (o != null) return (bool)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.SelectableField != "")
+ return (bool)
GetBoundPropertyValue (bin.SelectableField);
+ return bin.Selectable;
+ }
+ }
+ return true;
+ }
+ set {
+ ViewState ["Selectable"] = value;
+ }
+ }
+
+ [BrowsableAttribute (true)]
+ [DefaultValueAttribute (true)]
+ public bool Enabled {
+ get {
+ object o = ViewState ["Enabled"];
+ if (o != null) return (bool)o;
+ if (DataBound) {
+ MenuItemBinding bin = GetBinding ();
+ if (bin != null) {
+ if (bin.EnabledField != "")
+ return (bool)
GetBoundPropertyValue (bin.EnabledField);
+ return bin.Enabled;
+ }
+ }
+ return true;
+ }
+ set {
+ ViewState ["Enabled"] = value;
+ }
+ }
+
+ internal bool BranchEnabled {
+ get { return Enabled && (parent == null ||
parent.BranchEnabled); }
+ }
[DefaultValue (false)]
[Browsable (false)]
@@ -479,32 +529,72 @@
internal void Bind (IHierarchyData hierarchyData)
{
this.hierarchyData = hierarchyData;
+ dataBound = true;
+ dataPath = hierarchyData.Path;
+ dataItem = hierarchyData.Item;
}
+ internal void SetDataItem (object item)
+ {
+ dataItem = item;
+ }
+
+ internal void SetDataPath (string path)
+ {
+ dataPath = path;
+ }
+
+ internal void SetDataBound (bool bound)
+ {
+ dataBound = bound;
+ }
+
+ string GetDefaultBoundText ()
+ {
+ if (hierarchyData != null) return
hierarchyData.ToString ();
+ else if (dataItem != null) return dataItem.ToString ();
+ else return string.Empty;
+ }
+
+ string GetDataItemType ()
+ {
+ if (hierarchyData != null) return hierarchyData.Type;
+ else if (dataItem != null) return
dataItem.GetType().ToString ();
+ else return string.Empty;
+ }
+
MenuItemBinding GetBinding ()
{
if (menu == null) return null;
if (gotBinding) return binding;
- binding = menu.FindBindingForItem (hierarchyData.Type,
Depth);
+ binding = menu.FindBindingForItem (GetDataItemType (),
Depth);
gotBinding = true;
return binding;
}
object GetBoundPropertyValue (string name)
{
- if (boundProperties == null)
- boundProperties = TypeDescriptor.GetProperties
(hierarchyData);
+ if (boundProperties == null) {
+ if (hierarchyData != null)
+ boundProperties =
TypeDescriptor.GetProperties (hierarchyData);
+ else
+ boundProperties =
TypeDescriptor.GetProperties (dataItem);
+ }
PropertyDescriptor prop = boundProperties.Find (name,
true);
if (prop == null)
throw new InvalidOperationException ("Property
'" + name + "' not found in data bound item");
- return prop.GetValue (hierarchyData);
+
+ if (hierarchyData != null)
+ return prop.GetValue (hierarchyData);
+ else
+ return prop.GetValue (dataItem);
}
void FillBoundChildren ()
{
items = new MenuItemCollection (this);
- if (!hierarchyData.HasChildren) return;
+ if (hierarchyData == null ||
!hierarchyData.HasChildren) return;
IHierarchicalEnumerable e = hierarchyData.GetChildren
();
foreach (object obj in e) {
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/MenuItemBinding.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -158,7 +158,32 @@
}
}
+ [DefaultValue (true)]
+ public bool Selectable {
+ get {
+ object o = ViewState ["Selectable"];
+ if (o != null) return (bool) o;
+ return true;
+ }
+ set {
+ ViewState ["Selectable"] = value;
+ }
+ }
+
[DefaultValue ("")]
+ [TypeConverter
("System.Web.UI.Design.DataSourceViewSchemaConverter, " +
Consts.AssemblySystem_Design)]
+ public string SelectableField {
+ get {
+ object o = ViewState ["SelectableField"];
+ if (o != null) return (string) o;
+ return "";
+ }
+ set {
+ ViewState ["SelectableField"] = value;
+ }
+ }
+
+ [DefaultValue ("")]
public string Target {
get {
object o = ViewState ["Target"];
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyle.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -41,13 +41,21 @@
private static int HORZ_PADD = (0x01 << 16);
private static int VERT_PADD = (0x01 << 17);
- [DefaultValue (0)]
+ public SubMenuStyle ()
+ {
+ }
+
+ public SubMenuStyle (StateBag bag): base (bag)
+ {
+ }
+
+ [DefaultValue (typeof(Unit), "")]
[NotifyParentProperty (true)]
- public int HorizontalPadding {
+ public Unit HorizontalPadding {
get {
if(IsSet(HORZ_PADD))
- return
(int)(ViewState["HorizontalPadding"]);
- return 0;
+ return
(Unit)(ViewState["HorizontalPadding"]);
+ return Unit.Empty;
}
set {
ViewState["HorizontalPadding"] = value;
@@ -55,13 +63,13 @@
}
}
- [DefaultValue (0)]
+ [DefaultValue (typeof(Unit), "")]
[NotifyParentProperty (true)]
- public int VerticalPadding {
+ public Unit VerticalPadding {
get {
if(IsSet(VERT_PADD))
- return
(int)(ViewState["VerticalPadding"]);
- return 0;
+ return
(Unit)(ViewState["VerticalPadding"]);
+ return Unit.Empty;
}
set {
ViewState["VerticalPadding"] = value;
@@ -69,10 +77,6 @@
}
}
- protected internal override bool IsEmpty {
- get { return base.IsEmpty; }
- }
-
public override void CopyFrom (Style s)
{
if (s == null || s.IsEmpty)
Added:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyleCollection.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyleCollection.cs
2005-05-04 07:54:21 UTC (rev 44008)
+++
trunk/mcs/class/System.Web/System.Web.UI.WebControls/SubMenuStyleCollection.cs
2005-05-04 08:53:30 UTC (rev 44009)
@@ -0,0 +1,104 @@
+//
+// System.Web.UI.WebControls.SubMenuStyleCollection.cs
+//
+// Authors:
+// Lluis Sanchez Gual ([EMAIL PROTECTED])
+//
+// (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class SubMenuStyleCollection: StateManagedCollection
+ {
+ static Type[] types = new Type[] { typeof (SubMenuStyle) };
+
+ internal SubMenuStyleCollection ()
+ {
+ }
+
+ public int Add (SubMenuStyle style)
+ {
+ return ((IList)this).Add (style);
+ }
+
+ public bool Contains (SubMenuStyle style)
+ {
+ return ((IList)this).Contains (style);
+ }
+
+ public void CopyTo (SubMenuStyle[] array, int index)
+ {
+ ((IList)this).CopyTo (array, index);
+ }
+
+ protected override object CreateKnownType (int index)
+ {
+ return new SubMenuStyle ();
+ }
+
+ protected override Type[] GetKnownTypes ()
+ {
+ return types;
+ }
+
+ public int IndexOf (SubMenuStyle style)
+ {
+ return ((IList)this).IndexOf (style);
+ }
+
+ public void Insert (int index, SubMenuStyle style)
+ {
+ ((IList)this).Insert (index, style);
+ }
+
+ public void Remove (SubMenuStyle style)
+ {
+ ((IList)this).Remove (style);
+ }
+
+ public void RemoveAt (int index)
+ {
+ ((IList)this).RemoveAt (index);
+ }
+
+ public SubMenuStyle this [int i] {
+ get { return (SubMenuStyle) ((IList)this) [i]; }
+ set { ((IList)this) [i] = value; }
+ }
+
+ protected override void SetDirtyObject (object o)
+ {
+ ((SubMenuStyle)o).SetDirty ();
+ }
+ }
+}
+
+#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches