You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/05/17 07:02:59 UTC
[royale-asjs] branch develop updated: setting
XMLListCollection.source will update MenuBar and other list-like components
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 607f96a setting XMLListCollection.source will update MenuBar and other list-like components
607f96a is described below
commit 607f96a31a2b664cc70a161866d04b5afbc7a624
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun May 17 00:02:41 2020 -0700
setting XMLListCollection.source will update MenuBar and other list-like components
---
.../royale/mx/collections/XMLListCollection.as | 6 ++++
...ataItemRendererFactoryForICollectionViewData.as | 38 ++++++++++++++++++----
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/XMLListCollection.as b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/XMLListCollection.as
index 91c2e1e..043e892 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/XMLListCollection.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/XMLListCollection.as
@@ -19,6 +19,8 @@
package mx.collections
{
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
[DefaultProperty("source")]
@@ -116,6 +118,10 @@ public class XMLListCollection extends ListCollectionView
XMLListAdapter(list).source = null;
list = new XMLListAdapter(s);
+
+ var event:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+ event.kind = CollectionEventKind.RESET;
+ dispatchEvent(event);
}
//--------------------------------------------------------------------------
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForICollectionViewData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForICollectionViewData.as
index 7ecf118..7c66982 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForICollectionViewData.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForICollectionViewData.as
@@ -21,6 +21,8 @@ package mx.controls.listClasses
import mx.collections.ArrayCollection;
import mx.collections.ICollectionView;
import mx.collections.IViewCursor;
+ import mx.events.CollectionEvent;
+ import mx.events.CollectionEventKind;
import org.apache.royale.core.IBead;
import org.apache.royale.core.IBeadModel;
@@ -101,9 +103,10 @@ package mx.controls.listClasses
// listen for individual items being added in the future.
var dped:IEventDispatcher = dp as IEventDispatcher;
- dped.addEventListener(CollectionEvent.ITEM_ADDED, itemAddedHandler);
- dped.addEventListener(CollectionEvent.ITEM_REMOVED, itemRemovedHandler);
- dped.addEventListener(CollectionEvent.ITEM_UPDATED, itemUpdatedHandler);
+ dped.addEventListener(org.apache.royale.events.CollectionEvent.ITEM_ADDED, itemAddedHandler);
+ dped.addEventListener(org.apache.royale.events.CollectionEvent.ITEM_REMOVED, itemRemovedHandler);
+ dped.addEventListener(org.apache.royale.events.CollectionEvent.ITEM_UPDATED, itemUpdatedHandler);
+ dped.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler);
super.dataProviderChangeHandler(event);
}
@@ -133,7 +136,7 @@ package mx.controls.listClasses
* @royaleignorecoercion org.apache.royale.core.IIndexedItemRenderer
* @royaleignorecoercion org.apache.royale.events.IEventDispatcher
*/
- protected function itemAddedHandler(event:CollectionEvent):void
+ protected function itemAddedHandler(event:org.apache.royale.events.CollectionEvent):void
{
if (!dataProviderModel)
return;
@@ -169,7 +172,7 @@ package mx.controls.listClasses
(_strand as IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));
}
- protected function itemRemovedHandler(event:CollectionEvent):void
+ protected function itemRemovedHandler(event:org.apache.royale.events.CollectionEvent):void
{
if (!dataProviderModel)
return;
@@ -206,7 +209,7 @@ package mx.controls.listClasses
* @royaleignorecoercion org.apache.royale.collections.ICollectionView
* @royaleignorecoercion org.apache.royale.core.IIndexedItemRenderer
*/
- protected function itemUpdatedHandler(event:CollectionEvent):void
+ protected function itemUpdatedHandler(event:org.apache.royale.events.CollectionEvent):void
{
if (!dataProviderModel)
return;
@@ -226,5 +229,28 @@ package mx.controls.listClasses
ir.data = data;
}
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.collections.ICollectionView
+ * @royaleignorecoercion org.apache.royale.core.IListPresentationModel
+ * @royaleignorecoercion org.apache.royale.core.IIndexedItemRenderer
+ * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+ */
+ protected function collectionChangeHandler(event:mx.events.CollectionEvent):void
+ {
+ if (!dataProviderModel)
+ return;
+ dp = dataProviderModel.dataProvider as ICollectionView;
+ if (!dp)
+ return;
+
+ if (event.kind == CollectionEventKind.RESET)
+ {
+ super.dataProviderChangeHandler(event);
+ }
+ }
+
+
+
}
}