Mercurial > projects > dwt-win
comparison dwt/widgets/Widget.d @ 243:ecb80b2a89e1
work on allow null strings and arrays
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 28 Jun 2008 20:18:36 +0200 |
parents | 116b04c0d8c9 |
children | fd9c62a2998e |
comparison
equal
deleted
inserted
replaced
242:32a6819fef61 | 243:ecb80b2a89e1 |
---|---|
566 * </p> | 566 * </p> |
567 * | 567 * |
568 * @param key the name of the property | 568 * @param key the name of the property |
569 * @return the value of the property or null if it has not been set | 569 * @return the value of the property or null if it has not been set |
570 * | 570 * |
571 * @exception IllegalArgumentException <ul> | |
572 * <li>ERROR_NULL_ARGUMENT - if the key is null</li> | |
573 * </ul> | |
574 * @exception DWTException <ul> | 571 * @exception DWTException <ul> |
575 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 572 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
576 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 573 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
577 * </ul> | 574 * </ul> |
578 * | 575 * |
579 * @see #setData(String, Object) | 576 * @see #setData(String, Object) |
580 */ | 577 */ |
581 public Object getData (String key) { | 578 public Object getData (String key) { |
582 checkWidget(); | 579 checkWidget(); |
583 if (key is null) error (DWT.ERROR_NULL_ARGUMENT); | 580 // DWT extension: allow null key |
581 //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); | |
584 if ((state & KEYED_DATA) !is 0) { | 582 if ((state & KEYED_DATA) !is 0) { |
585 Object [] table = (cast(ArrayWrapperObject) data).array; | 583 Object [] table = (cast(ArrayWrapperObject) data).array; |
586 for (int i=1; i<table.length; i+=2) { | 584 for (int i=1; i<table.length; i+=2) { |
587 String tablekey = (cast(ArrayWrapperString) table[i]).array; | 585 String tablekey = (cast(ArrayWrapperString) table[i]).array; |
588 if (key ==/*eq*/ tablekey ) return table [i+1]; | 586 if (key ==/*eq*/ tablekey ) return table [i+1]; |
1141 * </p> | 1139 * </p> |
1142 * | 1140 * |
1143 * @param key the name of the property | 1141 * @param key the name of the property |
1144 * @param value the new value for the property | 1142 * @param value the new value for the property |
1145 * | 1143 * |
1146 * @exception IllegalArgumentException <ul> | |
1147 * <li>ERROR_NULL_ARGUMENT - if the key is null</li> | |
1148 * </ul> | |
1149 * @exception DWTException <ul> | 1144 * @exception DWTException <ul> |
1150 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 1145 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
1151 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 1146 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
1152 * </ul> | 1147 * </ul> |
1153 * | 1148 * |
1154 * @see #getData(String) | 1149 * @see #getData(String) |
1155 */ | 1150 */ |
1156 public void setData (String key, Object value) { | 1151 public void setData (String key, Object value) { |
1157 checkWidget(); | 1152 checkWidget(); |
1158 if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); | 1153 // DWT extension: allow null key |
1154 //if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); | |
1159 int index = 1; | 1155 int index = 1; |
1160 Object [] table = null; | 1156 Object [] table = null; |
1161 if ((state & KEYED_DATA) !is 0) { | 1157 if ((state & KEYED_DATA) !is 0) { |
1162 table = (cast(ArrayWrapperObject) data).array; | 1158 table = (cast(ArrayWrapperObject) data).array; |
1163 while (index < table.length) { | 1159 while (index < table.length) { |