- UPDATEDhttps://issues.apache.org/jira/browse/FLEX-33801 (missing include examples) - enabled asdoc examples path in build - added includes examples in MobileGrid asdoc
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/145c1683 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/145c1683 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/145c1683 Branch: refs/heads/develop Commit: 145c1683e720085a040a5058ebb1f3e4bd306c32 Parents: 7db2ddc Author: mamsellem <maurice.amsel...@systar.com> Authored: Sun Oct 6 13:41:22 2013 +0200 Committer: mamsellem <maurice.amsel...@systar.com> Committed: Sun Oct 6 13:52:19 2013 +0200 ---------------------------------------------------------------------- asdoc/build.xml | 2 +- .../examples/MobileGrid_ApplicationExample.mxml | 24 +++ .../renderers/MyActionButtonPartRenderer.as | 77 +++++++++ .../examples/views/MobileGridView.mxml | 158 +++++++++++++++++++ .../examples/views/MobileGridView2.mxml | 115 ++++++++++++++ .../src/spark/components/MobileGrid.as | 8 +- .../src/spark/skins/MobileGridSkin.as | 6 +- 7 files changed, 384 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/asdoc/build.xml ---------------------------------------------------------------------- diff --git a/asdoc/build.xml b/asdoc/build.xml index 6aa41df..98460bf 100644 --- a/asdoc/build.xml +++ b/asdoc/build.xml @@ -58,7 +58,7 @@ <fileset dir="${flexlib}/projects/charts/asdoc/en_US"/> <!-- <fileset dir="${flexlib}/projects/core/asdoc/en_US"/>--> <!-- <fileset dir="${flexlib}/projects/experimental/asdoc/en_US"/>--> - <!-- <fileset dir="${flexlib}/projects/experimental_mobile/asdoc/en_US"/>--> + <fileset dir="${flexlib}/projects/experimental_mobile/asdoc/en_US"/> <fileset dir="${flexlib}/projects/framework/asdoc/en_US"/> <fileset dir="${flexlib}/projects/mobilecomponents/asdoc/en_US"/> <!-- <fileset dir="${flexlib}/projects/mx/asdoc/en_US"/>--> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/MobileGrid_ApplicationExample.mxml ---------------------------------------------------------------------- diff --git a/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/MobileGrid_ApplicationExample.mxml b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/MobileGrid_ApplicationExample.mxml new file mode 100644 index 0000000..4a2558f --- /dev/null +++ b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/MobileGrid_ApplicationExample.mxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160"> + <s:ViewNavigator label="Grid Sample 1" firstView="views.MobileGridView" width="100%" height="100%" /> + <s:ViewNavigator label="Grid Sample 2" firstView="views.MobileGridView2" width="100%" height="100%"/> +</s:TabbedViewNavigatorApplication> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/renderers/MyActionButtonPartRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/renderers/MyActionButtonPartRenderer.as b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/renderers/MyActionButtonPartRenderer.as new file mode 100644 index 0000000..7d75488 --- /dev/null +++ b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/renderers/MyActionButtonPartRenderer.as @@ -0,0 +1,77 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 examples.renderers +{ +import flash.events.MouseEvent; + +import mx.styles.IStyleClient; + +import spark.components.Alert; + +import spark.components.Button; +import spark.components.itemRenderers.IMobileGridCellRenderer; + +public class MyActionButtonPartRenderer extends Button implements IMobileGridCellRenderer +{ + + private var _data:Object; + + public function MyActionButtonPartRenderer() + { + super(); + label = "Go"; + height=30; + addEventListener( MouseEvent.CLICK, onClick); + } + + public function set styleProvider(value:IStyleClient):void + { + } + + public function get canSetContentWidth():Boolean + { + return true; + } + + public function get canSetContentHeight():Boolean + { + return false; + } + + public function set cssStyleName(value:String):void + { + } + + public function get data():Object + { + return _data; + } + + public function set data(value:Object):void + { + _data = value; + } + + private function onClick(event:MouseEvent):void + { + Alert.show("Click on: " + data.Name, "Action"); + } + +} +} http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView.mxml ---------------------------------------------------------------------- diff --git a/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView.mxml b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView.mxml new file mode 100644 index 0000000..4f62334 --- /dev/null +++ b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView.mxml @@ -0,0 +1,158 @@ +<?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. + +--> +<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:exp="http://flex.apache.org/experimental/ns" + title="MobileGrid" + creationComplete="creationCompleteHandler(event)" + > + + + <fx:Style> + .bold { + fontWeight: bold; + } + + .comments { + fontStyle: italic; + multiline: true; + } + + @media (application-dpi: 120) { + .comments { + fontSize: 9; + } + } + + @media (application-dpi: 240) { + .comments { + fontSize: 18; + } + } + + @media (application-dpi: 160) { + .comments { + fontSize: 12; + } + } + + @media (application-dpi: 320) { + .comments { + fontSize: 24; + } + } + + </fx:Style> + + + <exp:MobileGrid id="dgm" dataProvider="{dataProvider}" width="100%" height="100%" > + <exp:columns> + <exp:MobileGridColumn dataField="Name" styleName="bold" width="100" /> + <exp:MobileGridColumn dataField="Surname" styleName="bold" width="100"/> + <exp:MobileGridColumn dataField="Age" width="50" textAlign="right" /> + <exp:MobileGridColumn headerText="S" dataField="status" width="30"> + <exp:itemRenderer> + <fx:Component> + <exp:MobileGridBitmapCellRenderer iconFunction="{outerDocument.getMDPIStatusIcon}" /> + </fx:Component> + </exp:itemRenderer> + </exp:MobileGridColumn> + <exp:MobileGridColumn headerText="Full Name" labelFunction="fullName" width="150" /> + <exp:MobileGridColumn headerText="Comments" dataField="comments" styleName="comments" width="100%" /> + + </exp:columns> + </exp:MobileGrid> + + <fx:Declarations> + + </fx:Declarations> + + <fx:Script><![CDATA[ + import mx.collections.ArrayCollection; + import mx.core.FlexGlobals; + import mx.events.FlexEvent; + + import spark.utils.MultiDPIBitmapSource; + + [Embed('../../embedded/images/aqua_inset_36_red.png')] + private const iconRed36:Class; + + [Embed('../../embedded/images/aqua_inset_36_green.png')] + private const iconGreen36:Class; + + [Embed('../../embedded/images/status_aqua24_red.png')] + private const iconRed24:Class; + + [Embed('../../embedded/images/status_aqua24_green.png')] + private const iconGreen24:Class; + + [Embed('../../embedded/images/status_aqua16_red.png')] + private const iconRed18:Class; + + [Embed('../../embedded/images/status_aqua16_green.png')] + private const iconGreen18:Class; + + private const dataProvider:ArrayCollection = new ArrayCollection(); + + private var iconRed:MultiDPIBitmapSource; + private var iconGreen:MultiDPIBitmapSource; + + private function creationCompleteHandler(event:FlexEvent):void + { + + iconRed = new MultiDPIBitmapSource(); + with (iconRed) + { + source160dpi = iconRed18; + source240dpi = iconRed24; + source320dpi = iconRed36; + } + + iconGreen = new MultiDPIBitmapSource() + with (iconGreen) + { + source160dpi = iconGreen18; + source240dpi = iconGreen24; + source320dpi = iconGreen36; + } + + var src:Array = []; + for (var i:int = 0; i <50; i++) + { + src.push({Name: "John_" + i, Surname: "Doe_" + i, Age: 5 + i, status: 1000 + i, comments: "Sed tamen haec cum ita tutius observentur, quidam vigore artuum inminuto rogati ad nuptias\n ubi aurum dextris manibus cavatis offertur, inpigre vel usque Spoletium pergunt. haec nobilium sunt."}); + src.push({Name: "Paul_" + i, Surname: "Smith_" + i, Age: 12 + i, status: 2000 + i, comments: "Quanta autem vis amicitiae sit, ex hoc intellegi maxime potest, quod ex infinita societate \ngeneris humani, quam conciliavit ipsa natura, ita contracta res est et adducta in angustum ut omnis caritas." }); + src.push({Name: "Sarah_" + i, Surname: "Lee_" + i, Age: 42 + i, status: 2000 + i, comments: "Ideo urbs venerabilis post superbas efferatarum gentium cervices oppressas latasque leges \nfundamenta libertatis et retinacula sempiterna velut frugi parens et prudens et dives Caesaribus tamquam."}); + } + dataProvider.source = src; + } + + private function fullName(o:Object):String + { + return o.Name + " " + o.Surname; + } + + public function getMDPIStatusIcon(e:Object):MultiDPIBitmapSource + { + return e.status >= 2000 ? iconRed : iconGreen; + } + + ]]></fx:Script> +</s:View> + http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView2.mxml ---------------------------------------------------------------------- diff --git a/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView2.mxml b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView2.mxml new file mode 100644 index 0000000..c4c8e6c --- /dev/null +++ b/frameworks/projects/experimental_mobile/asdoc/en_US/spark/components/examples/views/MobileGridView2.mxml @@ -0,0 +1,115 @@ +<?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. + +--> +<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:exp="http://flex.apache.org/experimental/ns" + title="MobileGrid w/ Custom Renderer" + creationComplete="creationCompleteHandler(event)" + > + + <exp:MobileGrid id="dgm" dataProvider="{dataProvider}" width="100%" height="100%" > + <exp:columns> + <exp:MobileGridColumn dataField="Name" styleName="bold" width="20%" /> + <exp:MobileGridColumn dataField="Surname" styleName="bold" width="20%"/> + <exp:MobileGridColumn dataField="comments" width="100%" /> + <exp:MobileGridColumn headerText="Action" dataField="Name" width="80" sortable="false" + itemRenderer="renderers.MyIconItemRenderer"/> + </exp:columns> + </exp:MobileGrid> + + <fx:Declarations> + + </fx:Declarations> + + <fx:Script><![CDATA[ + import mx.collections.ArrayCollection; + import mx.events.FlexEvent; + + import spark.utils.MultiDPIBitmapSource; + + [Embed('../../embedded/images/aqua_inset_36_red.png')] + private const iconRed36:Class; + + [Embed('../../embedded/images/aqua_inset_36_green.png')] + private const iconGreen36:Class; + + [Embed('../../embedded/images/status_aqua24_red.png')] + private const iconRed24:Class; + + [Embed('../../embedded/images/status_aqua24_green.png')] + private const iconGreen24:Class; + + [Embed('../../embedded/images/status_aqua16_red.png')] + private const iconRed18:Class; + + [Embed('../../embedded/images/status_aqua16_green.png')] + private const iconGreen18:Class; + + private const dataProvider:ArrayCollection = new ArrayCollection(); + + private var iconRed:MultiDPIBitmapSource; + private var iconGreen:MultiDPIBitmapSource; + + private function creationCompleteHandler(event:FlexEvent):void + { + + iconRed = new MultiDPIBitmapSource(); + with (iconRed) + { + source160dpi = iconRed18; + source240dpi = iconRed24; + source320dpi = iconRed36; + } + + iconGreen = new MultiDPIBitmapSource() + with (iconGreen) + { + source160dpi = iconGreen18; + source240dpi = iconGreen24; + source320dpi = iconGreen36; + } + + var src:Array = []; + for (var i:int = 0; i <50; i++) + { + src.push({Name: "John_" + i, Surname: "Doe_" + i, Age: 5 + i, status: 1000 + i, comments: "Sed tamen haec cum ita tutius observentur, quidam vigore artuum inminuto rogati ad nuptias\n ubi aurum dextris manibus cavatis offertur, inpigre vel usque Spoletium pergunt. haec nobilium sunt."}); + src.push({Name: "Paul_" + i, Surname: "Smith_" + i, Age: 12 + i, status: 2000 + i, comments: "Quanta autem vis amicitiae sit, ex hoc intellegi maxime potest, quod ex infinita societate \ngeneris humani, quam conciliavit ipsa natura, ita contracta res est et adducta in angustum ut omnis caritas." }); + src.push({Name: "Sarah_" + i, Surname: "Lee_" + i, Age: 42 + i, status: 2000 + i, comments: "Ideo urbs venerabilis post superbas efferatarum gentium cervices oppressas latasque leges \nfundamenta libertatis et retinacula sempiterna velut frugi parens et prudens et dives Caesaribus tamquam."}); + } + dataProvider.source = src; + } + + private function fullName(o:Object):String + { + return o.Name + " " + o.Surname; + } + + public function get160DPIStatusIcon(e:Object):Class + { + return e.status >= 2000 ? iconRed18 : iconGreen18; + } + + public function getMDPIStatusIcon(e:Object):MultiDPIBitmapSource + { + return e.status >= 2000 ? iconRed : iconGreen; + } + ]]></fx:Script> +</s:View> + http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/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 index 3c7719d..d58f885 100644 --- a/frameworks/projects/experimental_mobile/src/spark/components/MobileGrid.as +++ b/frameworks/projects/experimental_mobile/src/spark/components/MobileGrid.as @@ -75,10 +75,14 @@ use namespace mx_internal; * 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> - * <p>Click the link below to view examples of MobileGrid usage on the ApacheFlex github repository.</p> * * @see spark.components.supportClasses.MobileGridColumn - * @see https://github.com/apache/flex-examples/tree/develop/showcase/4.11/components/mobilegrid/index.html Examples of MobileGrid usage on ApacheFlex github + * + * @includeExample examples/MobileGrid_ApplicationExample.mxml -noswf + * @includeExample examples/views/MobileGridView.mxml -noswf + * @includeExample examples/views/MobileGridView2.mxml -noswf + * @includeExample examples/renderers/MyActionButtonPartRenderer.as -noswf + * * @langversion 3.0 * @playerversion AIR 3.8 * @productversion Flex 4.11 http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/145c1683/frameworks/projects/experimental_mobile/src/spark/skins/MobileGridSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/experimental_mobile/src/spark/skins/MobileGridSkin.as b/frameworks/projects/experimental_mobile/src/spark/skins/MobileGridSkin.as index 35353f8..4956dd5 100644 --- a/frameworks/projects/experimental_mobile/src/spark/skins/MobileGridSkin.as +++ b/frameworks/projects/experimental_mobile/src/spark/skins/MobileGridSkin.as @@ -33,7 +33,7 @@ import spark.components.supportClasses.MobileGridHeader; import spark.layouts.HorizontalAlign; import spark.layouts.VerticalLayout; import spark.skins.mobile.supportClasses.MobileSkin; -import spark.utils.MultiDPIBitmapSourceExt; +import spark.utils.MultiDPIBitmapSource; use namespace mx_internal; @@ -72,10 +72,10 @@ public class MobileGridSkin extends MobileSkin minWidth = 100; break; } - var headerShadowSrc:MultiDPIBitmapSourceExt = new MultiDPIBitmapSourceExt(); + var headerShadowSrc:MultiDPIBitmapSource = new MultiDPIBitmapSource(); headerShadowSrc.source320dpi = headerShadowCls320; headerShadowSrc.source160dpi = headerShadowCls160; - headerShadowCls = Class(headerShadowSrc.getSource(NaN)); + headerShadowCls = Class(headerShadowSrc.getMultiSource()); } override protected function commitCurrentState():void