changeset 244:a59d51c12b42

work on allow null strings and arrays
author Frank Benoit <benoit@tionex.de>
date Sat, 28 Jun 2008 20:27:21 +0200
parents ecb80b2a89e1
children d8c3d4a4f2b0
files dwt/custom/CCombo.d dwt/custom/CTabItem.d dwt/custom/PopupList.d dwt/custom/StyledText.d dwt/custom/TableTree.d dwt/custom/TableTreeItem.d
diffstat 6 files changed, 38 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/custom/CCombo.d	Sat Jun 28 20:18:36 2008 +0200
+++ b/dwt/custom/CCombo.d	Sat Jun 28 20:27:21 2008 +0200
@@ -192,9 +192,6 @@
  *
  * @param string the new item
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -204,7 +201,8 @@
  */
 public void add (String string) {
     checkWidget();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     list.add (string);
 }
 /**
@@ -220,7 +218,6 @@
  * @param index the index for the item
  *
  * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
  *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
  * </ul>
  * @exception DWTException <ul>
@@ -232,7 +229,8 @@
  */
 public void add (String string, int index) {
     checkWidget();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     list.add (string, index);
 }
 /**
@@ -869,9 +867,6 @@
  * @param string the search item
  * @return the index of the item
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -879,7 +874,8 @@
  */
 public int indexOf (String string) {
     checkWidget ();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     return list.indexOf (string);
 }
 /**
@@ -893,9 +889,6 @@
  * @param start the zero-relative index at which to begin the search
  * @return the index of the item
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -903,7 +896,8 @@
  */
 public int indexOf (String string, int start) {
     checkWidget ();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     return list.indexOf (string, start);
 }
 
@@ -1237,7 +1231,6 @@
  * @param string the item to remove
  *
  * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
  *    <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
  * </ul>
  * @exception DWTException <ul>
@@ -1247,7 +1240,8 @@
  */
 public void remove (String string) {
     checkWidget();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     list.remove (string);
 }
 /**
@@ -1421,7 +1415,6 @@
  *
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
  * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -1530,9 +1523,6 @@
  *
  * @param string the new text
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -1540,7 +1530,8 @@
  */
 public void setText (String string) {
     checkWidget();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     int index = list.indexOf (string);
     if (index is -1) {
         list.deselectAll ();
--- a/dwt/custom/CTabItem.d	Sat Jun 28 20:18:36 2008 +0200
+++ b/dwt/custom/CTabItem.d	Sat Jun 28 20:27:21 2008 +0200
@@ -1039,7 +1039,8 @@
 }
 public override void setText (String string) {
     checkWidget();
-    if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     if (string==getText()) return;
     super.setText(string);
     shortenedText = null;
--- a/dwt/custom/PopupList.d	Sat Jun 28 20:18:36 2008 +0200
+++ b/dwt/custom/PopupList.d	Sat Jun 28 20:27:21 2008 +0200
@@ -263,7 +263,6 @@
 * or could not be added in the OS.
 *
 * @exception IllegalArgumentException <ul>
-*    <li>ERROR_NULL_ARGUMENT - if the items array is null</li>
 *    <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li>
 * </ul>
 * @exception DWTException <ul>
--- a/dwt/custom/StyledText.d	Sat Jun 28 20:18:36 2008 +0200
+++ b/dwt/custom/StyledText.d	Sat Jun 28 20:27:21 2008 +0200
@@ -1605,9 +1605,10 @@
  */
 public void append(String string) {
     checkWidget();
-    if (string is null) {
-        DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    }
+    // DWT extension: allow null string
+    //if (string is null) {
+    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    //}
     int lastChar = Math.max(getCharCount(), 0);
     replaceTextRange(lastChar, 0, string);
 }
@@ -4936,15 +4937,13 @@
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when string is null</li>
- * </ul>
  */
 public void insert(String string) {
     checkWidget();
-    if (string is null) {
-        DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    }
+    // DWT extension: allow null string
+    //if (string is null) {
+    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    //}
     Point sel = getSelectionRange();
     replaceTextRange(sel.x, sel.y, string);
 }
@@ -6460,7 +6459,6 @@
  * </ul>
  * @exception IllegalArgumentException <ul>
  *   <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li>
- *   <li>ERROR_NULL_ARGUMENT when ranges is null</li>
  * </ul>
  *
  * @since 2.0
@@ -6470,7 +6468,8 @@
 public void replaceStyleRanges(int start, int length, StyleRange[] ranges) {
     checkWidget();
     if (isListening(LineGetStyle)) return;
-    if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null array
+    //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     setStyleRanges(start, length, null, ranges, false);
 }
 /**
@@ -6503,14 +6502,14 @@
  *   <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li>
  *   <li>ERROR_INVALID_ARGUMENT when either start or end is inside a multi byte line delimiter.
  *      Splitting a line delimiter for example by inserting text in between the CR and LF and deleting part of a line delimiter is not supported</li>
- *   <li>ERROR_NULL_ARGUMENT when string is null</li>
  * </ul>
  */
 public void replaceTextRange(int start, int length, String text) {
     checkWidget();
-    if (text is null) {
-        DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    }
+    // DWT extension: allow null string
+    //if (text is null) {
+    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    //}
     int contentLength = getCharCount();
     int end = start + length;
     if (start > end || start < 0 || end > contentLength) {
@@ -7926,7 +7925,6 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li>
  *    <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 is styles.length)</li>
  *    <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li>
  *    <li>ERROR_INVALID_RANGE when a range overlaps</li>
@@ -7968,7 +7966,6 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li>
  *    <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 is styles.length)</li>
  *    <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li>
  *    <li>ERROR_INVALID_RANGE when a range overlaps</li>
@@ -8096,7 +8093,6 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when the list of ranges is null</li>
  *    <li>ERROR_INVALID_RANGE when the last of the style ranges is outside the valid range (> getCharCount())</li>
  * </ul>
  *
@@ -8105,7 +8101,8 @@
 public void setStyleRanges(StyleRange[] ranges) {
     checkWidget();
     if (isListening(LineGetStyle)) return;
-    if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null array
+    //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     setStyleRanges(0, 0, null, ranges, true);
 }
 /**
@@ -8143,15 +8140,13 @@
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when string is null</li>
- * </ul>
  */
 public void setText(String text) {
     checkWidget();
-    if (text is null) {
-        DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    }
+    // DWT extension: allow null string
+    //if (text is null) {
+    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
+    //}
     Event event = new Event();
     event.start = 0;
     event.end = getCharCount();
--- a/dwt/custom/TableTree.d	Sat Jun 28 20:18:36 2008 +0200
+++ b/dwt/custom/TableTree.d	Sat Jun 28 20:27:21 2008 +0200
@@ -765,7 +765,6 @@
  * @param items the array of items
  *
  * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
  *    <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
  * </ul>
  * @exception DWTException <ul>
@@ -777,7 +776,8 @@
  */
 public void setSelection (TableTreeItem[] items) {
     checkWidget ();
-    if (items is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null array
+    //if (items is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     int length = items.length;
     if (length is 0 || ((table.getStyle() & DWT.SINGLE) !is 0 && length > 1)) {
         deselectAll();
--- a/dwt/custom/TableTreeItem.d	Sat Jun 28 20:18:36 2008 +0200
+++ b/dwt/custom/TableTreeItem.d	Sat Jun 28 20:27:21 2008 +0200
@@ -819,9 +819,6 @@
  * @param index the column number
  * @param text the new text
  *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
  * @exception DWTException <ul>
  *      <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
  *      <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
@@ -829,7 +826,8 @@
  */
 public void setText(int index, String text) {
     checkWidget();
-    if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
+    // DWT extension: allow null string
+    //if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     int columnCount = Math.max(parent.getTable().getColumnCount(), 1);
     if (index < 0 || index >= columnCount) return;
     if (texts.length < columnCount) {