You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2017/04/09 17:26:22 UTC
[1/7] flex-asjs git commit: text input should be of type “text”
Repository: flex-asjs
Updated Branches:
refs/heads/feature/chart-work 448e9f8e3 -> 8ea97a469
text input should be of type \u201ctext\u201d
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/bacc59b7
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/bacc59b7
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/bacc59b7
Branch: refs/heads/feature/chart-work
Commit: bacc59b71e5b2b5f40ed550dccd2807096f521f0
Parents: 04ad0ed
Author: Harbs <ha...@in-tools.com>
Authored: Mon Apr 3 16:03:48 2017 -0400
Committer: Harbs <ha...@in-tools.com>
Committed: Mon Apr 3 16:03:48 2017 -0400
----------------------------------------------------------------------
.../projects/HTML/src/main/flex/org/apache/flex/html/TextInput.as | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bacc59b7/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextInput.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextInput.as
index fab027e..0a63c95 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextInput.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextInput.as
@@ -169,7 +169,7 @@ package org.apache.flex.html
override protected function createElement():WrappedHTMLElement
{
element = document.createElement('input') as WrappedHTMLElement;
- element.setAttribute('type', 'input');
+ element.setAttribute('type', 'text');
element.className = 'TextInput';
typeNames = 'TextInput';
[7/7] git commit: [flex-asjs] [refs/heads/feature/chart-work] - Merge
branch 'develop' into feature/chart-work
Posted by pi...@apache.org.
Merge branch 'develop' into feature/chart-work
# Conflicts:
# frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8ea97a46
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8ea97a46
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8ea97a46
Branch: refs/heads/feature/chart-work
Commit: 8ea97a469dc48f3d4c9919d2576afa900a5f77ac
Parents: 448e9f8 61c4300
Author: piotrz <pi...@apache.org>
Authored: Sun Apr 9 19:26:17 2017 +0200
Committer: piotrz <pi...@apache.org>
Committed: Sun Apr 9 19:26:17 2017 +0200
----------------------------------------------------------------------
examples/examples-integrationtests/pom.xml | 4 +-
examples/express/DataBindingExample/pom.xml | 6 +-
examples/express/pom.xml | 95 ++++++++
examples/pom.xml | 1 +
.../main/flex/org/apache/flex/html/TextInput.as | 2 +-
.../html/beads/DataProviderAddRemoveNotifier.as | 183 ----------------
.../html/beads/DataProviderChangeNotifier.as | 214 +++----------------
.../DataProviderCollectionChangeNotifier.as | 71 ++++++
.../beads/DataProviderItemsChangeNotifier.as | 95 ++++++++
.../supportClasses/DataProviderNotifierBase.as | 154 +++++++++++++
.../HTML/src/main/resources/basic-manifest.xml | 3 +-
.../flex/org/apache/flex/net/HTTPService.as | 13 ++
pom.xml | 35 ++-
13 files changed, 478 insertions(+), 398 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8ea97a46/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
[3/7] git commit: [flex-asjs] [refs/heads/feature/chart-work] - CORS
security. Allow auth credentials to be passed when using cross site calls.
This is required as well as setting the Access-Control-Allow-Origin header on
the server.
Posted by pi...@apache.org.
CORS security. Allow auth credentials to be passed when using cross site calls. This is required as well as setting the Access-Control-Allow-Origin header on the server.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/326d6979
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/326d6979
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/326d6979
Branch: refs/heads/feature/chart-work
Commit: 326d69791b37cc2aaac546bcfcd3a51e88716f2f
Parents: 11ef21a
Author: Justin Mclean <jm...@apache.org>
Authored: Sun Apr 9 13:26:30 2017 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Sun Apr 9 13:26:30 2017 +1000
----------------------------------------------------------------------
.../src/main/flex/org/apache/flex/net/HTTPService.as | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/326d6979/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPService.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPService.as b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPService.as
index b939751..3a9968c 100644
--- a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPService.as
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/HTTPService.as
@@ -505,6 +505,18 @@ package org.apache.flex.net
return null;
}
+ /**
+ * Allows Javascript cross-site Access-Control requests to be made
+ * using credentials such as cookies or authorization headers
+ *
+ * @productversion FlexJS 0.8
+ */
+ COMPILE::JS
+ public function set withCredentials(value:Boolean):void {
+ var element:XMLHttpRequest = this.element as XMLHttpRequest;
+ element.withCredentials = value;
+ }
+
COMPILE::SWF
private var urlLoader:flash.net.URLLoader;
@@ -606,6 +618,7 @@ package org.apache.flex.net
}
}
+
if (_method !== HTTPConstants.GET &&
!sawContentType && contentData) {
element.setRequestHeader(
[2/7] git commit: [flex-asjs] [refs/heads/feature/chart-work] - -
Added the express example to the maven build - Updated the tomcat version
used in the integration test module - Made the tomcat download url more
resilient against new versions - Fine-tune
Posted by pi...@apache.org.
- Added the express example to the maven build
- Updated the tomcat version used in the integration test module
- Made the tomcat download url more resilient against new versions
- Fine-tuned the RAT exclusions to be more resilient when compiling with different sets of modules in the reactor
- Added some missing license headers
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/11ef21aa
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/11ef21aa
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/11ef21aa
Branch: refs/heads/feature/chart-work
Commit: 11ef21aaefab6c4fe80612dfe19143b7c0c457a8
Parents: bacc59b
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Wed Apr 5 13:15:19 2017 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Wed Apr 5 13:15:19 2017 +0200
----------------------------------------------------------------------
examples/examples-integrationtests/pom.xml | 4 +-
examples/express/DataBindingExample/pom.xml | 6 +-
examples/express/pom.xml | 95 ++++++++++++++++++++++++
examples/pom.xml | 1 +
pom.xml | 35 ++++-----
5 files changed, 117 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11ef21aa/examples/examples-integrationtests/pom.xml
----------------------------------------------------------------------
diff --git a/examples/examples-integrationtests/pom.xml b/examples/examples-integrationtests/pom.xml
index 36f2ddd..2c13b79 100644
--- a/examples/examples-integrationtests/pom.xml
+++ b/examples/examples-integrationtests/pom.xml
@@ -35,7 +35,7 @@
<name>Apache Flex - FlexJS: Examples: Integrationtests</name>
<properties>
- <tomcat.version>8.5.12</tomcat.version>
+ <tomcat.version>8.5.13</tomcat.version>
</properties>
<profiles>
@@ -93,7 +93,7 @@
<containerId>tomcat8x</containerId>
<log>${project.build.directory}/tomcat8x/container.log</log>
<zipUrlInstaller>
- <url>http://www-us.apache.org/dist/tomcat/tomcat-8/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
+ <url>https://repo1.maven.org/maven2/org/apache/tomcat/tomcat/${tomcat.version}/tomcat-${tomcat.version}.zip</url>
<extractDir>${java.io.tmpdir}/cargo/installs</extractDir>
</zipUrlInstaller>
<!-- 3 Minutes -->
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11ef21aa/examples/express/DataBindingExample/pom.xml
----------------------------------------------------------------------
diff --git a/examples/express/DataBindingExample/pom.xml b/examples/express/DataBindingExample/pom.xml
index 58ff0fa..958cda3 100644
--- a/examples/express/DataBindingExample/pom.xml
+++ b/examples/express/DataBindingExample/pom.xml
@@ -24,15 +24,15 @@
<parent>
<groupId>org.apache.flex.flexjs.examples</groupId>
- <artifactId>examples-flexjs</artifactId>
+ <artifactId>examples-express</artifactId>
<version>0.8.0-SNAPSHOT</version>
</parent>
- <artifactId>DataBindingExample</artifactId>
+ <artifactId>DataBindingExample-Express</artifactId>
<version>0.8.0-SNAPSHOT</version>
<packaging>swf</packaging>
- <name>Apache Flex - FlexJS: Examples: FlexJS: DataBindingExample</name>
+ <name>Apache Flex - FlexJS: Examples: Express: DataBindingExample</name>
<build>
<plugins>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11ef21aa/examples/express/pom.xml
----------------------------------------------------------------------
diff --git a/examples/express/pom.xml b/examples/express/pom.xml
new file mode 100644
index 0000000..e991497
--- /dev/null
+++ b/examples/express/pom.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.flex.flexjs.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>examples-express</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Apache Flex - FlexJS: Examples: Express</name>
+
+ <modules>
+ <module>DataBindingExample</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <executions>
+ <execution>
+ <id>tests-default</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <!-- Run the tests from the 'examples-tests' artifact -->
+ <dependenciesToScan>
+ <dependency>org.apache.flex.flexjs.examples:examples-tests</dependency>
+ </dependenciesToScan>
+ <systemPropertyVariables>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <type>${project.packaging}</type>
+ <buildDirectory>${project.build.directory}</buildDirectory>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Express</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Language</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+
+ <!-- Import the shared unit-tests we want to run on all examples -->
+ <dependency>
+ <groupId>org.apache.flex.flexjs.examples</groupId>
+ <artifactId>examples-tests</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11ef21aa/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index d5aba43..412ce1a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -39,6 +39,7 @@
</properties>
<modules>
+ <module>express</module>
<module>flexjs</module>
<module>native</module>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11ef21aa/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3b7fb24..b882ead 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,9 @@
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -161,14 +163,6 @@
</executions>
<configuration>
<excludes>
- <!--
- As the examples and distribution are not build in every case, we
- have to exclude them. This skips the checks if they are not included
- but if they are included, the checks inside distribution and examples
- kick in and do the checks.
- -->
- <exclude>distribution/**</exclude>
- <exclude>examples/**</exclude>
<!-- JSON files can't contain comments -->
<exclude>**/*.json</exclude>
<!-- This is appended to the LICENSE file for binary packages-->
@@ -177,19 +171,22 @@
<!-- Stuff that needs to be removed -->
<exclude>fxg2svg/**</exclude>
<exclude>vf2js/**</exclude>
- <!-- frameworks/fb.properties contains Alex' path entries and should be removed -->
- <exclude>fb.properties</exclude>
<!-- Should probably also be removed -->
<exclude>js/*jshint*</exclude>
- <!-- If checked in, they should have apache headers -->
+ <!-- FlashBuilder settings. frameworks/fb.properties contains Alex' path entries and should be removed -->
+ <exclude>fb.properties</exclude>
+ <!-- FlashBuilder / Eclipse settings. If checked in, they should have apache headers -->
<exclude>**/.settings/**</exclude>
- <!-- Examples needs to be fixed -->
- <exclude>native/**</exclude>
- <!-- After running the testsuite, the target directory is full of non-header files -->
- <exclude>testsuite/**</exclude>
- <!-- Ignore IntelliJ IDEA project files -->
- <exclude>**/*.iml</exclude>
- <exclude>**/.idea/**</exclude>
+ <!-- Ignore IntelliJ IDEA project files -->
+ <exclude>**/*.iml</exclude>
+ <exclude>**/.idea/**</exclude>
+ <!--
+ Exclude any eventually existing content of target directories.
+ Some times when building with a bigger maven reactor and then
+ with a smaller one, RAT will complain about stuff still in the
+ target directories. We don't want that.
+ -->
+ <exclude>**/target/**</exclude>
</excludes>
</configuration>
<dependencies>
[6/7] git commit: [flex-asjs] [refs/heads/feature/chart-work] - - Fix
build: Forgot commit some changes in DataProviderNotifierBase
Posted by pi...@apache.org.
- Fix build: Forgot commit some changes in DataProviderNotifierBase
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/61c4300d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/61c4300d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/61c4300d
Branch: refs/heads/feature/chart-work
Commit: 61c4300d0bf46c2a7901b04c5da593b8217a2efd
Parents: 83f4225
Author: piotrz <pi...@apache.org>
Authored: Sun Apr 9 18:40:52 2017 +0200
Committer: piotrz <pi...@apache.org>
Committed: Sun Apr 9 18:40:52 2017 +0200
----------------------------------------------------------------------
.../supportClasses/DataProviderNotifierBase.as | 37 +++++---------------
1 file changed, 8 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61c4300d/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
index 853fbb9..6c7eb08 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
@@ -16,7 +16,7 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
+package org.apache.flex.html.supportClasses
{
import org.apache.flex.core.IBead;
import org.apache.flex.core.IBeadModel;
@@ -29,15 +29,14 @@ package org.apache.flex.html.beads
import org.apache.flex.collections.ArrayList;
/**
- * The DataProviderChangeNotifier notifies listeners when a selection model's
- * ArrayList dataProvider has changed.
+ * Base class for all data provider notifiers.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class DataProviderChangeNotifier implements IBead, IDocument
+ public class DataProviderNotifierBase implements IBead, IDocument
{
/**
* constructor.
@@ -47,13 +46,13 @@ package org.apache.flex.html.beads
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function DataProviderChangeNotifier()
+ public function DataProviderNotifierBase()
{
}
- protected var _dataProvider:ArrayList;
+ protected var dataProvider:ArrayList;
- private var _strand:IStrand;
+ protected var _strand:IStrand;
/**
* @copy org.apache.flex.core.IBead#strand
@@ -76,23 +75,9 @@ package org.apache.flex.html.beads
}
}
- private function destinationChangedHandler(event:Event):void
+ protected function destinationChangedHandler(event:Event):void
{
- if (_dataProvider == null) {
- var object:Object = document[sourceID];
- _dataProvider = object[propertyName] as ArrayList;
- }
- else {
- _dataProvider.removeEventListener("itemAdded", handleDataProviderChanges);
- _dataProvider.removeEventListener("itemRemoved", handleDataProviderChanges);
- _dataProvider.removeEventListener("itemUpdated", handleDataProviderChanges);
- _dataProvider.removeEventListener("collectionChanged", handleDataProviderChanges);
- }
-
- _dataProvider.addEventListener("itemAdded", handleDataProviderChanges);
- _dataProvider.addEventListener("itemRemoved", handleDataProviderChanges);
- _dataProvider.addEventListener("itemUpdated", handleDataProviderChanges);
- _dataProvider.addEventListener("collectionChanged", handleDataProviderChanges);
+
}
protected var document:Object;
@@ -165,11 +150,5 @@ package org.apache.flex.html.beads
{
_propertyName = value;
}
-
- private function handleDataProviderChanges(event:Event):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
- }
}
}
[5/7] git commit: [flex-asjs] [refs/heads/feature/chart-work] - - Add
new notifie providers to basic-mainfest.xml file
Posted by pi...@apache.org.
- Add new notifie providers to basic-mainfest.xml file
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/83f4225c
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/83f4225c
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/83f4225c
Branch: refs/heads/feature/chart-work
Commit: 83f4225c22c35a5dd47df7cd281a3d1ea3b2a50a
Parents: b3cd50e
Author: piotrz <pi...@apache.org>
Authored: Sun Apr 9 18:02:32 2017 +0200
Committer: piotrz <pi...@apache.org>
Committed: Sun Apr 9 18:02:32 2017 +0200
----------------------------------------------------------------------
frameworks/projects/HTML/src/main/resources/basic-manifest.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/83f4225c/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
index 53e4a63..08acd5b 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -118,7 +118,8 @@
<component id="DataGrid" class="org.apache.flex.html.DataGrid"/>
<component id="DataProviderChangeNotifier" class="org.apache.flex.html.beads.DataProviderChangeNotifier"/>
- <component id="DataProviderAddRemoveNotifier" class="org.apache.flex.html.beads.DataProviderAddRemoveNotifier"/>
+ <component id="DataProviderCollectionChangeNotifier" class="org.apache.flex.html.beads.DataProviderCollectionChangeNotifier"/>
+ <component id="DataProviderItemsChangeNotifier" class="org.apache.flex.html.beads.DataProviderItemsChangeNotifier"/>
<component id="DataGridButtonBar" class="org.apache.flex.html.DataGridButtonBar"/>
<component id="DataGridButtonBarTextButton" class="org.apache.flex.html.DataGridButtonBarTextButton"/>
<component id="DataGridColumn" class="org.apache.flex.html.supportClasses.DataGridColumn"/>
[4/7] git commit: [flex-asjs] [refs/heads/feature/chart-work] - Data
provider notifier changes: - Add DataProviderNotifierBase class which holds
all common properties - Add DataProviderCollectionChangeNotifier which listen
for "collectionChanged" event a
Posted by pi...@apache.org.
Data provider notifier changes:
- Add DataProviderNotifierBase class which holds all common properties
- Add DataProviderCollectionChangeNotifier which listen for "collectionChanged" event and dispatch "dataProviderChanged" through model
- Rename DataProviderAddRemoveNotifier to DataProviderItemsChangeNotifier
- Add itemUpdated to DataProviderItemsChangeNotifier
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b3cd50eb
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b3cd50eb
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b3cd50eb
Branch: refs/heads/feature/chart-work
Commit: b3cd50ebb1fd5799c48812b2db7cf787b907920e
Parents: 326d697
Author: piotrz <pi...@apache.org>
Authored: Sun Apr 9 17:56:07 2017 +0200
Committer: piotrz <pi...@apache.org>
Committed: Sun Apr 9 17:56:07 2017 +0200
----------------------------------------------------------------------
.../html/beads/DataProviderAddRemoveNotifier.as | 183 -------------------
.../html/beads/DataProviderChangeNotifier.as | 163 +++--------------
.../DataProviderCollectionChangeNotifier.as | 71 +++++++
.../beads/DataProviderItemsChangeNotifier.as | 95 ++++++++++
.../supportClasses/DataProviderNotifierBase.as | 175 ++++++++++++++++++
5 files changed, 364 insertions(+), 323 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b3cd50eb/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderAddRemoveNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderAddRemoveNotifier.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderAddRemoveNotifier.as
deleted file mode 100644
index 81a80bb..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderAddRemoveNotifier.as
+++ /dev/null
@@ -1,183 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.html.beads
-{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IDocument;
- import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.Event;
- import org.apache.flex.collections.ArrayList;
- import org.apache.flex.events.CollectionEvent;
- /**
- * The DataProviderAddRemoveNotifier notifies listeners when a selection model's to
- * ArrayList dataProvider has been added or removed item.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DataProviderAddRemoveNotifier implements IBead, IDocument
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DataProviderAddRemoveNotifier()
- {
- }
-
- protected var _dataProvider:ArrayList;
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- if (_strand[destinationPropertyName] == null) {
- var model:IBeadModel = UIBase(_strand).model as IBeadModel;
- IEventDispatcher(model).addEventListener(changeEventName, destinationChangedHandler);
- }
- else {
- destinationChangedHandler(null);
- }
- }
-
- private function destinationChangedHandler(event:Event):void
- {
- if (_dataProvider == null) {
- var object:Object = document[sourceID];
- _dataProvider = object[propertyName] as ArrayList;
- }
- else {
- _dataProvider.removeEventListener(CollectionEvent.ITEM_ADDED, handleItemAdded);
- _dataProvider.removeEventListener(CollectionEvent.ITEM_REMOVED, handleItemRemoved);
- }
-
- _dataProvider.addEventListener(CollectionEvent.ITEM_ADDED, handleItemAdded);
- _dataProvider.addEventListener(CollectionEvent.ITEM_REMOVED, handleItemRemoved);
- }
-
- protected var document:Object;
-
- /**
- * @private
- */
- public function setDocument(document:Object, id:String = null):void
- {
- this.document = document;
- }
-
- private var _destinationPropertyName:String;
-
- public function get destinationPropertyName():String
- {
- return _destinationPropertyName;
- }
- public function set destinationPropertyName(value:String):void
- {
- _destinationPropertyName = value;
- }
-
- private var _changeEventName:String;
-
- public function get changeEventName():String
- {
- return _changeEventName;
- }
- public function set changeEventName(value:String):void
- {
- _changeEventName = value;
- }
-
- private var _sourceID:String;
-
- /**
- * The ID of the object holding the ArrayList, usually a model.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get sourceID():String
- {
- return _sourceID;
- }
- public function set sourceID(value:String):void
- {
- _sourceID = value;
- }
-
- private var _propertyName:String;
-
- /**
- * The property in the sourceID that is the ArrayList.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get propertyName():String
- {
- return _propertyName;
- }
-
- public function set propertyName(value:String):void
- {
- _propertyName = value;
- }
-
- /**
- * @private
- */
- private function handleItemAdded(event:CollectionEvent):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(event.cloneEvent() as CollectionEvent);
- }
-
- /**
- * @private
- */
- private function handleItemRemoved(event:CollectionEvent):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(event.cloneEvent() as CollectionEvent);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b3cd50eb/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
index a24810b..e8c28bd 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
@@ -18,17 +18,13 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.beads
{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IDocument;
import org.apache.flex.core.ISelectionModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.Event;
import org.apache.flex.collections.ArrayList;
-
- /**
+ import org.apache.flex.html.supportClasses.DataProviderNotifierBase;
+
+ /**
* The DataProviderChangeNotifier notifies listeners when a selection model's
* ArrayList dataProvider has changed.
*
@@ -37,7 +33,7 @@ package org.apache.flex.html.beads
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class DataProviderChangeNotifier implements IBead, IDocument
+ public class DataProviderChangeNotifier extends DataProviderNotifierBase
{
/**
* constructor.
@@ -51,144 +47,31 @@ package org.apache.flex.html.beads
{
}
- protected var _dataProvider:ArrayList;
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
+ override protected function destinationChangedHandler(event:Event):void
{
- _strand = value;
-
- if (_strand[destinationPropertyName] == null) {
- var model:IBeadModel = UIBase(_strand).model as IBeadModel;
- IEventDispatcher(model).addEventListener(changeEventName, destinationChangedHandler);
- }
- else {
- destinationChangedHandler(null);
- }
- }
-
- private function destinationChangedHandler(event:Event):void
- {
- if (_dataProvider == null) {
+ if (dataProvider == null)
+ {
var object:Object = document[sourceID];
- _dataProvider = object[propertyName] as ArrayList;
+ dataProvider = object[propertyName] as ArrayList;
}
- else {
- _dataProvider.removeEventListener("itemAdded", handleItemAdded);
- _dataProvider.removeEventListener("itemRemoved", handleItemRemoved);
- _dataProvider.removeEventListener("itemUpdated", handleItemUpdated);
+ else
+ {
+ dataProvider.removeEventListener("itemAdded", handleDataProviderChanges);
+ dataProvider.removeEventListener("itemRemoved", handleDataProviderChanges);
+ dataProvider.removeEventListener("itemUpdated", handleDataProviderChanges);
+ dataProvider.removeEventListener("collectionChanged", handleDataProviderChanges);
}
-
- _dataProvider.addEventListener("itemAdded", handleItemAdded);
- _dataProvider.addEventListener("itemRemoved", handleItemRemoved);
- _dataProvider.addEventListener("itemUpdated", handleItemUpdated);
- }
-
- protected var document:Object;
-
- /**
- * @private
- */
- public function setDocument(document:Object, id:String = null):void
- {
- this.document = document;
- }
-
- private var _destinationPropertyName:String;
-
- public function get destinationPropertyName():String
- {
- return _destinationPropertyName;
- }
- public function set destinationPropertyName(value:String):void
- {
- _destinationPropertyName = value;
- }
-
- private var _changeEventName:String;
-
- public function get changeEventName():String
- {
- return _changeEventName;
- }
- public function set changeEventName(value:String):void
- {
- _changeEventName = value;
- }
-
- private var _sourceID:String;
-
- /**
- * The ID of the object holding the ArrayList, usually a model.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get sourceID():String
- {
- return _sourceID;
- }
- public function set sourceID(value:String):void
- {
- _sourceID = value;
- }
-
- private var _propertyName:String;
-
- /**
- * The property in the sourceID that is the ArrayList.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get propertyName():String
- {
- return _propertyName;
- }
-
- public function set propertyName(value:String):void
- {
- _propertyName = value;
- }
-
- /**
- * @private
- */
- private function handleItemAdded(event:Event):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+
+ dataProvider.addEventListener("itemAdded", handleDataProviderChanges);
+ dataProvider.addEventListener("itemRemoved", handleDataProviderChanges);
+ dataProvider.addEventListener("itemUpdated", handleDataProviderChanges);
+ dataProvider.addEventListener("collectionChanged", handleDataProviderChanges);
}
-
- /**
- * @private
- */
- private function handleItemRemoved(event:Event):void
- {
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
- }
-
- /**
- * @private
- */
- private function handleItemUpdated(event:Event):void
+
+ private function handleDataProviderChanges(event:Event):void
{
- var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
- selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(new Event("dataProviderChanged"));
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b3cd50eb/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderCollectionChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderCollectionChangeNotifier.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderCollectionChangeNotifier.as
new file mode 100644
index 0000000..2d58795
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderCollectionChangeNotifier.as
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.collections.ArrayList;
+ import org.apache.flex.html.supportClasses.DataProviderNotifierBase;
+
+ /**
+ * The DataProviderCollectionChangeNotifier notifies listeners when a selection model's
+ * ArrayList dataProvider disptached collectionChanged event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataProviderCollectionChangeNotifier extends DataProviderNotifierBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataProviderCollectionChangeNotifier()
+ {
+ }
+
+ override protected function destinationChangedHandler(event:Event):void
+ {
+ if (dataProvider == null)
+ {
+ var object:Object = document[sourceID];
+ dataProvider = object[propertyName] as ArrayList;
+ }
+ else
+ {
+ dataProvider.removeEventListener("collectionChanged", handleCollectionChanged);
+ }
+
+ dataProvider.addEventListener("collectionChanged", handleCollectionChanged);
+ }
+
+ private function handleCollectionChanged(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b3cd50eb/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderItemsChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderItemsChangeNotifier.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderItemsChangeNotifier.as
new file mode 100644
index 0000000..eee1990
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderItemsChangeNotifier.as
@@ -0,0 +1,95 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.collections.ArrayList;
+ import org.apache.flex.events.CollectionEvent;
+ import org.apache.flex.html.supportClasses.DataProviderNotifierBase;
+
+ /**
+ * The DataProviderItemsChangeNotifier notifies listeners when to selection model's
+ * ArrayList dataProvider item has been added, removed or updated.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataProviderItemsChangeNotifier extends DataProviderNotifierBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataProviderItemsChangeNotifier()
+ {
+ }
+
+ private function destinationChangedHandler(event:Event):void
+ {
+ if (dataProvider == null) {
+ var object:Object = document[sourceID];
+ dataProvider = object[propertyName] as ArrayList;
+ }
+ else {
+ dataProvider.removeEventListener(CollectionEvent.ITEM_ADDED, handleItemAdded);
+ dataProvider.removeEventListener(CollectionEvent.ITEM_REMOVED, handleItemRemoved);
+ dataProvider.removeEventListener(CollectionEvent.ITEM_UPDATED, handleItemUpdated);
+ }
+
+ dataProvider.addEventListener(CollectionEvent.ITEM_ADDED, handleItemAdded);
+ dataProvider.addEventListener(CollectionEvent.ITEM_REMOVED, handleItemRemoved);
+ dataProvider.addEventListener(CollectionEvent.ITEM_UPDATED, handleItemUpdated);
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemAdded(event:CollectionEvent):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(event.cloneEvent() as CollectionEvent);
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemRemoved(event:CollectionEvent):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(event.cloneEvent() as CollectionEvent);
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemUpdated(event:CollectionEvent):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(event.cloneEvent() as CollectionEvent);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b3cd50eb/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
new file mode 100644
index 0000000..853fbb9
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
@@ -0,0 +1,175 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.collections.ArrayList;
+
+ /**
+ * The DataProviderChangeNotifier notifies listeners when a selection model's
+ * ArrayList dataProvider has changed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataProviderChangeNotifier implements IBead, IDocument
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataProviderChangeNotifier()
+ {
+ }
+
+ protected var _dataProvider:ArrayList;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ if (_strand[destinationPropertyName] == null) {
+ var model:IBeadModel = UIBase(_strand).model as IBeadModel;
+ IEventDispatcher(model).addEventListener(changeEventName, destinationChangedHandler);
+ }
+ else {
+ destinationChangedHandler(null);
+ }
+ }
+
+ private function destinationChangedHandler(event:Event):void
+ {
+ if (_dataProvider == null) {
+ var object:Object = document[sourceID];
+ _dataProvider = object[propertyName] as ArrayList;
+ }
+ else {
+ _dataProvider.removeEventListener("itemAdded", handleDataProviderChanges);
+ _dataProvider.removeEventListener("itemRemoved", handleDataProviderChanges);
+ _dataProvider.removeEventListener("itemUpdated", handleDataProviderChanges);
+ _dataProvider.removeEventListener("collectionChanged", handleDataProviderChanges);
+ }
+
+ _dataProvider.addEventListener("itemAdded", handleDataProviderChanges);
+ _dataProvider.addEventListener("itemRemoved", handleDataProviderChanges);
+ _dataProvider.addEventListener("itemUpdated", handleDataProviderChanges);
+ _dataProvider.addEventListener("collectionChanged", handleDataProviderChanges);
+ }
+
+ protected var document:Object;
+
+ /**
+ * @private
+ */
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.document = document;
+ }
+
+ private var _destinationPropertyName:String;
+
+ public function get destinationPropertyName():String
+ {
+ return _destinationPropertyName;
+ }
+ public function set destinationPropertyName(value:String):void
+ {
+ _destinationPropertyName = value;
+ }
+
+ private var _changeEventName:String;
+
+ public function get changeEventName():String
+ {
+ return _changeEventName;
+ }
+ public function set changeEventName(value:String):void
+ {
+ _changeEventName = value;
+ }
+
+ private var _sourceID:String;
+
+ /**
+ * The ID of the object holding the ArrayList, usually a model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get sourceID():String
+ {
+ return _sourceID;
+ }
+ public function set sourceID(value:String):void
+ {
+ _sourceID = value;
+ }
+
+ private var _propertyName:String;
+
+ /**
+ * The property in the sourceID that is the ArrayList.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get propertyName():String
+ {
+ return _propertyName;
+ }
+
+ public function set propertyName(value:String):void
+ {
+ _propertyName = value;
+ }
+
+ private function handleDataProviderChanges(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+ }
+ }
+}