Repository: flex-asjs Updated Branches: refs/heads/develop 1dac61548 -> c1682af60
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1682af6/examples/flexjs/MobileStocks/src/views/LaunchView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/LaunchView.mxml b/examples/flexjs/MobileStocks/src/views/LaunchView.mxml new file mode 100644 index 0000000..5d14065 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/views/LaunchView.mxml @@ -0,0 +1,161 @@ +<?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. + +--> +<js:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + title="Assets" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:models="models.*" + xmlns:local="*" + className="AssetsView" xmlns:views="views.*"> + <fx:Script> + <![CDATA[ + import controller.LaunchViewController; + import models.ProductsModel; + import models.Stock; + + import org.apache.flex.binding.SimpleBinding; + import org.apache.flex.core.IBeadController; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.events.Event; + import org.apache.flex.events.ValueChangeEvent; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.StackedViewManager; + import org.apache.flex.html.beads.DataProviderChangeNotifier; + + public function set dataModel(value:IBeadModel):void + { + var cm:IBeadController = controller; + (cm as LaunchViewController).model = value; + + var newEvent:ValueChangeEvent = new ValueChangeEvent("valueChange", false, false, null, value); + newEvent.propertyName = "dataModel"; + dispatchEvent(newEvent); + } + + public function get dataModel():IBeadModel + { + var cm:IBeadController = controller; + return (cm as LaunchViewController).model; + } + + public function addSymbol():void + { + dispatchEvent(new org.apache.flex.events.Event("addSymbol")); + } + + public function removeSymbol():void + { + dispatchEvent(new org.apache.flex.events.Event("removeSymbol")); + } + + public function gridSelected():void + { + dispatchEvent(new org.apache.flex.events.Event("symbolSelected")); + } + ]]> + </fx:Script> + + <fx:Style> + @namespace js "library://ns.apache.org/flexjs/basic"; + .AllCharts { + border-width: 0px; + padding-left: 2px; + padding-top: 10px; + padding-bottom: 2px; + padding-right: 10px; + } + </fx:Style> + + <fx:Metadata> + [Event("next")] + </fx:Metadata> + + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:model> + <models:AssetsModel /> + </js:model> + + <js:HContainer height="10%"> + <js:Label text="Symbol:" /> + <js:TextInput id="symbolInput" width="50" /> + <js:Spacer width="10" /> + <js:Label text="Shares:" /> + <js:TextInput id="sharesInput" width="50" /> + <js:Spacer width="10" /> + <js:TextButton id="addButton" text="Add" width="80" click="addSymbol()" /> + <js:Spacer width="30" /> + <js:TextButton id="removeButton" text="Remove" width="80" click="removeSymbol()" /> + </js:HContainer> + + <js:DataGrid id="assetGrid" height="45%" width="510" rowHeight="25" change="gridSelected()"> + <js:beads> + <js:SimpleBinding + eventName="update" + sourceID="dataModel" + sourcePropertyName="assetList" + destinationPropertyName="dataProvider" /> + <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" + destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> + </js:beads> + <js:columns> + <js:DataGridColumn columnWidth="250" label="Company (SYMB)" dataField="name" itemRenderer="renderers.CompanyNameRenderer" /> + <js:DataGridColumn columnWidth="80" label="Shares" dataField="shares" /> + <js:DataGridColumn columnWidth="80" label="Last" dataField="last" /> + <js:DataGridColumn columnWidth="100" label="Total $" dataField="shares" itemRenderer="renderers.SharesTotalRenderer" /> + </js:columns> + </js:DataGrid> + + <js:Spacer height="3%" /> + + <js:StackedBarChart id="barChart" width="510" height="40%" className="AllCharts"> + <js:model> + <js:ChartArrayListSelectionModel /> + </js:model> + <js:beads> + <js:DataItemRendererFactoryForSeriesArrayListData /> + <js:StackedBarChartLayoutForArrayList /> + <js:SimpleBinding + eventName="update" + sourceID="dataModel" + sourcePropertyName="assetList" + destinationPropertyName="dataProvider" /> + <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" + destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> + <js:HorizontalLinearAxisForArrayListBead valueField="total" /> + <js:VerticalCategoryAxisForArrayListBead categoryField="symbol" /> + </js:beads> + <js:series> + <js:BarSeries xField="total"> + <js:itemRenderer> + <fx:Component> + <js:BoxItemRenderer> + <js:fill> + <js:SolidColor color="#FF964D" alpha="1.0" /> + </js:fill> + </js:BoxItemRenderer> + </fx:Component> + </js:itemRenderer> + </js:BarSeries> + </js:series> + </js:StackedBarChart> + +</js:TitleView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1682af6/examples/flexjs/MobileStocks/src/views/SearchView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/SearchView.mxml b/examples/flexjs/MobileStocks/src/views/SearchView.mxml new file mode 100755 index 0000000..0348fba --- /dev/null +++ b/examples/flexjs/MobileStocks/src/views/SearchView.mxml @@ -0,0 +1,37 @@ +<?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. + +--> +<js:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:apache="org.apache.flex.html.beads.*" + xmlns:local="*" + className="StockView"> + + <fx:Script> + <![CDATA[ + import org.apache.flex.mobile.StackedViewManager; + private function onBackClick() : void + { + (viewManager as StackedViewManager).pop(); + } + ]]> + </fx:Script> + + <js:Label text="Search View" x="20" y="100" /> +</js:TitleView> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1682af6/examples/flexjs/MobileStocks/src/views/StockView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/StockView.mxml b/examples/flexjs/MobileStocks/src/views/StockView.mxml new file mode 100755 index 0000000..ca86ba7 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/views/StockView.mxml @@ -0,0 +1,102 @@ +<?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. + +--> +<js:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:apache="org.apache.flex.html.beads.*" + xmlns:local="*" + className="StockView"> + + <fx:Script> + <![CDATA[ + import models.Stock; + + import org.apache.flex.events.Event; + import org.apache.flex.mobile.StackedViewManager; + + private var _stock:Stock; + + [Bindable("stockChanged")] + public function get stock():Stock + { + return _stock; + } + public function set stock(value:Stock):void + { + _stock = value; + dispatchEvent(new org.apache.flex.events.Event("stockChanged")); + } + + private function onBackClick() : void + { + (viewManager as StackedViewManager).pop(); + } + + override public function addedToParent():void + { + super.addedToParent(); + + stockSymbol.text = stock.symbol; + stockName.text = stock.name; + lastPrice.text = String(stock.last); + openPrice.text = String(stock.open); + lowPrice.text = String(stock.low); + highPrice.text = String(stock.high); + changeAmount.text = String(stock.change); + } + + private function removeFromList():void + { + dispatchEvent(new org.apache.flex.events.Event("removeFromList")); + } + ]]> + </fx:Script> + + <js:Container> + <js:beads> + <js:VerticalLayout /> + </js:beads> + <js:style> + <js:SimpleCSSStyles top="10px" left="10px" /> + </js:style> + + <js:Label id="stockSymbol" text="{stock.symbol}" className="ViewTitle" /> + <js:Label id="stockName" text="{stock.name}" className="StockName" /> + + <js:Spacer height="10" /> + + <js:Container className="StockDetailArea"> + <js:beads> + <js:VerticalColumnLayout numColumns="2" /> + </js:beads> + + <js:Label text="Last Price:" className="StockLabel" /> <js:Label id="lastPrice" className="StockValue" /> + <js:Label text="Open Price:" className="StockLabel" /> <js:Label id="openPrice" className="StockValue" /> + <js:Label text="Low Price:" className="StockLabel" /> <js:Label id="lowPrice" className="StockValue" /> + <js:Label text="High Price:" className="StockLabel" /> <js:Label id="highPrice" className="StockValue" /> + <js:Label text="Change: " className="StockLabel" /> <js:Label id="changeAmount" className="StockValue" /> + </js:Container> + + <js:Spacer height="10" /> + + <js:Container className="StockDetailArea"> + <js:TextButton text="Remove From List" width="200" className="StockRemoveButton" click="removeFromList()" /> + </js:Container> + </js:Container> +</js:TitleView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1682af6/examples/flexjs/MobileStocks/src/views/WatchListView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/WatchListView.mxml b/examples/flexjs/MobileStocks/src/views/WatchListView.mxml new file mode 100755 index 0000000..f4dcd94 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/views/WatchListView.mxml @@ -0,0 +1,154 @@ +<?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. + +--> +<js:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + title="Watch List" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:controller="controller.*" + xmlns:local="*" + className="WatchListView" + xmlns:renderers="renderers.*"> + + <fx:Script> + <![CDATA[ + import controller.WatchListController; + + import models.ProductsModel; + import models.Stock; + + import org.apache.flex.binding.SimpleBinding; + import org.apache.flex.core.IBeadController; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.events.Event; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.StackedViewManager; + + public function set dataModel(value:IBeadModel):void + { + var cm:IBeadController = controller; + (cm as WatchListController).model = value; + + var newEvent:ValueChangeEvent = new ValueChangeEvent("valueChange", false, false, null, value); + newEvent.propertyName = "dataModel"; + dispatchEvent(newEvent); + } + public function get dataModel():IBeadModel + { + var cm:IBeadController = controller; + return (cm as WatchListController).model; + } + + private function onSelectStock():void + { + var stockView:StockView = new StockView(); + var svm:IViewManager = viewManager; + (viewManager as StackedViewManager).push(stockView); + } + + private function addSymbol():void + { + dispatchEvent(new org.apache.flex.events.Event("addSymbol")); + } + + public var selectedStockIndex:Number; + + private function selectRow():void + { + selectedStockIndex = dataGrid.selectedIndex; + dispatchEvent(new org.apache.flex.events.Event("stockSelected")); + } + + public function showStockDetails(stock:Stock):StockView + { + var stockView:StockView = new StockView(); + stockView.stock = stock; + var vm:* = viewManager; + (viewManager as StackedViewManager).push(stockView); + + var cm:IBeadController = controller; + + return stockView; + } + + public function popView():void + { + (viewManager as StackedViewManager).pop(); + } + ]]> + </fx:Script> + + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:HContainer className="WatchListInputArea" width="100%" height="10%"> + <js:Label text="Symbol:" /> + <js:TextInput id="symbolName" /> + <js:TextButton text="Add" click="addSymbol()" /> + </js:HContainer> + + <js:Spacer height="10" /> + + <js:DataGrid id="dataGrid" width="100%" height="85%" change="selectRow()" className="WatchListDataGrid"> + <js:beads> + <js:SimpleBinding + eventName="update" + sourceID="dataModel" + sourcePropertyName="watchList" + destinationPropertyName="dataProvider" /> + <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="watchList" + destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> + </js:beads> + <js:columns> + <js:DataGridColumn label="Company (SYMB)" dataField="symbol" + itemRenderer="renderers.CompanyNameRenderer" /> + <js:DataGridColumn label="Open" dataField="open" + itemRenderer="renderers.StockRenderer" /> + <js:DataGridColumn label="Last" dataField="last" > + <js:itemRenderer> + <fx:Component> + <renderers:StockRenderer /> + </fx:Component> + </js:itemRenderer> + </js:DataGridColumn> + <js:DataGridColumn label="Change" dataField="change"> + <js:itemRenderer> + <fx:Component> + <renderers:StockRenderer /> + </fx:Component> + </js:itemRenderer> + </js:DataGridColumn> + <js:DataGridColumn label="High" dataField="high" > + <js:itemRenderer> + <fx:Component> + <renderers:StockRenderer /> + </fx:Component> + </js:itemRenderer> + </js:DataGridColumn> + <js:DataGridColumn label="Low" dataField="low" > + <js:itemRenderer> + <fx:Component> + <renderers:StockRenderer /> + </fx:Component> + </js:itemRenderer> + </js:DataGridColumn> + </js:columns> + </js:DataGrid> + +</js:TitleView>