Author: suresh
Date: 2005-05-04 07:35:51 -0400 (Wed, 04 May 2005)
New Revision: 44017
Added:
trunk/mcs/class/System.Data/System.Data/DataTableClearEventArgs.cs
trunk/mcs/class/System.Data/System.Data/DataTableClearEventHandler.cs
Modified:
trunk/mcs/class/System.Data/ChangeLog
trunk/mcs/class/System.Data/System.Data.dll.sources
trunk/mcs/class/System.Data/System.Data/ChangeLog
trunk/mcs/class/System.Data/System.Data/DataTable.cs
trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
Log:
2005-05-04 Sureshkumar T <[EMAIL PROTECTED]>
* Test/System.Data/DataTableTest.cs: ClearTest () : added case for
checking whether TableCleared event is fired.
* System.Data.dll.sources: Added DataTableClearEventArgs.cs and
DataTableClearEventHandler.cs.
* System.Data/DataTable.cs: Clear (): Raise TableCleared event.
* System.Data/DataTableClearEventArgs.cs: Args for
DataTableClearEventHandler.
* System.Data/DataTableClearEventHandler.cs: Handler for
DataTable.TableClear event.
Modified: trunk/mcs/class/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/ChangeLog 2005-05-04 10:53:00 UTC (rev
44016)
+++ trunk/mcs/class/System.Data/ChangeLog 2005-05-04 11:35:51 UTC (rev
44017)
@@ -1,3 +1,8 @@
+2005-05-04 Sureshkumar T <[EMAIL PROTECTED]>
+
+ * System.Data.dll.sources: Added DataTableClearEventArgs.cs and
+ DataTableClearEventHandler.cs.
+
2005-04-27 Sureshkumar T <[EMAIL PROTECTED]>
* System.Data_test.dll.sources: Added DataTableReaderTest.cs
Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog 2005-05-04 10:53:00 UTC
(rev 44016)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog 2005-05-04 11:35:51 UTC
(rev 44017)
@@ -1,5 +1,12 @@
2005-05-04 Sureshkumar T <[EMAIL PROTECTED]>
+ * DataTable.cs: Clear (): Raise TableCleared event.
+
+ * DataTableClearEventArgs.cs: Args for DataTableClearEventHandler.
+
+ * DataTableClearEventHandler.cs: Handler for DataTable.TableClear
+ event.
+
* DataRow.cs: AcceptChanges: raise row changing & row changed
events.
Modified: trunk/mcs/class/System.Data/System.Data/DataTable.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataTable.cs 2005-05-04
10:53:00 UTC (rev 44016)
+++ trunk/mcs/class/System.Data/System.Data/DataTable.cs 2005-05-04
11:35:51 UTC (rev 44017)
@@ -678,6 +678,10 @@
public void Clear () {
// Foriegn key constraints are checked in _rows.Clear
method
_rows.Clear ();
+#if NET_2_0
+ OnTableCleared (new DataTableClearEventArgs (this));
+#endif // NET_2_0
+
}
/// <summary>
@@ -1618,6 +1622,16 @@
OnColumnChanged(e);
}
+#if NET_2_0
+ /// <summary>
+ /// Raises TableCleared Event and delegates to subscribers
+ /// </summary>
+ protected virtual void OnTableCleared (DataTableClearEventArgs
e) {
+ if (TableCleared != null)
+ TableCleared (this, e);
+ }
+#endif // NET_2_0
+
/// <summary>
/// Raises the ColumnChanging event.
/// </summary>
@@ -1756,7 +1770,16 @@
[DataCategory ("Data")]
[DataSysDescription ("Occurs when a row in the table marked for
deletion. Throw an exception to cancel the deletion.")]
public event DataRowChangeEventHandler RowDeleting;
-
+
+#if NET_2_0
+ /// <summary>
+ /// Occurs after the Clear method is called on the datatable.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs when the rows in a table is
cleared . Throw an exception to cancel the deletion.")]
+ public event DataTableClearEventHandler TableCleared;
+#endif // NET_2_0
+
#endregion // Events
/// <summary>
Added: trunk/mcs/class/System.Data/System.Data/DataTableClearEventArgs.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataTableClearEventArgs.cs
2005-05-04 10:53:00 UTC (rev 44016)
+++ trunk/mcs/class/System.Data/System.Data/DataTableClearEventArgs.cs
2005-05-04 11:35:51 UTC (rev 44017)
@@ -0,0 +1,57 @@
+//
+// System.Data.DataTableClearEventArgs.cs
+//
+// Author:
+// Sureshkumar T <[EMAIL PROTECTED]>
+//
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) Authors.
+//
+// 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
+namespace System.Data
+{
+ public sealed class DataTableClearEventArgs : EventArgs
+ {
+ #region Fields
+ private readonly DataTable _table;
+ #endregion //Fields
+
+ #region Constructors
+ public DataTableClearEventArgs(DataTable table)
+ {
+ _table = table;
+ }
+ #endregion // Constructors
+
+
+ #region Properties
+ public DataTable Table { get { return _table; } }
+ public string TableName { get { return _table.TableName ; } }
+ public string TableNamespace { get { return _table.Namespace;
} }
+ #endregion // Properties
+ }
+}
+#endif // NET_2_0
Property changes on:
trunk/mcs/class/System.Data/System.Data/DataTableClearEventArgs.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/mcs/class/System.Data/System.Data/DataTableClearEventHandler.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataTableClearEventHandler.cs
2005-05-04 10:53:00 UTC (rev 44016)
+++ trunk/mcs/class/System.Data/System.Data/DataTableClearEventHandler.cs
2005-05-04 11:35:51 UTC (rev 44017)
@@ -0,0 +1,43 @@
+//
+// System.Data.DataColumnChangeEventHandler.cs
+//
+// Author:
+// Sureshkumar T <[EMAIL PROTECTED]>
+//
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) Authors.
+//
+// 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
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the the TableCleared event.
+ /// </summary>
+ [Serializable]
+ public delegate void DataTableClearEventHandler(object sender,
DataTableClearEventArgs e);
+
+}
+#endif // NET_2_0
Property changes on:
trunk/mcs/class/System.Data/System.Data/DataTableClearEventHandler.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/System.Data/System.Data.dll.sources
===================================================================
--- trunk/mcs/class/System.Data/System.Data.dll.sources 2005-05-04 10:53:00 UTC
(rev 44016)
+++ trunk/mcs/class/System.Data/System.Data.dll.sources 2005-05-04 11:35:51 UTC
(rev 44017)
@@ -37,6 +37,8 @@
System.Data/DataSysDescriptionAttribute.cs
System.Data/DataTable.cs
System.Data/DataTableCollection.cs
+System.Data/DataTableClearEventArgs.cs
+System.Data/DataTableClearEventHandler.cs
System.Data/DataTableTypeConverter.cs
System.Data/DataTablePropertyDescriptor.cs
System.Data/DataTableReader.cs
Modified: trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/ChangeLog 2005-05-04
10:53:00 UTC (rev 44016)
+++ trunk/mcs/class/System.Data/Test/System.Data/ChangeLog 2005-05-04
11:35:51 UTC (rev 44017)
@@ -5,6 +5,8 @@
well. Simplified table creation for ClearReset test.
- Added a test to check whether Commit RowChanging & RowChanged
event is fired.
+ - ClearTest () : added case for checking whether TableCleared
+ event is fired.
2005-04-29 Sureshkumar T <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
2005-05-04 10:53:00 UTC (rev 44016)
+++ trunk/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
2005-05-04 11:35:51 UTC (rev 44017)
@@ -1212,8 +1212,15 @@
table.Rows.Add (new object [] { 4, "mono 4" });
table.AcceptChanges ();
+#if NET_2_0
+ _tableClearedEventFired = false;
+ table.TableCleared += new DataTableClearEventHandler
(OnTableCleared);
+#endif // NET_2_0
table.Clear ();
+#if NET_2_0
+ AssertEquals ("#0 should have fired cleared event",
true, _tableClearedEventFired);
+#endif // NET_2_0
DataRow r = table.Rows.Find (1);
AssertEquals ("#1 should have cleared", true, r ==
null);
@@ -1222,6 +1229,13 @@
table.Rows.Add (new object [] { 2, "mono 2" });
AssertEquals ("#2 should add row", 1,
table.Rows.Count);
}
+#if NET_2_0
+ private bool _tableClearedEventFired = false;
+ private void OnTableCleared (object src,
DataTableClearEventArgs args)
+ {
+ _tableClearedEventFired = true;
+ }
+#endif // NET_2_0
[Test]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches