flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mamsel...@apache.org
Subject [05/15] git commit: [flex-sdk] [refs/heads/develop] - https://issues.apache.org/jira/browse/FLEX-33777 Dagrid for mobile - formatted sources code - added ASDOC (almost all) - bug: Bitmap renderer does not support MultiDPI when appDPI is set
Date Fri, 04 Oct 2013 23:03:11 GMT
https://issues.apache.org/jira/browse/FLEX-33777 Dagrid for mobile
- formatted sources code
- added ASDOC (almost all)
- bug:  Bitmap renderer does not support MultiDPI when appDPI is set


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b78de5c0
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b78de5c0
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b78de5c0

Branch: refs/heads/develop
Commit: b78de5c0c4b019c2d928d21f6fb2a8eb485161e6
Parents: aef85b3
Author: mamsellem <maurice.amsellem@systar.com>
Authored: Tue Oct 1 12:02:14 2013 +0200
Committer: mamsellem <maurice.amsellem@systar.com>
Committed: Tue Oct 1 12:02:14 2013 +0200

----------------------------------------------------------------------
 asdoc/build.xml                                 |   2 +
 .../assets/images/mobile160/dg_header_asc.png   | Bin 0 -> 447 bytes
 .../assets/images/mobile160/dg_header_desc.png  | Bin 0 -> 418 bytes
 .../assets/images/mobile160/dg_header_sep.png   | Bin 0 -> 201 bytes
 .../images/mobile160/dg_header_shadow.png       | Bin 0 -> 277 bytes
 .../assets/images/mobile320/dg_header_asc.png   | Bin 0 -> 527 bytes
 .../assets/images/mobile320/dg_header_desc.png  | Bin 0 -> 496 bytes
 .../assets/images/mobile320/dg_header_sep.png   | Bin 0 -> 215 bytes
 .../images/mobile320/dg_header_shadow.png       | Bin 0 -> 329 bytes
 .../projects/experimental_mobile/build.xml      |  11 +-
 .../experimental_mobile/bundle-config.xml       |  20 +-
 .../experimental_mobile/compile-config.xml      |   5 +-
 .../projects/experimental_mobile/defaults.css   | 129 +++
 .../projects/experimental_mobile/manifest.xml   |  57 +-
 .../src/ExperimentalMobileClasses.as            |  25 +-
 .../src/spark/components/MobileGrid.as          | 302 +++++++
 .../itemRenderers/IItemPartRendererBase.as      |  55 ++
 .../itemRenderers/IItemTextPartRenderer.as      |  35 +
 .../itemRenderers/ItemBitmapPartRenderer.as     | 144 +++
 .../itemRenderers/ItemTextPartRenderer.as       |  97 ++
 .../supportClasses/IPartRendererDescriptor.as   |  34 +
 .../supportClasses/ItemRendererBase.as          | 894 +++++++++++++++++++
 .../ListMultiPartItemRendererBase.as            | 119 +++
 .../supportClasses/ListMultiPartLayoutBase.as   | 141 +++
 .../supportClasses/ListMultiPartTabbedLayout.as |  82 ++
 .../supportClasses/MobileGridColumn.as          | 148 +++
 .../supportClasses/MobileGridHeader.as          | 151 ++++
 .../supportClasses/MobileGridRowRenderer.as     |  34 +
 .../PartRendererDescriptorBase.as               | 184 ++++
 .../src/spark/events/MobileGridHeaderEvent.as   |  58 ++
 .../skins/MobileGridHeaderButtonBarSkin.as      |  89 ++
 .../spark/skins/MobileGridHeaderButtonSkin.as   |  43 +
 .../skins/MobileGridHeaderFirstButtonSkin.as    |  35 +
 .../src/spark/skins/MobileGridSkin.as           | 178 ++++
 .../assets/MobileGridHeaderButton_down.fxg      |  46 +
 .../mobile/assets/MobileGridHeaderButton_up.fxg |  44 +
 .../assets/MobileGridHeaderFirstButton_down.fxg |  34 +
 .../assets/MobileGridHeaderFirstButton_up.fxg   |  32 +
 .../src/spark/utils/DensityUtil2.as             |  88 ++
 .../src/spark/utils/MultiDPIBitmapSourceExt.as  |  44 +
 .../src/spark/utils/UIComponentUtils.as         | 163 ++++
 41 files changed, 3471 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/asdoc/build.xml
----------------------------------------------------------------------
diff --git a/asdoc/build.xml b/asdoc/build.xml
index 8803daf..ed9ea86 100644
--- a/asdoc/build.xml
+++ b/asdoc/build.xml
@@ -105,6 +105,7 @@
             <!--  added for Apache -->
 			<compiler.source-path path-element="${flexlib}/projects/apache/src"/>
 			<compiler.source-path path-element="${flexlib}/projects/experimental/src"/>
+            <compiler.source-path path-element="${flexlib}/projects/experimental_mobile/src"/>
 						
 			<!-- namespaces to include in asdoc -->
 		    <doc-namespaces uri="http://www.adobe.com/2006/airmxml"/>
@@ -141,6 +142,7 @@
             <!--  added for Apache -->
 		    <namespace uri="http://flex.apache.org/ns" manifest="${flexlib}/projects/apache/manifest.xml"/>
 		    <namespace uri="http://flex.apache.org/experimental/ns" manifest="${flexlib}/projects/experimental/manifest.xml"/>
+            <namespace uri="http://flex.apache.org/experimental/ns"  manifest="${flexlib}/projects/experimental_mobile/manifest.xml"/>
 
 			<library-path/>
             <external-library-path dir="${env.AIR_HOME}/frameworks/libs/air">

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_asc.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_asc.png b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_asc.png
new file mode 100644
index 0000000..6da01b4
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_asc.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_desc.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_desc.png b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_desc.png
new file mode 100644
index 0000000..3b0d1d0
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_desc.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_sep.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_sep.png b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_sep.png
new file mode 100644
index 0000000..67aa576
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_sep.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_shadow.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_shadow.png b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_shadow.png
new file mode 100644
index 0000000..d97bbcd
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile160/dg_header_shadow.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_asc.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_asc.png b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_asc.png
new file mode 100644
index 0000000..cec2d5a
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_asc.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_desc.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_desc.png b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_desc.png
new file mode 100644
index 0000000..e4bf91c
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_desc.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_sep.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_sep.png b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_sep.png
new file mode 100644
index 0000000..fd9800a
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_sep.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_shadow.png
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_shadow.png b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_shadow.png
new file mode 100644
index 0000000..b92d426
Binary files /dev/null and b/frameworks/projects/experimental_mobile/assets/images/mobile320/dg_header_shadow.png differ

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/build.xml b/frameworks/projects/experimental_mobile/build.xml
index 4796850..735e5e2 100644
--- a/frameworks/projects/experimental_mobile/build.xml
+++ b/frameworks/projects/experimental_mobile/build.xml
@@ -161,8 +161,9 @@
 
 	<target name="compile" description="Compiles experimental_mobile.swc">
 		<echo message="Compiling frameworks/libs/experimental_mobile.swc"/>
+        <echo message="Using ${env.AIR_HOME}/frameworks/libs/air/airglobal.swc" level="info"/>
 
-		<!-- Load the <compc> task. We can't do this at the <project> level -->
+        <!-- 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"/>
 		<!--
@@ -183,7 +184,7 @@
 			<jvmarg line="${compc.jvm.args}"/>
             <load-config filename="compile-config.xml" />
             <arg value="+playerglobal.version=${playerglobal.version}" />
-            <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+            <arg value="+env.AIR_HOME=${env.AIR_HOME}"/>
         </compc>
 	</target>
 
@@ -209,6 +210,12 @@
 		<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="ExperimentalMobileClasses"/>
+            <external-library-path dir="${FLEX_HOME}/frameworks/themes/Mobile">
+                <include name="mobile.swc"/>
+            </external-library-path>
+            <external-library-path dir="${FLEX_HOME}/frameworks/libs/mobile">
+                <include name="mobilecomponents.swc"/>
+            </external-library-path>
 		    <namespace uri="http://flex.apache.org/experimental/ns" manifest="${basedir}/manifest.xml"/>
 		    <namespace uri="library://ns.adobe.com/flex/spark" manifest="${basedir}/spark-manifest.xml"/>
 		    <jvmarg line="${asdoc.jvm.args}"/>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/bundle-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/bundle-config.xml b/frameworks/projects/experimental_mobile/bundle-config.xml
index 0fce3e0..3a1117c 100644
--- a/frameworks/projects/experimental_mobile/bundle-config.xml
+++ b/frameworks/projects/experimental_mobile/bundle-config.xml
@@ -18,35 +18,33 @@
 -->
 <flex-config>
 
-    <compiler>        
+    <compiler>
         <external-library-path>
             <path-element>${env.PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element>
             <path-element>../../libs/framework.swc</path-element>
-            <path-element>../../libs/spark.swc</path-element>
-            <path-element>../../libs/mobile/mobilecomponents.swc</path-element>
         </external-library-path>
-        
+
         <include-libraries/>
-        
+
         <library-path/>
-        
+
         <locale>
             <locale-element>${locale}</locale-element>
         </locale>
-        
+
         <source-path>
             <path-element>src</path-element>
             <path-element>bundles/${locale}</path-element>
         </source-path>
     </compiler>
-    
+
     <include-classes/>
-    
+
     <include-namespaces/>
-    
+
     <include-resource-bundles>
         <bundle>experimental</bundle>
     </include-resource-bundles>
-        
+
     <target-player>${playerglobal.version}</target-player>
 </flex-config>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/compile-config.xml b/frameworks/projects/experimental_mobile/compile-config.xml
index 4e0ee97..7a21013 100644
--- a/frameworks/projects/experimental_mobile/compile-config.xml
+++ b/frameworks/projects/experimental_mobile/compile-config.xml
@@ -22,11 +22,14 @@
         <accessible>true</accessible>
 
         <external-library-path>
-            <path-element>${env.PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element>
+            <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+            <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
             <path-element>../../libs/framework.swc</path-element>
+            <path-element>../../libs/apache.swc</path-element>
             <path-element>../../libs/spark.swc</path-element>
             <path-element>../../libs/textlayout.swc</path-element>
             <path-element>../../libs/mobile/mobilecomponents.swc</path-element>
+            <path-element>../../themes/Mobile/mobile.swc</path-element>
         </external-library-path>
 
         <keep-as3-metadata>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/defaults.css b/frameworks/projects/experimental_mobile/defaults.css
index 66188a1..236ea6f 100644
--- a/frameworks/projects/experimental_mobile/defaults.css
+++ b/frameworks/projects/experimental_mobile/defaults.css
@@ -18,3 +18,132 @@
 */
 @namespace "http://flex.apache.org/experimental/ns";
 @namespace s "library://ns.adobe.com/flex/spark";
+@namespace supportClasses "spark.components.supportClasses.*";
+
+MobileGrid
+{
+    skinClass: ClassReference('spark.skins.MobileGridSkin');
+    contentBackgroundColor: #202020;
+    alternatingItemColors: #202020, #2a2a2a;
+    color: white;
+    selection-color: #00a2ff; /* blue  */
+}
+
+supportClasses|MobileGridHeader
+{
+    chromeColor: #383838;
+    skinClass: ClassReference('spark.skins.MobileGridHeaderButtonBarSkin');
+    fontWeight: bold;
+    /*   color: #f0f0f0;  */
+}
+
+supportClasses|ItemRendererBase
+{
+    verticalAlign: "middle";
+}
+
+@media (application-dpi: 120)
+{
+
+    supportClasses|MobileGridHeader
+    {
+        fontSize: 10;
+    }
+
+    supportClasses|MobileGridRowRenderer
+    {
+        paddingTop: 1;
+        paddingLeft: 7;
+        paddingRight: 7;
+        paddingBottom: 0;
+    }
+
+    supportClasses|ItemRendererBase
+    {
+        color: #bae5ff;
+        paddingBottom: 12;
+        paddingLeft: 7;
+        paddingRight: 7;
+        paddingTop: 12;
+    }
+}
+
+@media (application-dpi: 160)
+{
+
+    supportClasses|MobileGridHeader
+    {
+        fontSize: 14;
+    }
+
+    supportClasses|MobileGridRowRenderer
+    {
+        paddingTop: 1;
+        paddingLeft: 10;
+        paddingRight: 10;
+        paddingBottom: 0;
+    }
+
+    supportClasses|ItemRendererBase
+    {
+        color: #acffb5;
+        paddingBottom: 16;
+        paddingLeft: 10;
+        paddingRight: 10;
+        paddingTop: 16;
+    }
+}
+
+@media (application-dpi: 240)
+{
+
+    supportClasses|MobileGridHeader
+    {
+        fontSize: 20;
+    }
+
+    supportClasses|MobileGridRowRenderer
+    {
+        paddingTop: 2;
+        paddingLeft: 14;
+        paddingRight: 14;
+        paddingBottom: 0;
+    }
+
+    supportClasses|ItemRendererBase
+    {
+        color: #fbffa0;
+        paddingBottom: 24;
+        paddingLeft: 14;
+        paddingRight: 14;
+        paddingTop: 24;
+    }
+}
+
+@media (application-dpi: 320)
+{
+
+    supportClasses|MobileGridHeader
+    {
+        fontSize: 28;
+    }
+
+    supportClasses|MobileGridRowRenderer
+    {
+        color: #ffc2aa;
+        paddingTop: 2;
+        paddingLeft: 20;
+        paddingRight: 20;
+        paddingBottom: 0;
+    }
+
+    supportClasses|ItemRendererBase
+    {
+        paddingBottom: 32;
+        paddingLeft: 20;
+        paddingRight: 20;
+        paddingTop: 32;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/manifest.xml b/frameworks/projects/experimental_mobile/manifest.xml
index 4864d95..9cb9823 100644
--- a/frameworks/projects/experimental_mobile/manifest.xml
+++ b/frameworks/projects/experimental_mobile/manifest.xml
@@ -1,29 +1,28 @@
-<?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.
-
--->
-
-<!--
-
-    Experimental Mobile Components
-
--->
-<componentPackage>
-
-    
-</componentPackage>
+<?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.
+-->
+
+<!--
+    Experimental Mobile Components
+-->
+<componentPackage>
+    <component class="spark.components.MobileGrid"/>
+    <component class="spark.components.supportClasses.MobileGridColumn"/>
+    <component class="spark.components.itemRenderers.ItemBitmapPartRenderer"/>
+    <component class="spark.components.itemRenderers.ItemTextPartRenderer"/>
+</componentPackage>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/ExperimentalMobileClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/ExperimentalMobileClasses.as b/frameworks/projects/experimental_mobile/src/ExperimentalMobileClasses.as
index 76e561c..215735f 100644
--- a/frameworks/projects/experimental_mobile/src/ExperimentalMobileClasses.as
+++ b/frameworks/projects/experimental_mobile/src/ExperimentalMobileClasses.as
@@ -18,13 +18,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 package
 {
-	internal class ExperimentalMobileClasses
-	{
-		/**
-		 *  @private
-		 *  This class is used to link additional classes into experimental.swc
-		 *  beyond those that are found by dependecy analysis starting
-		 *  from the classes specified in manifest.xml.
-		 */
-	}
+import spark.components.MobileGrid;
+import spark.components.supportClasses.MobileGridColumn;
+import spark.skins.MobileGridHeaderButtonBarSkin;
+import spark.skins.MobileGridSkin;
+
+/*
+ classes that won't be detected through dependencies
+* and classes that needs to be includes in ASDOC
+* */
+
+ internal class ExperimentalMobileClasses
+{
+
+    // mamsellem: for some reason, the import statements alone are not enough to have the classes included
+    private static const classes:Array = [MobileGrid, MobileGridColumn, MobileGridSkin, MobileGridHeaderButtonBarSkin];
+}
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/MobileGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/MobileGrid.as b/frameworks/projects/experimental_mobile/src/spark/components/MobileGrid.as
new file mode 100644
index 0000000..618a1bc
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/MobileGrid.as
@@ -0,0 +1,302 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components
+{
+
+import mx.collections.ICollectionView;
+import mx.collections.ISort;
+import mx.collections.ISortField;
+import mx.core.ClassFactory;
+import mx.core.ScrollPolicy;
+import mx.core.mx_internal;
+
+import spark.collections.Sort;
+import spark.components.supportClasses.IPartRendererDescriptor;
+import spark.components.supportClasses.MobileGridColumn;
+import spark.components.supportClasses.MobileGridHeader;
+import spark.components.supportClasses.MobileGridRowRenderer;
+import spark.events.MobileGridHeaderEvent;
+import spark.layouts.VerticalLayout;
+import spark.layouts.supportClasses.LayoutBase;
+
+use namespace  mx_internal;
+
+/**
+ *  Dispatched when the user releases the mouse button on a column header
+ *  to request the control to sort  the grid contents based on the contents of the column.
+ *  Only dispatched if the column is sortable and the data provider supports
+ *  sorting. The DataGrid control has a default handler for this event that implements
+ *  a single-column sort.
+ * <b>Note</b>: The sort arrows are defined by the default event handler for
+ * the headerRelease event. If you call the <code>preventDefault()</code> method
+ * in your event handler, the arrows are not drawn.
+ * </p>
+ *
+ *  @eventType mx.events.DataGridEvent.HEADER_RELEASE
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 3.8
+ *  @productversion Flex 4.11
+ */
+[Event(name="sortChange", type="spark.events.MobileGridHeaderEvent")]
+
+/**
+ *  The MobileGrid displays a collection of items in a grid of rows and columns, with column headers, optimized for mobile devices.
+ * <p> The MobileGrid component provides the following features:    </p>
+ *  <ul>
+ *      <li> user can swipe through the rows in the datagrid. </li>
+ *      <li> supports single selection of a row. </li>
+ *      <li> rows can be sorted according to a given column by clicking on the column's header. </li>
+ *      <li> cells can be displayed as text in different fonts and formats, as images, or using a custom renderer. </li>
+ *      <li> default  skin uses dark shades of gray, and is available in different screen densities.</li>
+ *  </ul>
+ *
+ * <p> It's important to understand that MobileGrid does not have all the capabilities and flexibility of it's desktop equivalent,
+ * in order to ensure optimal display and scrolling performance on mobile devices. </p>
+ * <p>Typically, the following features are not available in MobileGrid: </p>
+ * <ul>
+ *     <li>the list of columns is static and cannot be changed at runtime</li>
+ *     <li>multiple selection is not supported </li>
+ *     <li>it's not possible to interactively reorder columns </li>
+ *     <li>custom cell renderers must be designed with care, preferably in ActionScript, to ensure good display performance </li>
+ *   </ul>
+ *
+ * <p>Internally,  MobileGrid inherits for Mobile spark.List component rather than any Grid or DataGrid, which means that all cell renderers in a single row are managed
+ * by one single MobileGridRowRenderer that  delegates the individual  cell renderers to light-weight sub-renderers. </p>
+ * <p> You usually don't access this internal row renderer yourself, and will rather define the individual cell renderers.</p>
+ * <p> This technique ensures optimal display and memory performance, which is critical for mobile devices,, at the price of less flexibility for cell renderers </p>
+ *
+ *  @see spark.components.supportClasses.MobileGridColumn
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 3.8
+ *  @productversion Flex 4.11
+ */
+public class MobileGrid extends List
+{
+
+    [SkinPart(required="true")]
+    public var headerGroup:MobileGridHeader;
+
+    private var _columns: Array;
+    private var _columnsChanged:Boolean = false;
+    private var _sortableColumns:Boolean = true;
+    private var lastSortIndex:int = -1;
+    private var sortIndex:int = -1;
+    private var sortColumn:MobileGridColumn;
+
+    public function MobileGrid()
+    {
+        layout = getDefaultLayout();
+        scrollSnappingMode = ScrollSnappingMode.LEADING_EDGE;
+        setStyle("horizontalScrollPolicy", ScrollPolicy.OFF);
+        useVirtualLayout = true;
+        columns = [];
+    }
+
+    /**
+     *  An array of MobileGridColumn objects, one for each column that  can be displayed.
+     *  <p>Contrary to desktop DataGrid, this property must be set explicitly , or no columns will be displayed.</p>
+     *  <p>If you want to change the set of columns,you need to re-assign the new array to the columns property.
+     *  Changes to the original array without assigning the property will have no effect.</p>
+     *
+     *  @see   spark.components.supportClasses.MobileGridColumn
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    [Inspectable(arrayType="spark.components.supportClasses.MobileGridColumn")]
+    public function set columns(value:Array):void
+    {
+        _columns = value;
+        _columnsChanged = true;
+        invalidateProperties();
+        // copy  to vector and set indices
+    }
+
+    public function get columns():Array
+    {
+        return _columns.concat();
+    }
+
+    /**
+     *  A flag that indicates whether the user can sort the rows
+     *  by clicking on a column header cell.
+     *  If <code>true</code>, the user can sort the data provider items by
+     *  clicking on a column header cell.
+     *  If <code>true</code>, individual columns can be made to not respond
+     *  to a click on a header by setting the column's <code>sortable</code>
+     *  property to <code>false</code>.
+     *
+     *  <p>When a user releases the mouse button over a header cell, the DataGrid
+     *  control dispatches a <code>headerRelease</code> event if both
+     *  this property and the column's sortable property are <code>true</code>.
+     *  If no handler calls the <code>preventDefault()</code> method on the event, the
+     *  DataGrid sorts using that column's <code>MobileGridColumn.dataField</code> or
+     *  <code>MobileGridColumn.labelFunction</code> properties.</p>
+     *
+     *  @default true
+     *
+     *  @see spark.components.supportClasses.MobileGridColumn#sortable
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 3.8
+     *  @productversion Flex 4.11
+     */
+    public function get sortableColumns():Boolean
+    {
+        return _sortableColumns && (dataProvider is ICollectionView);
+    }
+
+    public function set sortableColumns(value:Boolean):void
+    {
+        _sortableColumns = value;
+    }
+
+    override protected function commitProperties():void
+    {
+        super.commitProperties();
+        if (_columnsChanged){
+            _columnsChanged = false;
+            for (var i:int = 0; i < _columns.length; i++)
+            {
+                MobileGridColumn(_columns[i]).colNum = i;
+            }
+            initDefaultItemRenderer(_columns);
+            if (headerGroup)
+                headerGroup.columns = _columns;
+        }
+    }
+
+    /* default layout for row item renderers */
+    protected function getDefaultLayout():LayoutBase
+    {
+        var l:VerticalLayout = new VerticalLayout();
+        l.horizontalAlign = "contentJustify";
+        l.gap = 0;
+        return l;
+    }
+
+    protected function initDefaultItemRenderer(pcolumnDescriptors: Array):void
+    {
+        var cf:ClassFactory;
+        cf = new ClassFactory(MobileGridRowRenderer);
+        cf.properties = {
+            partRendererDescriptors: Vector.<IPartRendererDescriptor>(pcolumnDescriptors)
+        };
+        this.itemRenderer = cf;
+    }
+
+    override protected function partAdded(partName:String, instance:Object):void
+    {
+        if (instance === headerGroup)
+        {
+            headerGroup.dataGrid = this;
+            headerGroup.columns = _columns;
+            headerGroup.addEventListener(MobileGridHeaderEvent.SORT_CHANGE, headerGroup_sortChangeHandler);
+        }
+        super.partAdded(partName, instance);
+    }
+
+    override protected function partRemoved(partName:String, instance:Object):void
+    {
+        if (instance === headerGroup)
+        {
+            headerGroup.columns = null;
+            headerGroup.removeEventListener(MobileGridHeaderEvent.SORT_CHANGE, headerGroup_sortChangeHandler);
+        }
+        super.partRemoved(partName, instance);
+    }
+
+
+    private function headerGroup_sortChangeHandler(event:MobileGridHeaderEvent):void
+    {
+        var e:MobileGridHeaderEvent = MobileGridHeaderEvent(event.clone());
+        dispatchEvent( e)
+        if (!e.isDefaultPrevented())
+        {
+                 sortByColumn(e.columnIndex);
+        }
+    }
+
+    /* roughly same behavior as mx:DataGrid */
+    private function sortByColumn(index:int):void
+    {
+        var collection:ICollectionView = dataProvider as ICollectionView;
+        var c:MobileGridColumn = _columns[index];
+        if (!c.sortable)
+            return ;
+        var desc:Boolean = c.sortDescending;
+
+        // do the sort if we're allowed to
+        if (collection == null)
+            return;
+
+        var s:ISort = collection.sort;
+        var f:ISortField;
+
+        if (s)
+        {
+            s.compareFunction = null;
+            // analyze the current sort to see what we've been given
+            var sf:Array = s.fields;
+            if (sf)
+            {
+                for (var i:int = 0; i < sf.length; i++)
+                {
+
+                    if (sf[i].name == c.dataField)
+                    {
+                        // we're part of the current sort
+                        f = sf[i];
+                        // flip the logic so desc is new desired order
+                        desc = !f.descending;
+                        break;
+                    }
+                }
+            }
+        }
+        else
+            s = new Sort();
+
+        if (!f)
+            f = c.sortField;
+
+        c.sortDescending = desc;
+
+        // set the grid's sortIndex
+        lastSortIndex = sortIndex;
+        sortIndex = index;
+        sortColumn = c;
+        f.name = c.dataField;
+        f.descending = desc;
+        s.fields = [f];
+        collection.sort = s;
+        collection.refresh();
+
+        // update header
+        headerGroup.setSort(sortIndex, desc);
+    }
+
+
+
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as
new file mode 100644
index 0000000..7194e75
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemPartRendererBase.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.itemRenderers
+{
+
+import mx.core.IDataRenderer;
+import mx.styles.IStyleClient;
+
+/**
+ * This is the base interface that all mobile cell or other mobile item part renderers must implement.
+ */
+public interface IItemPartRendererBase extends IDataRenderer
+{
+    /** @private
+     *  Object to be used for providing styles to the part renderer.
+     * Mobile part  items renders being lightweight classes, they usually don't manage styles by themselves.
+     * This property is automatically set
+     */
+    function set styleProvider(value:IStyleClient):void ;
+
+    /**
+     * @private
+     */
+    function set cssStyleName(value:String):void;
+
+    /**
+     * @private
+     */
+    function getPreferredBoundsWidth(postLayoutTransform:Boolean = true):Number;
+
+    /**
+     * @private
+     */
+    function getPreferredBoundsHeight(postLayoutTransform:Boolean = true):Number;
+
+
+
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as
new file mode 100644
index 0000000..69c3008
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/IItemTextPartRenderer.as
@@ -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 spark.components.itemRenderers
+{
+
+import flash.display.DisplayObjectContainer;
+
+import mx.core.IDataRenderer;
+
+public interface IItemTextPartRenderer extends IItemPartRendererBase
+{
+
+    function set labelField(value:String):void;
+
+    function set labelFunction(value:Function):void;
+
+    function set textAlign(textAlign:String):void;
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as
new file mode 100644
index 0000000..b5e7abe
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemBitmapPartRenderer.as
@@ -0,0 +1,144 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.itemRenderers
+{
+
+import mx.core.BitmapAsset;
+import mx.styles.IStyleClient;
+
+import spark.utils.MultiDPIBitmapSourceExt;
+
+/** Default lightweight  class for rendering embedded Bitmaps  or Multi-DPI Bitmaps in a MobileGrid cell .
+ * <p> You define the icon to be used in each cell by setting either iconField or iconFunction properties.  </p>
+ *  */
+public class ItemBitmapPartRenderer extends BitmapAsset implements IItemPartRendererBase
+{
+
+    private var _iconFunction:Function = null;
+    private var _iconField:String = null;
+    protected var _data:Object;
+
+    public function ItemBitmapPartRenderer()
+    {
+        super();
+    }
+
+    /**
+     *  The name of the field or property in the DataGrid's dataProvider item that defines the icon to display for this renderer's column.
+     *  <p> The fields value must be either an embedded bitmap's class, or or MultiBitmapSourceExt object.   </p>
+     *   <p> If not set, then iconFunction will be used.  </p>
+     *  @default null
+     *
+     *  @see #iconFunction
+     *  @see  spark.utils.MultiDPIBitmapSourceExt
+     *
+     */
+    public function get iconField():String
+    {
+        return _iconField;
+    }
+
+    public function set iconField(value:String):void
+    {
+        _iconField = value;
+    }
+
+    /**
+     *  An user-provided function that converts a data provider item into an icon to display in each cell for this renderer's column.
+     *
+     *  <p>if set, this property is used even if iconField is also set.</p>
+     *  <p>The function specified to the <code>iconFunction</code> property
+     *  must have the following signature:</p>
+     *
+     *  <pre>iconFunction(item:Object):Object</pre>
+     *
+     *  <p>The <code>item</code> parameter is the data provider item for an entire row.</p>
+     *  <p> The function must return either an embedded bitmap's class, or a MultiBitmapSourceExt object .</p>
+     *
+     *  @default null
+     *
+     *  @see #iconLabel
+     *  @see  spark.utils.MultiDPIBitmapSourceExt
+     *
+     */
+    public function get iconFunction():Function
+    {
+        return _iconFunction;
+    }
+
+    public function set iconFunction(value:Function):void
+    {
+        _iconFunction = value;
+    }
+
+    public function set data(value:Object):void
+    {
+        var iconClass:Class;
+        _data = value;
+        var iconSource:Object = _iconFunction != null ? _iconFunction(_data) : _data[_iconField];
+        if (iconSource is MultiDPIBitmapSourceExt)
+        {
+            iconClass = MultiDPIBitmapSourceExt(iconSource).getSource(NaN) as Class;
+        }
+        else
+        {
+            iconClass = iconSource as Class;
+        }
+        if (iconClass != null)
+        {
+            var icon:BitmapAsset = new iconClass();
+            this.bitmapData = icon.bitmapData;
+        }
+        else
+        {
+            this.bitmapData = null;
+        }
+    }
+
+    public function get data():Object
+    {
+        return _data;
+    }
+
+    public function getPreferredBoundsWidth(postLayoutTransform:Boolean = true):Number
+    {
+        return bitmapData.width;
+    }
+
+    public function getPreferredBoundsHeight(postLayoutTransform:Boolean = true):Number
+    {
+        return bitmapData.height;
+    }
+
+    override public function setActualSize(newWidth:Number, newHeight:Number):void
+    {
+        // do nothing, bitmap renderer don't stretch for now
+    }
+
+    public function set styleProvider(value:IStyleClient):void
+    {
+        // do nothing, this renderer does not manages styles for now.
+    }
+
+    public function set cssStyleName(value:String):void
+    {
+    }
+
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as
new file mode 100644
index 0000000..afb991e
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/itemRenderers/ItemTextPartRenderer.as
@@ -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 spark.components.itemRenderers
+{
+
+import mx.core.mx_internal;
+import mx.styles.CSSStyleDeclaration;
+import mx.styles.IStyleClient;
+import mx.styles.StyleManager;
+
+import spark.components.supportClasses.StyleableTextField;
+import spark.utils.UIComponentUtils;
+
+use namespace mx_internal;
+
+/** Default lightweight  class for rendering formatted text in MobileGrid cells .
+ * <p> You don't have to use this render explicitly as it will be used by default for MobileGrid text cells. </p>
+ *  */
+public class ItemTextPartRenderer extends StyleableTextField implements IItemTextPartRenderer
+{
+
+    private var _labelFunction:Function;
+    private var _labelField:String;
+    private var _data:Object;
+
+    public function ItemTextPartRenderer()
+    {
+        super();
+        editable = false;
+        selectable = false;
+        multiline = true;
+    }
+
+    public function set styleProvider(value:IStyleClient):void
+    {
+        styleName = value;
+        commitStyles();
+    }
+
+    public function set textAlign(value:String):void
+    {
+        setStyle("textAlign", value);
+    }
+
+    public function set cssStyleName(pstyleName:String):void
+    {
+        var css:CSSStyleDeclaration = pstyleName ? StyleManager.getStyleManager(null).getStyleDeclaration("." + pstyleName) : null;
+        // must add to container before working on styles
+        styleDeclaration = css;     // for direct style
+        if (css)
+        {
+            leftMargin = css.getStyle("paddingLeft");
+            rightMargin = css.getStyle("paddingRight");
+            //     multiline = css.get
+        }
+    }
+
+    public function set data(value:Object):void
+    {
+        _data = value;
+        text = UIComponentUtils.itemToLabel(value, _labelField, _labelFunction);
+    }
+
+    public function get data():Object
+    {
+        return _data;
+    }
+
+    public function set labelField(value:String):void
+    {
+        _labelField = value;
+    }
+
+    public function set labelFunction(value:Function):void
+    {
+        _labelFunction = value;
+    }
+}
+}
+
+

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/IPartRendererDescriptor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/IPartRendererDescriptor.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/IPartRendererDescriptor.as
new file mode 100644
index 0000000..c81f9f6
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/IPartRendererDescriptor.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.supportClasses
+{
+
+import mx.core.IFactory;
+
+import spark.components.itemRenderers.IItemPartRendererBase;
+
+public interface IPartRendererDescriptor
+{
+    function get scaledWidth():Number;
+
+    function get itemRenderer():IFactory;
+
+    function createPartRenderer():IItemPartRendererBase;
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ItemRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ItemRendererBase.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ItemRendererBase.as
new file mode 100644
index 0000000..cf54c6e
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ItemRendererBase.as
@@ -0,0 +1,894 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**  @private
+ *  monkey-patched  from LabelItemRenderer, pruned from label/labelDisplay  and change some variable accessibility
+ *  Provides default behavior for  ListMultiPartItemRenderer
+ *  Eventually should  become superclass of LabelItemRenderer
+ *  */
+
+package spark.components.supportClasses
+{
+import flash.display.GradientType;
+import flash.events.Event;
+import flash.geom.Matrix;
+
+import mx.core.DPIClassification;
+import mx.core.FlexGlobals;
+import mx.core.IDataRenderer;
+import mx.core.IFlexDisplayObject;
+import mx.core.ILayoutElement;
+import mx.core.UIComponent;
+import mx.core.mx_internal;
+import mx.events.FlexEvent;
+
+import spark.components.DataGroup;
+import spark.components.IItemRenderer;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the <code>data</code> property changes.
+ *
+ *  <p>When you use a component as an item renderer,
+ *  the <code>data</code> property contains the data to display.
+ *  You can listen for this event and update the component
+ *  when the <code>data</code> property changes.</p>
+ *
+ *  @eventType mx.events.FlexEvent.DATA_CHANGE
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Event(name="dataChange", type="mx.events.FlexEvent")]
+
+//--------------------------------------
+//  Styles
+//--------------------------------------
+
+[Style(name="paddingLeft", type="Number", format="Length", inherit="no")]
+
+/**
+ *  @copy spark.components.supportClasses.GroupBase#style:alternatingItemColors
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="alternatingItemColors", type="Array", arrayType="uint", format="Color", inherit="yes", theme="spark, mobile")]
+
+/**
+ *  @copy spark.components.supportClasses.GroupBase#style:chromeColor
+ *
+ *  @default 0xCCCCCC
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+[Style(name="chromeColor", type="uint", format="Color", inherit="yes", theme="spark, mobile")]
+
+/**
+ *  @copy spark.components.supportClasses.GroupBase#style:downColor
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="downColor", type="uint", format="Color", inherit="yes", theme="spark, mobile")]
+
+/**
+ *  @copy spark.components.supportClasses.GroupBase#style:focusColor
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="focusColor", type="uint", format="Color", inherit="yes", theme="spark, mobile")]
+
+/**
+ *  Number of pixels between the bottom border and the text component
+ *  of the item renderer.
+ *
+ *  @default 5
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Number of pixels between the top border and the text component
+ *  of the item renderer.
+ *
+ *  @default 5
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
+
+/**
+ *  @copy spark.components.supportClasses.GroupBase#style:rollOverColor
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="rollOverColor", type="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy spark.components.List#style:selectionColor
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="selectionColor", type="uint", format="Color", inherit="yes")]
+
+/**
+ *  @copy spark.components.supportClasses.GroupBase#style:symbolColor
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="symbolColor", type="uint", format="Color", inherit="yes", theme="spark,mobile")]
+
+/**
+ *  The vertical alignment of the content when it does not have
+ *  a one-to-one aspect ratio.
+ *  Possible values are <code>"top"</code>, <code>"center"</code>,
+ *  and <code>"bottom"</code>.
+ *
+ *  @default "center"
+ *
+ *  @langversion 3.0
+ *  @playerversion AIR 2.5
+ *  @productversion Flex 4.5
+ */
+[Style(name="verticalAlign", type="String", enumeration="bottom,middle,top", inherit="no")]
+
+//--------------------------------------
+//  Excluded APIs
+//--------------------------------------
+
+[Exclude(name="focusBlendMode", kind="style")]
+[Exclude(name="focusThickness", kind="style")]
+
+public class ItemRendererBase extends UIComponent implements IDataRenderer, IItemRenderer
+{
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function ItemRendererBase()
+    {
+        super();
+
+        switch (applicationDPI)
+        {
+            case DPIClassification.DPI_480:
+            {
+                minHeight = 132;
+                break;
+            }
+            case DPIClassification.DPI_320:
+            {
+                minHeight = 88;
+                break;
+            }
+            case DPIClassification.DPI_240:
+            {
+                minHeight = 66;
+                break;
+            }
+            default:
+            {
+                // default PPI160
+                minHeight = 44;
+                break;
+            }
+        }
+
+        interactionStateDetector = new InteractionStateDetector(this);
+        interactionStateDetector.addEventListener(Event.CHANGE, interactionStateDetector_changeHandler);
+
+        cacheAsBitmap = true;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Private Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Helper class to help determine when we are in the hovered or down states
+     */
+    protected var interactionStateDetector:InteractionStateDetector;
+
+    /**
+     *  @private
+     *  Whether or not we're the last element in the list
+     */
+    mx_internal var isLastItem:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Public Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  data
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _data:Object;
+
+    [Bindable("dataChange")]
+
+    /**
+     *  The implementation of the <code>data</code> property
+     *  as defined by the IDataRenderer interface.
+     *  When set, it stores the value and invalidates the component
+     *  to trigger a relayout of the component.
+     *
+     *  @see mx.core.IDataRenderer
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get data():Object
+    {
+        return _data;
+    }
+
+    /**
+     *  @private
+     */
+    public function set data(value:Object):void
+    {
+        _data = value;
+
+        if (hasEventListener(FlexEvent.DATA_CHANGE))
+            dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
+
+        if (_data) onDataChanged();
+    }
+
+    protected function onDataChanged():void
+    {
+        // set data related properties
+    }
+
+    //----------------------------------
+    //  down
+    //----------------------------------
+    /**
+     *  @private
+     *  storage for the down property
+     */
+    private var _down:Boolean = false;
+
+    /**
+     *  Set to <code>true</code> when the user is pressing down on an item renderer.
+     *
+     *  @default false
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function get down():Boolean
+    {
+        return _down;
+    }
+
+    /**
+     *  @private
+     */
+    protected function set down(value:Boolean):void
+    {
+        if (value == _down)
+            return;
+
+        _down = value;
+        invalidateDisplayList();
+    }
+
+    //----------------------------------
+    //  hovered
+    //----------------------------------
+    /**
+     *  @private
+     *  storage for the hovered property
+     */
+    private var _hovered:Boolean = false;
+
+    /**
+     *  Set to <code>true</code> when the user is hovered over the item renderer.
+     *
+     *  @default false
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function get hovered():Boolean
+    {
+        return _hovered;
+    }
+
+    /**
+     *  @private
+     */
+    protected function set hovered(value:Boolean):void
+    {
+        if (value == _hovered)
+            return;
+
+        _hovered = value;
+        invalidateDisplayList();
+    }
+
+    //----------------------------------
+    //  itemIndex
+    //----------------------------------
+
+    /**
+     *  @private
+     *  storage for the itemIndex property
+     */
+    private var _itemIndex:int;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default 0
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get itemIndex():int
+    {
+        return _itemIndex;
+    }
+
+    /**
+     *  @private
+     */
+    public function set itemIndex(value:int):void
+    {
+        var wasLastItem:Boolean = isLastItem;
+        var dataGroup:DataGroup = parent as DataGroup;
+        isLastItem = (dataGroup && (value == dataGroup.numElements - 1));
+
+        // if whether or not we are the last item in the last has changed then
+        // invalidate our display. note:  even if our new index has not changed,
+        // whether or not we're the last item may have so we perform this check
+        // before the value == _itemIndex check below
+        if (wasLastItem != isLastItem)
+            invalidateDisplayList();
+
+        if (value == _itemIndex)
+            return;
+
+        _itemIndex = value;
+
+        // only invalidateDisplayList() if this causes use to redraw which
+        // is only if alternatingItemColors are defined (and technically also
+        // only if we are not selected or down, etc..., but we'll ignore those
+        // as this will shortcut 95% of the time anyways)
+        if (getStyle("alternatingItemColors") !== undefined)
+            invalidateDisplayList();
+    }
+
+    public function get label():String
+    {
+        return "";
+    }
+
+    public function set label(value:String):void
+    {
+    }
+
+    private var _showsCaret:Boolean = false;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default false
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get showsCaret():Boolean
+    {
+        return _showsCaret;
+    }
+
+    /**
+     *  @private
+     */
+    public function set showsCaret(value:Boolean):void
+    {
+        if (value == _showsCaret)
+            return;
+
+        _showsCaret = value;
+        invalidateDisplayList();
+    }
+
+    //----------------------------------
+    //  selected
+    //----------------------------------
+
+    /**
+     *  @private
+     *  storage for the selected property
+     */
+    private var _selected:Boolean = false;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default false
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get selected():Boolean
+    {
+        return _selected;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selected(value:Boolean):void
+    {
+        if (value == _selected)
+            return;
+
+        _selected = value;
+        invalidateDisplayList();
+    }
+
+    //----------------------------------
+    //  dragging
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the dragging property.
+     */
+    private var _dragging:Boolean = false;
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get dragging():Boolean
+    {
+        return _dragging;
+    }
+
+    /**
+     *  @private
+     */
+    public function set dragging(value:Boolean):void
+    {
+        _dragging = value;
+    }
+
+
+    //----------------------------------
+    //  authorDensity
+    //----------------------------------
+    /**
+     *  Returns the DPI of the application.
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get applicationDPI():Number
+    {
+        return FlexGlobals.topLevelApplication.applicationDPI;
+    }
+
+
+    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+        // clear the graphics before calling super.updateDisplayList()
+        graphics.clear();
+
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+        drawBackground(unscaledWidth, unscaledHeight);
+
+        layoutContents(unscaledWidth, unscaledHeight);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Renders a background for the item renderer.
+     *
+     *  <p>This method, along with <code>layoutContents()</code>, is called
+     *  by the <code>updateDisplayList()</code> method.</p>
+     *
+     *  <p>This method draws the background and the outline for this item renderer.
+     *  It knows how to appropriately handle the selected, down, or caretted states.
+     *  However, when <code>alternatingItemColors</code> is set to <code>undefined</code>,
+     *  the default background is transparent.
+     *  Override this method to change the appearance of the background of
+     *  the item renderer.</p>
+     *
+     *  @param unscaledWidth Specifies the width of the component, in pixels,
+     *  in the component's coordinates, regardless of the value of the
+     *  <code>scaleX</code> property of the component.
+     *
+     *  @param unscaledHeight Specifies the height of the component, in pixels,
+     *  in the component's coordinates, regardless of the value of the
+     *  <code>scaleY</code> property of the component.
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+        // figure out backgroundColor
+        var backgroundColor:*;
+        var downColor:* = getStyle("downColor");
+        var drawBackground:Boolean = true;
+        var opaqueBackgroundColor:* = undefined;
+
+        if (down && downColor !== undefined)
+        {
+            backgroundColor = downColor;
+        }
+        else if (selected)
+        {
+            backgroundColor = getStyle("selectionColor");
+        }
+        else if (hovered)
+        {
+            backgroundColor = getStyle("rollOverColor");
+        }
+        else if (showsCaret)
+        {
+            backgroundColor = getStyle("selectionColor");
+        }
+        else
+        {
+            var alternatingColors:Array;
+            var alternatingColorsStyle:Object = getStyle("alternatingItemColors");
+
+            if (alternatingColorsStyle)
+                alternatingColors = (alternatingColorsStyle is Array) ? (alternatingColorsStyle as Array) : [alternatingColorsStyle];
+
+            if (alternatingColors && alternatingColors.length > 0)
+            {
+                // translate these colors into uints
+                styleManager.getColorNames(alternatingColors);
+
+                backgroundColor = alternatingColors[itemIndex % alternatingColors.length];
+            }
+            else
+            {
+                // don't draw background if it is the contentBackgroundColor. The
+                // list skin handles the background drawing for us.
+                drawBackground = false;
+            }
+
+        }
+
+        // draw backgroundColor
+        // the reason why we draw it in the case of drawBackground == 0 is for
+        // mouse hit testing purposes
+        graphics.beginFill(backgroundColor, drawBackground ? 1 : 0);
+        graphics.lineStyle();
+        graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
+        graphics.endFill();
+
+        // Selected and down states have a gradient overlay as well
+        // as different separators colors/alphas
+        if (selected || down)
+        {
+            var colors:Array = [0x000000, 0x000000 ];
+            var alphas:Array = [.2, .1];
+            var ratios:Array = [0, 255];
+            var matrix:Matrix = new Matrix();
+
+            // gradient overlay
+            matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI / 2, 0, 0);
+            graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
+            graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
+            graphics.endFill();
+        }
+        else if (drawBackground)
+        {
+            // If our background is a solid color, use it as the opaqueBackground property
+            // for this renderer. This makes scrolling considerably faster.
+            opaqueBackgroundColor = backgroundColor;
+        }
+
+        // Draw the separator for the item renderer
+        drawBorder(unscaledWidth, unscaledHeight, alternatingColorsStyle != null);
+
+        opaqueBackground = opaqueBackgroundColor;
+    }
+
+    /**
+     *  Renders the border for the item renderer.
+     *
+     *  <p>This method is called by <code>drawBackground</code> after the
+     *  background has been rendered.</p>
+     *
+     *  <p>Override this method to change the appearance of the separator or
+     *  border of the item renderer.</p>
+     *
+     *  @param unscaledWidth Specifies the width of the component, in pixels,
+     *  in the component's coordinates, regardless of the value of the
+     *  <code>scaleX</code> property of the component.
+     *
+     *  @param unscaledHeight Specifies the height of the component, in pixels,
+     *  in the component's coordinates, regardless of the value of the
+     *  <code>scaleY</code> property of the component.
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 3.0
+     *  @productversion Flex 4.6
+     */
+    protected function drawBorder(unscaledWidth:Number, unscaledHeight:Number, hasAlternatingColors:Boolean):void
+    {
+        var topSeparatorColor:uint;
+        var topSeparatorAlpha:Number;
+        var bottomSeparatorColor:uint;
+        var bottomSeparatorAlpha:Number;
+
+        var borderWidth:Number = 1;
+        var drawBottomBorder:Boolean = !hasAlternatingColors; // if alternating colors, don't draw shadow
+
+        // separators are a highlight on the top and shadow on the bottom
+        topSeparatorColor = 0xFFFFFF;
+        topSeparatorAlpha = .3;
+        bottomSeparatorColor = 0x000000;
+        bottomSeparatorAlpha = .3;
+
+
+        // draw separators
+        // don't draw top separator for down and selected states
+        if (!(selected || down))
+        {
+            graphics.beginFill(topSeparatorColor, topSeparatorAlpha);
+            graphics.drawRect(0, 0, unscaledWidth, borderWidth);
+            graphics.endFill();
+        }
+
+        if (drawBottomBorder)
+            graphics.beginFill(bottomSeparatorColor, bottomSeparatorAlpha);
+        graphics.drawRect(0, unscaledHeight - (isLastItem ? 0 : borderWidth), unscaledWidth, borderWidth);
+        graphics.endFill();
+
+
+        // add extra separators to the first and last items so that
+        // the list looks correct during the scrolling bounce/pull effect
+        // top
+        if (itemIndex == 0 && drawBottomBorder)
+        {
+            graphics.beginFill(bottomSeparatorColor, bottomSeparatorAlpha);
+            graphics.drawRect(0, -borderWidth, unscaledWidth, borderWidth);
+            graphics.endFill();
+        }
+
+        // bottom
+        if (isLastItem)
+        {
+            // we want to offset the bottom by 1 so that we don't get
+            // a double line at the bottom of the list if there's a
+            // border
+            graphics.beginFill(topSeparatorColor, topSeparatorAlpha);
+            graphics.drawRect(0, unscaledHeight + borderWidth, unscaledWidth, borderWidth);
+            graphics.endFill();
+        }
+    }
+
+    /**
+     *  Positions the children for this item renderer.
+     *
+     *  <p>This method, along with <code>drawBackground()</code>, is called
+     *  by the <code>updateDisplayList()</code> method.</p>
+     *
+     *  <p>This method positions the <code>labelDisplay</code> component.
+     *  Subclasses should override this to position their children.</p>
+     *
+     *  @param unscaledWidth Specifies the width of the component, in pixels,
+     *  in the component's coordinates, regardless of the value of the
+     *  <code>scaleX</code> property of the component.
+     *
+     *  @param unscaledHeight Specifies the height of the component, in pixels,
+     *  in the component's coordinates, regardless of the value of the
+     *  <code>scaleY</code> property of the component.
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+
+    }
+
+    protected function setElementPosition(element:Object, x:Number, y:Number):void
+    {
+        if (element is ILayoutElement)
+        {
+            ILayoutElement(element).setLayoutBoundsPosition(x, y, false);
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            IFlexDisplayObject(element).move(x, y);
+        }
+        else
+        {
+            element.x = x;
+            element.y = y;
+        }
+    }
+
+    /**
+     *  @copy spark.skins.mobile.supportClasses.MobileSkin#setElementSize()
+     *
+     *  @see #setElementPosition
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function setElementSize(element:Object, width:Number, height:Number):void
+    {
+        if (element is ILayoutElement)
+        {
+            ILayoutElement(element).setLayoutBoundsSize(width, height, false);
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            IFlexDisplayObject(element).setActualSize(width, height);
+        }
+        else
+        {
+            element.width = width;
+            element.height = height;
+        }
+    }
+
+    /**
+     *  @copy spark.skins.mobile.supportClasses.MobileSkin#getElementPreferredWidth()
+     *
+     *  @see #setElementPosition
+     *  @see #setElementSize
+     *  @see #getElementPreferredHeight
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function getElementPreferredWidth(element:Object):Number
+    {
+        var result:Number;
+
+        if (element is ILayoutElement)
+        {
+            result = ILayoutElement(element).getPreferredBoundsWidth();
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            result = IFlexDisplayObject(element).measuredWidth;
+        }
+        else
+        {
+            result = element.width;
+        }
+
+        return Math.round(result);
+    }
+
+    /**
+     *  @copy spark.skins.mobile.supportClasses.MobileSkin#getElementPreferredHeight()
+     *
+     *  @see #setElementPosition
+     *  @see #setElementSize
+     *  @see #getElementPreferredWidth
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    protected function getElementPreferredHeight(element:Object):Number
+    {
+        var result:Number;
+
+        if (element is ILayoutElement)
+        {
+            result = ILayoutElement(element).getPreferredBoundsHeight();
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            result = IFlexDisplayObject(element).measuredHeight;
+        }
+        else
+        {
+            result = element.height;
+        }
+
+        return Math.ceil(result);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event Handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function interactionStateDetector_changeHandler(event:Event):void
+    {
+        down = (interactionStateDetector.state == InteractionState.DOWN);
+        hovered = (interactionStateDetector.state == InteractionState.OVER);
+    }
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartItemRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartItemRendererBase.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartItemRendererBase.as
new file mode 100644
index 0000000..e53a968
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartItemRendererBase.as
@@ -0,0 +1,119 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.supportClasses
+{
+import flash.display.DisplayObject;
+
+import spark.components.itemRenderers.IItemPartRendererBase;
+
+/**  @private
+ *  This is the base class for multi-part renderers that manages a vector of part renderers.
+ *  This class is responsible for creating and storing  the actual renderers from their descriptors
+ *  the layout of the part renderers is delegated to a subclass of ListMultiPartLayoutBase;
+ */
+public class ListMultiPartItemRendererBase extends ItemRendererBase
+{
+    private var _partRendererDescriptors:Vector.<IPartRendererDescriptor>;
+    private var _partRenderers:Vector.<IItemPartRendererBase>;
+    private var _partRenderersLayout:ListMultiPartLayoutBase;
+
+    public function ListMultiPartItemRendererBase()
+    {
+    }
+
+    /* set by DataGridMobile Factory */
+    public function set partRendererDescriptors(value:Vector.<IPartRendererDescriptor>):void
+    {
+        _partRendererDescriptors = value;
+        _partRenderers = new Vector.<IItemPartRendererBase>(_partRendererDescriptors.length);
+    }
+
+    public function get partRendererDescriptors():Vector.<IPartRendererDescriptor>
+    {
+        return _partRendererDescriptors;
+    }
+
+    public function get partRenderersLayout():ListMultiPartLayoutBase
+    {
+        return _partRenderersLayout;
+    }
+
+    public function set partRenderersLayout(value:ListMultiPartLayoutBase):void
+    {
+        _partRenderersLayout = value;
+    }
+
+    public function get partRenderers():Vector.<IItemPartRendererBase>
+    {
+        return _partRenderers;
+    }
+
+    override protected function createChildren():void
+    {
+        super.createChildren();
+        var desc:IPartRendererDescriptor;
+        var pr:IItemPartRendererBase;
+        for (var i:int = 0; i < _partRendererDescriptors.length; i++)
+        {
+            desc = _partRendererDescriptors[i];
+            pr = desc.createPartRenderer();
+            if (pr != null)
+            {
+                pr.styleProvider = this;
+                addChild(DisplayObject(pr));
+                _partRenderers[i] = pr;
+            }
+            else
+            {
+                //TODO move to resource bundle
+                throw  new Error("MobileGridColumn item renderer must implement spark.components.itemRenderers.IItemPartRendererBase") ;
+            }
+        }
+    }
+
+    override protected function measure():void
+    {
+        super.measure();
+        _partRenderersLayout.measure();
+    }
+
+   /** delegate children layout to its partRendererLayout
+    subclasses can override this method to layout chrome content
+    */
+    override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+        _partRenderersLayout.layoutContents(unscaledWidth, unscaledHeight);
+    }
+
+    override protected function onDataChanged():void
+    {
+        var dpr:IItemPartRendererBase;
+        for (var i:int = 0; i < _partRenderers.length; i++)
+        {
+            dpr = _partRenderers[i];
+            dpr.data = data;
+        }
+        invalidateSize();
+    }
+
+
+
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartLayoutBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartLayoutBase.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartLayoutBase.as
new file mode 100644
index 0000000..0c8c5ff
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartLayoutBase.as
@@ -0,0 +1,141 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.supportClasses
+{
+import mx.core.IFlexDisplayObject;
+import mx.core.ILayoutElement;
+
+import spark.components.itemRenderers.IItemPartRendererBase;
+
+/** @private
+ *   Abstract base class for laying out part renderers in a multi-part renderer.
+ *   Subclasses must override measure() and layoutContents() methods
+ */
+public class ListMultiPartLayoutBase extends Object
+{
+    private var _target:ListMultiPartItemRendererBase;
+
+    public function ListMultiPartLayoutBase(target:ListMultiPartItemRendererBase)
+    {
+        _target = target;
+    }
+
+    public function get target():ListMultiPartItemRendererBase
+    {
+        return _target;
+    }
+
+    protected function get partRendererDescriptors():Vector.<IPartRendererDescriptor>
+    {
+        return target.partRendererDescriptors;
+    }
+
+    protected function get partRenderers():Vector.<IItemPartRendererBase>
+    {
+        return target.partRenderers;
+    }
+
+    public function measure():void
+    {
+
+    }
+
+    /* vertical align middle
+     * give all columns the requested sizes, and the last column the remaining width  */
+    public function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+
+    }
+
+    protected function setElementPosition(element:Object, x:Number, y:Number):void
+    {
+        if (element is ILayoutElement)
+        {
+            ILayoutElement(element).setLayoutBoundsPosition(x, y, false);
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            IFlexDisplayObject(element).move(x, y);
+        }
+        else
+        {
+            element.x = x;
+            element.y = y;
+        }
+    }
+
+    protected function setElementSize(element:Object, width:Number, height:Number):void
+    {
+        if (element is ILayoutElement)
+        {
+            ILayoutElement(element).setLayoutBoundsSize(width, height, false);
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            IFlexDisplayObject(element).setActualSize(width, height);
+        }
+        else
+        {
+            element.width = width;
+            element.height = height;
+        }
+    }
+
+    protected function getElementPreferredWidth(element:Object):Number
+    {
+        var result:Number;
+
+        if (element is ILayoutElement)
+        {
+            result = ILayoutElement(element).getPreferredBoundsWidth();
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            result = IFlexDisplayObject(element).measuredWidth;
+        }
+        else
+        {
+            result = element.width;
+        }
+
+        return Math.round(result);
+    }
+
+    protected function getElementPreferredHeight(element:Object):Number
+    {
+        var result:Number;
+
+        if (element is ILayoutElement)
+        {
+            result = ILayoutElement(element).getPreferredBoundsHeight();
+        }
+        else if (element is IFlexDisplayObject)
+        {
+            result = IFlexDisplayObject(element).measuredHeight;
+        }
+        else
+        {
+            result = element.height;
+        }
+
+        return Math.ceil(result);
+    }
+
+}
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b78de5c0/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartTabbedLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartTabbedLayout.as b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartTabbedLayout.as
new file mode 100644
index 0000000..f211a8c
--- /dev/null
+++ b/frameworks/projects/experimental_mobile/src/spark/components/supportClasses/ListMultiPartTabbedLayout.as
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.supportClasses
+{
+import spark.components.itemRenderers.IItemPartRendererBase;
+import spark.utils.UIComponentUtils;
+
+/** @private
+ *    this class is reponsible for laying out grid cells in a given MobileGrid row.
+ *    It will make sure that cell content is aligned according to the column widths.
+ */
+public class ListMultiPartTabbedLayout extends ListMultiPartLayoutBase
+{
+
+    public function ListMultiPartTabbedLayout(target:ListMultiPartItemRendererBase)
+    {
+        super(target);
+    }
+
+    override public function measure():void
+    {
+        super.measure();
+        var totalWidth:Number = 0;
+        for each (var ld:IPartRendererDescriptor in partRendererDescriptors)
+        {
+            totalWidth += ld.scaledWidth;
+        }
+        target.measuredWidth = totalWidth;
+        target.measuredMinWidth = 50;
+    }
+
+    /* vertical align middle
+     * Layout algorithm:   give all columns the requested sizes, and the last column the remaining width  */
+    override public function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+
+        if (unscaledWidth == 0 && unscaledHeight == 0)
+            return;   // not ready
+        var cellPaddingLeft:Number = target.getStyle("paddingLeft");
+        var cellPaddingRight:Number = target.getStyle("paddingRight");
+        var paddingTop:Number = target.getStyle("paddingTop");
+        var paddingBottom:Number = target.getStyle("paddingBottom");
+        var cellHeight:Number = unscaledHeight - paddingTop - paddingBottom;
+
+        var desc:IPartRendererDescriptor;
+        var dpr:IItemPartRendererBase;
+        var remainingWidth:Number = unscaledWidth;
+        var curX:Number = cellPaddingLeft;
+        var curY:Number = paddingTop;
+        var partWidth:Number;
+        var partHeight:Number;
+        var count:int = partRenderers.length - 1;
+        for (var i:int = 0; i <= count; i++)
+        {
+            dpr = partRenderers[i];
+            desc = partRendererDescriptors[i];
+            partHeight = dpr.getPreferredBoundsHeight();
+            partWidth = Math.max(0, i == count ? remainingWidth : desc.scaledWidth - cellPaddingLeft - cellPaddingRight);
+            setElementSize(dpr, partWidth, partHeight);
+            setElementPosition(dpr, curX, curY + UIComponentUtils.offsetForCenter(partHeight, cellHeight));
+            curX += partWidth + cellPaddingRight + cellPaddingLeft;
+            remainingWidth -= desc.scaledWidth;
+        }
+    }
+}
+}


Mime
View raw message