Mercurial > projects > dwt-addons
changeset 128:8df1d4193877
Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Add: collection impls.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 17 Aug 2008 02:05:20 +0200 |
parents | 1997315125c0 |
children | eb30df5ca28b de96284b35d8 |
files | dwtx/dwtxhelper/Collection.d dwtx/ui/forms/widgets/TableWrapLayout.d |
diffstat | 2 files changed, 16 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/dwtx/dwtxhelper/Collection.d Sun Aug 17 01:30:26 2008 +0200 +++ b/dwtx/dwtxhelper/Collection.d Sun Aug 17 02:05:20 2008 +0200 @@ -425,28 +425,27 @@ implMissing( __FILE__, __LINE__ ); } - Enumeration elements(){ - implMissing( __FILE__, __LINE__ ); - return null; - } - class KeysEnumeration : Enumeration { - Object[] keys; + class ObjectEnumeration : Enumeration { + Object[] values; int index = 0; - this( Object[] keys ){ - this.keys = keys; + this( Object[] values ){ + this.values = values; } public bool hasMoreElements(){ - return index < keys.length; + return index < values.length; } public Object nextElement(){ - Object res = keys[index]; + Object res = values[index]; index++; return res; } } + Enumeration elements(){ + return new ObjectEnumeration( map.values ); + } Enumeration keys() { - return new KeysEnumeration( map.keys ); + return new ObjectEnumeration( map.keys ); } public synchronized void clear(){ map = null; @@ -513,8 +512,7 @@ } // public Object remove(String key) public synchronized int size(){ - implMissing( __FILE__, __LINE__ ); - return 0; + return map.length; } public Collection values(){ implMissing( __FILE__, __LINE__ );
--- a/dwtx/ui/forms/widgets/TableWrapLayout.d Sun Aug 17 01:30:26 2008 +0200 +++ b/dwtx/ui/forms/widgets/TableWrapLayout.d Sun Aug 17 02:05:20 2008 +0200 @@ -512,7 +512,7 @@ // assume the children of a // composite are maintained in the order in which they are created // and added to the composite. - arrayFromObject!(TableWrapData)( grid.elementAt(row))[column] = spec; + (cast(ArrayWrapperObject) grid.elementAt(row)).array[column] = spec; spec.childIndex = i; if (spec.grabHorizontal) { updateGrowingColumns(growingCols, spec, column); @@ -529,14 +529,14 @@ for (int c = 0; c < spec.colspan; c++) { spacerSpec = new TableWrapData(); spacerSpec.isItemData = false; - arrayFromObject!(TableWrapData)( grid.elementAt(row + r))[column + c] = spacerSpec; + (cast(ArrayWrapperObject) grid.elementAt(row + r)).array[column + c] = spacerSpec; } } for (int c = 1; c <= columnFill; c++) { for (int r = 0; r < spec.rowspan; r++) { spacerSpec = new TableWrapData(); spacerSpec.isItemData = false; - arrayFromObject!(TableWrapData)( grid.elementAt(row + r))[column + c] = spacerSpec; + (cast(ArrayWrapperObject) grid.elementAt(row + r)).array[column + c] = spacerSpec; } } column = column + spec.colspan - 1; @@ -545,12 +545,12 @@ for (int k = column + 1; k < numColumns; k++) { spacerSpec = new TableWrapData(); spacerSpec.isItemData = false; - arrayFromObject!(TableWrapData)( grid.elementAt(row))[k] = spacerSpec; + (cast(ArrayWrapperObject) grid.elementAt(row)).array[k] = spacerSpec; } for (int k = row + 1; k < grid.size(); k++) { spacerSpec = new TableWrapData(); spacerSpec.isItemData = false; - arrayFromObject!(TableWrapData)( grid.elementAt(k))[column] = spacerSpec; + (cast(ArrayWrapperObject) grid.elementAt(k)).array[column] = spacerSpec; } growingColumns = new int[growingCols.size()]; for (int i = 0; i < growingCols.size(); i++) {