You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2013/11/07 18:02:27 UTC
[2/2] git commit: [flex-asjs] [refs/heads/develop] - Rename
FlexJSTest_again to FlexJSTest_basic.
Rename FlexJSTest_again to FlexJSTest_basic.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4b17f61c
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4b17f61c
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4b17f61c
Branch: refs/heads/develop
Commit: 4b17f61ce380bde5497a1157bc52ff9e39304040
Parents: f368228
Author: Peter Ent <pe...@apache.org>
Authored: Thu Nov 7 12:02:14 2013 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Thu Nov 7 12:02:14 2013 -0500
----------------------------------------------------------------------
.../FlexJSTest_again/src/ButtonImageDown.png | Bin 206 -> 0 bytes
.../FlexJSTest_again/src/ButtonImageOver.png | Bin 266 -> 0 bytes
examples/FlexJSTest_again/src/ButtonImageUp.png | Bin 236 -> 0 bytes
.../FlexJSTest_again/src/FlexJSTest_again.mxml | 51 -------
.../FlexJSTest_again/src/MyInitialView.mxml | 143 -------------------
.../src/StockDataJSONItemConverter.as | 38 -----
.../src/controllers/MyController.as | 92 ------------
examples/FlexJSTest_again/src/models/MyModel.as | 59 --------
.../FlexJSTest_basic/src/ButtonImageDown.png | Bin 0 -> 206 bytes
.../FlexJSTest_basic/src/ButtonImageOver.png | Bin 0 -> 266 bytes
examples/FlexJSTest_basic/src/ButtonImageUp.png | Bin 0 -> 236 bytes
.../FlexJSTest_basic/src/FlexJSTest_basic.mxml | 51 +++++++
.../FlexJSTest_basic/src/MyInitialView.mxml | 143 +++++++++++++++++++
.../src/StockDataJSONItemConverter.as | 38 +++++
.../src/controllers/MyController.as | 92 ++++++++++++
examples/FlexJSTest_basic/src/models/MyModel.as | 59 ++++++++
16 files changed, 383 insertions(+), 383 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/ButtonImageDown.png
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/ButtonImageDown.png b/examples/FlexJSTest_again/src/ButtonImageDown.png
deleted file mode 100644
index 0cf7f8a..0000000
Binary files a/examples/FlexJSTest_again/src/ButtonImageDown.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/ButtonImageOver.png
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/ButtonImageOver.png b/examples/FlexJSTest_again/src/ButtonImageOver.png
deleted file mode 100644
index 2f78d59..0000000
Binary files a/examples/FlexJSTest_again/src/ButtonImageOver.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/ButtonImageUp.png
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/ButtonImageUp.png b/examples/FlexJSTest_again/src/ButtonImageUp.png
deleted file mode 100644
index 927e1c8..0000000
Binary files a/examples/FlexJSTest_again/src/ButtonImageUp.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/FlexJSTest_again.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/FlexJSTest_again.mxml b/examples/FlexJSTest_again/src/FlexJSTest_again.mxml
deleted file mode 100644
index 2f3cbbd..0000000
--- a/examples/FlexJSTest_again/src/FlexJSTest_again.mxml
+++ /dev/null
@@ -1,51 +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.
-
--->
-<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:local="*"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- xmlns:models="models.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).labelText='Hello World'"
- >
- <basic:valuesImpl>
- <basic:SimpleCSSValuesImpl />
- </basic:valuesImpl>
- <basic:initialView>
- <local:MyInitialView />
- </basic:initialView>
- <basic:model>
- <models:MyModel />
- </basic:model>
- <basic:controller>
- <controllers:MyController />
- </basic:controller>
- <basic:beads>
- <basic:HTTPService id="service">
- <basic:LazyCollection id="collection">
- <basic:inputParser>
- <basic:JSONInputParser />
- </basic:inputParser>
- <basic:itemConverter>
- <local:StockDataJSONItemConverter />
- </basic:itemConverter>
- </basic:LazyCollection>
- </basic:HTTPService>
- </basic:beads>
-</basic:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/MyInitialView.mxml b/examples/FlexJSTest_again/src/MyInitialView.mxml
deleted file mode 100644
index 9a910cc..0000000
--- a/examples/FlexJSTest_again/src/MyInitialView.mxml
+++ /dev/null
@@ -1,143 +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.
-
--->
-<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- >
- <fx:Script>
- <![CDATA[
- import org.apache.flex.events.CustomEvent;
- import org.apache.flex.events.Event;
- import org.apache.flex.utils.Timer;
-
- private var timer:org.apache.flex.utils.Timer;
-
- public function get symbol():String
- {
- return list.selectedItem as String;
- }
-
- public function get city():String
- {
- return cityList.selectedItem as String;
- }
-
- public function get inputText():String
- {
- return input.text;
- }
-
- public function get comboBoxValue():String
- {
- return String(comboBox.selectedItem);
- }
-
- public function startTimer():void
- {
- timer = new org.apache.flex.utils.Timer(1000);
- timer.addEventListener('timer', timerHandler);
- timer.start()
- }
-
- public function timerHandler(event:org.apache.flex.events.Event):void
- {
- timerLabel.text = timer.currentCount.toString();
- }
- ]]>
- </fx:Script>
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
-
- .skinned {
- background-image: url('ButtonImageUp.png');
- border-style: none;
- }
-
- .skinned:hover {
- background-image: url('ButtonImageOver.png');
- }
-
- .skinned:active {
- background-image: url('ButtonImageDown.png');
- }
-
- </fx:Style>
- <basic:Label id="lbl" x="100" y="25" >
- <basic:beads>
- <basic:SimpleBinding eventName="labelTextChanged"
- sourceID="applicationModel"
- sourcePropertyName="labelText"
- destinationPropertyName="text" />
- </basic:beads>
- </basic:Label>
- <basic:TextButton text="Start Timer" x="100" y="75" click="startTimer()" />
- <basic:TextButton text="Stop Timer" x="100" y="100" click="timer.removeEventListener('timer', timerHandler);timer.stop()" />
- <basic:Label id="timerLabel" x="100" y="125" />
-
- <basic:List id="cityList" x="200" y="75" width="100" height="75" change="dispatchEvent(new CustomEvent('cityListChanged'))">
- <basic:beads>
- <basic:ConstantBinding
- sourceID="applicationModel"
- sourcePropertyName="cities"
- destinationPropertyName="dataProvider" />
- </basic:beads>
- </basic:List>
-
- <basic:TextArea x="320" y="25" width="150" height="75">
- <basic:beads>
- <basic:SimpleBinding eventName="labelTextChanged"
- sourceID="applicationModel"
- sourcePropertyName="labelText"
- destinationPropertyName="text" />
- </basic:beads>
- </basic:TextArea>
- <basic:TextInput id="input" x="320" y="110" />
- <basic:TextButton text="Transfer" x="320" y="138" click="dispatchEvent(new CustomEvent('transferClicked'))" />
-
- <basic:CheckBox id="checkbox" x="320" y="170" text="Check Me" />
-
- <basic:RadioButton groupName="group1" text="Apples" value="0" x="100" y="150" />
- <basic:RadioButton groupName="group1" text="Oranges" value="1" x="100" y="170" selected="true" />
- <basic:RadioButton groupName="group1" text="Grapes" value="2" x="100" y="190" />
-
- <basic:RadioButton groupName="group2" text="Red" value="red" x="100" y="250" selected="true" />
- <basic:RadioButton groupName="group2" text="Green" value="green" x="100" y="270" />
- <basic:RadioButton groupName="group2" text="Blue" value="blue" x="100" y="290" />
-
- <basic:DropDownList id="list" x="200" y="200" width="100" height="18" change="dispatchEvent(new CustomEvent('listChanged'))">
- <basic:beads>
- <basic:ConstantBinding
- sourceID="applicationModel"
- sourcePropertyName="strings"
- destinationPropertyName="dataProvider" />
- </basic:beads>
- </basic:DropDownList>
- <basic:TextButton text="OK" x="200" y="230" click="dispatchEvent(new CustomEvent('buttonClicked'))" />
- <basic:TextButton text="Skinned" x="200" y="260" width="80" height="24" className="skinned" click="dispatchEvent(new CustomEvent('buttonClicked'))" />
-
- <basic:ComboBox id="comboBox" x="320" y="200" width="100" change="dispatchEvent(new CustomEvent('comboBoxChanged'))">
- <basic:beads>
- <basic:ConstantBinding
- sourceID="applicationModel"
- sourcePropertyName="cities"
- destinationPropertyName="dataProvider" />
- </basic:beads>
- </basic:ComboBox>
-
-</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/StockDataJSONItemConverter.as b/examples/FlexJSTest_again/src/StockDataJSONItemConverter.as
deleted file mode 100644
index 2483ce0..0000000
--- a/examples/FlexJSTest_again/src/StockDataJSONItemConverter.as
+++ /dev/null
@@ -1,38 +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
-{
- import org.apache.flex.net.JSONItemConverter;
-
- public class StockDataJSONItemConverter extends JSONItemConverter
- {
- public function StockDataJSONItemConverter()
- {
- super();
- }
-
- override public function convertItem(data:String):Object
- {
- var obj:Object = super.convertItem(data);
- if (obj['query']['results'] == null)
- return 'No Quote Available';
- return obj['query']['results']['quote']['Ask'];
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/controllers/MyController.as b/examples/FlexJSTest_again/src/controllers/MyController.as
deleted file mode 100644
index d7b0547..0000000
--- a/examples/FlexJSTest_again/src/controllers/MyController.as
+++ /dev/null
@@ -1,92 +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 controllers
-{
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
- import org.apache.flex.events.Event;
-
-
- import models.MyModel;
-
- public class MyController implements IDocument
- {
- public function MyController(app:Application = null)
- {
- if (app)
- {
- this.app = app as FlexJSTest_again;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
- }
-
- 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 app:FlexJSTest_again;
-
- private function viewChangeHandler(event:Event):void
- {
- app.initialView.addEventListener("buttonClicked", buttonClickHandler);
- app.initialView.addEventListener("listChanged", listChangedHandler);
- app.initialView.addEventListener("cityListChanged", cityListChangeHandler);
- app.initialView.addEventListener("transferClicked", transferClickHandler);
- app.initialView.addEventListener("comboBoxChanged", comboBoxChangeHandler);
- }
-
- private function buttonClickHandler(event:Event):void
- {
- var sym:String = MyInitialView(app.initialView).symbol;
- app.service.url = queryBegin + sym + queryEnd;
- app.service.send();
- app.service.addEventListener("complete", completeHandler);
- }
-
- private function completeHandler(event:Event):void
- {
- MyModel(app.model).labelText = app.collection.getItemAt(0) as String;
- }
-
- private function listChangedHandler(event:Event):void
- {
- MyModel(app.model).labelText = MyInitialView(app.initialView).symbol;
- }
-
- private function cityListChangeHandler(event:Event):void
- {
- MyModel(app.model).labelText = MyInitialView(app.initialView).city;
- }
-
- private function transferClickHandler(event:Event):void
- {
- MyModel(app.model).labelText = MyInitialView(app.initialView).inputText;
- }
-
- private function comboBoxChangeHandler(event:Event):void
- {
- MyModel(app.model).labelText = MyInitialView(app.initialView).comboBoxValue;
- }
-
- public function setDocument(document:Object, id:String = null):void
- {
- this.app = document as FlexJSTest_again;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_again/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/models/MyModel.as b/examples/FlexJSTest_again/src/models/MyModel.as
deleted file mode 100644
index 1dc23e6..0000000
--- a/examples/FlexJSTest_again/src/models/MyModel.as
+++ /dev/null
@@ -1,59 +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 MyModel extends EventDispatcher
- {
- public function MyModel()
- {
- }
-
- private var _labelText:String;
-
- public function get labelText():String
- {
- return _labelText;
- }
-
- public function set labelText(value:String):void
- {
- if (value != _labelText)
- {
- _labelText = value;
- dispatchEvent(new Event("labelTextChanged"));
- }
- }
-
- private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
- public function get strings():Array
- {
- return _strings;
- }
-
- private var _cities:Array = ["London", "Miami", "Paris", "Sydney", "Tokyo"];
- public function get cities():Array
- {
- return _cities;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/ButtonImageDown.png
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/ButtonImageDown.png b/examples/FlexJSTest_basic/src/ButtonImageDown.png
new file mode 100644
index 0000000..0cf7f8a
Binary files /dev/null and b/examples/FlexJSTest_basic/src/ButtonImageDown.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/ButtonImageOver.png
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/ButtonImageOver.png b/examples/FlexJSTest_basic/src/ButtonImageOver.png
new file mode 100644
index 0000000..2f78d59
Binary files /dev/null and b/examples/FlexJSTest_basic/src/ButtonImageOver.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/ButtonImageUp.png
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/ButtonImageUp.png b/examples/FlexJSTest_basic/src/ButtonImageUp.png
new file mode 100644
index 0000000..927e1c8
Binary files /dev/null and b/examples/FlexJSTest_basic/src/ButtonImageUp.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/FlexJSTest_basic.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/FlexJSTest_basic.mxml b/examples/FlexJSTest_basic/src/FlexJSTest_basic.mxml
new file mode 100644
index 0000000..2f3cbbd
--- /dev/null
+++ b/examples/FlexJSTest_basic/src/FlexJSTest_basic.mxml
@@ -0,0 +1,51 @@
+<?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.
+
+-->
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:models="models.*"
+ xmlns:controllers="controllers.*"
+ initialize="MyModel(model).labelText='Hello World'"
+ >
+ <basic:valuesImpl>
+ <basic:SimpleCSSValuesImpl />
+ </basic:valuesImpl>
+ <basic:initialView>
+ <local:MyInitialView />
+ </basic:initialView>
+ <basic:model>
+ <models:MyModel />
+ </basic:model>
+ <basic:controller>
+ <controllers:MyController />
+ </basic:controller>
+ <basic:beads>
+ <basic:HTTPService id="service">
+ <basic:LazyCollection id="collection">
+ <basic:inputParser>
+ <basic:JSONInputParser />
+ </basic:inputParser>
+ <basic:itemConverter>
+ <local:StockDataJSONItemConverter />
+ </basic:itemConverter>
+ </basic:LazyCollection>
+ </basic:HTTPService>
+ </basic:beads>
+</basic:Application>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/MyInitialView.mxml b/examples/FlexJSTest_basic/src/MyInitialView.mxml
new file mode 100644
index 0000000..9a910cc
--- /dev/null
+++ b/examples/FlexJSTest_basic/src/MyInitialView.mxml
@@ -0,0 +1,143 @@
+<?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.
+
+-->
+<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ >
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.events.CustomEvent;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.utils.Timer;
+
+ private var timer:org.apache.flex.utils.Timer;
+
+ public function get symbol():String
+ {
+ return list.selectedItem as String;
+ }
+
+ public function get city():String
+ {
+ return cityList.selectedItem as String;
+ }
+
+ public function get inputText():String
+ {
+ return input.text;
+ }
+
+ public function get comboBoxValue():String
+ {
+ return String(comboBox.selectedItem);
+ }
+
+ public function startTimer():void
+ {
+ timer = new org.apache.flex.utils.Timer(1000);
+ timer.addEventListener('timer', timerHandler);
+ timer.start()
+ }
+
+ public function timerHandler(event:org.apache.flex.events.Event):void
+ {
+ timerLabel.text = timer.currentCount.toString();
+ }
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+
+ .skinned {
+ background-image: url('ButtonImageUp.png');
+ border-style: none;
+ }
+
+ .skinned:hover {
+ background-image: url('ButtonImageOver.png');
+ }
+
+ .skinned:active {
+ background-image: url('ButtonImageDown.png');
+ }
+
+ </fx:Style>
+ <basic:Label id="lbl" x="100" y="25" >
+ <basic:beads>
+ <basic:SimpleBinding eventName="labelTextChanged"
+ sourceID="applicationModel"
+ sourcePropertyName="labelText"
+ destinationPropertyName="text" />
+ </basic:beads>
+ </basic:Label>
+ <basic:TextButton text="Start Timer" x="100" y="75" click="startTimer()" />
+ <basic:TextButton text="Stop Timer" x="100" y="100" click="timer.removeEventListener('timer', timerHandler);timer.stop()" />
+ <basic:Label id="timerLabel" x="100" y="125" />
+
+ <basic:List id="cityList" x="200" y="75" width="100" height="75" change="dispatchEvent(new CustomEvent('cityListChanged'))">
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="cities"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ </basic:List>
+
+ <basic:TextArea x="320" y="25" width="150" height="75">
+ <basic:beads>
+ <basic:SimpleBinding eventName="labelTextChanged"
+ sourceID="applicationModel"
+ sourcePropertyName="labelText"
+ destinationPropertyName="text" />
+ </basic:beads>
+ </basic:TextArea>
+ <basic:TextInput id="input" x="320" y="110" />
+ <basic:TextButton text="Transfer" x="320" y="138" click="dispatchEvent(new CustomEvent('transferClicked'))" />
+
+ <basic:CheckBox id="checkbox" x="320" y="170" text="Check Me" />
+
+ <basic:RadioButton groupName="group1" text="Apples" value="0" x="100" y="150" />
+ <basic:RadioButton groupName="group1" text="Oranges" value="1" x="100" y="170" selected="true" />
+ <basic:RadioButton groupName="group1" text="Grapes" value="2" x="100" y="190" />
+
+ <basic:RadioButton groupName="group2" text="Red" value="red" x="100" y="250" selected="true" />
+ <basic:RadioButton groupName="group2" text="Green" value="green" x="100" y="270" />
+ <basic:RadioButton groupName="group2" text="Blue" value="blue" x="100" y="290" />
+
+ <basic:DropDownList id="list" x="200" y="200" width="100" height="18" change="dispatchEvent(new CustomEvent('listChanged'))">
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="strings"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ </basic:DropDownList>
+ <basic:TextButton text="OK" x="200" y="230" click="dispatchEvent(new CustomEvent('buttonClicked'))" />
+ <basic:TextButton text="Skinned" x="200" y="260" width="80" height="24" className="skinned" click="dispatchEvent(new CustomEvent('buttonClicked'))" />
+
+ <basic:ComboBox id="comboBox" x="320" y="200" width="100" change="dispatchEvent(new CustomEvent('comboBoxChanged'))">
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="cities"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ </basic:ComboBox>
+
+</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/StockDataJSONItemConverter.as b/examples/FlexJSTest_basic/src/StockDataJSONItemConverter.as
new file mode 100644
index 0000000..2483ce0
--- /dev/null
+++ b/examples/FlexJSTest_basic/src/StockDataJSONItemConverter.as
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+ import org.apache.flex.net.JSONItemConverter;
+
+ public class StockDataJSONItemConverter extends JSONItemConverter
+ {
+ public function StockDataJSONItemConverter()
+ {
+ super();
+ }
+
+ override public function convertItem(data:String):Object
+ {
+ var obj:Object = super.convertItem(data);
+ if (obj['query']['results'] == null)
+ return 'No Quote Available';
+ return obj['query']['results']['quote']['Ask'];
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/controllers/MyController.as b/examples/FlexJSTest_basic/src/controllers/MyController.as
new file mode 100644
index 0000000..636ed30
--- /dev/null
+++ b/examples/FlexJSTest_basic/src/controllers/MyController.as
@@ -0,0 +1,92 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 controllers
+{
+ import org.apache.flex.core.Application;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.events.Event;
+
+
+ import models.MyModel;
+
+ public class MyController implements IDocument
+ {
+ public function MyController(app:Application = null)
+ {
+ if (app)
+ {
+ this.app = app as FlexJSTest_basic;
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+ }
+
+ 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 app:FlexJSTest_basic;
+
+ private function viewChangeHandler(event:Event):void
+ {
+ app.initialView.addEventListener("buttonClicked", buttonClickHandler);
+ app.initialView.addEventListener("listChanged", listChangedHandler);
+ app.initialView.addEventListener("cityListChanged", cityListChangeHandler);
+ app.initialView.addEventListener("transferClicked", transferClickHandler);
+ app.initialView.addEventListener("comboBoxChanged", comboBoxChangeHandler);
+ }
+
+ private function buttonClickHandler(event:Event):void
+ {
+ var sym:String = MyInitialView(app.initialView).symbol;
+ app.service.url = queryBegin + sym + queryEnd;
+ app.service.send();
+ app.service.addEventListener("complete", completeHandler);
+ }
+
+ private function completeHandler(event:Event):void
+ {
+ MyModel(app.model).labelText = app.collection.getItemAt(0) as String;
+ }
+
+ private function listChangedHandler(event:Event):void
+ {
+ MyModel(app.model).labelText = MyInitialView(app.initialView).symbol;
+ }
+
+ private function cityListChangeHandler(event:Event):void
+ {
+ MyModel(app.model).labelText = MyInitialView(app.initialView).city;
+ }
+
+ private function transferClickHandler(event:Event):void
+ {
+ MyModel(app.model).labelText = MyInitialView(app.initialView).inputText;
+ }
+
+ private function comboBoxChangeHandler(event:Event):void
+ {
+ MyModel(app.model).labelText = MyInitialView(app.initialView).comboBoxValue;
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.app = document as FlexJSTest_basic;
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b17f61c/examples/FlexJSTest_basic/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_basic/src/models/MyModel.as b/examples/FlexJSTest_basic/src/models/MyModel.as
new file mode 100644
index 0000000..1dc23e6
--- /dev/null
+++ b/examples/FlexJSTest_basic/src/models/MyModel.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 MyModel extends EventDispatcher
+ {
+ public function MyModel()
+ {
+ }
+
+ private var _labelText:String;
+
+ public function get labelText():String
+ {
+ return _labelText;
+ }
+
+ public function set labelText(value:String):void
+ {
+ if (value != _labelText)
+ {
+ _labelText = value;
+ dispatchEvent(new Event("labelTextChanged"));
+ }
+ }
+
+ private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+ public function get strings():Array
+ {
+ return _strings;
+ }
+
+ private var _cities:Array = ["London", "Miami", "Paris", "Sydney", "Tokyo"];
+ public function get cities():Array
+ {
+ return _cities;
+ }
+
+ }
+}
\ No newline at end of file