http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RegionDetail.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RegionDetail.mxml b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RegionDetail.mxml index 5678373..2c01180 100755 --- a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RegionDetail.mxml +++ b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RegionDetail.mxml @@ -1,175 +1,175 @@ -<?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. - ---> -<mx:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns="*" - title="Region Details"> - - <fx:Script> - - <![CDATA[ - import mx.charts.HitData; - import mx.controls.Alert; - import mx.charts.chartClasses.ChartBase; - - private var _region:String; - - [Bindable] - public var revenueData:Array; - - [Bindable] - public var selectedMonth:Object; - - protected function monthChange(month:Object):void - { - selectedMonth = month; - dispatchEvent(new Event("monthChange")); - } - - protected function currencyFormat(value:Object, arg2:Object, arg3:Object):String - { - return cf.format(value); - } - - private function dataGridCurrencyFormat(item:Object, column:Object):String - { - return cf.format(item[column.dataField]); - } - - private function sortByDates(obj1:Object, obj2:Object):Number - { - var n:Number = SortUtils.sortByDates(obj1, obj2, "name"); - return n; - } - - public function set region(r:String):void - { - _region = r; - this.title = "Region Details [" + r + "]"; - } - - private function formatDataTip(hitData:HitData):String - { - var month:String = hitData.item.name; - var revenue:Number = hitData.item.revenue; - var average:Number = hitData.item.average; - return "<b>Month: " + month + "</b><br>" + _region + ": " + - cf.format(revenue) + "<br>Average: " + cf.format(average); - } - - ]]> - - </fx:Script> - - <fx:Declarations> - <mx:SeriesInterpolate id="interpolate" elementOffset="10"/> - - <mx:CurrencyFormatter id="cf"/> - </fx:Declarations> - - <mx:ViewStack id="vs" width="100%" height="100%"> - - <mx:VBox id="chartVBox" width="100%" height="100%" icon="@Embed('icon_chart.png')" toolTip="Chart View" - paddingLeft="4" paddingTop="4" paddingBottom="4" paddingRight="4"> - - <mx:ColumnChart dataProvider="{revenueData}" width="100%" height="100%" showDataTips="true" dataTipFunction="formatDataTip"> - - <mx:horizontalAxis> - <mx:CategoryAxis dataProvider="{revenueData}" categoryField="name"/> - </mx:horizontalAxis> - - <mx:verticalAxis> - <mx:LinearAxis maximum="160000" labelFunction="currencyFormat"/> - </mx:verticalAxis> - - <mx:series> - <fx:Array> - <mx:ColumnSeries yField="revenue" showDataEffect="{interpolate}"> - <mx:fill> - <mx:LinearGradient> - <mx:entries> - <fx:Array> - <mx:GradientEntry color="#C6D5DD" ratio="0" alpha="100"/> - <mx:GradientEntry color="#336699" ratio="0.1" alpha="100"/> - <mx:GradientEntry color="#24496D" ratio="0.9" alpha="100"/> - <mx:GradientEntry color="#000000" ratio="1" alpha="100"/> - </fx:Array> - </mx:entries> - </mx:LinearGradient> - </mx:fill> - </mx:ColumnSeries> - - - <mx:LineSeries yField="average" form="curve" showDataEffect="{interpolate}"> - <mx:stroke> -<!-- SDK4 --> - <mx:SolidColorStroke color="#708EA4" weight="1"/> -<!-- SDK3 - <mx:Stroke color="#708EA4" weight="1"/> ---> - </mx:stroke> - - </mx:LineSeries> - - </fx:Array> - </mx:series> - - <mx:backgroundElements> - <fx:Array> -<!-- SDK4 --> - <mx:GridLines gridDirection="both"> -<!-- SDK3 - <mx:GridLines direction="both"> --> - <mx:verticalStroke> -<!-- SDK4 --> - <mx:SolidColorStroke weight="1" color="#CCCCCC"/> -<!-- SDK3 - <mx:Stroke weight="1" color="#CCCCCC"/> ---> - </mx:verticalStroke> - </mx:GridLines> - </fx:Array> - </mx:backgroundElements> - - </mx:ColumnChart> - </mx:VBox> - - <mx:VBox width="100%" height="100%" icon="@Embed('icon_grid.png')" toolTip="Grid View" - hideEffect="Fade" showEffect="Fade"> - <mx:DataGrid dataProvider="{revenueData}" width="100%" height="100%" - change="monthChange(DataGrid(event.target).selectedItem)"> - <mx:columns> - <fx:Array> - <mx:DataGridColumn dataField="name" headerText="Month" - sortCompareFunction="sortByDates" /> - <mx:DataGridColumn dataField="revenue" headerText="Total Revenue" - labelFunction="dataGridCurrencyFormat" /> - <mx:DataGridColumn dataField="average" headerText="Average Across Regions" - labelFunction="dataGridCurrencyFormat" /> - </fx:Array> - </mx:columns> - </mx:DataGrid> - </mx:VBox> - - </mx:ViewStack> - - <mx:ControlBar> - <mx:ToggleButtonBar dataProvider="{vs}"/> - </mx:ControlBar> - +<?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. + +--> +<mx:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns="*" + title="Region Details"> + + <fx:Script> + + <![CDATA[ + import mx.charts.HitData; + import mx.controls.Alert; + import mx.charts.chartClasses.ChartBase; + + private var _region:String; + + [Bindable] + public var revenueData:Array; + + [Bindable] + public var selectedMonth:Object; + + protected function monthChange(month:Object):void + { + selectedMonth = month; + dispatchEvent(new Event("monthChange")); + } + + protected function currencyFormat(value:Object, arg2:Object, arg3:Object):String + { + return cf.format(value); + } + + private function dataGridCurrencyFormat(item:Object, column:Object):String + { + return cf.format(item[column.dataField]); + } + + private function sortByDates(obj1:Object, obj2:Object):Number + { + var n:Number = SortUtils.sortByDates(obj1, obj2, "name"); + return n; + } + + public function set region(r:String):void + { + _region = r; + this.title = "Region Details [" + r + "]"; + } + + private function formatDataTip(hitData:HitData):String + { + var month:String = hitData.item.name; + var revenue:Number = hitData.item.revenue; + var average:Number = hitData.item.average; + return "<b>Month: " + month + "</b><br>" + _region + ": " + + cf.format(revenue) + "<br>Average: " + cf.format(average); + } + + ]]> + + </fx:Script> + + <fx:Declarations> + <mx:SeriesInterpolate id="interpolate" elementOffset="10"/> + + <mx:CurrencyFormatter id="cf"/> + </fx:Declarations> + + <mx:ViewStack id="vs" width="100%" height="100%"> + + <mx:VBox id="chartVBox" width="100%" height="100%" icon="@Embed('icon_chart.png')" toolTip="Chart View" + paddingLeft="4" paddingTop="4" paddingBottom="4" paddingRight="4"> + + <mx:ColumnChart dataProvider="{revenueData}" width="100%" height="100%" showDataTips="true" dataTipFunction="formatDataTip"> + + <mx:horizontalAxis> + <mx:CategoryAxis dataProvider="{revenueData}" categoryField="name"/> + </mx:horizontalAxis> + + <mx:verticalAxis> + <mx:LinearAxis maximum="160000" labelFunction="currencyFormat"/> + </mx:verticalAxis> + + <mx:series> + <fx:Array> + <mx:ColumnSeries yField="revenue" showDataEffect="{interpolate}"> + <mx:fill> + <mx:LinearGradient> + <mx:entries> + <fx:Array> + <mx:GradientEntry color="#C6D5DD" ratio="0" alpha="100"/> + <mx:GradientEntry color="#336699" ratio="0.1" alpha="100"/> + <mx:GradientEntry color="#24496D" ratio="0.9" alpha="100"/> + <mx:GradientEntry color="#000000" ratio="1" alpha="100"/> + </fx:Array> + </mx:entries> + </mx:LinearGradient> + </mx:fill> + </mx:ColumnSeries> + + + <mx:LineSeries yField="average" form="curve" showDataEffect="{interpolate}"> + <mx:stroke> +<!-- SDK4 --> + <mx:SolidColorStroke color="#708EA4" weight="1"/> +<!-- SDK3 + <mx:Stroke color="#708EA4" weight="1"/> +--> + </mx:stroke> + + </mx:LineSeries> + + </fx:Array> + </mx:series> + + <mx:backgroundElements> + <fx:Array> +<!-- SDK4 --> + <mx:GridLines gridDirection="both"> +<!-- SDK3 + <mx:GridLines direction="both"> --> + <mx:verticalStroke> +<!-- SDK4 --> + <mx:SolidColorStroke weight="1" color="#CCCCCC"/> +<!-- SDK3 + <mx:Stroke weight="1" color="#CCCCCC"/> +--> + </mx:verticalStroke> + </mx:GridLines> + </fx:Array> + </mx:backgroundElements> + + </mx:ColumnChart> + </mx:VBox> + + <mx:VBox width="100%" height="100%" icon="@Embed('icon_grid.png')" toolTip="Grid View" + hideEffect="Fade" showEffect="Fade"> + <mx:DataGrid dataProvider="{revenueData}" width="100%" height="100%" + change="monthChange(DataGrid(event.target).selectedItem)"> + <mx:columns> + <fx:Array> + <mx:DataGridColumn dataField="name" headerText="Month" + sortCompareFunction="sortByDates" /> + <mx:DataGridColumn dataField="revenue" headerText="Total Revenue" + labelFunction="dataGridCurrencyFormat" /> + <mx:DataGridColumn dataField="average" headerText="Average Across Regions" + labelFunction="dataGridCurrencyFormat" /> + </fx:Array> + </mx:columns> + </mx:DataGrid> + </mx:VBox> + + </mx:ViewStack> + + <mx:ControlBar> + <mx:ToggleButtonBar dataProvider="{vs}"/> + </mx:ControlBar> + </mx:Panel> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RevenueTimeline.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RevenueTimeline.mxml b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RevenueTimeline.mxml index 79a04ef..41e4619 100755 --- a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RevenueTimeline.mxml +++ b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/RevenueTimeline.mxml @@ -1,134 +1,134 @@ -<?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. - ---> -<mx:ViewStack xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns="*" width="100%" height="100%"> - - <fx:Script> - - <![CDATA[ - import mx.charts.HitData; - - [Bindable] - public var revenueData:Array; - - [Bindable] - public var selectedMonth:Object; - - private var colors:Array = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF]; - - protected function monthChange(month:Object):void - { - selectedMonth = month; - dispatchEvent(new Event("monthChange")); - } - - protected function currencyFormat(value:Object, arg2:Object, arg3:Object):String - { - return cf.format(value); - } - - private function dataGridCurrencyFormat(item:Object, column:Object):String - { - return cf.format(item[column.dataField]); - } - - private function sortByDates(obj1:Object, obj2:Object):Number - { - var n:Number = SortUtils.sortByDates(obj1, obj2, "name"); - return n; - } - - private function formatDataTip(hitData:HitData):String - { - var name:String = hitData.item.name; - var revenue:Number = hitData.item.revenue; - return "<b>Month: "+name+"</b><br>Revenue: "+cf.format(revenue); - } - - ]]> - - </fx:Script> - - <fx:Metadata> - [Event("monthChange")] - </fx:Metadata> - - <fx:Declarations> - <mx:SeriesInterpolate id="interpolate" elementOffset="10"/> - - <mx:CurrencyFormatter id="cf"/> - </fx:Declarations> - - <mx:VBox id="chartVBox" width="100%" height="100%" icon="@Embed('icon_chart.png')" toolTip="Chart View" - paddingLeft="4" paddingTop="4" paddingBottom="4" paddingRight="4"> - <mx:LineChart id="lc" dataProvider="{revenueData}" showDataTips="true" width="100%" height="100%" dataTipFunction="formatDataTip" - itemClick="monthChange(event.hitData.item)"> - - <mx:horizontalAxis> - <mx:CategoryAxis dataProvider="{revenueData}" categoryField="name"/> - </mx:horizontalAxis> - - <mx:verticalAxis> - <mx:LinearAxis labelFunction="currencyFormat"/> - </mx:verticalAxis> - - <mx:series> - <mx:LineSeries yField="revenue" showDataEffect="{interpolate}"> - <mx:lineStroke> - <mx:SolidColorStroke color="#708EA4" weight="1"/> - </mx:lineStroke> - </mx:LineSeries> - <mx:LineSeries yField="license" showDataEffect="{interpolate}"> - <mx:lineStroke> - <mx:SolidColorStroke weight="1"/> - </mx:lineStroke> - </mx:LineSeries> - </mx:series> - - <mx:backgroundElements> - <fx:Array> -<!-- SDK4 --> - <mx:GridLines gridDirection="both"> -<!-- SDK3 - <mx:GridLines direction="both"> --> - <mx:verticalStroke> - <mx:SolidColorStroke weight="1" color="#CCCCCC"/> - </mx:verticalStroke> - </mx:GridLines> - </fx:Array> - </mx:backgroundElements> - - </mx:LineChart> - </mx:VBox> - - <mx:VBox width="100%" height="100%" icon="@Embed('icon_grid.png')" toolTip="Grid View"> - <mx:DataGrid dataProvider="{revenueData}" width="100%" height="100%" - change="monthChange(DataGrid(event.target).selectedItem)"> - <mx:columns> - <mx:DataGridColumn dataField="name" headerText="Month" - sortCompareFunction="sortByDates" /> - <mx:DataGridColumn dataField="revenue" headerText="Total Revenue" - labelFunction="dataGridCurrencyFormat" /> - <mx:DataGridColumn dataField="average" headerText="Region Average" - labelFunction="dataGridCurrencyFormat" /> - </mx:columns> - </mx:DataGrid> - </mx:VBox> - +<?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. + +--> +<mx:ViewStack xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns="*" width="100%" height="100%"> + + <fx:Script> + + <![CDATA[ + import mx.charts.HitData; + + [Bindable] + public var revenueData:Array; + + [Bindable] + public var selectedMonth:Object; + + private var colors:Array = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF]; + + protected function monthChange(month:Object):void + { + selectedMonth = month; + dispatchEvent(new Event("monthChange")); + } + + protected function currencyFormat(value:Object, arg2:Object, arg3:Object):String + { + return cf.format(value); + } + + private function dataGridCurrencyFormat(item:Object, column:Object):String + { + return cf.format(item[column.dataField]); + } + + private function sortByDates(obj1:Object, obj2:Object):Number + { + var n:Number = SortUtils.sortByDates(obj1, obj2, "name"); + return n; + } + + private function formatDataTip(hitData:HitData):String + { + var name:String = hitData.item.name; + var revenue:Number = hitData.item.revenue; + return "<b>Month: "+name+"</b><br>Revenue: "+cf.format(revenue); + } + + ]]> + + </fx:Script> + + <fx:Metadata> + [Event("monthChange")] + </fx:Metadata> + + <fx:Declarations> + <mx:SeriesInterpolate id="interpolate" elementOffset="10"/> + + <mx:CurrencyFormatter id="cf"/> + </fx:Declarations> + + <mx:VBox id="chartVBox" width="100%" height="100%" icon="@Embed('icon_chart.png')" toolTip="Chart View" + paddingLeft="4" paddingTop="4" paddingBottom="4" paddingRight="4"> + <mx:LineChart id="lc" dataProvider="{revenueData}" showDataTips="true" width="100%" height="100%" dataTipFunction="formatDataTip" + itemClick="monthChange(event.hitData.item)"> + + <mx:horizontalAxis> + <mx:CategoryAxis dataProvider="{revenueData}" categoryField="name"/> + </mx:horizontalAxis> + + <mx:verticalAxis> + <mx:LinearAxis labelFunction="currencyFormat"/> + </mx:verticalAxis> + + <mx:series> + <mx:LineSeries yField="revenue" showDataEffect="{interpolate}"> + <mx:lineStroke> + <mx:SolidColorStroke color="#708EA4" weight="1"/> + </mx:lineStroke> + </mx:LineSeries> + <mx:LineSeries yField="license" showDataEffect="{interpolate}"> + <mx:lineStroke> + <mx:SolidColorStroke weight="1"/> + </mx:lineStroke> + </mx:LineSeries> + </mx:series> + + <mx:backgroundElements> + <fx:Array> +<!-- SDK4 --> + <mx:GridLines gridDirection="both"> +<!-- SDK3 + <mx:GridLines direction="both"> --> + <mx:verticalStroke> + <mx:SolidColorStroke weight="1" color="#CCCCCC"/> + </mx:verticalStroke> + </mx:GridLines> + </fx:Array> + </mx:backgroundElements> + + </mx:LineChart> + </mx:VBox> + + <mx:VBox width="100%" height="100%" icon="@Embed('icon_grid.png')" toolTip="Grid View"> + <mx:DataGrid dataProvider="{revenueData}" width="100%" height="100%" + change="monthChange(DataGrid(event.target).selectedItem)"> + <mx:columns> + <mx:DataGridColumn dataField="name" headerText="Month" + sortCompareFunction="sortByDates" /> + <mx:DataGridColumn dataField="revenue" headerText="Total Revenue" + labelFunction="dataGridCurrencyFormat" /> + <mx:DataGridColumn dataField="average" headerText="Region Average" + labelFunction="dataGridCurrencyFormat" /> + </mx:columns> + </mx:DataGrid> + </mx:VBox> + </mx:ViewStack> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/dashboard/src/SortUtils.as ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/SortUtils.as b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/SortUtils.as index 525585a..a461df1 100755 --- a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/SortUtils.as +++ b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/SortUtils.as @@ -1,62 +1,62 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 { - -import mx.utils.ObjectUtil; - -public class SortUtils -{ - //lookup the index based on month abbreviation - static public var monthMap:Object = { - Jan: 0, - Feb: 1, - Mar: 2, - Apr: 3, - May: 4, - Jun: 5, - Jul: 6, - Aug: 7, - Sep: 8, - Oct: 9, - Nov: 10, - Dec: 11 - }; - - public function SortUtils() - { - super(); - } - - static public function sortByDates(obj1:Object, obj2:Object, prop:String):Number - { - var month:String = obj1[prop].substr(0,3); - var month1:Number = monthMap[month]; - var year1:String = "20" + obj1[prop].substr(4,2); - month = obj2[prop].substr(0,3); - var month2:Number = monthMap[month]; - var year2:String = "20" + obj2[prop].substr(4,2); - var date1:Date = new Date(Number(year1), month1, 01); - var date2:Date = new Date(Number(year2), month2, 01); - - return ObjectUtil.dateCompare(date1, date2); - } - -} - -} +//////////////////////////////////////////////////////////////////////////////// +// +// 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 { + +import mx.utils.ObjectUtil; + +public class SortUtils +{ + //lookup the index based on month abbreviation + static public var monthMap:Object = { + Jan: 0, + Feb: 1, + Mar: 2, + Apr: 3, + May: 4, + Jun: 5, + Jul: 6, + Aug: 7, + Sep: 8, + Oct: 9, + Nov: 10, + Dec: 11 + }; + + public function SortUtils() + { + super(); + } + + static public function sortByDates(obj1:Object, obj2:Object, prop:String):Number + { + var month:String = obj1[prop].substr(0,3); + var month1:Number = monthMap[month]; + var year1:String = "20" + obj1[prop].substr(4,2); + month = obj2[prop].substr(0,3); + var month2:Number = monthMap[month]; + var year2:String = "20" + obj2[prop].substr(4,2); + var date1:Date = new Date(Number(year1), month1, 01); + var date2:Date = new Date(Number(year2), month2, 01); + + return ObjectUtil.dateCompare(date1, date2); + } + +} + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/dashboard/src/dashboard.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/dashboard.mxml b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/dashboard.mxml index c40b4de..1be8190 100755 --- a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/dashboard.mxml +++ b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/dashboard.mxml @@ -1,209 +1,209 @@ -<?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. - ---> -<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns="*" - pageTitle="Collaborative Dashboard" - creationComplete="initApp()"> - - - <fx:Style source="main.css"/> - - <fx:Script> - <![CDATA[ - - import mx.messaging.messages.AsyncMessage; - import mx.messaging.messages.IMessage; - import mx.collections.ArrayCollection; - import mx.messaging.events.MessageEvent; - import mx.rpc.events.ResultEvent; - - [Bindable] - public var slicedMonthData:ArrayCollection; - - [Bindable] - public var slicedRegionData:ArrayCollection; - - private var monthData:Array; - private var regionData:Array; - - private function initApp():void - { - consumer.subscribe(); - srv.send(); - slicedMonthData = new ArrayCollection(); - slicedRegionData = new ArrayCollection(); - } - - private function resultHandler(event:ResultEvent):void - { - monthData = event.result.list.month.source as Array; - slider.maximum = monthData.length - 1; - slider.values = [0, monthData.length - 1]; - slicedMonthData.source = monthData; - regionBreakdown.month = monthData[0]; - - regionData = new Array(monthData.length); - var monthTotal:Number; - - for (var i:Number = 0; i < monthData.length; i++) - { - regionData[i] = {name: monthData[i].name, average: 0, revenue: 0}; - var regions:Array = monthData[i].region.source; - monthTotal = 0; - for (var j:Number = 0; j < regions.length; j++) - { - monthTotal += regions[j].revenue; - } - regionData[i].average = monthTotal/monthData[i].region.length - } - slicedRegionData.source = regionData.slice(slider.values[0], slider.values[1]); - } - - private function getSliderLabel(value:String):String - { - return monthData[parseInt(value)].name; - } - - // Send messages when user's selection changes - private function monthChange():void - { - var message:IMessage = new AsyncMessage(); - message.body = {month: timeline.selectedMonth}; - producer.send(message); - } - - private function rangeChange():void - { - var message:IMessage = new AsyncMessage(); - message.body = {min: slider.values[0], max: slider.values[1]+1}; - producer.send(message); - } - - private function regionChange():void - { - var message: IMessage = new AsyncMessage(); - message.body = {region: regionBreakdown.selectedRegion}; - producer.send(message); - } - - // Handle incoming messages - private function messageHandler(event:MessageEvent):void - { - var body:Object = event.message.body; - - if (body.min != null) //range - { - slider.values = [body.min, body.max - 1]; - - if (monthData != null) - slicedMonthData.source = monthData.slice(body.min, body.max); - if (regionData != null) - slicedRegionData.source = regionData.slice(body.min, body.max); - - } - else if (body.month != null) //month in timeline - { - regionBreakdown.month = body.month; - } - else if (body.region != null) //region from breakdown - { - regionBreakdown.selectedRegion = body.region; - regionDetail.region = body.region.name; - - for (var i: Number = 0; i < monthData.length; i++) - { - var regions: Array = monthData[i].region.source; - for (var j: Number = 0; j < regions.length; j++) - { - if (regions[j].name == body.region.name) - { - regionData[i].revenue = regions[j].revenue; - break; - } - } - } - slicedRegionData.source = regionData.slice(slider.values[0], slider.values[1] + 1); - } - } - - private function toggleSeries():void - { - var message: IMessage = new AsyncMessage(); - if (currentState=="series") - { - currentState = ""; - message.body.series = false; - } - else - { - currentState = "series"; - message.body.series = true; - } - producer.send(message); - } - - private function dataGridCurrencyFormat(item:Object, column:Object):String - { - return cf.format(item[column.dataField]); - } - - ]]> - </fx:Script> - - <fx:Declarations> - <mx:Producer id="producer" destination="dashboard"/> - <mx:Consumer id="consumer" destination="dashboard" message="messageHandler(event)"/> - - <mx:HTTPService id="srv" url="results.xml" useProxy="false" result="resultHandler(event)"/> - - <mx:CurrencyFormatter id="cf"/> - </fx:Declarations> - - <mx:HBox width="100%" verticalAlign="middle" horizontalAlign="right" paddingRight="40"> - <mx:Label text="Welcome, Guest |"/> - <mx:ComboBox id="cb"> - <mx:dataProvider> - <fx:String>Revenue Timeline</fx:String> - </mx:dataProvider> - </mx:ComboBox> - </mx:HBox> - - <mx:HDividedBox width="100%" height="100%"> - - <mx:Panel id="timelinePanel" title="Revenue Timeline" width="100%" height="100%"> - <RevenueTimeline id="timeline" revenueData="{slicedMonthData.source}" - monthChange="monthChange()"/> - <mx:ControlBar horizontalGap="4"> - <mx:ToggleButtonBar dataProvider="{timeline}"/> - <mx:Spacer width="10"/> - <mx:Label text="Range:"/> - <mx:HSlider id="slider" width="150" thumbCount="2" snapInterval="1" minimum="0" - dataTipFormatFunction="getSliderLabel" - change="rangeChange()"/> - </mx:ControlBar> - </mx:Panel> - - <mx:VDividedBox width="100%" height="100%"> - <RegionBreakdown id="regionBreakdown" regionChange="regionChange()" width="100%" height="50%" /> - <RegionDetail id="regionDetail" revenueData="{slicedRegionData.source}" width="100%" height="50%" /> - </mx:VDividedBox> - - </mx:HDividedBox> - +<?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. + +--> +<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns="*" + pageTitle="Collaborative Dashboard" + creationComplete="initApp()"> + + + <fx:Style source="main.css"/> + + <fx:Script> + <![CDATA[ + + import mx.messaging.messages.AsyncMessage; + import mx.messaging.messages.IMessage; + import mx.collections.ArrayCollection; + import mx.messaging.events.MessageEvent; + import mx.rpc.events.ResultEvent; + + [Bindable] + public var slicedMonthData:ArrayCollection; + + [Bindable] + public var slicedRegionData:ArrayCollection; + + private var monthData:Array; + private var regionData:Array; + + private function initApp():void + { + consumer.subscribe(); + srv.send(); + slicedMonthData = new ArrayCollection(); + slicedRegionData = new ArrayCollection(); + } + + private function resultHandler(event:ResultEvent):void + { + monthData = event.result.list.month.source as Array; + slider.maximum = monthData.length - 1; + slider.values = [0, monthData.length - 1]; + slicedMonthData.source = monthData; + regionBreakdown.month = monthData[0]; + + regionData = new Array(monthData.length); + var monthTotal:Number; + + for (var i:Number = 0; i < monthData.length; i++) + { + regionData[i] = {name: monthData[i].name, average: 0, revenue: 0}; + var regions:Array = monthData[i].region.source; + monthTotal = 0; + for (var j:Number = 0; j < regions.length; j++) + { + monthTotal += regions[j].revenue; + } + regionData[i].average = monthTotal/monthData[i].region.length + } + slicedRegionData.source = regionData.slice(slider.values[0], slider.values[1]); + } + + private function getSliderLabel(value:String):String + { + return monthData[parseInt(value)].name; + } + + // Send messages when user's selection changes + private function monthChange():void + { + var message:IMessage = new AsyncMessage(); + message.body = {month: timeline.selectedMonth}; + producer.send(message); + } + + private function rangeChange():void + { + var message:IMessage = new AsyncMessage(); + message.body = {min: slider.values[0], max: slider.values[1]+1}; + producer.send(message); + } + + private function regionChange():void + { + var message: IMessage = new AsyncMessage(); + message.body = {region: regionBreakdown.selectedRegion}; + producer.send(message); + } + + // Handle incoming messages + private function messageHandler(event:MessageEvent):void + { + var body:Object = event.message.body; + + if (body.min != null) //range + { + slider.values = [body.min, body.max - 1]; + + if (monthData != null) + slicedMonthData.source = monthData.slice(body.min, body.max); + if (regionData != null) + slicedRegionData.source = regionData.slice(body.min, body.max); + + } + else if (body.month != null) //month in timeline + { + regionBreakdown.month = body.month; + } + else if (body.region != null) //region from breakdown + { + regionBreakdown.selectedRegion = body.region; + regionDetail.region = body.region.name; + + for (var i: Number = 0; i < monthData.length; i++) + { + var regions: Array = monthData[i].region.source; + for (var j: Number = 0; j < regions.length; j++) + { + if (regions[j].name == body.region.name) + { + regionData[i].revenue = regions[j].revenue; + break; + } + } + } + slicedRegionData.source = regionData.slice(slider.values[0], slider.values[1] + 1); + } + } + + private function toggleSeries():void + { + var message: IMessage = new AsyncMessage(); + if (currentState=="series") + { + currentState = ""; + message.body.series = false; + } + else + { + currentState = "series"; + message.body.series = true; + } + producer.send(message); + } + + private function dataGridCurrencyFormat(item:Object, column:Object):String + { + return cf.format(item[column.dataField]); + } + + ]]> + </fx:Script> + + <fx:Declarations> + <mx:Producer id="producer" destination="dashboard"/> + <mx:Consumer id="consumer" destination="dashboard" message="messageHandler(event)"/> + + <mx:HTTPService id="srv" url="results.xml" useProxy="false" result="resultHandler(event)"/> + + <mx:CurrencyFormatter id="cf"/> + </fx:Declarations> + + <mx:HBox width="100%" verticalAlign="middle" horizontalAlign="right" paddingRight="40"> + <mx:Label text="Welcome, Guest |"/> + <mx:ComboBox id="cb"> + <mx:dataProvider> + <fx:String>Revenue Timeline</fx:String> + </mx:dataProvider> + </mx:ComboBox> + </mx:HBox> + + <mx:HDividedBox width="100%" height="100%"> + + <mx:Panel id="timelinePanel" title="Revenue Timeline" width="100%" height="100%"> + <RevenueTimeline id="timeline" revenueData="{slicedMonthData.source}" + monthChange="monthChange()"/> + <mx:ControlBar horizontalGap="4"> + <mx:ToggleButtonBar dataProvider="{timeline}"/> + <mx:Spacer width="10"/> + <mx:Label text="Range:"/> + <mx:HSlider id="slider" width="150" thumbCount="2" snapInterval="1" minimum="0" + dataTipFormatFunction="getSliderLabel" + change="rangeChange()"/> + </mx:ControlBar> + </mx:Panel> + + <mx:VDividedBox width="100%" height="100%"> + <RegionBreakdown id="regionBreakdown" regionChange="regionChange()" width="100%" height="50%" /> + <RegionDetail id="regionDetail" revenueData="{slicedRegionData.source}" width="100%" height="50%" /> + </mx:VDividedBox> + + </mx:HDividedBox> + </mx:Application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/dashboard/src/main.css ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/main.css b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/main.css index 4563e9f..1c3d051 100755 --- a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/main.css +++ b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/main.css @@ -1,35 +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. - */ -@namespace mx "library://ns.adobe.com/flex/mx"; - -mx|Application { - paddingTop: 12; - verticalGap: 12; -} - -mx|Panel { - cornerRadius: 6; - panelBorderStyle: "roundCorners"; -} - -mx|Button { - cornerRadius: 4; -} - -mx|HSlider { - showTrackHighlight: true; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@namespace mx "library://ns.adobe.com/flex/mx"; + +mx|Application { + paddingTop: 12; + verticalGap: 12; +} + +mx|Panel { + cornerRadius: 6; + panelBorderStyle: "roundCorners"; +} + +mx|Button { + cornerRadius: 4; +} + +mx|HSlider { + showTrackHighlight: true; +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/dashboard/src/results.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/results.xml b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/results.xml index 9727e91..6a96b33 100755 --- a/attic/apps/samples/WEB-INF/flex-src/dashboard/src/results.xml +++ b/attic/apps/samples/WEB-INF/flex-src/dashboard/src/results.xml @@ -16,198 +16,198 @@ See the License for the specific language governing permissions and limitations under the License. --> -<list> - - <month name="Jan-04" revenue="400263" average="80052"> - <region name="APAC" revenue="46130"/> - <region name="Europe" revenue="106976"/> - <region name="Japan" revenue="79554"/> - <region name="Latin America" revenue="39252"/> - <region name="North America" revenue="128351"/> - </month> - - <month name="Feb-04" revenue="379145" average="75829"> - <region name="APAC" revenue="70324"/> - <region name="Europe" revenue="88912"/> - <region name="Japan" revenue="69677"/> - <region name="Latin America" revenue="59428"/> - <region name="North America" revenue="90804"/> - </month> - - <month name="Mar-04" revenue="389687" average="77937"> - <region name="APAC" revenue="60431"/> - <region name="Europe" revenue="140982"/> - <region name="Japan" revenue="58196"/> - <region name="Latin America" revenue="33373"/> - <region name="North America" revenue="96705"/> - </month> - - <month name="Apr-04" revenue="460329" average="92065"> - <region name="APAC" revenue="78969"/> - <region name="Europe" revenue="85885"/> - <region name="Japan" revenue="78107"/> - <region name="Latin America" revenue="65796"/> - <region name="North America" revenue="151572"/> - </month> - - <month name="May-04" revenue="351014" average="70202"> - <region name="APAC" revenue="64069"/> - <region name="Europe" revenue="82415"/> - <region name="Japan" revenue="96397"/> - <region name="Latin America" revenue="44627"/> - <region name="North America" revenue="63506"/> - </month> - - <month name="Jun-04" revenue="384855" average="76971"> - <region name="APAC" revenue="55331"/> - <region name="Europe" revenue="113196"/> - <region name="Japan" revenue="55371"/> - <region name="Latin America" revenue="58323"/> - <region name="North America" revenue="102634"/> - </month> - - <month name="Jul-04" revenue="335192" average="67038"> - <region name="APAC" revenue="39445"/> - <region name="Europe" revenue="110750"/> - <region name="Japan" revenue="73722"/> - <region name="Latin America" revenue="50595"/> - <region name="North America" revenue="60680"/> - </month> - - <month name="Aug-04" revenue="393654" average="78730"> - <region name="APAC" revenue="44801"/> - <region name="Europe" revenue="98806"/> - <region name="Japan" revenue="93673"/> - <region name="Latin America" revenue="50636"/> - <region name="North America" revenue="105738"/> - </month> - - <month name="Sep-04" revenue="472554" average="94510"> - <region name="APAC" revenue="61134"/> - <region name="Europe" revenue="136467"/> - <region name="Japan" revenue="93624"/> - <region name="Latin America" revenue="32293"/> - <region name="North America" revenue="149036"/> - </month> - - <month name="Oct-04" revenue="324299" average="64859"> - <region name="APAC" revenue="32078"/> - <region name="Europe" revenue="85420"/> - <region name="Japan" revenue="80483"/> - <region name="Latin America" revenue="64390"/> - <region name="North America" revenue="61928"/> - </month> - - <month name="Nov-04" revenue="415403" average="83080"> - <region name="APAC" revenue="58832"/> - <region name="Europe" revenue="143128"/> - <region name="Japan" revenue="64295"/> - <region name="Latin America" revenue="58261"/> - <region name="North America" revenue="90887"/> - </month> - - <month name="Dec-04" revenue="386089" average="77217"> - <region name="APAC" revenue="80555"/> - <region name="Europe" revenue="118981"/> - <region name="Japan" revenue="87520"/> - <region name="Latin America" revenue="27154"/> - <region name="North America" revenue="71879"/> - </month> - - <month name="Jan-05" revenue="400263" average="80052"> - <region name="APAC" revenue="46130"/> - <region name="Europe" revenue="106976"/> - <region name="Japan" revenue="79554"/> - <region name="Latin America" revenue="39252"/> - <region name="North America" revenue="128351"/> - </month> - - <month name="Feb-05" revenue="379145" average="75829"> - <region name="APAC" revenue="70324"/> - <region name="Europe" revenue="88912"/> - <region name="Japan" revenue="69677"/> - <region name="Latin America" revenue="59428"/> - <region name="North America" revenue="90804"/> - </month> - - <month name="Mar-05" revenue="389687" average="77937"> - <region name="APAC" revenue="60431"/> - <region name="Europe" revenue="140982"/> - <region name="Japan" revenue="58196"/> - <region name="Latin America" revenue="33373"/> - <region name="North America" revenue="96705"/> - </month> - - <month name="Apr-05" revenue="460329" average="92065"> - <region name="APAC" revenue="78969"/> - <region name="Europe" revenue="85885"/> - <region name="Japan" revenue="78107"/> - <region name="Latin America" revenue="65796"/> - <region name="North America" revenue="151572"/> - </month> - - <month name="May-05" revenue="351014" average="70202"> - <region name="APAC" revenue="64069"/> - <region name="Europe" revenue="82415"/> - <region name="Japan" revenue="96397"/> - <region name="Latin America" revenue="44627"/> - <region name="North America" revenue="63506"/> - </month> - - <month name="Jun-05" revenue="384855" average="76971"> - <region name="APAC" revenue="55331"/> - <region name="Europe" revenue="113196"/> - <region name="Japan" revenue="55371"/> - <region name="Latin America" revenue="58323"/> - <region name="North America" revenue="102634"/> - </month> - - <month name="Jul-05" revenue="335192" average="67038"> - <region name="APAC" revenue="39445"/> - <region name="Europe" revenue="110750"/> - <region name="Japan" revenue="73722"/> - <region name="Latin America" revenue="50595"/> - <region name="North America" revenue="60680"/> - </month> - - <month name="Aug-05" revenue="393654" average="78730"> - <region name="APAC" revenue="44801"/> - <region name="Europe" revenue="98806"/> - <region name="Japan" revenue="93673"/> - <region name="Latin America" revenue="50636"/> - <region name="North America" revenue="105738"/> - </month> - - <month name="Sep-05" revenue="472554" average="94510"> - <region name="APAC" revenue="61134"/> - <region name="Europe" revenue="136467"/> - <region name="Japan" revenue="93624"/> - <region name="Latin America" revenue="32293"/> - <region name="North America" revenue="149036"/> - </month> - - <month name="Oct-05" revenue="324299" average="64859"> - <region name="APAC" revenue="32078"/> - <region name="Europe" revenue="85420"/> - <region name="Japan" revenue="80483"/> - <region name="Latin America" revenue="64390"/> - <region name="North America" revenue="61928"/> - </month> - - <month name="Nov-05" revenue="415403" average="83080"> - <region name="APAC" revenue="58832"/> - <region name="Europe" revenue="143128"/> - <region name="Japan" revenue="64295"/> - <region name="Latin America" revenue="58261"/> - <region name="North America" revenue="90887"/> - </month> - - <month name="Dec-05" revenue="386089" average="77217"> - <region name="APAC" revenue="80555"/> - <region name="Europe" revenue="118981"/> - <region name="Japan" revenue="87520"/> - <region name="Latin America" revenue="27154"/> - <region name="North America" revenue="71879"/> - </month> - +<list> + + <month name="Jan-04" revenue="400263" average="80052"> + <region name="APAC" revenue="46130"/> + <region name="Europe" revenue="106976"/> + <region name="Japan" revenue="79554"/> + <region name="Latin America" revenue="39252"/> + <region name="North America" revenue="128351"/> + </month> + + <month name="Feb-04" revenue="379145" average="75829"> + <region name="APAC" revenue="70324"/> + <region name="Europe" revenue="88912"/> + <region name="Japan" revenue="69677"/> + <region name="Latin America" revenue="59428"/> + <region name="North America" revenue="90804"/> + </month> + + <month name="Mar-04" revenue="389687" average="77937"> + <region name="APAC" revenue="60431"/> + <region name="Europe" revenue="140982"/> + <region name="Japan" revenue="58196"/> + <region name="Latin America" revenue="33373"/> + <region name="North America" revenue="96705"/> + </month> + + <month name="Apr-04" revenue="460329" average="92065"> + <region name="APAC" revenue="78969"/> + <region name="Europe" revenue="85885"/> + <region name="Japan" revenue="78107"/> + <region name="Latin America" revenue="65796"/> + <region name="North America" revenue="151572"/> + </month> + + <month name="May-04" revenue="351014" average="70202"> + <region name="APAC" revenue="64069"/> + <region name="Europe" revenue="82415"/> + <region name="Japan" revenue="96397"/> + <region name="Latin America" revenue="44627"/> + <region name="North America" revenue="63506"/> + </month> + + <month name="Jun-04" revenue="384855" average="76971"> + <region name="APAC" revenue="55331"/> + <region name="Europe" revenue="113196"/> + <region name="Japan" revenue="55371"/> + <region name="Latin America" revenue="58323"/> + <region name="North America" revenue="102634"/> + </month> + + <month name="Jul-04" revenue="335192" average="67038"> + <region name="APAC" revenue="39445"/> + <region name="Europe" revenue="110750"/> + <region name="Japan" revenue="73722"/> + <region name="Latin America" revenue="50595"/> + <region name="North America" revenue="60680"/> + </month> + + <month name="Aug-04" revenue="393654" average="78730"> + <region name="APAC" revenue="44801"/> + <region name="Europe" revenue="98806"/> + <region name="Japan" revenue="93673"/> + <region name="Latin America" revenue="50636"/> + <region name="North America" revenue="105738"/> + </month> + + <month name="Sep-04" revenue="472554" average="94510"> + <region name="APAC" revenue="61134"/> + <region name="Europe" revenue="136467"/> + <region name="Japan" revenue="93624"/> + <region name="Latin America" revenue="32293"/> + <region name="North America" revenue="149036"/> + </month> + + <month name="Oct-04" revenue="324299" average="64859"> + <region name="APAC" revenue="32078"/> + <region name="Europe" revenue="85420"/> + <region name="Japan" revenue="80483"/> + <region name="Latin America" revenue="64390"/> + <region name="North America" revenue="61928"/> + </month> + + <month name="Nov-04" revenue="415403" average="83080"> + <region name="APAC" revenue="58832"/> + <region name="Europe" revenue="143128"/> + <region name="Japan" revenue="64295"/> + <region name="Latin America" revenue="58261"/> + <region name="North America" revenue="90887"/> + </month> + + <month name="Dec-04" revenue="386089" average="77217"> + <region name="APAC" revenue="80555"/> + <region name="Europe" revenue="118981"/> + <region name="Japan" revenue="87520"/> + <region name="Latin America" revenue="27154"/> + <region name="North America" revenue="71879"/> + </month> + + <month name="Jan-05" revenue="400263" average="80052"> + <region name="APAC" revenue="46130"/> + <region name="Europe" revenue="106976"/> + <region name="Japan" revenue="79554"/> + <region name="Latin America" revenue="39252"/> + <region name="North America" revenue="128351"/> + </month> + + <month name="Feb-05" revenue="379145" average="75829"> + <region name="APAC" revenue="70324"/> + <region name="Europe" revenue="88912"/> + <region name="Japan" revenue="69677"/> + <region name="Latin America" revenue="59428"/> + <region name="North America" revenue="90804"/> + </month> + + <month name="Mar-05" revenue="389687" average="77937"> + <region name="APAC" revenue="60431"/> + <region name="Europe" revenue="140982"/> + <region name="Japan" revenue="58196"/> + <region name="Latin America" revenue="33373"/> + <region name="North America" revenue="96705"/> + </month> + + <month name="Apr-05" revenue="460329" average="92065"> + <region name="APAC" revenue="78969"/> + <region name="Europe" revenue="85885"/> + <region name="Japan" revenue="78107"/> + <region name="Latin America" revenue="65796"/> + <region name="North America" revenue="151572"/> + </month> + + <month name="May-05" revenue="351014" average="70202"> + <region name="APAC" revenue="64069"/> + <region name="Europe" revenue="82415"/> + <region name="Japan" revenue="96397"/> + <region name="Latin America" revenue="44627"/> + <region name="North America" revenue="63506"/> + </month> + + <month name="Jun-05" revenue="384855" average="76971"> + <region name="APAC" revenue="55331"/> + <region name="Europe" revenue="113196"/> + <region name="Japan" revenue="55371"/> + <region name="Latin America" revenue="58323"/> + <region name="North America" revenue="102634"/> + </month> + + <month name="Jul-05" revenue="335192" average="67038"> + <region name="APAC" revenue="39445"/> + <region name="Europe" revenue="110750"/> + <region name="Japan" revenue="73722"/> + <region name="Latin America" revenue="50595"/> + <region name="North America" revenue="60680"/> + </month> + + <month name="Aug-05" revenue="393654" average="78730"> + <region name="APAC" revenue="44801"/> + <region name="Europe" revenue="98806"/> + <region name="Japan" revenue="93673"/> + <region name="Latin America" revenue="50636"/> + <region name="North America" revenue="105738"/> + </month> + + <month name="Sep-05" revenue="472554" average="94510"> + <region name="APAC" revenue="61134"/> + <region name="Europe" revenue="136467"/> + <region name="Japan" revenue="93624"/> + <region name="Latin America" revenue="32293"/> + <region name="North America" revenue="149036"/> + </month> + + <month name="Oct-05" revenue="324299" average="64859"> + <region name="APAC" revenue="32078"/> + <region name="Europe" revenue="85420"/> + <region name="Japan" revenue="80483"/> + <region name="Latin America" revenue="64390"/> + <region name="North America" revenue="61928"/> + </month> + + <month name="Nov-05" revenue="415403" average="83080"> + <region name="APAC" revenue="58832"/> + <region name="Europe" revenue="143128"/> + <region name="Japan" revenue="64295"/> + <region name="Latin America" revenue="58261"/> + <region name="North America" revenue="90887"/> + </month> + + <month name="Dec-05" revenue="386089" average="77217"> + <region name="APAC" revenue="80555"/> + <region name="Europe" revenue="118981"/> + <region name="Japan" revenue="87520"/> + <region name="Latin America" revenue="27154"/> + <region name="North America" revenue="71879"/> + </month> + </list> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/inventory/build.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/inventory/build.xml b/attic/apps/samples/WEB-INF/flex-src/inventory/build.xml index d64e42e..b1e0787 100755 --- a/attic/apps/samples/WEB-INF/flex-src/inventory/build.xml +++ b/attic/apps/samples/WEB-INF/flex-src/inventory/build.xml @@ -1,82 +1,82 @@ -<?xml version="1.0"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<project name="samples.war/build.xml" default="main" basedir="../../../../../"> - - <property environment="env" /> - <property file="${basedir}/build.properties"/> - <property name="samples.war" value="${basedir}/apps/samples"/> - <property name="context.root" value="samples" /> - <property name="application.name" value="Inventory Management" /> - <property name="application.file" value="inventory" /> - <property name="application.bin.dir" value="${samples.war}/inventory" /> - <property name="application.src.dir" value="${samples.war}/WEB-INF/flex-src/inventory/src" /> - - <target name="main" depends="clean,compile-swf" /> - - <target name="compile-swf"> - - <taskdef resource="flexTasks.tasks" classpath="${basedir}/ant/lib/flexTasks.jar" /> - - <property name="FLEX_HOME" value="${basedir}"/> - - <mxmlc file="${application.src.dir}/${application.file}.mxml" - output="${application.bin.dir}/${application.file}.swf" - actionscript-file-encoding="UTF-8" - keep-generated-actionscript="false" - incremental="false" - services="${samples.war}/WEB-INF/flex/services-config.xml" - context-root="${context.root}" - locale="en_US"> - <load-config filename="${basedir}/frameworks/flex-config.xml"/> - <license product="flexbuilder3" serial-number="${env.fb3_license}"/> - <source-path path-element="${basedir}/frameworks"/> - <external-library-path/> - <metadata> - <publisher name="${manifest.Implementation-Vendor}" /> - <creator name="${manifest.Implementation-Vendor}" /> - </metadata> - </mxmlc> - - <html-wrapper title="${application.name}" - height="100%" - width="100%" - application="app" - swf="${application.file}" - version-major="10" - version-minor="0" - version-revision="0" - history="true" - express-install="true" - output="${application.bin.dir}"/> - - <copy todir="${application.bin.dir}"> - <fileset dir="${application.src.dir}" includes="*.jsp"/> - </copy> - - </target> - - <target name="clean" description="--> Removes jars and classes"> - <delete quiet="true" includeemptydirs="true"> - <fileset dir="${application.bin.dir}" includes="*.swf,index.html,*.jsp"/> - <fileset dir="${application.bin.dir}/history" /> - </delete> - </target> - -</project> +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project name="samples.war/build.xml" default="main" basedir="../../../../../"> + + <property environment="env" /> + <property file="${basedir}/build.properties"/> + <property name="samples.war" value="${basedir}/apps/samples"/> + <property name="context.root" value="samples" /> + <property name="application.name" value="Inventory Management" /> + <property name="application.file" value="inventory" /> + <property name="application.bin.dir" value="${samples.war}/inventory" /> + <property name="application.src.dir" value="${samples.war}/WEB-INF/flex-src/inventory/src" /> + + <target name="main" depends="clean,compile-swf" /> + + <target name="compile-swf"> + + <taskdef resource="flexTasks.tasks" classpath="${basedir}/ant/lib/flexTasks.jar" /> + + <property name="FLEX_HOME" value="${basedir}"/> + + <mxmlc file="${application.src.dir}/${application.file}.mxml" + output="${application.bin.dir}/${application.file}.swf" + actionscript-file-encoding="UTF-8" + keep-generated-actionscript="false" + incremental="false" + services="${samples.war}/WEB-INF/flex/services-config.xml" + context-root="${context.root}" + locale="en_US"> + <load-config filename="${basedir}/frameworks/flex-config.xml"/> + <license product="flexbuilder3" serial-number="${env.fb3_license}"/> + <source-path path-element="${basedir}/frameworks"/> + <external-library-path/> + <metadata> + <publisher name="${manifest.Implementation-Vendor}" /> + <creator name="${manifest.Implementation-Vendor}" /> + </metadata> + </mxmlc> + + <html-wrapper title="${application.name}" + height="100%" + width="100%" + application="app" + swf="${application.file}" + version-major="10" + version-minor="0" + version-revision="0" + history="true" + express-install="true" + output="${application.bin.dir}"/> + + <copy todir="${application.bin.dir}"> + <fileset dir="${application.src.dir}" includes="*.jsp"/> + </copy> + + </target> + + <target name="clean" description="--> Removes jars and classes"> + <delete quiet="true" includeemptydirs="true"> + <fileset dir="${application.bin.dir}" includes="*.swf,index.html,*.jsp"/> + <fileset dir="${application.bin.dir}/history" /> + </delete> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/inventory/src/Product.as ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/inventory/src/Product.as b/attic/apps/samples/WEB-INF/flex-src/inventory/src/Product.as index 3d9b476..2f91ccb 100755 --- a/attic/apps/samples/WEB-INF/flex-src/inventory/src/Product.as +++ b/attic/apps/samples/WEB-INF/flex-src/inventory/src/Product.as @@ -1,44 +1,44 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 -{ - [Bindable] - [RemoteClass(alias="flex.samples.product.Product")] - public class Product - { - public function Product() - { - } - - public var productId:int; - - public var name:String; - - public var category:String; - - public var price:Number = 0; - - public var image:String; - - public var description:String; - - public var qtyInStock:int = 0; - - } +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package +{ + [Bindable] + [RemoteClass(alias="flex.samples.product.Product")] + public class Product + { + public function Product() + { + } + + public var productId:int; + + public var name:String; + + public var category:String; + + public var price:Number = 0; + + public var image:String; + + public var description:String; + + public var qtyInStock:int = 0; + + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/inventory/src/ProductForm.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/inventory/src/ProductForm.mxml b/attic/apps/samples/WEB-INF/flex-src/inventory/src/ProductForm.mxml index 9c553a5..d9977fa 100755 --- a/attic/apps/samples/WEB-INF/flex-src/inventory/src/ProductForm.mxml +++ b/attic/apps/samples/WEB-INF/flex-src/inventory/src/ProductForm.mxml @@ -1,106 +1,106 @@ -<?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. - ---> -<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" - label="{product.productId > 0 ? product.name : 'New Product'}" width="100%" height="100%"> - - <mx:Script> - <![CDATA[ - import mx.events.ValidationResultEvent; - import mx.rpc.events.ResultEvent; - - [Bindable] - public var product:Product; - - private function save():void - { - if (nameValidator.validate().type == ValidationResultEvent.INVALID) return; - product.name = productName.text; - product.category = category.text; - product.price = Number(price.text); - product.qtyInStock = parseInt(qtyInStock.text); - product.image = image.text; - product.description = description.text; - if (product.productId > 0) - srv.update(product); - else - srv.create(product); - } - - private function createResult(event:ResultEvent):void - { - product = event.result as Product; - label = product.name; - } - - private function removeResult(event:ResultEvent):void - { - parent.removeChild(this); - } - - - ]]> - </mx:Script> - - <mx:StringValidator id="nameValidator" source="{productName}" property="text" minLength="1"/> - - <mx:RemoteObject id="srv" destination="product"> - <mx:method name="create" result="createResult(event)"/> - <mx:method name="remove" result="removeResult(event)"/> - </mx:RemoteObject> - - <mx:Image source="../images/{product.image}" top="0" right="20" brokenImageSkin="@Embed('assets/blank.png')"/> - - <mx:Form width="100%" verticalGap="8"> - - <mx:FormItem label="Id"> - <mx:TextInput id="productId" text="{product.productId}" enabled="false"/> - </mx:FormItem> - - <mx:FormItem label="Name" required="true"> - <mx:TextInput id="productName" text="{product.name}"/> - </mx:FormItem> - - <mx:FormItem label="Category"> - <mx:TextInput id="category" text="{product.category}"/> - </mx:FormItem> - - <mx:FormItem label="Image"> - <mx:TextInput id="image" text="{product.image}"/> - </mx:FormItem> - - <mx:FormItem label="Price"> - <mx:TextInput id="price" text="{product.price}"/> - </mx:FormItem> - - <mx:FormItem label="In Stock"> - <mx:TextInput id="qtyInStock" text="{product.qtyInStock}"/> - </mx:FormItem> - - <mx:FormItem label="Description" width="100%"> - <mx:TextArea id="description" text="{product.description}" width="100%" height="100"/> - </mx:FormItem> - - </mx:Form> - - <mx:Button label="Save" click="save()" bottom="10" left="10" height="36" width="63"/> - <mx:Button label="Delete" click="srv.remove(product)" left="75" bottom="10" height="36" width="72"/> - <mx:Button label="Close Tab" click="parent.removeChild(this)" right="10" bottom="10" height="36" width="88"/> - +<?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. + +--> +<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" + label="{product.productId > 0 ? product.name : 'New Product'}" width="100%" height="100%"> + + <mx:Script> + <![CDATA[ + import mx.events.ValidationResultEvent; + import mx.rpc.events.ResultEvent; + + [Bindable] + public var product:Product; + + private function save():void + { + if (nameValidator.validate().type == ValidationResultEvent.INVALID) return; + product.name = productName.text; + product.category = category.text; + product.price = Number(price.text); + product.qtyInStock = parseInt(qtyInStock.text); + product.image = image.text; + product.description = description.text; + if (product.productId > 0) + srv.update(product); + else + srv.create(product); + } + + private function createResult(event:ResultEvent):void + { + product = event.result as Product; + label = product.name; + } + + private function removeResult(event:ResultEvent):void + { + parent.removeChild(this); + } + + + ]]> + </mx:Script> + + <mx:StringValidator id="nameValidator" source="{productName}" property="text" minLength="1"/> + + <mx:RemoteObject id="srv" destination="product"> + <mx:method name="create" result="createResult(event)"/> + <mx:method name="remove" result="removeResult(event)"/> + </mx:RemoteObject> + + <mx:Image source="../images/{product.image}" top="0" right="20" brokenImageSkin="@Embed('assets/blank.png')"/> + + <mx:Form width="100%" verticalGap="8"> + + <mx:FormItem label="Id"> + <mx:TextInput id="productId" text="{product.productId}" enabled="false"/> + </mx:FormItem> + + <mx:FormItem label="Name" required="true"> + <mx:TextInput id="productName" text="{product.name}"/> + </mx:FormItem> + + <mx:FormItem label="Category"> + <mx:TextInput id="category" text="{product.category}"/> + </mx:FormItem> + + <mx:FormItem label="Image"> + <mx:TextInput id="image" text="{product.image}"/> + </mx:FormItem> + + <mx:FormItem label="Price"> + <mx:TextInput id="price" text="{product.price}"/> + </mx:FormItem> + + <mx:FormItem label="In Stock"> + <mx:TextInput id="qtyInStock" text="{product.qtyInStock}"/> + </mx:FormItem> + + <mx:FormItem label="Description" width="100%"> + <mx:TextArea id="description" text="{product.description}" width="100%" height="100"/> + </mx:FormItem> + + </mx:Form> + + <mx:Button label="Save" click="save()" bottom="10" left="10" height="36" width="63"/> + <mx:Button label="Delete" click="srv.remove(product)" left="75" bottom="10" height="36" width="72"/> + <mx:Button label="Close Tab" click="parent.removeChild(this)" right="10" bottom="10" height="36" width="88"/> + </mx:Canvas> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/012fad7c/attic/apps/samples/WEB-INF/flex-src/inventory/src/SearchPopup.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/inventory/src/SearchPopup.mxml b/attic/apps/samples/WEB-INF/flex-src/inventory/src/SearchPopup.mxml index 04b5ad4..89333d2 100755 --- a/attic/apps/samples/WEB-INF/flex-src/inventory/src/SearchPopup.mxml +++ b/attic/apps/samples/WEB-INF/flex-src/inventory/src/SearchPopup.mxml @@ -1,96 +1,96 @@ -<?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. - ---> -<mx:List xmlns:mx="http://www.adobe.com/2006/mxml" - dropShadowEnabled="true" - currentState="hidden" - labelField="name" - keyDown="searchKeyDownHandler(event)" - click="openSelectedItem()"> - - <mx:Metadata> - [Event(name="select")] - </mx:Metadata> - - <mx:Script> - <![CDATA[ - import mx.rpc.events.ResultEvent; - - import mx.collections.ArrayCollection; - - public function search(searchStr:String):void - { - dataProvider = null; - srv.getProductsByName(searchStr); - if (currentState == "hidden") currentState = ""; - } - - protected function searchKeyDownHandler(event:KeyboardEvent):void - { - switch (event.keyCode) - { - case Keyboard.ENTER: - openSelectedItem(); - break; - case Keyboard.ESCAPE: - currentState = "hidden"; - break; - } - } - - public function openSelectedItem():void - { - if (selectedItem) - { - dispatchEvent(new Event("select")); - currentState="hidden"; - } - } - - public function selectNext():void - { - selectedIndex++; - } - - public function selectPrevious():void - { - if (selectedIndex > 0) selectedIndex--; - } - - private function resultHandler(event:ResultEvent):void - { - dataProvider = event.result as ArrayCollection; - if (dataProvider && dataProvider.length > 0) - { - selectedIndex = 0; - } - } - - ]]> - </mx:Script> - - <mx:RemoteObject id="srv" destination="product" result="resultHandler(event)"/> - - <mx:states> - <mx:State name="hidden"> - <mx:SetProperty name="visible" value="false"/> - </mx:State> - </mx:states> - +<?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. + +--> +<mx:List xmlns:mx="http://www.adobe.com/2006/mxml" + dropShadowEnabled="true" + currentState="hidden" + labelField="name" + keyDown="searchKeyDownHandler(event)" + click="openSelectedItem()"> + + <mx:Metadata> + [Event(name="select")] + </mx:Metadata> + + <mx:Script> + <![CDATA[ + import mx.rpc.events.ResultEvent; + + import mx.collections.ArrayCollection; + + public function search(searchStr:String):void + { + dataProvider = null; + srv.getProductsByName(searchStr); + if (currentState == "hidden") currentState = ""; + } + + protected function searchKeyDownHandler(event:KeyboardEvent):void + { + switch (event.keyCode) + { + case Keyboard.ENTER: + openSelectedItem(); + break; + case Keyboard.ESCAPE: + currentState = "hidden"; + break; + } + } + + public function openSelectedItem():void + { + if (selectedItem) + { + dispatchEvent(new Event("select")); + currentState="hidden"; + } + } + + public function selectNext():void + { + selectedIndex++; + } + + public function selectPrevious():void + { + if (selectedIndex > 0) selectedIndex--; + } + + private function resultHandler(event:ResultEvent):void + { + dataProvider = event.result as ArrayCollection; + if (dataProvider && dataProvider.length > 0) + { + selectedIndex = 0; + } + } + + ]]> + </mx:Script> + + <mx:RemoteObject id="srv" destination="product" result="resultHandler(event)"/> + + <mx:states> + <mx:State name="hidden"> + <mx:SetProperty name="visible" value="false"/> + </mx:State> + </mx:states> + </mx:List> \ No newline at end of file
