flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject svn commit: r1369772 [1/2] - in /incubator/flex/trunk/frameworks/projects/apache: ./ bundles/ bundles/en_AU/ bundles/en_CA/ bundles/en_GB/ bundles/en_US/ src/ src/core/ src/mx/ src/mx/collections/ src/org/ src/org/apache/ src/org/apache/flex/ src/org/a...
Date Mon, 06 Aug 2012 10:28:11 GMT
Author: jmclean
Date: Mon Aug  6 10:28:10 2012
New Revision: 1369772

URL: http://svn.apache.org/viewvc?rev=1369772&view=rev
Log:
Added PostCodeFormatter, PostCodeValidator, ArrayList, VectorCollecton, VectorList to new Apache namespace/project/swc

Added:
    incubator/flex/trunk/frameworks/projects/apache/
    incubator/flex/trunk/frameworks/projects/apache/build.xml
    incubator/flex/trunk/frameworks/projects/apache/bundles/
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_AU/
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_AU/validators.properties
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_CA/
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_CA/validators.properties
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_GB/
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_GB/validators.properties
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_US/
    incubator/flex/trunk/frameworks/projects/apache/bundles/en_US/validators.properties
    incubator/flex/trunk/frameworks/projects/apache/defaults.css
    incubator/flex/trunk/frameworks/projects/apache/manifest.xml
    incubator/flex/trunk/frameworks/projects/apache/src/
    incubator/flex/trunk/frameworks/projects/apache/src/ApacheClasses.as
    incubator/flex/trunk/frameworks/projects/apache/src/core/
    incubator/flex/trunk/frameworks/projects/apache/src/core/Version.as
    incubator/flex/trunk/frameworks/projects/apache/src/mx/
    incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/
    incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/ArrayList.as
    incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorCollection.as
    incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorList.as
    incubator/flex/trunk/frameworks/projects/apache/src/org/
    incubator/flex/trunk/frameworks/projects/apache/src/org/apache/
    incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/
    incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/formatters/
    incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/formatters/PostCodeFormatter.as
    incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/validators/
    incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/validators/PostCodeValidator.as

Added: incubator/flex/trunk/frameworks/projects/apache/build.xml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/build.xml?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/build.xml (added)
+++ incubator/flex/trunk/frameworks/projects/apache/build.xml Mon Aug  6 10:28:10 2012
@@ -0,0 +1,222 @@
+<?xml version="1.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.
+
+-->
+
+
+<project name="apache" default="main" basedir=".">
+
+	<property name="FLEX_HOME" location="${basedir}/../../.."/>
+
+    <property file="${FLEX_HOME}/env.properties"/>
+    <property environment="env"/>
+	<property file="${FLEX_HOME}/build.properties"/>
+
+	<macrodef name="bundle">
+		<attribute name="locale"/>
+			<sequential>
+				<echo message="Compiling frameworks/locale/@{locale}/apache_rb.swc"/>
+
+			<!-- Load the <compc> task. We can't do this at the <project> level -->
+			<!-- because targets that run before flexTasks.jar gets built would fail. -->
+			<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/lib/flexTasks.jar"/>
+			<compc fork="true"
+				   output="${FLEX_HOME}/frameworks/locale/@{locale}/apache_rb.swc"
+				   locale="@{locale}">
+				<jvmarg line="${compc.jvm.args}"/>
+				<target-player>${playerglobal.version}</target-player>
+				<include-resource-bundles bundle="validators"/>
+				<include-namespaces/>
+				<include-classes/>
+				<source-path path-element="${basedir}/bundles/@{locale}"/>
+				<source-path path-element="${FLEX_HOME}/frameworks/projects/apache/src"/>
+				<include-libraries/>
+				<library-path/>
+				<external-library-path dir="${env.PLAYERGLOBAL_HOME}">
+					<include name="${playerglobal.version}/playerglobal.swc"/>
+				</external-library-path>
+				<external-library-path dir="${FLEX_HOME}/frameworks/libs">
+	                <include name="framework.swc"/>
+				</external-library-path>
+			</compc>
+		</sequential>
+	</macrodef>	
+	
+	<macrodef name="fat-swc">
+		<attribute name="locale"/>
+		<sequential>
+			<mkdir dir="${basedir}/bundles/@{locale}/docs" />
+			<zip destfile="${FLEX_HOME}/frameworks/locale/@{locale}/apache_rb.swc" update="true">
+				<zipfileset dir="${basedir}/bundles/@{locale}/docs" prefix="docs">
+					<include name="*.*"/>
+				</zipfileset>
+				<zipfileset dir="${basedir}/bundles/en_US" prefix="docs">
+					<include name="packages.dita"/>
+				</zipfileset>
+			</zip>
+		</sequential>
+	</macrodef>	
+
+	<macrodef name="bundle-clean">
+		<attribute name="locale"/>
+		<sequential>
+			<delete failonerror="false">
+				<fileset dir="${FLEX_HOME}/frameworks/locale">
+					<include name="@{locale}/apache_rb.swc"/>
+					<include name="@{locale}/apache_rb.swc.incr"/>
+				</fileset>
+			</delete>
+		</sequential>
+	</macrodef>	
+	
+	<macrodef name="bundler">
+		<attribute name="locale"/>
+		<element name="run.fat.swc" optional="yes"/>
+		<sequential>
+			<bundle-clean locale="@{locale}"/>
+			<bundle locale="@{locale}"/>
+			<run.fat.swc/>
+		</sequential>
+	</macrodef>
+	
+	<target name="main" depends="clean,compile" description="Clean build of apache.swc and default locale">
+		<bundle locale="${locale}"/>
+	</target>
+	
+	<target name="other.locales" depends="bundles" description="Build other locale SWCs"/>
+	
+	<!-- This is a private target for building apache.swc for various locales. -->
+	<!-- The targets below set the 'locale' parameter and call it with <antcall>. -->
+	<target name="bundles">
+		<!-- these languages have localized docs -->
+		<!-- TODO add misisng locales -->
+		<bundler locale="en_AU"/><!-- Australian resources -->
+		<bundler locale="en_GB"/><!-- United Kingdom resources -->
+		<bundler locale="en_CA"/><!-- Canadian resources -->
+	</target>
+	
+	<target name="clean" depends="bundles-clean">
+		<delete failonerror="false">
+			<fileset dir="${basedir}" >
+				<include name="bundles.properties"/>
+			    <include name="bundles/en_US/packages.dita"/>
+			</fileset>
+			<fileset dir="${FLEX_HOME}/frameworks/libs/apache">
+				<include name="apache.swc"/>
+				<include name="apache.swc.incr"/>
+			</fileset>
+		</delete>
+	</target>
+	
+	<target name="bundles-clean">
+		<delete failonerror="false">
+			<fileset dir="${FLEX_HOME}/frameworks/locale">
+				<include name="*/apache_rb.swc"/>
+				<include name="*/apache_rb.swc.incr"/>
+			</fileset>
+		</delete>
+	</target>
+	
+	<target name="compile" description="Compiles apache.swc">
+		<echo message="Compiling frameworks/libs/apache.swc"/>
+
+		<!-- Load the <compc> task. We can't do this at the <project> level -->
+		<!-- because targets that run before flexTasks.jar gets built would fail. -->
+		<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/lib/flexTasks.jar"/>
+		<!--
+			Link in the classes (and their dependencies) for the Apache classes
+			listed in this project's manifest.xml.
+			Also link the additional classes (and their dependencies)
+			listed in ApacheClasses.as,
+			because these aren't referenced by the manifest classes.
+			Keep the standard metadata when compiling.
+			Link in accessibility support.
+			Include the appropriate CSS files and assets in the SWC.
+			Don't include any resources in the SWC.
+			Write a bundle list of referenced resource bundles
+			into the file bundles.properties in this directory.
+		-->
+		<compc fork="true"
+			   output="${FLEX_HOME}/frameworks/libs/apache.swc"
+			   resource-bundle-list="${basedir}/bundles.properties">
+			<jvmarg line="${compc.jvm.args}"/>
+			<target-player>${playerglobal.version}</target-player>
+			<namespace uri="http://flex.apache.org/ns" manifest="${basedir}/manifest.xml"/>
+			<include-classes>ApacheClasses</include-classes>
+			<source-path path-element="${basedir}/src"/>
+			<library-path/>
+			<external-library-path dir="${env.PLAYERGLOBAL_HOME}">
+                <include name="${playerglobal.version}/playerglobal.swc"/>
+            </external-library-path>
+            <external-library-path dir="${FLEX_HOME}/frameworks/libs">
+                  <include name="mx.swc"/>
+			</external-library-path>
+			<include-file name="defaults.css" path="${basedir}/defaults.css"/>
+			<locale/>
+			<accessible>true</accessible>
+			<keep-as3-metadata name="Bindable"/>
+			<keep-as3-metadata name="Managed"/>
+			<keep-as3-metadata name="ChangeEvent"/>
+			<keep-as3-metadata name="NonCommittingChangeEvent"/>
+			<keep-as3-metadata name="Transient"/>
+		</compc>
+	</target>
+	
+	<target name="doc" depends="clean-temp-docs" description="updates apache.swc with asdoc xml">
+		<!-- Load the <asdoc> task. We can't do this at the <project> level -->
+		<!-- because targets that run before flexTasks.jar gets built would fail. -->
+		<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/lib/flexTasks.jar"/>
+
+	    <condition property="asdoc.jvm.args" value="-Xmx384m">
+	        <os family="windows"/>
+	    </condition>
+
+	    <condition property="asdoc.jvm.args" value="-Xmx512m">
+	        <os family="mac"/>
+	    </condition>
+
+	    <condition property="asdoc.jvm.args" value="-Xmx512m">
+	        <os family="unix"/>
+	    </condition>
+
+
+		<!-- Call asdoc to generate dita xml files -->
+		<asdoc output="${FLEX_HOME}/tempDoc" lenient="true" failonerror="true" keep-xml="true" skip-xsl="true" fork="true">
+		    <compiler.source-path path-element="${basedir}/src"/>
+		    <doc-classes class="ApacheClasses"/>
+		    <doc-namespaces uri="http://flex.apache.org/ns"/>
+		    <namespace uri="http://flex.apache.org/ns" manifest="${basedir}/manifest.xml"/>
+		    <jvmarg line="${asdoc.jvm.args}"/>
+		</asdoc>
+
+		<!-- updates apache.swc with asdoc xml -->
+		<zip destfile="${FLEX_HOME}/frameworks/locale/en_US/apache_rb.swc" update="true">
+		    <zipfileset dir="${FLEX_HOME}/tempDoc/tempdita" prefix="docs">
+			    <include name="*.*"/>
+				<exclude name="ASDoc_Config.xml"/>
+				<exclude name="overviews.xml"/>
+		    </zipfileset>
+		</zip>
+		<copy file="${FLEX_HOME}/tempDoc/tempdita/packages.dita" tofile="${basedir}/bundles/en_US/packages.dita"/>
+	</target>
+
+	<target name="clean-temp-docs">
+		<delete dir="${FLEX_HOME}/tempDoc" failonerror="false" includeEmptyDirs="true"/>
+		<delete file="${basedir}/bundles/en_US/packages.dita" failonerror="false"/>
+	</target>
+</project>

Added: incubator/flex/trunk/frameworks/projects/apache/bundles/en_AU/validators.properties
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/bundles/en_AU/validators.properties?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/bundles/en_AU/validators.properties (added)
+++ incubator/flex/trunk/frameworks/projects/apache/bundles/en_AU/validators.properties Mon Aug  6 10:28:10 2012
@@ -0,0 +1,24 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+#PostCodeValidator
+invalidCharPostcodeError=The postcode contains invalid characters.
+wrongLengthPostcodeError=The postcode is the wrong length.
+wrongFormatPostcodeError=The postcode is the wrong format.
+incorrectFormatPostcodeError=The postcode format string is incorrect.
\ No newline at end of file

Added: incubator/flex/trunk/frameworks/projects/apache/bundles/en_CA/validators.properties
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/bundles/en_CA/validators.properties?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/bundles/en_CA/validators.properties (added)
+++ incubator/flex/trunk/frameworks/projects/apache/bundles/en_CA/validators.properties Mon Aug  6 10:28:10 2012
@@ -0,0 +1,24 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+#PostCodeValidator
+invalidCharPostcodeError=The postcode contains invalid characters.
+wrongLengthPostcodeError=The postcode is the wrong length.
+wrongFormatPostcodeError=The postcode is the wrong format.
+incorrectFormatPostcodeError=The postcode format string is incorrect.
\ No newline at end of file

Added: incubator/flex/trunk/frameworks/projects/apache/bundles/en_GB/validators.properties
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/bundles/en_GB/validators.properties?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/bundles/en_GB/validators.properties (added)
+++ incubator/flex/trunk/frameworks/projects/apache/bundles/en_GB/validators.properties Mon Aug  6 10:28:10 2012
@@ -0,0 +1,24 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+#PostCodeValidator
+invalidCharPostcodeError=The postcode contains invalid characters.
+wrongLengthPostcodeError=The postcode is the wrong length.
+wrongFormatPostcodeError=The postcode is the wrong format.
+incorrectFormatPostcodeError=The postcode format string is incorrect.
\ No newline at end of file

Added: incubator/flex/trunk/frameworks/projects/apache/bundles/en_US/validators.properties
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/bundles/en_US/validators.properties?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/bundles/en_US/validators.properties (added)
+++ incubator/flex/trunk/frameworks/projects/apache/bundles/en_US/validators.properties Mon Aug  6 10:28:10 2012
@@ -0,0 +1,24 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+#PostCodeValidator
+invalidCharPostcodeError=The ZIP code contains invalid characters.
+wrongLengthPostcodeError=The ZIP code is the wrong length.
+wrongFormatPostcodeError=The ZIP code is the wrong format.
+incorrectFormatPostcodeError=The ZIP code format string is incorrect.
\ No newline at end of file

Added: incubator/flex/trunk/frameworks/projects/apache/defaults.css
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/defaults.css?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/defaults.css (added)
+++ incubator/flex/trunk/frameworks/projects/apache/defaults.css Mon Aug  6 10:28:10 2012
@@ -0,0 +1,20 @@
+/*
+*
+*  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.
+*
+*/
+
+@namespace "http://flex.apache.org/ns";

Added: incubator/flex/trunk/frameworks/projects/apache/manifest.xml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/manifest.xml?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/manifest.xml (added)
+++ incubator/flex/trunk/frameworks/projects/apache/manifest.xml Mon Aug  6 10:28:10 2012
@@ -0,0 +1,35 @@
+<?xml version="1.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.
+
+-->
+
+<!--
+
+    Apache Components
+
+-->
+<componentPackage>
+
+    <component id="PostCodeFormatter" class="org.apache.flex.formatters.PostCodeFormatter"/>
+    <component id="PostCodeValidator" class="org.apache.flex.validators.PostCodeValidator"/>
+
+	<component id="ArrayList" class="mx.collections.ArrayList"/>
+	<component id="VectorCollecton" class="mx.collections.VectorCollection"/>
+	<component id="VectorList" class="mx.collections.VectorList"/>
+
+</componentPackage>

Added: incubator/flex/trunk/frameworks/projects/apache/src/ApacheClasses.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/src/ApacheClasses.as?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/src/ApacheClasses.as (added)
+++ incubator/flex/trunk/frameworks/projects/apache/src/ApacheClasses.as Mon Aug  6 10:28:10 2012
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+	
+	internal class ApacheClasses
+	{
+		
+		/**
+		 *  @private
+		 *  This class is used to link additional classes into apache.swc
+		 *  beyond those that are found by dependecy analysis starting
+		 *  from the classes specified in manifest.xml.
+		 */
+
+	}
+	
+}

Added: incubator/flex/trunk/frameworks/projects/apache/src/core/Version.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/src/core/Version.as?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/src/core/Version.as (added)
+++ incubator/flex/trunk/frameworks/projects/apache/src/core/Version.as Mon Aug  6 10:28:10 2012
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+import mx.core.mx_internal;
+
+/**
+ *  @private
+ *  Version string for this class.
+ */
+mx_internal static const VERSION:String = "4.9.0.0";

Added: incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/ArrayList.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/ArrayList.as?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/ArrayList.as (added)
+++ incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/ArrayList.as Mon Aug  6 10:28:10 2012
@@ -0,0 +1,808 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.collections 
+{
+    
+import flash.events.EventDispatcher;
+import flash.events.IEventDispatcher;
+import flash.utils.IDataInput;
+import flash.utils.IDataOutput;
+import flash.utils.IExternalizable;
+import flash.utils.getQualifiedClassName;
+
+import mx.core.IPropertyChangeNotifier;
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
+import mx.events.PropertyChangeEvent;
+import mx.events.PropertyChangeEventKind;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+import mx.utils.ArrayUtil;
+import mx.utils.UIDUtil;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the IList has been updated in some way.
+ *  
+ *  @eventType mx.events.CollectionEvent.COLLECTION_CHANGE
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+[Event(name="collectionChange", type="mx.events.CollectionEvent")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[RemoteClass(alias="flex.messaging.io.ArrayList")]
+
+[ResourceBundle("collections")]
+
+[DefaultProperty("source")]
+
+/**
+ *  The ArrayList class is a simple implementation of IList 
+ *  that uses a backing Array as the source of the data. 
+ * 
+ *  Items in the backing Array can be accessed and manipulated 
+ *  using the methods and properties of the <code>IList</code>
+ *  interface. Operations on an ArrayList instance modify the 
+ *  data source; for example, if you use the <code>removeItemAt()</code> 
+ *  method on an ArrayList, you remove the item from the underlying 
+ *  Array.
+ * 
+ *  This base class will not throw ItemPendingErrors but it
+ *  is possible that a subclass might.
+ * 
+ *  <pre>
+ *  &lt;mx:ArrayList
+ *  <b>Properties</b>
+ *  source="null"
+ *  /&gt;
+ *  </pre>
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class ArrayList extends EventDispatcher
+       implements IList, IExternalizable, IPropertyChangeNotifier
+{
+    //include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Construct a new ArrayList using the specified array as its source.
+     *  If no source is specified an empty array will be used.
+     * 
+     *  @param source The Array to use as a source for the ArrayList.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function ArrayList(source:Array = null)
+    {
+        super();
+
+        disableEvents();
+        this.source = source;
+        enableEvents();
+        _uid = UIDUtil.createUID();
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Used for accessing localized Error messages.
+     */
+    private var resourceManager:IResourceManager =
+        ResourceManager.getInstance();
+                                    
+    /**
+     *  @private 
+     *  Indicates if events should be dispatched.
+     *  calls to enableEvents() and disableEvents() effect the value when == 0
+     *  events should be dispatched. 
+     */
+    private var _dispatchEvents:int = 0;
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    // 
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    // length
+    //----------------------------------
+    
+    [Bindable("collectionChange")]
+    
+    /**
+     *  Get the number of items in the list.  An ArrayList should always
+     *  know its length so it shouldn't return -1, though a subclass may 
+     *  override that behavior.
+     *
+     *  @return int representing the length of the source.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get length():int
+    {
+        if (source)
+            return source.length;
+        else
+            return 0;
+    }
+    
+    //----------------------------------
+    // source
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  Storage for the source Array.
+     */
+    private var _source:Array;
+    
+    /**
+     *  The source array for this ArrayList.  
+     *  Any changes done through the IList interface will be reflected in the 
+     *  source array.  
+     *  If no source array was supplied the ArrayList will create one internally.
+     *  Changes made directly to the underlying Array (e.g., calling 
+     *  <code>theList.source.pop()</code> will not cause <code>CollectionEvents</code> 
+     *  to be dispatched.
+     *
+     *  @return An Array that represents the underlying source.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get source():Array
+    {
+        return _source;
+    }
+    
+    public function set source(s:Array):void
+    {
+        var i:int;
+        var len:int;
+        if (_source && _source.length)
+        {
+            len = _source.length;
+            for (i = 0; i < len; i++)
+            {
+                stopTrackUpdates(_source[i]);
+            }
+        }
+        _source  = s ? s : [];
+        len = _source.length;
+        for (i = 0; i < len; i++)
+        {
+            startTrackUpdates(_source[i]);
+        }
+        
+        if (_dispatchEvents == 0)
+        {
+           var event:CollectionEvent =
+            new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+           event.kind = CollectionEventKind.RESET;
+           dispatchEvent(event);
+        }
+    }
+    
+    //----------------------------------
+    // uid -- mx.core.IPropertyChangeNotifier
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  Storage for the UID String. 
+     */
+    private var _uid:String;
+    
+    /**
+     *  Provides access to the unique id for this list.
+     *  
+     *  @return String representing the internal uid. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */  
+    public function get uid():String
+    {
+        return _uid;
+    }
+    
+    public function set uid(value:String):void
+    {
+        _uid = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Get the item at the specified index.
+     * 
+     *  @param  index the index in the list from which to retrieve the item
+     *  @param  prefetch int indicating both the direction and amount of items
+     *          to fetch during the request should the item not be local.
+     *  @return the item at that index, null if there is none
+     *  @throws ItemPendingError if the data for that index needs to be 
+     *                           loaded from a remote location
+     *  @throws RangeError if the index &lt; 0 or index &gt;= length
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function getItemAt(index:int, prefetch:int = 0):Object
+    {
+        if (index < 0 || index >= length)
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+            
+        return source[index];
+    }
+    
+    /**
+     *  Place the item at the specified index.  
+     *  If an item was already at that index the new item will replace it and it 
+     *  will be returned.
+     *
+     *  @param  item the new value for the index
+     *  @param  index the index at which to place the item
+     *  @return the item that was replaced, null if none
+     *  @throws RangeError if index is less than 0 or greater than or equal to length
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function setItemAt(item:Object, index:int):Object
+    {
+        if (index < 0 || index >= length) 
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+        
+        var oldItem:Object = source[index];
+        source[index] = item;
+        stopTrackUpdates(oldItem);
+        startTrackUpdates(item);
+        
+        //dispatch the appropriate events 
+        if (_dispatchEvents == 0)
+        {
+            var hasCollectionListener:Boolean = 
+                hasEventListener(CollectionEvent.COLLECTION_CHANGE);
+            var hasPropertyListener:Boolean = 
+                hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
+            var updateInfo:PropertyChangeEvent; 
+            
+            if (hasCollectionListener || hasPropertyListener)
+            {
+                updateInfo = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+                updateInfo.kind = PropertyChangeEventKind.UPDATE;
+                updateInfo.oldValue = oldItem;
+                updateInfo.newValue = item;
+                updateInfo.property = index;
+            }
+            
+            if (hasCollectionListener)
+            {
+                var event:CollectionEvent =
+                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+                event.kind = CollectionEventKind.REPLACE;
+                event.location = index;
+                event.items.push(updateInfo);
+                dispatchEvent(event);
+            }
+            
+            if (hasPropertyListener)
+            {
+                dispatchEvent(updateInfo);
+            }
+        }
+        return oldItem;    
+    }
+    
+    /**
+     *  Add the specified item to the end of the list.
+     *  Equivalent to addItemAt(item, length);
+     * 
+     *  @param item the item to add
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addItem(item:Object):void
+    {
+        addItemAt(item, length);
+    }
+    
+    /**
+     *  Add the item at the specified index.  
+     *  Any item that was after this index is moved out by one.  
+     * 
+     *  @param item the item to place at the index
+     *  @param index the index at which to place the item
+     *  @throws RangeError if index is less than 0 or greater than the length
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addItemAt(item:Object, index:int):void
+    {
+        if (index < 0 || index > length) 
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+            
+        source.splice(index, 0, item);
+
+        startTrackUpdates(item);
+        internalDispatchEvent(CollectionEventKind.ADD, item, index);
+    }
+    
+    /**
+     *  @copy mx.collections.ListCollectionView#addAll()
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addAll(addList:IList):void
+    {
+        addAllAt(addList, length);
+    }
+    
+    /**
+     *  @copy mx.collections.ListCollectionView#addAllAt()
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addAllAt(addList:IList, index:int):void
+    {
+        var length:int = addList.length;
+        for (var i:int = 0; i < length; i++)
+        {
+            this.addItemAt(addList.getItemAt(i), i+index);
+        }
+    }
+    
+    /**
+     *  Return the index of the item if it is in the list such that
+     *  getItemAt(index) == item.  
+     *  Note that in this implementation the search is linear and is therefore 
+     *  O(n).
+     * 
+     *  @param item the item to find
+     *  @return the index of the item, -1 if the item is not in the list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function getItemIndex(item:Object):int
+    {
+        return ArrayUtil.getItemIndex(item, source);
+    }
+    
+    /**
+     *  Removes the specified item from this list, should it exist.
+     *
+     *  @param  item Object reference to the item that should be removed.
+     *  @return Boolean indicating if the item was removed.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeItem(item:Object):Boolean
+    {
+        var index:int = getItemIndex(item);
+        var result:Boolean = index >= 0;
+        if (result)
+            removeItemAt(index);
+
+        return result;
+    }
+    
+    /**
+     *  Remove the item at the specified index and return it.  
+     *  Any items that were after this index are now one index earlier.
+     *
+     *  @param index The index from which to remove the item.
+     *  @return The item that was removed.
+     *  @throws RangeError if index &lt; 0 or index &gt;= length.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeItemAt(index:int):Object
+    {
+        if (index < 0 || index >= length)
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+
+        var removed:Object = source.splice(index, 1)[0];
+        stopTrackUpdates(removed);
+        internalDispatchEvent(CollectionEventKind.REMOVE, removed, index);
+        return removed;
+    }
+    
+    /** 
+     *  Remove all items from the list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeAll():void
+    {
+        if (length > 0)
+        {
+            var len:int = length;
+            for (var i:int = 0; i < len; i++)
+            {
+                stopTrackUpdates(source[i]);
+            }
+
+            source.splice(0, length);
+            internalDispatchEvent(CollectionEventKind.RESET);
+        }    
+    }
+    
+    /**
+     *  Notify the view that an item has been updated.  
+     *  This is useful if the contents of the view do not implement 
+     *  <code>IEventDispatcher</code>.  
+     *  If a property is specified the view may be able to optimize its 
+     *  notification mechanism.
+     *  Otherwise it may choose to simply refresh the whole view.
+     *
+     *  @param item The item within the view that was updated.
+     *
+     *  @param property A String, QName, or int
+     *  specifying the property that was updated.
+     *
+     *  @param oldValue The old value of that property.
+     *  (If property was null, this can be the old value of the item.)
+     *
+     *  @param newValue The new value of that property.
+     *  (If property was null, there's no need to specify this
+     *  as the item is assumed to be the new value.)
+     *
+     *  @see mx.events.CollectionEvent
+     *  @see mx.core.IPropertyChangeNotifier
+     *  @see mx.events.PropertyChangeEvent
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+     public function itemUpdated(item:Object, property:Object = null, 
+                                 oldValue:Object = null, 
+                                 newValue:Object = null):void
+    {
+        var event:PropertyChangeEvent =
+            new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+        
+        event.kind = PropertyChangeEventKind.UPDATE;
+        event.source = item;
+        event.property = property;
+        event.oldValue = oldValue;
+        event.newValue = newValue;
+
+		//This handler was intended to handle events from child objects, not to be called directly
+		//itemUpdateHandler(event);        
+
+		internalDispatchEvent(CollectionEventKind.UPDATE, event);
+		
+		// need to dispatch object event now
+		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+		{
+			dispatchPropertyChangeEventClone( event, item );
+		}
+    }    
+    
+    /**
+     *  Return an Array that is populated in the same order as the IList
+     *  implementation.  
+     *
+     *  @return An Array populated in the same order as the IList
+     *  implementation.
+     * 
+     *  @throws ItemPendingError if the data is not yet completely loaded
+     *  from a remote location
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */ 
+    public function toArray():Array
+    {
+        return source.concat();
+    }
+    
+    /**
+     *  Ensures that only the source property is seralized.
+     *  @private
+     */
+    public function readExternal(input:IDataInput):void
+    {
+        source = input.readObject();
+    }
+    
+    /**
+     *  Ensures that only the source property is serialized.
+     *  @private
+     */
+    public function writeExternal(output:IDataOutput):void
+    {
+        output.writeObject(_source);
+    }
+
+    /**
+     *  Pretty prints the contents of this ArrayList to a string and returns it.
+     *
+     *  @return A String containing the contents of the ArrayList.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    override public function toString():String
+    {
+        if (source)
+            return source.toString();
+        else
+            return getQualifiedClassName(this); 
+    }   
+    
+    //--------------------------------------------------------------------------
+    //
+    // Internal Methods
+    // 
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Dispatches a PropertyChangeEvent clone either from a child object whose event needs to be redispatched
+	 *  or when a PropertyChangeEvent is faked inside of this class for the purposes of informing the view
+	 *  of an update to underlying data.
+	 *
+	 *  @param event The PropertyChangeEvent to be cloned and dispatched
+	 *  @param item The item within the view that was updated.
+	 *
+	 *  @see mx.core.IPropertyChangeNotifier
+	 *  @see mx.events.PropertyChangeEvent
+	 */
+	
+	private function dispatchPropertyChangeEventClone( event:PropertyChangeEvent, item:Object ):void {
+		var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
+		
+		var index:int = getItemIndex( item );
+		objEvent.property = index.toString() + "." + event.property;
+		dispatchEvent(objEvent);
+	} 
+
+    /**
+     *  Enables event dispatch for this list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function enableEvents():void
+    {
+        _dispatchEvents++;
+        if (_dispatchEvents > 0)
+            _dispatchEvents = 0;
+    }
+    
+    /**
+     *  Disables event dispatch for this list.
+     *  To re-enable events call enableEvents(), enableEvents() must be called
+     *  a matching number of times as disableEvents().
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function disableEvents():void
+    {
+        _dispatchEvents--;
+    }
+    
+    /**
+     *  Dispatches a collection event with the specified information.
+     *
+     *  @param kind String indicates what the kind property of the event should be
+     *  @param item Object reference to the item that was added or removed
+     *  @param location int indicating where in the source the item was added.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function internalDispatchEvent(kind:String, item:Object = null, location:int = -1):void
+    {
+        if (_dispatchEvents == 0)
+        {
+            if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
+            {
+                var event:CollectionEvent =
+                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+                event.kind = kind;
+                event.items.push(item);
+                event.location = location;
+                dispatchEvent(event);
+            }
+
+            // now dispatch a complementary PropertyChangeEvent
+            if (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE) && 
+               (kind == CollectionEventKind.ADD || kind == CollectionEventKind.REMOVE))
+            {
+                var objEvent:PropertyChangeEvent =
+                    new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+                objEvent.property = location;
+                if (kind == CollectionEventKind.ADD)
+                    objEvent.newValue = item;
+                else
+                    objEvent.oldValue = item;
+                dispatchEvent(objEvent);
+            }
+        }
+    }
+    
+    /**
+     *  Called when any of the contained items in the list dispatch an
+     *  ObjectChange event.  
+     *  Wraps it in a <code>CollectionEventKind.UPDATE</code> object.
+     *
+     *  @param event The event object for the ObjectChange event.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */    
+    protected function itemUpdateHandler(event:PropertyChangeEvent):void
+    {
+        internalDispatchEvent(CollectionEventKind.UPDATE, event);
+
+		// need to dispatch object event now
+		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+		{
+			dispatchPropertyChangeEventClone( event, event.target );
+		}
+    }
+    
+    /** 
+     *  If the item is an IEventDispatcher, watch it for updates.  
+     *  This method is called by the <code>addItemAt()</code> method, 
+     *  and when the source is initially assigned.
+     *
+     *  @param item The item passed to the <code>addItemAt()</code> method.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function startTrackUpdates(item:Object):void
+    {
+        if (item && (item is IEventDispatcher))
+        {
+            IEventDispatcher(item).addEventListener(
+                                        PropertyChangeEvent.PROPERTY_CHANGE, 
+                                        itemUpdateHandler, false, 0, true);
+        }
+    }
+    
+    /** 
+     *  If the item is an IEventDispatcher, stop watching it for updates.
+     *  This method is called by the <code>removeItemAt()</code> and 
+     *  <code>removeAll()</code> methods, and before a new
+     *  source is assigned.
+     *
+     *  @param item The item passed to the <code>removeItemAt()</code> method.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function stopTrackUpdates(item:Object):void
+    {
+        if (item && item is IEventDispatcher)
+        {
+            IEventDispatcher(item).removeEventListener(
+                                        PropertyChangeEvent.PROPERTY_CHANGE, 
+                                        itemUpdateHandler);    
+        }
+    }
+    
+}
+
+}

Added: incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorCollection.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorCollection.as?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorCollection.as (added)
+++ incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorCollection.as Mon Aug  6 10:28:10 2012
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.collections
+{
+
+import flash.utils.IDataInput;
+import flash.utils.IDataOutput;
+import flash.utils.IExternalizable;
+
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+
+[DefaultProperty("source")]
+
+public class VectorCollection extends ListCollectionView implements ICollectionView
+{
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  <p>Creates a new VectorCollection using the specified source vector.
+     *  If no Vector is specified an empty vector of type&lt;*&gt; will be used.</p>
+	 * 
+	 *  Due to the way the compiler (not the runtime) checks Vectors, we need to 
+	 *  leave the source as an &lt;*&gt; until a compiler change can be implemented.
+     */
+    public function VectorCollection(source:* = null)
+    {		
+        super();
+
+        this.source = source;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  source
+    //----------------------------------
+
+    [Inspectable(category="General", arrayType="Object")]
+    [Bindable("listChanged")] //superclass will fire this
+
+    /**
+     *  The source of data in the VectorCollection.
+     *  The VectorCollection object does not represent any changes that you make
+     *  directly to the source Vector. Always use
+     *  the ICollectionView or IList methods to modify the collection.
+     */
+    public function get source():*
+    {
+        if (list && (list is VectorList))
+        {
+            return VectorList(list).source;
+        }
+
+        return null;
+    }
+
+    /**
+     *  @private
+     */
+    public function set source(s:*):void
+    {		
+		//Provides a default VectorList
+		list = new VectorList( s );
+    }
+}
+
+}

Added: incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorList.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorList.as?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorList.as (added)
+++ incubator/flex/trunk/frameworks/projects/apache/src/mx/collections/VectorList.as Mon Aug  6 10:28:10 2012
@@ -0,0 +1,652 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.collections {
+    
+import flash.events.EventDispatcher;
+import flash.events.IEventDispatcher;
+import flash.net.registerClassAlias;
+import flash.system.ApplicationDomain;
+import flash.utils.IDataInput;
+import flash.utils.IDataOutput;
+import flash.utils.IExternalizable;
+import flash.utils.describeType;
+import flash.utils.getQualifiedClassName;
+
+import mx.core.IPropertyChangeNotifier;
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
+import mx.events.PropertyChangeEvent;
+import mx.events.PropertyChangeEventKind;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+import mx.utils.UIDUtil;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the IList has been updated in some way.
+ *  
+ *  @eventType mx.events.CollectionEvent.COLLECTION_CHANGE
+ */
+[Event(name="collectionChange", type="mx.events.CollectionEvent")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[ResourceBundle("collections")]
+
+/**
+ *  @private
+ *  A simple implementation of IList that uses a backing Vector.
+ *  This base class will not throw ItemPendingErrors but it
+ *  is possible that a subclass might.
+ */
+public class VectorList extends EventDispatcher
+	   implements IList, IPropertyChangeNotifier {
+	   
+    //--------------------------------------------------------------------------
+    //
+    // Static Initializer
+    // 
+    //--------------------------------------------------------------------------
+	   /*    {
+        //If one attempt to serialize a Vector in any way, the type of the Vector is not retained unless the types are also aliased
+        //This should really be handled in the VM in my opinion, however, it is being done here to make it more pay as you go
+        //Unfortunately the consequence is that one must either do this manually or in some way reference a VectorList to ensure
+        //proper serialization of their Vectors
+
+	//This is commented out pending the outcome of discussion abotu serialization	
+		registerClassAlias( "Boolean", Boolean );
+        registerClassAlias( "int", int );
+        registerClassAlias( "Number", Number );
+        registerClassAlias( "String", String );
+        registerClassAlias( "uint", uint );
+
+        registerClassAlias( "Array", Array );
+        registerClassAlias( "Date", Date );
+
+        registerClassAlias( "Vector", Vector );
+    }
+		*/	 
+	private static const VECTOR_PREFIX:String = "__AS3__.vec::Vector.";
+	private var fixedLengthVector:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Construct a new VectorList using the specified Vector as its source.
+     *  If no source is specified an empty Vector of type * will be used.
+     */
+    public function VectorList(source:* = null)
+    {
+		super();
+
+        disableEvents();
+        this.source = source;
+        enableEvents();
+        _uid = UIDUtil.createUID();
+    }
+
+	/**
+	 *  @private
+	 *  Used for accessing localized Error messages.
+	 */
+	private var resourceManager:IResourceManager =
+									ResourceManager.getInstance();
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    // 
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    // length
+    //----------------------------------
+
+    /**
+     *  Get the number of items in the list.  An VectorList should always
+     *  know its length so it shouldn't return -1, though a subclass may 
+     *  override that behavior.
+     *
+     *  @return int representing the length of the source.
+     */
+    public function get length():int
+    {
+       	return source.length;
+    }
+    
+    //----------------------------------
+    // source
+    //----------------------------------
+    
+    /**
+     *  The source vector for this VectorList.  
+     *  Any changes done through the IList interface will be reflected in the 
+     *  source Vector.  
+     *  If no source Vector was supplied the VectorList will create one internally.
+     *  Changes made directly to the underlying Vector (e.g., calling 
+     *  <code>theList.source.pop()</code> will not cause <code>CollectionEvents</code> 
+     *  to be dispatched.
+     *
+	 *  @return An Vector that represents the underlying source.
+     */
+    public function get source():*
+    {
+        return _source;
+    }
+    
+    public function set source(s:*):void
+    {
+        var i:int;
+        var len:int;
+        if (_source && _source.length)
+        {
+            len = _source.length;
+            for (i = 0; i < len; i++)
+            {
+                stopTrackUpdates(_source[i]);
+            }
+        }
+		
+		if ( s && !isVector( s ) ) {
+			//Move me to the resource manager
+			throw new TypeError("The source of a VectorList must be a Vector" );
+		} 
+
+		_source  = s ? s : new Vector.<*>();
+
+		if ( _source.fixed ) {
+			fixedLengthVector = true;
+		}
+		
+        len = _source.length;
+        for (i = 0; i < len; i++)
+        {
+            startTrackUpdates(_source[i]);
+        }
+        
+        if (_dispatchEvents == 0)
+        {
+           var event:CollectionEvent =
+			new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+           event.kind = CollectionEventKind.RESET;
+           dispatchEvent(event);
+        }
+    }
+    
+    //----------------------------------
+    // uid -- mx.core.IPropertyChangeNotifier
+    //----------------------------------
+    
+    /**
+     *  Provides access to the unique id for this list.
+     *  
+     *  @return String representing the internal uid. 
+     */  
+    public function get uid():String
+    {
+    	return _uid;
+    }
+    
+    public function set uid(value:String):void
+    {
+    	_uid = value;
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    // 
+    //--------------------------------------------------------------------------
+	private function isVector( value:* ):Boolean {
+		//I am rather ashamed of doing this, but it seems the only reliable way we have to ensure we were given a Vector 
+		//is to compare it against a string
+		var sourceClassName:String = getQualifiedClassName( value );
+
+		return ( sourceClassName.indexOf( VECTOR_PREFIX ) >= 0 );
+	}
+	
+    /**
+     *  Get the item at the specified index.
+     * 
+     *  @param 	index the index in the list from which to retrieve the item
+     *  @param	Not used in this implementation at this time
+     *  @return the item at that index, null if there is none
+     *  @throws RangeError if the index < 0 or index >= length
+     */
+    public function getItemAt(index:int, prefetch:int = 0):Object
+    {
+        if (index < 0 || index >= length)
+		{
+			var message:String = resourceManager.getString(
+				"collections", "outOfBounds", [ index ]);
+        	throw new RangeError(message);
+		}
+            
+        return source[index];
+    }
+    
+    /**
+     *  Place the item at the specified index.  
+     *  If an item was already at that index the new item will replace it and it 
+     *  will be returned.
+     *
+     *  @param 	item the new value for the index
+     *  @param 	index the index at which to place the item
+     *  @return the item that was replaced, null if none
+     *  @throws RangeError if index is less than 0 or greater than or equal to length
+     */
+    public function setItemAt(item:Object, index:int):Object
+    {
+        if (index < 0 || index >= length) 
+		{
+			var message:String = resourceManager.getString(
+				"collections", "outOfBounds", [ index ]);
+        	throw new RangeError(message);
+		}
+        
+        var oldItem:Object = source[index];
+        source[index] = item;
+        stopTrackUpdates(oldItem);
+        startTrackUpdates(item);
+        
+        //dispatch the appropriate events 
+        if (_dispatchEvents == 0)
+        {
+        	var hasCollectionListener:Boolean = 
+        		hasEventListener(CollectionEvent.COLLECTION_CHANGE);
+        	var hasPropertyListener:Boolean = 
+        		hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
+        	var updateInfo:PropertyChangeEvent; 
+        	
+        	if (hasCollectionListener || hasPropertyListener)
+        	{
+        		updateInfo = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+        		updateInfo.kind = PropertyChangeEventKind.UPDATE;
+            	updateInfo.oldValue = oldItem;
+            	updateInfo.newValue = item;
+            	updateInfo.property = index;
+        	}
+        	
+        	if (hasCollectionListener)
+        	{
+           		var event:CollectionEvent =
+					new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+            	event.kind = CollectionEventKind.REPLACE;
+            	event.location = index;
+            	event.items.push(updateInfo);
+            	dispatchEvent(event);
+         	}
+         	
+         	if (hasPropertyListener)
+         	{
+            	dispatchEvent(updateInfo);
+          	}
+        }
+        return oldItem;    
+    }
+    
+    /**
+     *  Add the specified item to the end of the list.
+     *  Equivalent to addItemAt(item, length);
+     * 
+     *  @param item the item to add
+     */
+    public function addItem(item:Object):void
+    {
+        addItemAt(item, length);
+    }
+    
+    /**
+     *  Add the item at the specified index.  
+     *  Any item that was after this index is moved out by one.  
+     * 
+     *  @param item the item to place at the index
+     *  @param index the index at which to place the item
+     *  @throws RangeError if index is less than 0 or greater than the length
+     */
+    public function addItemAt(item:Object, index:int):void
+    {
+		if ( fixedLengthVector ) {
+			//Make a message in manager
+			throw new RangeError( "Fixed Length Vector");
+		}
+
+		if ( index < 0 || index > length) 
+		{
+			var message:String = resourceManager.getString(
+				"collections", "outOfBounds", [ index ]);
+        	throw new RangeError(message);
+		}
+        	
+        source.splice(index, 0, item);
+
+        startTrackUpdates(item);
+        internalDispatchEvent(CollectionEventKind.ADD, item, index);
+    }
+    
+    /**
+     *  Return the index of the item if it is in the list such that
+     *  getItemAt(index) == item.  
+     *  Note that in this implementation the search is linear and is therefore 
+     *  O(n).
+     * 
+     *  @param item the item to find
+     *  @return the index of the item, -1 if the item is not in the list.
+     */
+    public function getItemIndex(item:Object):int
+    {
+        var n:int = source.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            if (source[i] === item)
+                return i;
+        }
+
+        return -1;           
+    }
+ 
+    /**
+     *  Removes the specified item from this list, should it exist.
+     *
+     *	@param	item Object reference to the item that should be removed.
+     *  @return	Boolean indicating if the item was removed.
+     */
+    public function removeItem(item:Object):Boolean
+    {
+    	var index:int = getItemIndex(item);
+    	var result:Boolean = index >= 0;
+    	if (result)
+    		removeItemAt(index);
+
+    	return result;
+    }
+    
+    /**
+     *  Remove the item at the specified index and return it.  
+     *  Any items that were after this index are now one index earlier.
+     *
+     *  @param index the index from which to remove the item
+     *  @return the item that was removed
+     *  @throws RangeError is index < 0 or index >= length
+     */
+    public function removeItemAt(index:int):Object
+    {
+		if ( fixedLengthVector ) {
+			//Make a message in manager
+			throw new RangeError( "Fixed Length Vector");
+		}
+
+		if (index < 0 || index >= length)
+		{
+			var message:String = resourceManager.getString(
+				"collections", "outOfBounds", [ index ]);
+        	throw new RangeError(message);
+		}
+
+        var removed:Object = source.splice(index, 1)[0];
+        stopTrackUpdates(removed);
+        internalDispatchEvent(CollectionEventKind.REMOVE, removed, index);
+        return removed;
+    }
+    
+    /** 
+     *  Remove all items from the list.
+     */
+    public function removeAll():void
+    {
+        if (length > 0)
+        {
+            var len:int = length;
+            for (var i:int = 0; i < len; i++)
+            {
+                stopTrackUpdates(source[i]);
+            }
+
+            source.splice(0, length);
+			internalDispatchEvent(CollectionEventKind.RESET);
+        }    
+    }
+    
+    /**
+     *  Notify the view that an item has been updated.  
+     *  This is useful if the contents of the view do not implement 
+     *  <code>IEventDispatcher</code>.  
+     *  If a property is specified the view may be able to optimize its 
+     *  notification mechanism.
+     *  Otherwise it may choose to simply refresh the whole view.
+     *
+     *  @param item The item within the view that was updated.
+	 *
+     *  @param property A String, QName, or int
+	 *  specifying the property that was updated.
+	 *
+     *  @param oldValue The old value of that property.
+	 *  (If property was null, this can be the old value of the item.)
+	 *
+     *  @param newValue The new value of that property.
+	 *  (If property was null, there's no need to specify this
+	 *  as the item is assumed to be the new value.)
+     *
+     *  @see mx.events.CollectionEvent
+     *  @see mx.core.IPropertyChangeNotifier
+     *  @see mx.events.PropertyChangeEvent
+     */
+     public function itemUpdated(item:Object, property:Object = null, 
+                                 oldValue:Object = null, 
+                                 newValue:Object = null):void
+    {
+        var event:PropertyChangeEvent =
+			new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+        
+		event.kind = PropertyChangeEventKind.UPDATE;
+        event.source = item;
+        event.property = property;
+        event.oldValue = oldValue;
+        event.newValue = newValue;
+        
+		internalDispatchEvent(CollectionEventKind.UPDATE, event);
+		
+		// need to dispatch object event now
+		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+		{
+			dispatchPropertyChangeEventClone( event, item );
+		}
+    }    
+
+    /**
+     *  Return an Vector that is populated in the same order as the IList
+     *  implementation.  
+     * 
+     *  @throws ItemPendingError if the data is not yet completely loaded
+     *  from a remote location
+     */ 
+    public function toArray():Array
+    {
+    	var ar:Array = new Array( source.length );
+    	
+    	for ( var i:int=0;i<source.length; i++ ) {
+    		ar[ i ] = source[ i ];
+    	}
+
+        return ar;
+    }
+
+	/**
+     *  Pretty prints the contents of this VectorList to a string and returns it.
+     */
+    override public function toString():String
+	{
+		return source.toString();
+	}	
+    
+    //--------------------------------------------------------------------------
+    //
+    // Internal Methods
+    // 
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Dispatches a PropertyChangeEvent clone either from a child object whose event needs to be redispatched
+	 *  or when a PropertyChangeEvent is faked inside of this class for the purposes of informing the view
+	 *  of an update to underlying data.
+	 *
+	 *  @param event The PropertyChangeEvent to be cloned and dispatched
+	 *  @param item The item within the view that was updated.
+	 *
+	 *  @see mx.core.IPropertyChangeNotifier
+	 *  @see mx.events.PropertyChangeEvent
+	 */
+	
+	private function dispatchPropertyChangeEventClone( event:PropertyChangeEvent, item:Object ):void {
+		var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
+		
+		var index:int = getItemIndex( item );
+		objEvent.property = index.toString() + "." + event.property;
+		dispatchEvent(objEvent);
+	} 
+
+	/**
+	 *  Enables event dispatch for this list.
+	 */
+	private function enableEvents():void
+	{
+		_dispatchEvents++;
+		if (_dispatchEvents > 0)
+			_dispatchEvents = 0;
+	}
+	
+	/**
+	 *  Disables event dispatch for this list.
+	 *  To re-enable events call enableEvents(), enableEvents() must be called
+	 *  a matching number of times as disableEvents().
+	 */
+	private function disableEvents():void
+	{
+		_dispatchEvents--;
+	}
+	
+	/**
+	 *  Dispatches a collection event with the specified information.
+	 *
+	 *  @param kind String indicates what the kind property of the event should be
+	 *  @param item Object reference to the item that was added or removed
+	 *  @param location int indicating where in the source the item was added.
+	 */
+	private function internalDispatchEvent(kind:String, item:Object = null, location:int = -1):void
+	{
+    	if (_dispatchEvents == 0)
+    	{
+    		if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
+    		{
+		        var event:CollectionEvent =
+					new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+		        event.kind = kind;
+		        event.items.push(item);
+		        event.location = location;
+		        dispatchEvent(event);
+		    }
+
+	    	// now dispatch a complementary PropertyChangeEvent
+	    	if (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE) && 
+	    	   (kind == CollectionEventKind.ADD || kind == CollectionEventKind.REMOVE))
+	    	{
+	    		var objEvent:PropertyChangeEvent =
+					new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+	    		objEvent.property = location;
+	    		if (kind == CollectionEventKind.ADD)
+	    			objEvent.newValue = item;
+	    		else
+	    			objEvent.oldValue = item;
+	    		dispatchEvent(objEvent);
+	    	}
+	    }
+	}
+	
+    /**
+     *  Called whenever any of the contained items in the list fire an
+     *  ObjectChange event.  
+     *  Wraps it in a CollectionEventKind.UPDATE.
+     */    
+    protected function itemUpdateHandler(event:PropertyChangeEvent):void
+    {
+		internalDispatchEvent(CollectionEventKind.UPDATE, event);
+		// need to dispatch object event now
+    	if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+    	{
+			dispatchPropertyChangeEventClone( event, event.target );
+    	}
+    }
+    
+    /** 
+     *  If the item is an IEventDispatcher watch it for updates.  
+     *  This is called by addItemAt and when the source is initially
+     *  assigned.
+     */
+    protected function startTrackUpdates(item:Object):void
+    {
+        if (item && (item is IEventDispatcher))
+        {
+            IEventDispatcher(item).addEventListener(
+				                        PropertyChangeEvent.PROPERTY_CHANGE, 
+                                        itemUpdateHandler, false, 0, true);
+        }
+    }
+    
+    /** 
+     *  If the item is an IEventDispatcher stop watching it for updates.
+     *  This is called by removeItemAt, removeAll, and before a new
+     *  source is assigned.
+     */
+    protected function stopTrackUpdates(item:Object):void
+    {
+        if (item && item is IEventDispatcher)
+        {
+            IEventDispatcher(item).removeEventListener(
+				                        PropertyChangeEvent.PROPERTY_CHANGE, 
+                                        itemUpdateHandler);    
+        }
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    // 
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  indicates if events should be dispatched.
+	 *  calls to enableEvents() and disableEvents() effect the value when == 0
+	 *  events should be dispatched. 
+	 */
+	private var _dispatchEvents:int = 0;
+    private var _source:*;
+    private var _uid:String;
+}
+
+}

Added: incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/formatters/PostCodeFormatter.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/formatters/PostCodeFormatter.as?rev=1369772&view=auto
==============================================================================
--- incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/formatters/PostCodeFormatter.as (added)
+++ incubator/flex/trunk/frameworks/projects/apache/src/org/apache/flex/formatters/PostCodeFormatter.as Mon Aug  6 10:28:10 2012
@@ -0,0 +1,299 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.formatters
+{
+import org.apache.flex.validators.PostCodeValidator;
+	
+import mx.events.ValidationResultEvent;
+import mx.formatters.Formatter;
+import mx.managers.ISystemManager;
+import mx.managers.SystemManager;
+import mx.validators.ValidationResult;
+
+[ResourceBundle("validators")]
+
+/**
+ *  The PostCodeFormatter class formats a valid postcode
+ *  based on a user set <code>formatString</code> or
+ *  <code>formats</code> property.
+ *
+ *  <p>Postcode formats consists of the letters C, N, A and spaces or hyphens
+ *  <ul>
+ *  <li>CC or C is the country code (required for some postcodes).</li>
+ *	<li>N is a number 0-9.</li>
+ *  <li>A is a letter A-Z or a-z,</li>
+ *  </ul></p>
+ *
+ *  <p>Country codes one be one or two digits.</p>
+ *
+ *  <p>For example "NNNN" is a four digit numeric postcode, "CCNNNN" is country code
+ *  followed by four digits and "AA NNNN" is two letters, followed by a space then
+ *  followed by four digits.</p>
+ *
+ *  <p>More than one format can be specified by setting the <code>formats</code>
+ *  property to an array of format strings.</p>
+ *
+ *  <p>Spaces and hypens will be added if missing to format the postcode correctly.</p>
+ *
+ *  <p>If an error occurs, an empty String is returned and a String that
+ *  describes the error is saved to the <code>error</code> property.
+ *  The <code>error</code> property can have one of the following values:
+ *  <ul>
+ *    <li><code>"invalidFormat"</code> means the format constants an invalid
+ *    character.</li>
+ *    <li><code>"wrongFormat"</code> means the postcode has an invalid format.</li>
+ *    <li><code>"wrongLength"</code> means the postcode is not a valid length.</li>
+ *    <li><code>"invalidChar"</code> means the postcode contains an invalid
+ *    character.</li>
+ *  </ul></p>
+ *
+ *  <p>Fullwidth numbers and letters are supported in postcodes by ignoring character
+ *  width via the <code>flash.globalization.Collator</code> <code>equals</code> method.</p>
+ *
+ *  @mxml
+ *
+ *  <p>The <code>&lt;mx:PostCodeFormatter&gt;</code> tag
+ *  inherits all of the tag attributes of its superclass,
+ *  and adds the following tag attributes:</p>
+ *
+ *  <pre>
+ *  &lt;mx:PostCodeFormatter
+ *    formatString="NNNNN"
+ *    formats="['NNNNN', 'NNNNN-NNNN']"
+ *  />
+ *  </pre>
+ *
+ *  @see org.apache.flex.validators.PostCodeValidator
+ * 
+ *  @includeExample PostCodeValidationExample.mxml
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10.2
+ *  @productversion ApacheFlex 4.8
+ */
+public class PostCodeFormatter extends Formatter
+{
+    include "../../../../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @productversion ApacheFlex 4.8
+     */
+    public function PostCodeFormatter()
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  formats
+    //----------------------------------
+
+    /**
+     *  @private
+     *  An array of the postcode formats to check against.
+     */
+    private var _formats:Array = [];
+
+
+    [Inspectable(category = "General", defaultValue = "null")]
+
+    /**
+     *  Format string to format the postcode in.
+     *
+     *  <p>The format string consists of the letters C, N, A and spaces
+     *  or hyphens:
+     *  <ul>
+     *  <li>CC or C is country code (required for some postcodes).</li>
+     *	<li>N is a number 0-9.</li>
+     *  <li>A is a letter A-Z or a-z.</li>
+     *  </ul></p>
+     *
+     *  @default null
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @productversion ApacheFlex 4.8
+     */
+    public function get formatString():String
+    {
+        if (_formats && _formats.length == 1)
+            return _formats[0];
+
+        return null;
+    }
+
+    /**
+     *  @private
+     */
+    public function set formatString(value:String):void
+    {
+        if (value != null)
+            _formats = [ value ];
+        else
+            _formats = [];
+    }
+
+    /**
+     *  An array of format strings to format the postcode in.
+     *
+     *  <p>Use for locales where more than one format is required.
+     *  eg en_UK</p>
+     *
+     *  <p>See <code>formatString</code> for format of the format
+     *  strings.</p>
+     *
+     *  @default []
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @productversion ApacheFlex 4.8
+     */
+    public function get formats():Array
+    {
+        return _formats;
+    }
+
+    /**
+     *  @private
+     */
+    public function set formats(value:Array):void
+    {
+        _formats = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overidden methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+       *  Formats the value by using the format set in <code>formatString</code>
+       *  or <code>formats</code>.
+       *
+       *  <p>If the value cannot be formatted this method returns an empty String
+       *  and write a description of the error to the <code>error</code> property.</p>
+       *
+       *  @param value Value to format.
+       *
+       *  @return Formatted String. Empty if an error occurs. A description
+       *  of the error condition is written to the <code>error</code> property.
+       *
+       *  @langversion 3.0
+       *  @playerversion Flash 10.2
+       *  @productversion ApacheFlex 4.8
+       */
+    override public function format(value:Object):String
+    {
+        var postCode:String = value as String;
+        var formatted:String = "";
+        var validator:PostCodeValidator = new PostCodeValidator();
+        var errors:Array;
+
+        error = "";
+
+        validator.formats = formats;
+        errors = PostCodeValidator.validatePostCode(validator, postCode, null);
+
+        // Valid postcode no need for formatting
+        if (errors.length == 0)
+            return postCode ? postCode : "";
+
+        // Check and add missing (or convert) padding characters
+        for each (var format:String in formats)
+        {
+            var condensedPostcode:String = condensedFormat(postCode);
+            var condensedFormat:String = condensedFormat(format);
+            var char:String;
+            var length:int = format.length;
+            var condensedErrors:Array;
+
+            validator.format = condensedFormat;
+
+            condensedErrors = PostCodeValidator.validatePostCode(validator, condensedPostcode, null);
+
+            if (condensedErrors.length == 0)
+            {
+                var pos:int = 0;
+
+                for (var i:int = 0; i < length; i++)
+                {
+                    char = format.charAt(i);
+
+                    if (PostCodeValidator.FORMAT_SPACERS.indexOf(char) >= 0)
+                        formatted += char;
+                    else
+                        formatted += condensedPostcode.charAt(pos++);
+                }
+
+                //TODO may want to return the longest match?
+                errors = [];
+                break;
+            }
+        }
+
+        if (errors.length > 0)
+            error = (errors[0] as ValidationResult).errorCode;
+
+        return formatted;
+    }
+
+    /**
+     *  @private
+     *
+     *  Take a format or paostCode and strip all spacing characters
+     *  out of it.
+     *
+     */
+    protected function condensedFormat(postCode:String):String
+    {
+        var condensed:String = postCode;
+        var length:int;
+
+        if (postCode)
+            length = postCode.length;
+
+        for (var i:int = 0; i < length; i++)
+        {
+            var char:String = PostCodeValidator.FORMAT_SPACERS.charAt(i);
+
+            condensed = condensed.split(char).join("");
+        }
+
+        return condensed;
+    }
+
+}
+}



Mime
View raw message