You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/10/27 15:16:03 UTC
[02/17] git commit: [flex-asjs]
[refs/heads/feature-autobuild/example-maven-dirs] - - Refactored the
directory structure of the example projects to be maven-style
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/models/AssetsModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/AssetsModel.as b/examples/flexjs/MobileTrader/src/models/AssetsModel.as
deleted file mode 100755
index 3d72137..0000000
--- a/examples/flexjs/MobileTrader/src/models/AssetsModel.as
+++ /dev/null
@@ -1,57 +0,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 models
-{
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.EventDispatcher;
- import org.apache.flex.collections.ArrayList;
-
- public class AssetsModel extends EventDispatcher implements IBeadModel
- {
- public function AssetsModel()
- {
- super();
- _assetsData = new ArrayList();
- _assetsData.source = source;
- }
- private var source:Array = [
- new Asset("NetWorth:", 161984, 2.36),
- new Asset("Last Month:", 165915, 10.98),
- new Asset("6 Months Ago:", 145962, 16.56),
- new Asset("Last Year:", 138972, 8.36)
- ];
- private var _assetsData:ArrayList;
-
- public function get assetsData():ArrayList
- {
- return _assetsData;
- }
-
- public function get assetsDataAsArray():Array
- {
- return source;
- }
-
- public function set strand(value:IStrand):void
- {
- // not used
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/ProductsModel.as b/examples/flexjs/MobileTrader/src/models/ProductsModel.as
deleted file mode 100755
index f4b2008..0000000
--- a/examples/flexjs/MobileTrader/src/models/ProductsModel.as
+++ /dev/null
@@ -1,165 +0,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 models
-{
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
- import org.apache.flex.net.HTTPService;
- import org.apache.flex.collections.parsers.JSONInputParser;
- import org.apache.flex.collections.LazyCollection;
- import org.apache.flex.collections.ArrayList;
-
- public class ProductsModel extends EventDispatcher implements IBeadModel
- {
- public function ProductsModel()
- {
- super();
-
- service = new HTTPService();
- collection = new LazyCollection;
- collection.inputParser = new JSONInputParser();
- collection.itemConverter = new StockDataJSONItemConverter();
-
- _watchList = new ArrayList();
- _alerts = new ArrayList();
- }
-
- private var service:HTTPService;
- private var collection:LazyCollection;
- private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22";
- private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";
-
- private var _strand:IStrand;
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- service.addBead(collection);
- _strand.addBead(service);
- }
-
- private var _tabList:Array = ["Assets", "Watch", "Alerts"];
- public function get tabList():Array
- {
- return _tabList;
- }
-
- private var _labelFields:Array = [ "id", "title", "detail" ];
- public function get labelFields():Array
- {
- return _labelFields;
- }
-
- private var _watchList:ArrayList;
-
- public function get watchList():ArrayList
- {
- return _watchList;
- }
-
- private var _alerts:ArrayList;
-
- public function get alerts():ArrayList
- {
- return _alerts;
- }
-
- public function addAlert(value:Alert):void
- {
- for (var i:int =0; i < _alerts.length; i++)
- {
- var alert:Alert = _alerts.getItemAt(i) as Alert;
- if (alert.symbol == value.symbol) {
- _alerts.setItemAt(value, i);
- return;
- }
- }
-
- _alerts.addItem(value);
- dispatchEvent(new Event("alertsUpdate"));
- }
-
- public function addStock(symbol:String):Stock
- {
- for (var i:int=0; i < _watchList.length; i++)
- {
- var stock:Stock = _watchList.getItemAt(i) as Stock;
- if (stock.symbol == symbol) return stock;
- }
-
- stock = new Stock(symbol);
-
- _watchList.addItem(stock);
- // dispatchEvent(new Event("update"));
-
- updateStockData(stock);
- return stock;
- }
-
- public function updateStockData(value:Stock):void
- {
- var sym:String = value.symbol;
- service.url = queryBegin + sym + queryEnd;
- service.send();
- service.addEventListener("complete", completeHandler);
- }
-
- public function removeStock(stock:Stock):void
- {
- for (var i:int=0; i < alerts.length; i++)
- {
- var alert:Alert = alerts.getItemAt(i) as Alert;
- if (stock.symbol == alert.symbol) {
- alerts.removeItemAt(i);
- break;
- }
- }
-
- for (i=0; i < _watchList.length; i++)
- {
- var s:Stock = _watchList.getItemAt(i) as Stock;
- if (stock.symbol == s.symbol) {
- _watchList.removeItemAt(i);
- break;
- }
- }
-
- dispatchEvent(new Event("alertsUpdate"));
- dispatchEvent(new Event("update"));
- }
-
- private function completeHandler(event:Event):void
- {
- var responseData:Object = collection.getItemAt(0);
-
- var sym:String = responseData["Symbol"];
- for (var i:int=0; i < _watchList.length; i++)
- {
- var stock:Stock = _watchList.getItemAt(i) as Stock;
- if (stock.symbol == sym) {
- stock.updateFromData(responseData);
- _watchList.itemUpdatedAt(i);
- break;
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/models/Stock.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/Stock.as b/examples/flexjs/MobileTrader/src/models/Stock.as
deleted file mode 100755
index 9e53f47..0000000
--- a/examples/flexjs/MobileTrader/src/models/Stock.as
+++ /dev/null
@@ -1,148 +0,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 models
-{
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
-
- public class Stock extends EventDispatcher
- {
- public var history:Array;
-
- public function Stock(symbol:String=null, last:Number=0)
- {
- this.symbol = symbol;
- this.last = last;
- this.low = last;
- this.high = last;
- this.open = last;
- this.change = 0;
- this.name = "";
- }
-
- public function updateFromData(obj:Object):void
- {
- name = obj["Name"];
- low = obj["DaysLow"];
- high = obj["DaysHigh"];
- open = obj["Open"];
- change = obj["Change"];
- symbol = obj["Symbol"];
- last = obj["LastTradePriceOnly"];
- }
-
- private var _symbol:String;
- private var _name:String;
- private var _low:Number;
- private var _high:Number;
- private var _open:Number;
- private var _last:Number;
- private var _change:Number;
- private var _date:Date;
-
- [Bindable("symbolChanged")]
- public function get symbol():String
- {
- return _symbol;
- }
- public function set symbol(value:String):void
- {
- _symbol = value;
- dispatchEvent(new Event("symbolChanged"));
- }
-
- [Bindable("nameChanged")]
- public function get name():String
- {
- return _name;
- }
- public function set name(value:String):void
- {
- _name = value;
- dispatchEvent(new Event("nameChanged"));
- }
-
- [Bindable("lowChanged")]
- public function get low():Number
- {
- return _low;
- }
- public function set low(value:Number):void
- {
- _low = value;
- dispatchEvent(new Event("lowChanged"));
- }
-
- [Bindable("highChanged")]
- public function get high():Number
- {
- return _high;
- }
- public function set high(value:Number):void
- {
- _high = value;
- dispatchEvent(new Event("highChanged"));
- }
-
- [Bindable("openChanged")]
- public function get open():Number
- {
- return _open;
- }
- public function set open(value:Number):void
- {
- _open = value;
- dispatchEvent(new Event("openChanged"));
- }
-
- [Bindable("lastChanged")]
- public function get last():Number
- {
- return _last;
- }
- public function set last(value:Number):void
- {
- _last = value;
- dispatchEvent(new Event("lastChanged"));
- }
-
- [Bindable("changeChanged")]
- public function get change():Number
- {
- return _change;
- }
- public function set change(value:Number):void
- {
- _change = value;
- dispatchEvent(new Event("changeChanged"));
- }
-
- [Bindable("dateChanged")]
- public function get date():Date
- {
- return _date;
- }
- public function set date(value:Date):void
- {
- _date = value;
- dispatchEvent(new Event("dateChanged"));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as b/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as
deleted file mode 100644
index e683020..0000000
--- a/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as
+++ /dev/null
@@ -1,44 +0,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 renderers
-{
- import org.apache.flex.html.supportClasses.StringItemRenderer;
-
- public class AlertRenderer extends StringItemRenderer
- {
- public function AlertRenderer()
- {
- super();
- }
-
- override public function set data(value:Object):void
- {
- super.data = value;
-
- if (labelField == "greaterThan") {
- if (Boolean(value[labelField])) {
- text = "when over "+value["value"];
- }
- else {
- text = "when under "+value["value"];
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as b/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as
deleted file mode 100755
index afba26f..0000000
--- a/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as
+++ /dev/null
@@ -1,47 +0,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 renderers
-{
- import org.apache.flex.html.supportClasses.StringItemRenderer;
-
- public class StockRenderer extends StringItemRenderer
- {
- public function StockRenderer()
- {
- super();
- }
-
- override public function set data(value:Object):void
- {
- super.data = value;
-
- var n1:Number = Number(value[labelField]);
- if (!isNaN(n1)) {
- n1 = Math.round(n1*100)/100.0;
-
- // something to keep in mind when using FlexJS for cross-platform
- // use: make sure that public properties are used versus protected
- // functions or properties. in most cases, internal vars and functions
- // will be platform-specific whereas public properties and function
- // should be cross-platform.
- text = String(n1);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/views/AlertsView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/AlertsView.mxml b/examples/flexjs/MobileTrader/src/views/AlertsView.mxml
deleted file mode 100755
index f06dd65..0000000
--- a/examples/flexjs/MobileTrader/src/views/AlertsView.mxml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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="Alerts"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- xmlns:local="*"
- className="AlertsView" xmlns:renderers="renderers.*">
-
- <fx:Metadata>
- [Event("next")]
- </fx:Metadata>
-
- <fx:Script>
- <![CDATA[
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.events.Event;
- import controller.AlertsViewController;
-
- public function set dataModel(value:IBeadModel):void
- {
- var cm:IBeadController = controller;
- (cm as AlertsViewController).model = value;
- }
- public function get dataModel():IBeadModel
- {
- var cm:IBeadController = controller;
- return (cm as AlertsViewController).model;
- }
-
- private function onAlertSet():void
- {
- dispatchEvent(new org.apache.flex.events.Event("alertSet"));
- }
- ]]>
- </fx:Script>
-
- <js:Container x="4" y="10" >
- <js:beads>
- <js:HorizontalLayout />
- </js:beads>
- <js:Label text="Symbol:" />
- <js:TextInput id="symbolField" width="50" />
- <js:Label text="Value:" />
- <js:TextInput id="valueField" width="50" />
- <js:CheckBox text="Higher?" id="higherCheck" />
- <js:TextButton text="Set" click="onAlertSet()" />
- </js:Container>
-
- <js:DataGrid id="dataGrid" x="0" y="40" width="100%" height="200">
- <js:beads>
- <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="alerts" />
- <js:SimpleBinding
- eventName="alertsUpdate"
- sourceID="dataModel"
- sourcePropertyName="alerts"
- destinationPropertyName="dataProvider" />
- </js:beads>
- <js:columns>
- <js:DataGridColumn label="Symbol" dataField="symbol">
- <js:itemRenderer>
- <fx:Component>
- <js:StringItemRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Alert" dataField="greaterThan">
- <js:itemRenderer>
- <fx:Component>
- <renderers:AlertRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Message" dataField="message">
- <js:itemRenderer>
- <fx:Component>
- <js:StringItemRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- </js:columns>
- </js:DataGrid>
-
-</js:TitleView>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/views/AssetsView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/AssetsView.mxml b/examples/flexjs/MobileTrader/src/views/AssetsView.mxml
deleted file mode 100755
index 2929a3e..0000000
--- a/examples/flexjs/MobileTrader/src/views/AssetsView.mxml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?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">
- <fx:Script>
- <![CDATA[
-
- ]]>
- </fx:Script>
-
- <fx:Metadata>
- [Event("next")]
- </fx:Metadata>
-
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
-
- <js:model>
- <models:AssetsModel />
- </js:model>
-
- <js:Label text="Summary" height="10%" />
-
- <js:DataGrid height="150" width="100%">
- <js:style>
- <js:SimpleCSSStyles top="0" left="0" right="0" />
- </js:style>
- <js:beads>
- <js:ConstantBinding
- sourceID="model"
- sourcePropertyName="assetsData"
- destinationPropertyName="dataProvider" />
- </js:beads>
- <js:columns>
- <js:DataGridColumn label="Type" dataField="label" />
- <js:DataGridColumn label="Value" dataField="value" />
- <js:DataGridColumn label="Change" dataField="netChange" />
- </js:columns>
- </js:DataGrid>
-
- <js:Label text="Performance History" height="10%" />
-
- <js:BarChart id="barChart" width="100%" height="40%">
- <js:beads>
- <js:ConstantBinding
- sourceID="model"
- sourcePropertyName="assetsDataAsArray"
- destinationPropertyName="dataProvider" />
- <js:VerticalCategoryAxisBead categoryField="label" />
- <js:HorizontalLinearAxisBead valueField="netChange" />
- </js:beads>
- <js:series>
- <js:BarSeries xField="netChange">
- <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:BarChart>
-
-</js:TitleView>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/views/SearchView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/SearchView.mxml b/examples/flexjs/MobileTrader/src/views/SearchView.mxml
deleted file mode 100755
index 0348fba..0000000
--- a/examples/flexjs/MobileTrader/src/views/SearchView.mxml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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/e75059f7/examples/flexjs/MobileTrader/src/views/StockView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/StockView.mxml b/examples/flexjs/MobileTrader/src/views/StockView.mxml
deleted file mode 100755
index 95b8992..0000000
--- a/examples/flexjs/MobileTrader/src/views/StockView.mxml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?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: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: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/e75059f7/examples/flexjs/MobileTrader/src/views/WatchListView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/WatchListView.mxml b/examples/flexjs/MobileTrader/src/views/WatchListView.mxml
deleted file mode 100755
index aa9da04..0000000
--- a/examples/flexjs/MobileTrader/src/views/WatchListView.mxml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?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;
- }
- 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;
- (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:DataProviderChangeNotifier sourceID="dataModel" propertyName="watchList" />
- <js:SimpleBinding
- eventName="update"
- sourceID="dataModel"
- sourcePropertyName="watchList"
- destinationPropertyName="dataProvider" />
- </js:beads>
- <js:columns>
- <js:DataGridColumn label="Symbol" dataField="symbol">
- <js:itemRenderer>
- <fx:Component>
- <js:StringItemRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Open" dataField="open">
- <js:itemRenderer>
- <fx:Component>
- <renderers:StockRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Last" dataField="last" >
- <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>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/resources/config.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/resources/config.xml b/examples/flexjs/StorageExample/resources/config.xml
deleted file mode 100644
index 00b9f64..0000000
--- a/examples/flexjs/StorageExample/resources/config.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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.
-
--->
-<widget id="${groupId}.${artifactId}" version="${version}" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>${artifactId}</name>
- <description>
- ${description}
- </description>
- <author email="dev@flex.apache.org" href="http://flex.apache.org">
- Apache Flex Team
- </author>
- <content src="index.html" />
- <plugin name="cordova-plugin-whitelist" version="1" />
- <access origin="*" />
- <allow-intent href="http://*/*" />
- <allow-intent href="https://*/*" />
- <allow-intent href="tel:*" />
- <allow-intent href="sms:*" />
- <allow-intent href="mailto:*" />
- <allow-intent href="geo:*" />
- <platform name="android">
- <allow-intent href="market:*" />
- </platform>
- <platform name="ios">
- <allow-intent href="itms:*" />
- <allow-intent href="itms-apps:*" />
- </platform>
-</widget>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/MyInitialView.mxml b/examples/flexjs/StorageExample/src/MyInitialView.mxml
deleted file mode 100644
index 370d0af..0000000
--- a/examples/flexjs/StorageExample/src/MyInitialView.mxml
+++ /dev/null
@@ -1,245 +0,0 @@
-<?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:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- xmlns:local="*"
- initComplete="startup()">
- <fx:Script>
- <![CDATA[
- import org.apache.flex.storage.PermanentStorage;
- import org.apache.flex.storage.events.FileEvent;
- import org.apache.flex.storage.events.FileErrorEvent;
- import org.apache.flex.storage.file.IDataInput;
- import org.apache.flex.storage.file.IDataOutput;
-
- private function startup():void
- {
- trace("Starting up");
- }
-
- // READING - PLAIN
-
- private function onRead():void
- {
- var storage:PermanentStorage = new PermanentStorage();
-
- var useFile:String = readFileNameField.text;
-
- storage.addEventListener("READ", handleRead);
- storage.addEventListener("ERROR", handleRead);
- storage.readTextFromDataFile( useFile );
- }
-
- private function handleRead(event:FileEvent):void
- {
- trace(event.data);
- status.text = "Read Success!";
- readContent.text = String(event.data);
- }
-
- private function handleReadError(event:FileErrorEvent):void
- {
- status.text = "Error: "+event.errorMessage;
- readContent.text = "";
- }
-
- // READING - STREAM
-
- private function onReadStream():void
- {
- var storage:PermanentStorage = new PermanentStorage();
- var useFile:String = readFileNameField.text;
-
- storage.addEventListener("READY", handleReadStreamReady);
- storage.addEventListener("READ", handleReadStreamData);
- storage.addEventListener("COMPLETE", handleReadStreamComplete);
- storage.addEventListener("ERROR", handleReadStreamError);
- storage.openInputDataStream(useFile);
- }
-
- private function handleReadStreamReady(event:FileEvent):void
- {
- trace("INPUT STREAM READY");
-
- status.text = "Input stream ready";
-
- var stream:IDataInput = event.stream as IDataInput;
- stream.readText();
- }
-
- private function handleReadStreamData(event:FileEvent):void
- {
- trace("INPUT STREAM DATA.");
- var stream:IDataInput = event.stream as IDataInput;
-
- status.text = "Input stream reading";
- readContent.text = String(event.data);
- }
-
- private function handleReadStreamComplete(event:FileEvent):void
- {
- trace("INPUT STREAM CLOSED");
- status.text = "Input stream closed";
- }
-
- private function handleReadStreamError(event:FileErrorEvent):void
- {
- status.text = event.errorMessage;
- }
-
- // SAVING - PLAIN
-
- private function onSave():void
- {
- var storage:PermanentStorage = new PermanentStorage();
- var today:Date = new Date();
-
- var useFile:String = writeFileNameField.text;
- var useContent:String = today.toString() + " " + contentField.text;
-
- storage.addEventListener("WRITE", handleSave);
- storage.writeTextToDataFile(useFile, useContent);
- }
-
- private function handleSave(event:FileEvent):void
- {
- status.text = "Write Success!";
- }
-
- private function handleSaveError(event:FileErrorEvent):void
- {
- status.text = "Error: "+event.errorMessage;
- }
-
- // SAVING - STREAM
-
- private var writeCount:Number = 0;
-
- private function onSaveStream():void
- {
- var storage:PermanentStorage = new PermanentStorage();
- var useFile:String = writeFileNameField.text;
-
- storage.addEventListener("READY", handleSaveStreamReady);
- storage.addEventListener("WRITE", handleSaveStreamData);
- storage.addEventListener("COMPLETE", handleSaveStreamComplete);
- storage.addEventListener("ERROR", handleSaveStreamError);
- storage.openOutputDataStream(useFile);
- }
-
- private function handleSaveStreamReady(event:FileEvent):void
- {
- writeCount = 3;
- trace("OUTPUT STREAM READY");
-
- status.text = "Output stream ready";
- var today:Date = new Date();
- var useContent:String = "("+String(writeCount)+") "+today.toString() + " " + contentField.text + "\n";
-
- var stream:IDataOutput = event.stream as IDataOutput;
- stream.writeText(useContent);
- }
-
- private function handleSaveStreamData(event:FileEvent):void
- {
- trace("OUTPUT STREAM DATA. Count = "+writeCount);
- var stream:IDataOutput = event.stream as IDataOutput;
-
- if (--writeCount == 0) {
- stream.close();
- }
- else {
- status.text = "Output stream writing";
- var today:Date = new Date();
- var useContent:String = "("+String(writeCount)+") "+today.toString() + " " + contentField.text + "\n";
- stream.writeText(useContent);
- }
- }
-
- private function handleSaveStreamComplete(event:FileEvent):void
- {
- trace("OUTPUT STREAM CLOSED");
- status.text = "Output stream closed";
- }
-
- private function handleSaveStreamError(event:FileErrorEvent):void
- {
- status.text = event.errorMessage;
- }
- ]]>
- </fx:Script>
-
- <fx:Style>
-
- .labelStyle {
- color: #9999FF;
- }
-
- .contentStyle {
- font-size: 18pt;
- }
-
- </fx:Style>
-
- <js:beads>
- <js:ViewDataBinding />
- </js:beads>
-
- <js:VContainer width="100%" height="100%">
- <js:Label text="Storage Example" width="100%" />
- <js:Spacer height="20" />
-
- <js:HContainer>
- <js:Label text="Write File Name:" className="labelStyle" />
- <js:TextInput id="writeFileNameField" text="testfile.txt" />
- </js:HContainer>
- <js:HContainer>
- <js:Label text="Content:" className="labelStyle" />
- <js:TextInput id="contentField" />
- </js:HContainer>
- <js:HContainer>
- <js:TextButton text="SAVE" click="onSave()" />
- <js:Spacer width="10" />
- <js:TextButton text="SAVE STREAM" click="onSaveStream()" />
- </js:HContainer>
- <js:Spacer height="20" />
-
- <js:Label id="status" />
- <js:Spacer height="20" />
-
- <js:HContainer>
- <js:Label text="Read File Name:" className="labelStyle" />
- <js:TextInput id="readFileNameField" text="testfile.txt" />
- </js:HContainer>
- <js:HContainer>
- <js:TextButton text="READ" click="onRead()" />
- <js:Spacer width="10" />
- <js:TextButton text="READ STREAM" click="onReadStream()" />
- </js:HContainer>
- <js:HContainer>
- <js:Label text="Content:" className="labelStyle" />
- </js:HContainer>
- <js:HContainer>
- <js:Label id="readContent" className="contentStyle" />
- </js:HContainer>
- </js:VContainer>
-
-
-</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/StorageExample.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/StorageExample.mxml b/examples/flexjs/StorageExample/src/StorageExample.mxml
deleted file mode 100644
index 1b9842a..0000000
--- a/examples/flexjs/StorageExample/src/StorageExample.mxml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:local="*"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- >
-
- <!-- This application demonstrates how to use the Google MAP API
- on both the AIR and JavaScript/browser platform. After cross-
- compiling this application for JavaScript, edit the index.html
- file and include your Google developer API token.
- -->
-
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:beads>
- <js:MixinManager />
- </js:beads>
-
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/main/flex/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/main/flex/MyInitialView.mxml b/examples/flexjs/StorageExample/src/main/flex/MyInitialView.mxml
new file mode 100644
index 0000000..370d0af
--- /dev/null
+++ b/examples/flexjs/StorageExample/src/main/flex/MyInitialView.mxml
@@ -0,0 +1,245 @@
+<?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:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:local="*"
+ initComplete="startup()">
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.storage.PermanentStorage;
+ import org.apache.flex.storage.events.FileEvent;
+ import org.apache.flex.storage.events.FileErrorEvent;
+ import org.apache.flex.storage.file.IDataInput;
+ import org.apache.flex.storage.file.IDataOutput;
+
+ private function startup():void
+ {
+ trace("Starting up");
+ }
+
+ // READING - PLAIN
+
+ private function onRead():void
+ {
+ var storage:PermanentStorage = new PermanentStorage();
+
+ var useFile:String = readFileNameField.text;
+
+ storage.addEventListener("READ", handleRead);
+ storage.addEventListener("ERROR", handleRead);
+ storage.readTextFromDataFile( useFile );
+ }
+
+ private function handleRead(event:FileEvent):void
+ {
+ trace(event.data);
+ status.text = "Read Success!";
+ readContent.text = String(event.data);
+ }
+
+ private function handleReadError(event:FileErrorEvent):void
+ {
+ status.text = "Error: "+event.errorMessage;
+ readContent.text = "";
+ }
+
+ // READING - STREAM
+
+ private function onReadStream():void
+ {
+ var storage:PermanentStorage = new PermanentStorage();
+ var useFile:String = readFileNameField.text;
+
+ storage.addEventListener("READY", handleReadStreamReady);
+ storage.addEventListener("READ", handleReadStreamData);
+ storage.addEventListener("COMPLETE", handleReadStreamComplete);
+ storage.addEventListener("ERROR", handleReadStreamError);
+ storage.openInputDataStream(useFile);
+ }
+
+ private function handleReadStreamReady(event:FileEvent):void
+ {
+ trace("INPUT STREAM READY");
+
+ status.text = "Input stream ready";
+
+ var stream:IDataInput = event.stream as IDataInput;
+ stream.readText();
+ }
+
+ private function handleReadStreamData(event:FileEvent):void
+ {
+ trace("INPUT STREAM DATA.");
+ var stream:IDataInput = event.stream as IDataInput;
+
+ status.text = "Input stream reading";
+ readContent.text = String(event.data);
+ }
+
+ private function handleReadStreamComplete(event:FileEvent):void
+ {
+ trace("INPUT STREAM CLOSED");
+ status.text = "Input stream closed";
+ }
+
+ private function handleReadStreamError(event:FileErrorEvent):void
+ {
+ status.text = event.errorMessage;
+ }
+
+ // SAVING - PLAIN
+
+ private function onSave():void
+ {
+ var storage:PermanentStorage = new PermanentStorage();
+ var today:Date = new Date();
+
+ var useFile:String = writeFileNameField.text;
+ var useContent:String = today.toString() + " " + contentField.text;
+
+ storage.addEventListener("WRITE", handleSave);
+ storage.writeTextToDataFile(useFile, useContent);
+ }
+
+ private function handleSave(event:FileEvent):void
+ {
+ status.text = "Write Success!";
+ }
+
+ private function handleSaveError(event:FileErrorEvent):void
+ {
+ status.text = "Error: "+event.errorMessage;
+ }
+
+ // SAVING - STREAM
+
+ private var writeCount:Number = 0;
+
+ private function onSaveStream():void
+ {
+ var storage:PermanentStorage = new PermanentStorage();
+ var useFile:String = writeFileNameField.text;
+
+ storage.addEventListener("READY", handleSaveStreamReady);
+ storage.addEventListener("WRITE", handleSaveStreamData);
+ storage.addEventListener("COMPLETE", handleSaveStreamComplete);
+ storage.addEventListener("ERROR", handleSaveStreamError);
+ storage.openOutputDataStream(useFile);
+ }
+
+ private function handleSaveStreamReady(event:FileEvent):void
+ {
+ writeCount = 3;
+ trace("OUTPUT STREAM READY");
+
+ status.text = "Output stream ready";
+ var today:Date = new Date();
+ var useContent:String = "("+String(writeCount)+") "+today.toString() + " " + contentField.text + "\n";
+
+ var stream:IDataOutput = event.stream as IDataOutput;
+ stream.writeText(useContent);
+ }
+
+ private function handleSaveStreamData(event:FileEvent):void
+ {
+ trace("OUTPUT STREAM DATA. Count = "+writeCount);
+ var stream:IDataOutput = event.stream as IDataOutput;
+
+ if (--writeCount == 0) {
+ stream.close();
+ }
+ else {
+ status.text = "Output stream writing";
+ var today:Date = new Date();
+ var useContent:String = "("+String(writeCount)+") "+today.toString() + " " + contentField.text + "\n";
+ stream.writeText(useContent);
+ }
+ }
+
+ private function handleSaveStreamComplete(event:FileEvent):void
+ {
+ trace("OUTPUT STREAM CLOSED");
+ status.text = "Output stream closed";
+ }
+
+ private function handleSaveStreamError(event:FileErrorEvent):void
+ {
+ status.text = event.errorMessage;
+ }
+ ]]>
+ </fx:Script>
+
+ <fx:Style>
+
+ .labelStyle {
+ color: #9999FF;
+ }
+
+ .contentStyle {
+ font-size: 18pt;
+ }
+
+ </fx:Style>
+
+ <js:beads>
+ <js:ViewDataBinding />
+ </js:beads>
+
+ <js:VContainer width="100%" height="100%">
+ <js:Label text="Storage Example" width="100%" />
+ <js:Spacer height="20" />
+
+ <js:HContainer>
+ <js:Label text="Write File Name:" className="labelStyle" />
+ <js:TextInput id="writeFileNameField" text="testfile.txt" />
+ </js:HContainer>
+ <js:HContainer>
+ <js:Label text="Content:" className="labelStyle" />
+ <js:TextInput id="contentField" />
+ </js:HContainer>
+ <js:HContainer>
+ <js:TextButton text="SAVE" click="onSave()" />
+ <js:Spacer width="10" />
+ <js:TextButton text="SAVE STREAM" click="onSaveStream()" />
+ </js:HContainer>
+ <js:Spacer height="20" />
+
+ <js:Label id="status" />
+ <js:Spacer height="20" />
+
+ <js:HContainer>
+ <js:Label text="Read File Name:" className="labelStyle" />
+ <js:TextInput id="readFileNameField" text="testfile.txt" />
+ </js:HContainer>
+ <js:HContainer>
+ <js:TextButton text="READ" click="onRead()" />
+ <js:Spacer width="10" />
+ <js:TextButton text="READ STREAM" click="onReadStream()" />
+ </js:HContainer>
+ <js:HContainer>
+ <js:Label text="Content:" className="labelStyle" />
+ </js:HContainer>
+ <js:HContainer>
+ <js:Label id="readContent" className="contentStyle" />
+ </js:HContainer>
+ </js:VContainer>
+
+
+</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/main/flex/StorageExample.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/main/flex/StorageExample.mxml b/examples/flexjs/StorageExample/src/main/flex/StorageExample.mxml
new file mode 100644
index 0000000..1b9842a
--- /dev/null
+++ b/examples/flexjs/StorageExample/src/main/flex/StorageExample.mxml
@@ -0,0 +1,42 @@
+<?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:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ >
+
+ <!-- This application demonstrates how to use the Google MAP API
+ on both the AIR and JavaScript/browser platform. After cross-
+ compiling this application for JavaScript, edit the index.html
+ file and include your Google developer API token.
+ -->
+
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:beads>
+ <js:MixinManager />
+ </js:beads>
+
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/main/flex/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/main/flex/models/MyModel.as b/examples/flexjs/StorageExample/src/main/flex/models/MyModel.as
new file mode 100644
index 0000000..e0dab68
--- /dev/null
+++ b/examples/flexjs/StorageExample/src/main/flex/models/MyModel.as
@@ -0,0 +1,58 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 models
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class MyModel extends EventDispatcher implements IBeadModel
+ {
+ public function MyModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _cities:Array = ["Sydney", "NYC", "Mexico City", "London", "Rio de Janeiro"];
+
+ [Bindable]
+ public function get cities():Array
+ {
+ return _cities;
+ }
+
+ private var _coordinates:Array = [{lat:-33.86, lng:151.211},
+ {lat:40.712, lng:-74.0059},
+ {lat:19.26, lng:-99.03},
+ {lat:51.4, lng:-0.1},
+ {lat:-22.95, lng:-43.12}];
+ public function get coordinates():Array
+ {
+ return _coordinates;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/main/resources/config.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/main/resources/config.xml b/examples/flexjs/StorageExample/src/main/resources/config.xml
new file mode 100644
index 0000000..00b9f64
--- /dev/null
+++ b/examples/flexjs/StorageExample/src/main/resources/config.xml
@@ -0,0 +1,44 @@
+<?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.
+
+-->
+<widget id="${groupId}.${artifactId}" version="${version}" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>${artifactId}</name>
+ <description>
+ ${description}
+ </description>
+ <author email="dev@flex.apache.org" href="http://flex.apache.org">
+ Apache Flex Team
+ </author>
+ <content src="index.html" />
+ <plugin name="cordova-plugin-whitelist" version="1" />
+ <access origin="*" />
+ <allow-intent href="http://*/*" />
+ <allow-intent href="https://*/*" />
+ <allow-intent href="tel:*" />
+ <allow-intent href="sms:*" />
+ <allow-intent href="mailto:*" />
+ <allow-intent href="geo:*" />
+ <platform name="android">
+ <allow-intent href="market:*" />
+ </platform>
+ <platform name="ios">
+ <allow-intent href="itms:*" />
+ <allow-intent href="itms-apps:*" />
+ </platform>
+</widget>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StorageExample/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/StorageExample/src/models/MyModel.as b/examples/flexjs/StorageExample/src/models/MyModel.as
deleted file mode 100644
index e0dab68..0000000
--- a/examples/flexjs/StorageExample/src/models/MyModel.as
+++ /dev/null
@@ -1,58 +0,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 models
-{
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
-
- public class MyModel extends EventDispatcher implements IBeadModel
- {
- public function MyModel()
- {
- super();
- }
-
- private var _strand:IStrand;
-
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
-
- private var _cities:Array = ["Sydney", "NYC", "Mexico City", "London", "Rio de Janeiro"];
-
- [Bindable]
- public function get cities():Array
- {
- return _cities;
- }
-
- private var _coordinates:Array = [{lat:-33.86, lng:151.211},
- {lat:40.712, lng:-74.0059},
- {lat:19.26, lng:-99.03},
- {lat:51.4, lng:-0.1},
- {lat:-22.95, lng:-43.12}];
- public function get coordinates():Array
- {
- return _coordinates;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StyleExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StyleExample/src/MyInitialView.mxml b/examples/flexjs/StyleExample/src/MyInitialView.mxml
deleted file mode 100644
index 944d9ea..0000000
--- a/examples/flexjs/StyleExample/src/MyInitialView.mxml
+++ /dev/null
@@ -1,427 +0,0 @@
-<?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:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- xmlns:local="org.apache.flex.html.*"
- initComplete="onComplete()">
- <fx:Script>
- <![CDATA[
- import models.MyModel;
-
- private function onComplete() : void {
- dropDown.dataProvider = MyModel(applicationModel).strings;
- list.dataProvider = MyModel(applicationModel).strings;
- dataGrid.dataProvider = MyModel(applicationModel).gridData;
- }
-
- private function listChanged():void {
- var index:Number = list.selectedIndex;
- listOutput.text = "Selected: "+index;
- }
- ]]>
- </fx:Script>
-
- <fx:Style>
- @namespace js "library://ns.apache.org/flexjs/basic";
- @namespace internal "org.apache.flex.html.supportClasses.*";
-
- /*
- * TextButton
- */
-
- js|TextButton {
- border-radius : 6px ;
- font-weight : normal ;
- line-height : 1.4 ;
- color : #00A3EE ;
- background-color : transparent ;
- border : none ;
- font-size : 15px ;
- padding : 5px ;
- }
-
- js|TextButton:hover {
- background-color: #CFCFCF;
- vertical-align: middle;
- border: none;
- border-radius: 6px;
- }
-
- js|TextButton:active {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-
- /*
- * TextInput
- */
-
- js|TextInput {
- padding: 5px;
- border: solid 1px #666666;
- border-radius: 6px;
- color: #333333;
- }
-
- js|TextInput:hover {
- padding: 5px;
- background-color: #DFDFDF;
- }
-
- /*
- * CheckBox
- */
-
- js|CheckBox {
- position : relative ;
- vertical-align : middle ;
- color : #333333 ;
- font-size : 14px ;
- }
-
- internal|CheckBoxIcon {
- margin-right: 8px;
- }
-
- js|CheckBox:hover {
- position : relative ;
- vertical-align : middle ;
- color : #666666 ;
- font-size : 14px ;
- }
-
- /*
- * RadioButton
- */
-
- js|RadioButton {
- position: relative;
- vertical-align: middle;
- color: #333333;
- font-size: 14px;
- }
-
- internal|RadioButtonIcon {
- margin-right: 8px;
- }
-
- js|RadioButton:hover {
- position: relative;
- vertical-align: middle;
- color: #666666;
- font-size: 14px;
- }
-
- /*
- * Label
- */
-
- js|Label {
- font-size: 14pt;
- font-weight: regular;
- color: #333333;
- position: relative;
- }
-
- /*
- * DateChooser
- */
-
- .dc {
- box-shadow: 1px 4px 8px gray;
- padding: 10px;
- }
-
- js|DateChooser {
- background-color: #FFFFFF;
- padding: 8px;
- border: solid 1px #EEEEEE;
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 1px 4px 8px gray;
- }
-
-@media -flex-flash
-{
- js|DateChooser {
- iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
- iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
- border-style: solid;
- border-color: #000000;
- border-width: 1px;
- background-color: #FFFFFF;
- }
-}
-
-
- internal|DateChooserButton {
- border-radius : 0px ;
- background-color : #FFFFFF ;
- color: #333333;
- border : none ;
- font-size : 10px ;
- padding : 1px ;
- }
-
-
- internal|DateChooserButton:hover {
- border-radius : 0px ;
- background-color : #CFCFCF ;
- color: #333333;
- border : none ;
- padding : 1px ;
- }
-
- internal|DateChooserButton:active {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-
- #todayDateChooserButton {
- background-color: #FFFFFF;
- color: #333333;
- border: solid 1px #77CEFF;
- }
-
- #todayDateChooserButton:hover {
- background-color : #CFCFCF ;
- color: #333333;
- }
-
- #todayDateChooserButton:active {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-
-
- internal|DateHeaderButton {
- border-radius : 0px ;
- font-weight : bold ;
- background-color : #FFFFFF ;
- color: #333333;
- border : none ;
- padding : 1px ;
- font-size : 12px ;
- }
-
-
- internal|DateHeaderButton:hover {
- border-radius : 0px ;
- background-color : #CFCFCF ;
- color: #333333;
- border : none ;
- padding : 1px ;
- }
-
- internal|DateHeaderButton:active {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-
- /*
- * NumberStepper and Spinner
- */
-
- internal|NumericStepperInput {
- padding: 5px;
- background-color: #FFFFFF;
- color: #333333;
- margin-right: 8px;
- }
-
- internal|NumericStepperInput:hover {
- background-color: #DFDFDF;
- }
-
- internal|SpinnerButton {
- background-color: transparent;
- font-size: 7pt;
- display: block;
- padding: 0px;
- }
-
- internal|SpinnerButton:hover {
- background-color: #DFDFDF;
- font-size: 7pt;
- display: block;
- padding: 0px;
- }
-
- /*
- * List
- */
-
- js|List {
- background-color: #FFFFFF;
- padding: 0px;
- border: solid 1px #EEEEEE;
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 1px 4px 8px gray;
- }
-
-@media -flex-flash
-{
- js|List {
- iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
- iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
- border-style: solid;
- border-color: #000000;
- border-width: 1px;
- background-color: #FFFFFF;
- padding: 8px;
- }
-}
- .ListDataGroup {
- padding: 8px;
- }
-
- js|StringItemRenderer {
- padding: 2px;
- font-size: 10pt;
- color: #333333;
- }
-
- js|StringItemRenderer:hover {
- background-color: #CFCFCF;
- color: #333333;
- }
-
- js|StringItemRenderer:active {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-
- js|StringItemRenderer.selected {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-
-@media -flex-flash
-{
- js|StringItemRenderer:selected {
- background-color: #77CEFF;
- color: #FFFFFF;
- }
-}
-
- /*
- * DataGrid
- */
-
- js|DataGrid {
- background-color: white;
- border: solid 1px #EEEEEE;
- border-radius: 8px;
- box-shadow : 1px 4px 8px gray ;
- }
-
-@media -flex-flash
-{
- js|DataGrid {
- iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
- iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
- border-style: solid;
- border-color: #000000;
- border-width: 1px;
- background-color: #FFCC00;
- padding: 8px;
- }
-}
-
- .DataGridListArea {
- background-color: transparent;
- border: none;
- overflow: hidden;
- }
-
- js|DataGridButtonBarTextButton {
- border-style: none;
- background-color: transparent;
- text-align: center;
- font-size: 14pt;
- color: #77CEFF;
- }
-
- js|DataGridButtonBarTextButton:hover {
- border-style: none;
- background-color: transparent;
- color: #77CEFF;
- }
-
- .yellow {
- background-color: #FFFF00;
- vertical-align: middle;
- }
-
- .centeredLabel {
- line-height: 100px;
- }
- </fx:Style>
-
- <js:beads>
- <js:ViewDataBinding />
- </js:beads>
-
- <js:VContainer x="50" y="50" width="400" height="400" className="foo">
-
- <js:TextInput text="Input here" width="200" />
- <js:Spacer height="20" />
-
- <js:HContainer>
- <js:TextButton text="Default Button" width="120" height="40"/>
- <js:Spacer width="10" />
- <js:DropDownList id="dropDown" width="100" />
- <js:Spacer width="10" />
- <js:NumericStepper id="nstep" />
- </js:HContainer>
- <js:Spacer height="20" />
-
- <js:CheckBox text="Check Me, please!" />
- <js:Spacer height="20" />
- <js:RadioButton text="Apples" groupName="fruits" value="1" selected="true" />
- <js:RadioButton text="Oranges" groupName="fruits" value="2" />
- <js:RadioButton text="Grapes" groupName="fruits" value="3" />
- <js:RadioButton text="Bananas" groupName="fruits" value="4" />
-
- <js:Spacer height="10" />
- <js:Label id="output" text="An Example of a Label" />
-
- <js:Spacer height="20" />
- <js:DateChooser />
-
- <js:Spacer height="20" />
- <js:HContainer width="400">
- <js:List id="list" width="100" height="100" change="listChanged()" />
- <js:Spacer width="10" />
- <js:Label id="listOutput" width="90" height="100" className="centeredLabel" />
- </js:HContainer>
-
- <js:Spacer height="20" />
- <js:DataGrid id="dataGrid" width="300" height="300">
- <js:columns>
- <js:DataGridColumn dataField="month" label="Month" />
- <js:DataGridColumn dataField="days" label="# Days" />
- </js:columns>
- </js:DataGrid>
-
- </js:VContainer>
-
-</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StyleExample/src/StyleExample.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StyleExample/src/StyleExample.mxml b/examples/flexjs/StyleExample/src/StyleExample.mxml
deleted file mode 100644
index f7c5584..0000000
--- a/examples/flexjs/StyleExample/src/StyleExample.mxml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:local="*"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- xmlns:models="models.*"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StyleExample/src/main/flex/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StyleExample/src/main/flex/MyInitialView.mxml b/examples/flexjs/StyleExample/src/main/flex/MyInitialView.mxml
new file mode 100644
index 0000000..944d9ea
--- /dev/null
+++ b/examples/flexjs/StyleExample/src/main/flex/MyInitialView.mxml
@@ -0,0 +1,427 @@
+<?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:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:local="org.apache.flex.html.*"
+ initComplete="onComplete()">
+ <fx:Script>
+ <![CDATA[
+ import models.MyModel;
+
+ private function onComplete() : void {
+ dropDown.dataProvider = MyModel(applicationModel).strings;
+ list.dataProvider = MyModel(applicationModel).strings;
+ dataGrid.dataProvider = MyModel(applicationModel).gridData;
+ }
+
+ private function listChanged():void {
+ var index:Number = list.selectedIndex;
+ listOutput.text = "Selected: "+index;
+ }
+ ]]>
+ </fx:Script>
+
+ <fx:Style>
+ @namespace js "library://ns.apache.org/flexjs/basic";
+ @namespace internal "org.apache.flex.html.supportClasses.*";
+
+ /*
+ * TextButton
+ */
+
+ js|TextButton {
+ border-radius : 6px ;
+ font-weight : normal ;
+ line-height : 1.4 ;
+ color : #00A3EE ;
+ background-color : transparent ;
+ border : none ;
+ font-size : 15px ;
+ padding : 5px ;
+ }
+
+ js|TextButton:hover {
+ background-color: #CFCFCF;
+ vertical-align: middle;
+ border: none;
+ border-radius: 6px;
+ }
+
+ js|TextButton:active {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+
+ /*
+ * TextInput
+ */
+
+ js|TextInput {
+ padding: 5px;
+ border: solid 1px #666666;
+ border-radius: 6px;
+ color: #333333;
+ }
+
+ js|TextInput:hover {
+ padding: 5px;
+ background-color: #DFDFDF;
+ }
+
+ /*
+ * CheckBox
+ */
+
+ js|CheckBox {
+ position : relative ;
+ vertical-align : middle ;
+ color : #333333 ;
+ font-size : 14px ;
+ }
+
+ internal|CheckBoxIcon {
+ margin-right: 8px;
+ }
+
+ js|CheckBox:hover {
+ position : relative ;
+ vertical-align : middle ;
+ color : #666666 ;
+ font-size : 14px ;
+ }
+
+ /*
+ * RadioButton
+ */
+
+ js|RadioButton {
+ position: relative;
+ vertical-align: middle;
+ color: #333333;
+ font-size: 14px;
+ }
+
+ internal|RadioButtonIcon {
+ margin-right: 8px;
+ }
+
+ js|RadioButton:hover {
+ position: relative;
+ vertical-align: middle;
+ color: #666666;
+ font-size: 14px;
+ }
+
+ /*
+ * Label
+ */
+
+ js|Label {
+ font-size: 14pt;
+ font-weight: regular;
+ color: #333333;
+ position: relative;
+ }
+
+ /*
+ * DateChooser
+ */
+
+ .dc {
+ box-shadow: 1px 4px 8px gray;
+ padding: 10px;
+ }
+
+ js|DateChooser {
+ background-color: #FFFFFF;
+ padding: 8px;
+ border: solid 1px #EEEEEE;
+ border-radius: 8px;
+ overflow: hidden;
+ box-shadow: 1px 4px 8px gray;
+ }
+
+@media -flex-flash
+{
+ js|DateChooser {
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFFFFF;
+ }
+}
+
+
+ internal|DateChooserButton {
+ border-radius : 0px ;
+ background-color : #FFFFFF ;
+ color: #333333;
+ border : none ;
+ font-size : 10px ;
+ padding : 1px ;
+ }
+
+
+ internal|DateChooserButton:hover {
+ border-radius : 0px ;
+ background-color : #CFCFCF ;
+ color: #333333;
+ border : none ;
+ padding : 1px ;
+ }
+
+ internal|DateChooserButton:active {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+
+ #todayDateChooserButton {
+ background-color: #FFFFFF;
+ color: #333333;
+ border: solid 1px #77CEFF;
+ }
+
+ #todayDateChooserButton:hover {
+ background-color : #CFCFCF ;
+ color: #333333;
+ }
+
+ #todayDateChooserButton:active {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+
+
+ internal|DateHeaderButton {
+ border-radius : 0px ;
+ font-weight : bold ;
+ background-color : #FFFFFF ;
+ color: #333333;
+ border : none ;
+ padding : 1px ;
+ font-size : 12px ;
+ }
+
+
+ internal|DateHeaderButton:hover {
+ border-radius : 0px ;
+ background-color : #CFCFCF ;
+ color: #333333;
+ border : none ;
+ padding : 1px ;
+ }
+
+ internal|DateHeaderButton:active {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+
+ /*
+ * NumberStepper and Spinner
+ */
+
+ internal|NumericStepperInput {
+ padding: 5px;
+ background-color: #FFFFFF;
+ color: #333333;
+ margin-right: 8px;
+ }
+
+ internal|NumericStepperInput:hover {
+ background-color: #DFDFDF;
+ }
+
+ internal|SpinnerButton {
+ background-color: transparent;
+ font-size: 7pt;
+ display: block;
+ padding: 0px;
+ }
+
+ internal|SpinnerButton:hover {
+ background-color: #DFDFDF;
+ font-size: 7pt;
+ display: block;
+ padding: 0px;
+ }
+
+ /*
+ * List
+ */
+
+ js|List {
+ background-color: #FFFFFF;
+ padding: 0px;
+ border: solid 1px #EEEEEE;
+ border-radius: 8px;
+ overflow: hidden;
+ box-shadow: 1px 4px 8px gray;
+ }
+
+@media -flex-flash
+{
+ js|List {
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFFFFF;
+ padding: 8px;
+ }
+}
+ .ListDataGroup {
+ padding: 8px;
+ }
+
+ js|StringItemRenderer {
+ padding: 2px;
+ font-size: 10pt;
+ color: #333333;
+ }
+
+ js|StringItemRenderer:hover {
+ background-color: #CFCFCF;
+ color: #333333;
+ }
+
+ js|StringItemRenderer:active {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+
+ js|StringItemRenderer.selected {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+
+@media -flex-flash
+{
+ js|StringItemRenderer:selected {
+ background-color: #77CEFF;
+ color: #FFFFFF;
+ }
+}
+
+ /*
+ * DataGrid
+ */
+
+ js|DataGrid {
+ background-color: white;
+ border: solid 1px #EEEEEE;
+ border-radius: 8px;
+ box-shadow : 1px 4px 8px gray ;
+ }
+
+@media -flex-flash
+{
+ js|DataGrid {
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFCC00;
+ padding: 8px;
+ }
+}
+
+ .DataGridListArea {
+ background-color: transparent;
+ border: none;
+ overflow: hidden;
+ }
+
+ js|DataGridButtonBarTextButton {
+ border-style: none;
+ background-color: transparent;
+ text-align: center;
+ font-size: 14pt;
+ color: #77CEFF;
+ }
+
+ js|DataGridButtonBarTextButton:hover {
+ border-style: none;
+ background-color: transparent;
+ color: #77CEFF;
+ }
+
+ .yellow {
+ background-color: #FFFF00;
+ vertical-align: middle;
+ }
+
+ .centeredLabel {
+ line-height: 100px;
+ }
+ </fx:Style>
+
+ <js:beads>
+ <js:ViewDataBinding />
+ </js:beads>
+
+ <js:VContainer x="50" y="50" width="400" height="400" className="foo">
+
+ <js:TextInput text="Input here" width="200" />
+ <js:Spacer height="20" />
+
+ <js:HContainer>
+ <js:TextButton text="Default Button" width="120" height="40"/>
+ <js:Spacer width="10" />
+ <js:DropDownList id="dropDown" width="100" />
+ <js:Spacer width="10" />
+ <js:NumericStepper id="nstep" />
+ </js:HContainer>
+ <js:Spacer height="20" />
+
+ <js:CheckBox text="Check Me, please!" />
+ <js:Spacer height="20" />
+ <js:RadioButton text="Apples" groupName="fruits" value="1" selected="true" />
+ <js:RadioButton text="Oranges" groupName="fruits" value="2" />
+ <js:RadioButton text="Grapes" groupName="fruits" value="3" />
+ <js:RadioButton text="Bananas" groupName="fruits" value="4" />
+
+ <js:Spacer height="10" />
+ <js:Label id="output" text="An Example of a Label" />
+
+ <js:Spacer height="20" />
+ <js:DateChooser />
+
+ <js:Spacer height="20" />
+ <js:HContainer width="400">
+ <js:List id="list" width="100" height="100" change="listChanged()" />
+ <js:Spacer width="10" />
+ <js:Label id="listOutput" width="90" height="100" className="centeredLabel" />
+ </js:HContainer>
+
+ <js:Spacer height="20" />
+ <js:DataGrid id="dataGrid" width="300" height="300">
+ <js:columns>
+ <js:DataGridColumn dataField="month" label="Month" />
+ <js:DataGridColumn dataField="days" label="# Days" />
+ </js:columns>
+ </js:DataGrid>
+
+ </js:VContainer>
+
+</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StyleExample/src/main/flex/StyleExample.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/StyleExample/src/main/flex/StyleExample.mxml b/examples/flexjs/StyleExample/src/main/flex/StyleExample.mxml
new file mode 100644
index 0000000..f7c5584
--- /dev/null
+++ b/examples/flexjs/StyleExample/src/main/flex/StyleExample.mxml
@@ -0,0 +1,34 @@
+<?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:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:models="models.*"
+ >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:model>
+ <models:MyModel />
+ </js:model>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/StyleExample/src/main/flex/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/StyleExample/src/main/flex/models/MyModel.as b/examples/flexjs/StyleExample/src/main/flex/models/MyModel.as
new file mode 100644
index 0000000..20ab016
--- /dev/null
+++ b/examples/flexjs/StyleExample/src/main/flex/models/MyModel.as
@@ -0,0 +1,53 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 models
+{
+ import org.apache.flex.collections.ArrayList;
+ import org.apache.flex.collections.IArrayList;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class MyModel extends EventDispatcher
+ {
+ public function MyModel()
+ {
+ }
+
+ private var _strings:Array = ["AAPL", "ADBE", "FX", "GOOG", "MSFT", "NYSE", "YHOO"];
+ [Bindable("__NoChangeEvent__")]
+ public function get strings():Array
+ {
+ return _strings;
+ }
+
+ private var _gridData:ArrayList = new ArrayList([
+ {month:"January", days:31}, {month:"February", days:28},
+ {month:"March", days:31}, {month:"April", days:30},
+ {month:"May", days:31}, {month:"June", days:30},
+ {month:"July", days:31}, {month:"August", days:31},
+ {month:"September", days:30}, {month:"October", days:31},
+ {month:"November", days:30}, {month:"December", days:31}]);
+ [Bindable("__NoChangeEvent__")]
+ public function get gridData():IArrayList
+ {
+ return _gridData;
+ }
+
+ }
+}