Mercurial > projects > dwt-addons
diff dwtx/core/commands/Category.d @ 104:04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 15:01:33 +0200 |
parents | ea8ff534f622 |
children |
line wrap: on
line diff
--- a/dwtx/core/commands/Category.d Sun Aug 03 17:01:51 2008 +0200 +++ b/dwtx/core/commands/Category.d Thu Aug 07 15:01:33 2008 +0200 @@ -12,14 +12,13 @@ *******************************************************************************/ module dwtx.core.commands.Category; -import tango.util.collection.ArraySeq; - import dwtx.core.commands.common.NamedHandleObject; import dwtx.core.internal.commands.util.Util; import dwtx.core.commands.ICategoryListener; import dwtx.core.commands.CategoryEvent; import dwt.dwthelper.utils; +import dwtx.dwtxhelper.Collection; import tango.text.convert.Format; /** @@ -37,7 +36,7 @@ * A collection of objects listening to changes to this category. This * collection is <code>null</code> if there are no listeners. */ - private ArraySeq!(ICategoryListener) categoryListeners; + private Collection categoryListeners; /** * Constructs a new instance of <code>Category</code> based on the given @@ -67,10 +66,10 @@ throw new NullPointerException(); } if (categoryListeners is null) { - categoryListeners = new ArraySeq!(ICategoryListener); + categoryListeners = new ArrayList(); } - if (!categoryListeners.contains(categoryListener)) { - categoryListeners.append(categoryListener); + if (!categoryListeners.contains(cast(Object)categoryListener)) { + categoryListeners.add(cast(Object)categoryListener); } } @@ -120,7 +119,10 @@ throw new NullPointerException(); } if (categoryListeners !is null) { - foreach( listener; categoryListeners ){ + Iterator listenerItr = categoryListeners.iterator(); + while (listenerItr.hasNext()) { + ICategoryListener listener = cast(ICategoryListener) listenerItr + .next(); listener.categoryChanged(categoryEvent); } } @@ -140,7 +142,7 @@ } if (categoryListeners !is null) { - categoryListeners.remove(categoryListener); + categoryListeners.remove(cast(Object)categoryListener); } }