You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/08/21 20:42:55 UTC
[1/7] git commit: [flex-asjs] [refs/heads/develop] - remove these
examples. They are included in DataBindingTest
Repository: flex-asjs
Updated Branches:
refs/heads/develop 4ba97a19f -> 002449f92
remove these examples. They are included in DataBindingTest
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b7fba067
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b7fba067
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b7fba067
Branch: refs/heads/develop
Commit: b7fba067eb4beb0fdfe51fb9262be9788ab6b349
Parents: 4ba97a1
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 21 09:27:59 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 21 09:27:59 2015 -0700
----------------------------------------------------------------------
examples/StatesTest/build.xml | 45 -----
examples/StatesTest/src/MyInitialView.mxml | 164 ------------------
examples/StatesTest/src/README.txt | 47 ------
examples/StatesTest/src/StatesTest.mxml | 52 ------
.../src/StockDataJSONItemConverter.as | 40 -----
.../StatesTest/src/controllers/MyController.as | 81 ---------
examples/StatesTest/src/models/MyModel.as | 126 --------------
examples/StockQuote/build.xml | 44 -----
examples/StockQuote/src/MyInitialView.mxml | 169 -------------------
examples/StockQuote/src/README.txt | 49 ------
.../src/StockDataJSONItemConverter.as | 40 -----
examples/StockQuote/src/StockQuote.mxml | 52 ------
.../StockQuote/src/controllers/MyController.as | 81 ---------
examples/StockQuote/src/models/MyModel.as | 126 --------------
14 files changed, 1116 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/build.xml
----------------------------------------------------------------------
diff --git a/examples/StatesTest/build.xml b/examples/StatesTest/build.xml
deleted file mode 100644
index 142af2b..0000000
--- a/examples/StatesTest/build.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-
-<project name="statestest" default="main" basedir=".">
- <property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="StatesTest" />
-
- <property file="${FLEXJS_HOME}/env.properties"/>
- <property environment="env"/>
- <property file="${FLEXJS_HOME}/build.properties"/>
- <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
- <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
- <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
- <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
-
- <include file="${basedir}/../build_example.xml" />
-
- <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
- </target>
-
- <target name="clean">
- <delete dir="${basedir}/bin" failonerror="false" />
- <delete dir="${basedir}/bin-debug" failonerror="false" />
- <delete dir="${basedir}/bin-release" failonerror="false" />
- </target>
-
-</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/StatesTest/src/MyInitialView.mxml b/examples/StatesTest/src/MyInitialView.mxml
deleted file mode 100644
index 31e881d..0000000
--- a/examples/StatesTest/src/MyInitialView.mxml
+++ /dev/null
@@ -1,164 +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:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- xmlns:core="library://ns.apache.org/flexjs/core"
- initComplete="initControls()">
- <fx:Script>
- <![CDATA[
- import models.MyModel;
-
- import org.apache.flex.events.CustomEvent;
-
- private var _symbol:String;
-
- public function get symbol():String
- {
- return _symbol;
- }
-
- public function get requestedField():String
- {
- return radio1.selectedValue as String;
- }
-
- private function radioChanged(e:org.apache.flex.events.Event):void
- {
- dispatchEvent(new CustomEvent("radioClicked"));
- field.text = RadioButton(e.target).text;
- }
-
- private function initControls():void
- {
- list.selectedItem = MyModel(applicationModel).stockSymbol;
- radio1.selectedValue = MyModel(applicationModel).requestedField;
- if (radio1.selected)
- field.text = radio1.text;
- else if (radio2.selected)
- field.text = radio2.text;
- else if (radio3.selected)
- field.text = radio3.text;
- else if (radio4.selected)
- field.text = radio4.text;
-
- }
-
- private function setState():void
- {
- currentState = showAllData.selected ? "showAll" : "hideAll";
- }
- ]]>
- </fx:Script>
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
-
- .output {
- font-size: 20px;
- }
-
- .topContainer {
- padding: 10px;
-
- }
- .leftSide {
- vertical-align: top;
- margin-right: 10px;
- }
-
- .rightSide {
- vertical-align: top;
- margin-left: 10px;
- padding-left: 10px;
- }
-
- .quoteButton {
- margin-top: 10px;
- margin-bottom: 10px;
- }
- </fx:Style>
- <js:states>
- <js:State name="hideAll" />
- <js:State name="showAll" />
- </js:states>
- <js:Container x="0" y="0" className="topContainer" >
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:Label width="300" text="Enter Stock Symbol or choose from list:" />
- <js:Container>
- <js:beads>
- <js:HorizontalLayout />
- </js:beads>
- <js:Container className="leftSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:TextInput id="symbolTI" >
- <js:beads>
- <js:SimpleBinding eventName="stockSymbolChanged"
- sourceID="applicationModel"
- sourcePropertyName="stockSymbol"
- destinationPropertyName="text" />
- </js:beads>
- </js:TextInput>
- <js:TextButton text="Get Quote" className="quoteButton"
- click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" />
- <js:Label id="field" />
- <js:Label className="output" height="24">
- <js:beads>
- <js:SimpleBinding eventName="responseTextChanged"
- sourceID="applicationModel"
- sourcePropertyName="responseText"
- destinationPropertyName="text" />
- </js:beads>
- </js:Label>
- </js:Container>
- <js:Container className="rightSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:DropDownList id="list" width="100" height="17"
- change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))">
- <js:beads>
- <js:ConstantBinding
- sourceID="applicationModel"
- sourcePropertyName="strings"
- destinationPropertyName="dataProvider" />
- </js:beads>
- </js:DropDownList>
- <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/>
- <js:CheckBox id="showAllData" text="Show All Data" change="setState()" />
- </js:Container>
- </js:Container>
- <js:Label width="300" text.showAll="110" includeIn="showAll" />
- <js:TextArea id="ta" width="300" height="100" height.showAll="110"
- includeIn="showAll">
- <js:beads>
- <js:SimpleBinding eventName="responseDataChanged"
- sourceID="applicationModel"
- sourcePropertyName="allData"
- destinationPropertyName="text" />
- </js:beads>
- </js:TextArea>
- </js:Container>
-</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/StatesTest/src/README.txt b/examples/StatesTest/src/README.txt
deleted file mode 100644
index 9ea5dc1..0000000
--- a/examples/StatesTest/src/README.txt
+++ /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.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-DESCRIPTION
-
-The StatesTest sample demonstrates how to use Flex states to alter the visual
-display. This application is based on the DataBindingTest.
-
-This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
-into JavaScript and HTML and run without Flash.
-
-In this example, states are used to display some or all of the stock quote details.
-
-COMPONENTS and BEADS
-
-- Container
-- DropDownList
-- Label
-- RadioButton
-- TextArea
-- TextButton
-- TextInput
-
-- NonVirtualVerticalLayout
-- NumericOnlyTextInputBead
-- VerticalColumnLayout
-
-NOTES
-
-The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
-should be addressed in future releases of the Falcon JX compiler.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/StatesTest.mxml
----------------------------------------------------------------------
diff --git a/examples/StatesTest/src/StatesTest.mxml b/examples/StatesTest/src/StatesTest.mxml
deleted file mode 100644
index cf5e9e6..0000000
--- a/examples/StatesTest/src/StatesTest.mxml
+++ /dev/null
@@ -1,52 +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.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).stockSymbol='ADBE'"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
- <js:controller>
- <controllers:MyController />
- </js:controller>
- <js:beads>
- <js:HTTPService id="service">
- <js:LazyCollection id="collection">
- <js:inputParser>
- <js:JSONInputParser />
- </js:inputParser>
- <js:itemConverter>
- <local:StockDataJSONItemConverter />
- </js:itemConverter>
- </js:LazyCollection>
- </js:HTTPService>
- <js:ViewSourceContextMenuOption />
- </js:beads>
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/StatesTest/src/StockDataJSONItemConverter.as b/examples/StatesTest/src/StockDataJSONItemConverter.as
deleted file mode 100644
index a39606b..0000000
--- a/examples/StatesTest/src/StockDataJSONItemConverter.as
+++ /dev/null
@@ -1,40 +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.collections.converters.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"]["count"] == 0)
- return "No Data";
-
- obj = obj["query"]["results"]["quote"];
- return obj;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/StatesTest/src/controllers/MyController.as b/examples/StatesTest/src/controllers/MyController.as
deleted file mode 100644
index d6cae7d..0000000
--- a/examples/StatesTest/src/controllers/MyController.as
+++ /dev/null
@@ -1,81 +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.events.Event;
-
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
-
- import models.MyModel;
-
- public class MyController implements IDocument
- {
- public function MyController(app:Application = null)
- {
- if (app)
- {
- this.app = app as StatesTest;
- 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:StatesTest;
-
- private function viewChangeHandler(event:Event):void
- {
- app.initialView.addEventListener("buttonClicked", buttonClickHandler);
- app.initialView.addEventListener("radioClicked", radioClickHandler);
- app.initialView.addEventListener("listChanged", listChangedHandler);
- }
-
- 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 radioClickHandler(event:Event):void
- {
- var field:String = MyInitialView(app.initialView).requestedField;
- MyModel(app.model).requestedField = field;
- }
-
- private function completeHandler(event:Event):void
- {
- MyModel(app.model).responseData = app.collection.getItemAt(0);
- }
-
- private function listChangedHandler(event:Event):void
- {
- MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
- }
-
- public function setDocument(document:Object, id:String = null):void
- {
- this.app = document as StatesTest;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/StatesTest/src/models/MyModel.as b/examples/StatesTest/src/models/MyModel.as
deleted file mode 100644
index c724f4b..0000000
--- a/examples/StatesTest/src/models/MyModel.as
+++ /dev/null
@@ -1,126 +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 _requestedField:String = "Ask";
-
- [Bindable("requestedFieldChanged")]
- public function get requestedField():String
- {
- return _requestedField;
- }
-
- public function set requestedField(value:String):void
- {
- if (value != _requestedField)
- {
- _requestedField = value;
- dispatchEvent(new Event("requestedFieldChanged"));
- if (_responseData)
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _responseText:String;
-
- [Bindable("responseTextChanged")]
- public function get responseText():String
- {
- if (_responseData == null)
- return "";
- if (_responseData == "No Data")
- return _responseData as String;
- var s:String = _responseData[_requestedField];
- if (s == null)
- {
- if (_requestedField == "Ask")
- s = _responseData["Bid"];
- }
- return s;
- }
-
- private var _responseData:Object;
-
- [Bindable("responseDataChanged")]
- public function get responseData():Object
- {
- return _responseData;
- }
-
- public function set responseData(value:Object):void
- {
- if (value != _responseData)
- {
- _responseData = value;
- _allData = "";
- dispatchEvent(new Event("responseDataChanged"));
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _allData:String = "";
-
- [Bindable("responseDataChanged")]
- public function get allData():String
- {
- if (_allData == "" && _responseData != null)
- {
- for (var p:String in _responseData)
- {
- _allData += p + ": " + _responseData[p] + "\n";
- }
- }
- return _allData;
- }
-
-
- private var _stockSymbol:String;
-
- [Bindable("stockSymbolChanged")]
- public function get stockSymbol():String
- {
- return _stockSymbol;
- }
-
- public function set stockSymbol(value:String):void
- {
- if (value != _stockSymbol)
- {
- _stockSymbol = value;
- dispatchEvent(new Event("stockSymbolChanged"));
- }
- }
-
- private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
- public function get strings():Array
- {
- return _strings;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/build.xml
----------------------------------------------------------------------
diff --git a/examples/StockQuote/build.xml b/examples/StockQuote/build.xml
deleted file mode 100644
index 42a8510..0000000
--- a/examples/StockQuote/build.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-
-<project name="stockquote" default="main" basedir=".">
- <property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="StockQuote" />
-
- <property environment="env"/>
- <property file="${FLEXJS_HOME}/build.properties"/>
- <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
- <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
- <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
- <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
-
- <include file="${basedir}/../build_example.xml" />
-
- <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
- </target>
-
- <target name="clean">
- <delete dir="${basedir}/bin" failonerror="false" />
- <delete dir="${basedir}/bin-debug" failonerror="false" />
- <delete dir="${basedir}/bin-release" failonerror="false" />
- </target>
-
-</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/StockQuote/src/MyInitialView.mxml b/examples/StockQuote/src/MyInitialView.mxml
deleted file mode 100644
index 0d5697f..0000000
--- a/examples/StockQuote/src/MyInitialView.mxml
+++ /dev/null
@@ -1,169 +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:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- initComplete="initControls()">
- <fx:Script>
- <![CDATA[
- import org.apache.flex.events.CustomEvent;
- import models.MyModel;
-
- private var _symbol:String;
-
- public function get symbol():String
- {
- return _symbol;
- }
-
- public function get requestedField():String
- {
- return radio1.selectedValue as String;
- }
-
- private function radioChanged(e:org.apache.flex.events.Event):void
- {
- dispatchEvent(new CustomEvent("radioClicked"));
- field.text = RadioButton(e.target).text;
- }
-
- private function initControls():void
- {
- list.selectedItem = MyModel(applicationModel).stockSymbol;
- radio1.selectedValue = MyModel(applicationModel).requestedField;
- if (radio1.selected)
- field.text = radio1.text;
- else if (radio2.selected)
- field.text = radio2.text;
- else if (radio3.selected)
- field.text = radio3.text;
- else if (radio4.selected)
- field.text = radio4.text;
-
- }
- ]]>
- </fx:Script>
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
-
- .output {
- font-size: 20px;
- }
-
- .topContainer {
- padding: 10px;
-
- }
- .leftSide {
- vertical-align: top;
- margin-right: 10px;
- border-style: solid;
- }
-
- .rightSide {
- vertical-align: top;
- margin-left: 10px;
- padding-left: 10px;
- border-style: solid;
- }
-
- .quoteButton {
- margin-top: 10px;
- margin-bottom: 10px;
- }
-
- @media -flex-flash
- {
-
- .leftSide {
- iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
- }
-
- .rightSide {
- iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
- }
- }
- </fx:Style>
- <js:Container x="0" y="0" className="topContainer" >
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:Label width="300" text="Enter Stock Symbol or choose from list:" />
- <js:Container>
- <js:beads>
- <js:HorizontalLayout />
- </js:beads>
- <js:Panel title="Left Side" className="leftSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:TextInput id="symbolTI" >
- <js:beads>
- <js:SimpleBinding eventName="stockSymbolChanged"
- sourceID="applicationModel"
- sourcePropertyName="stockSymbol"
- destinationPropertyName="text" />
- </js:beads>
- </js:TextInput>
- <js:Label id="field" />
- <js:Label className="output" height="24">
- <js:beads>
- <js:SimpleBinding eventName="responseTextChanged"
- sourceID="applicationModel"
- sourcePropertyName="responseText"
- destinationPropertyName="text" />
- </js:beads>
- </js:Label>
- <js:TextButton text="Get Quote" className="quoteButton"
- click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" />
- </js:Panel>
- <js:Panel title="Right Side" className="rightSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:DropDownList id="list" width="100" height="17"
- change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))">
- <js:beads>
- <js:ConstantBinding
- sourceID="applicationModel"
- sourcePropertyName="strings"
- destinationPropertyName="dataProvider" />
- </js:beads>
- </js:DropDownList>
- <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/>
- <js:CheckBox id="showAllData" text="Show All Data" />
- </js:Panel>
- </js:Container>
- <js:TextArea id="ta" width="300" height="100">
- <js:beads>
- <js:SimpleBinding eventName="change"
- sourceID="showAllData"
- sourcePropertyName="selected"
- destinationPropertyName="visible" />
- <js:SimpleBinding eventName="responseDataChanged"
- sourceID="applicationModel"
- sourcePropertyName="allData"
- destinationPropertyName="text" />
- </js:beads>
- </js:TextArea>
- </js:Container>
-</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/StockQuote/src/README.txt b/examples/StockQuote/src/README.txt
deleted file mode 100644
index 44d8015..0000000
--- a/examples/StockQuote/src/README.txt
+++ /dev/null
@@ -1,49 +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.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-DESCRIPTION
-
-The StockQuote example is very closely related to the DataBindingTest and shows
-a number of FlexJS components and beads, including the HTTPService used to
-obtain the stock information.
-
-This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
-into JavaScript and HTML and run without Flash.
-
-COMPONENTS and BEADS
-
-- CheckBox
-- Container
-- DropDownList
-- Label
-- Panel
-- RadioButton
-- TextArea
-- TextButton
-- TextInput
-
-- ConstantBinding
-- NonVirtualHorizontalLayout
-- NonVirtualVerticalLayout
-- SimpleBinding
-
-NOTES
-
-Some work needs to be done with the layout; both ActionScript and JavaScript platforms
-are different and each requires some work.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/StockQuote/src/StockDataJSONItemConverter.as b/examples/StockQuote/src/StockDataJSONItemConverter.as
deleted file mode 100644
index a39606b..0000000
--- a/examples/StockQuote/src/StockDataJSONItemConverter.as
+++ /dev/null
@@ -1,40 +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.collections.converters.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"]["count"] == 0)
- return "No Data";
-
- obj = obj["query"]["results"]["quote"];
- return obj;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/StockQuote.mxml
----------------------------------------------------------------------
diff --git a/examples/StockQuote/src/StockQuote.mxml b/examples/StockQuote/src/StockQuote.mxml
deleted file mode 100644
index cb3d098..0000000
--- a/examples/StockQuote/src/StockQuote.mxml
+++ /dev/null
@@ -1,52 +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.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).stockSymbol='ADBE'"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
- <js:controller>
- <controllers:MyController />
- </js:controller>
- <js:beads>
- <js:HTTPService id="service">
- <js:LazyCollection id="collection">
- <js:inputParser>
- <js:JSONInputParser />
- </js:inputParser>
- <js:itemConverter>
- <local:StockDataJSONItemConverter />
- </js:itemConverter>
- </js:LazyCollection>
- </js:HTTPService>
- <js:ViewSourceContextMenuOption />
- </js:beads>
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/StockQuote/src/controllers/MyController.as b/examples/StockQuote/src/controllers/MyController.as
deleted file mode 100644
index c7332e3..0000000
--- a/examples/StockQuote/src/controllers/MyController.as
+++ /dev/null
@@ -1,81 +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.events.Event;
-
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
-
- import models.MyModel;
-
- public class MyController implements IDocument
- {
- public function MyController(app:Application = null)
- {
- if (app)
- {
- this.app = app as StockQuote;
- 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:StockQuote;
-
- private function viewChangeHandler(event:Event):void
- {
- app.initialView.addEventListener("buttonClicked", buttonClickHandler);
- app.initialView.addEventListener("radioClicked", radioClickHandler);
- app.initialView.addEventListener("listChanged", listChangedHandler);
- }
-
- 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 radioClickHandler(event:Event):void
- {
- var field:String = MyInitialView(app.initialView).requestedField;
- MyModel(app.model).requestedField = field;
- }
-
- private function completeHandler(event:Event):void
- {
- MyModel(app.model).responseData = app.collection.getItemAt(0);
- }
-
- private function listChangedHandler(event:Event):void
- {
- MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
- }
-
- public function setDocument(document:Object, id:String = null):void
- {
- this.app = document as StockQuote;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/StockQuote/src/models/MyModel.as b/examples/StockQuote/src/models/MyModel.as
deleted file mode 100644
index c724f4b..0000000
--- a/examples/StockQuote/src/models/MyModel.as
+++ /dev/null
@@ -1,126 +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 _requestedField:String = "Ask";
-
- [Bindable("requestedFieldChanged")]
- public function get requestedField():String
- {
- return _requestedField;
- }
-
- public function set requestedField(value:String):void
- {
- if (value != _requestedField)
- {
- _requestedField = value;
- dispatchEvent(new Event("requestedFieldChanged"));
- if (_responseData)
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _responseText:String;
-
- [Bindable("responseTextChanged")]
- public function get responseText():String
- {
- if (_responseData == null)
- return "";
- if (_responseData == "No Data")
- return _responseData as String;
- var s:String = _responseData[_requestedField];
- if (s == null)
- {
- if (_requestedField == "Ask")
- s = _responseData["Bid"];
- }
- return s;
- }
-
- private var _responseData:Object;
-
- [Bindable("responseDataChanged")]
- public function get responseData():Object
- {
- return _responseData;
- }
-
- public function set responseData(value:Object):void
- {
- if (value != _responseData)
- {
- _responseData = value;
- _allData = "";
- dispatchEvent(new Event("responseDataChanged"));
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _allData:String = "";
-
- [Bindable("responseDataChanged")]
- public function get allData():String
- {
- if (_allData == "" && _responseData != null)
- {
- for (var p:String in _responseData)
- {
- _allData += p + ": " + _responseData[p] + "\n";
- }
- }
- return _allData;
- }
-
-
- private var _stockSymbol:String;
-
- [Bindable("stockSymbolChanged")]
- public function get stockSymbol():String
- {
- return _stockSymbol;
- }
-
- public function set stockSymbol(value:String):void
- {
- if (value != _stockSymbol)
- {
- _stockSymbol = value;
- dispatchEvent(new Event("stockSymbolChanged"));
- }
- }
-
- private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
- public function get strings():Array
- {
- return _strings;
- }
-
- }
-}
\ No newline at end of file
[4/7] git commit: [flex-asjs] [refs/heads/develop] - rename
DataBindingTest to DataBindingExample and fix up references
Posted by ah...@apache.org.
rename DataBindingTest to DataBindingExample and fix up references
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4b6f8a80
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4b6f8a80
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4b6f8a80
Branch: refs/heads/develop
Commit: 4b6f8a803358cb5bfdfacc8b21b70ac5a93fdec7
Parents: 9c7e00b
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 21 10:27:46 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 21 10:27:46 2015 -0700
----------------------------------------------------------------------
examples/DataBindingExample/build.xml | 4 +-
.../src/DataBindingExample.mxml | 53 ++++
.../DataBindingExample/src/DataBindingTest.mxml | 53 ----
examples/DataBindingExample/src/README.txt | 7 +-
.../src/controllers/MyController.as | 6 +-
examples/DataBindingExample_Flat/build.xml | 4 +-
.../src/DataBindingExample.mxml | 53 ++++
.../src/DataBindingTest.mxml | 53 ----
.../src/controllers/MyController.as | 6 +-
examples/DataBindingExample_as/build.xml | 4 +-
.../src/DataBindingExample.as | 257 +++++++++++++++++++
.../src/DataBindingTest.as | 257 -------------------
.../src/controllers/MyController.as | 6 +-
13 files changed, 382 insertions(+), 381 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/build.xml b/examples/DataBindingExample/build.xml
index 9c551dd..0cfef1b 100644
--- a/examples/DataBindingExample/build.xml
+++ b/examples/DataBindingExample/build.xml
@@ -19,9 +19,9 @@
-->
-<project name="databindingtest" default="main" basedir=".">
+<project name="databindingexample" default="main" basedir=".">
<property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="DataBindingTest" />
+ <property name="example" value="DataBindingExample" />
<property file="${FLEXJS_HOME}/env.properties"/>
<property environment="env"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample/src/DataBindingExample.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/DataBindingExample.mxml b/examples/DataBindingExample/src/DataBindingExample.mxml
new file mode 100644
index 0000000..751e427
--- /dev/null
+++ b/examples/DataBindingExample/src/DataBindingExample.mxml
@@ -0,0 +1,53 @@
+<?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.*"
+ xmlns:controllers="controllers.*"
+ initialize="MyModel(model).stockSymbol='ADBE'"
+ >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:model>
+ <models:MyModel />
+ </js:model>
+ <js:controller>
+ <controllers:MyController />
+ </js:controller>
+ <js:beads>
+ <js:HTTPService id="service">
+ <js:LazyCollection id="collection">
+ <js:inputParser>
+ <js:JSONInputParser />
+ </js:inputParser>
+ <js:itemConverter>
+ <local:StockDataJSONItemConverter />
+ </js:itemConverter>
+ </js:LazyCollection>
+ </js:HTTPService>
+ <js:CSSFontFaceBead />
+ <js:ViewSourceContextMenuOption />
+ </js:beads>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample/src/DataBindingTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/DataBindingTest.mxml b/examples/DataBindingExample/src/DataBindingTest.mxml
deleted file mode 100644
index 751e427..0000000
--- a/examples/DataBindingExample/src/DataBindingTest.mxml
+++ /dev/null
@@ -1,53 +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.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).stockSymbol='ADBE'"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
- <js:controller>
- <controllers:MyController />
- </js:controller>
- <js:beads>
- <js:HTTPService id="service">
- <js:LazyCollection id="collection">
- <js:inputParser>
- <js:JSONInputParser />
- </js:inputParser>
- <js:itemConverter>
- <local:StockDataJSONItemConverter />
- </js:itemConverter>
- </js:LazyCollection>
- </js:HTTPService>
- <js:CSSFontFaceBead />
- <js:ViewSourceContextMenuOption />
- </js:beads>
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/README.txt b/examples/DataBindingExample/src/README.txt
index afe521b..91a0359 100644
--- a/examples/DataBindingExample/src/README.txt
+++ b/examples/DataBindingExample/src/README.txt
@@ -19,14 +19,15 @@
DESCRIPTION
-The DataBindingTest example shows a Flex application that can communicate with
+The DataBindingExample shows a Flex application that can communicate with
a third-party data source (in this case, yahoo.finance) and display the values
-returned using data binding.
+returned using data binding. It also demonstrates that you can use “states” to
+control the UI.
This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
into JavaScript and HTML and run without Flash.
-The DataBindingTest example also shows how the model-view-controller (MVC) pattern
+The DataBindingExample also shows how the model-view-controller (MVC) pattern
can be used to separate the parts of the application. This is facilitated by
the use of FlexJS beads added to the main application that provide the
data connection (via HTTPService) and interacting with the rest of the application
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/controllers/MyController.as b/examples/DataBindingExample/src/controllers/MyController.as
index 83c2cd5..2ee16ae 100644
--- a/examples/DataBindingExample/src/controllers/MyController.as
+++ b/examples/DataBindingExample/src/controllers/MyController.as
@@ -31,14 +31,14 @@ package controllers
{
if (app)
{
- this.app = app as DataBindingTest;
+ this.app = app as DataBindingExample;
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:DataBindingTest;
+ private var app:DataBindingExample;
private function viewChangeHandler(event:Event):void
{
@@ -73,7 +73,7 @@ package controllers
public function setDocument(document:Object, id:String = null):void
{
- this.app = document as DataBindingTest;
+ this.app = document as DataBindingExample;
app.addEventListener("viewChanged", viewChangeHandler);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_Flat/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/build.xml b/examples/DataBindingExample_Flat/build.xml
index ab55f2f..5ede59c 100644
--- a/examples/DataBindingExample_Flat/build.xml
+++ b/examples/DataBindingExample_Flat/build.xml
@@ -19,9 +19,9 @@
-->
-<project name="databindingtest_flat" default="main" basedir=".">
+<project name="databindingexample_flat" default="main" basedir=".">
<property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="DataBindingTest" />
+ <property name="example" value="DataBindingExample" />
<property name="theme_arg" value="-theme=${FLEXJS_HOME}/frameworks/libs/Flat.swc" />
<property file="${FLEXJS_HOME}/env.properties"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_Flat/src/DataBindingExample.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/DataBindingExample.mxml b/examples/DataBindingExample_Flat/src/DataBindingExample.mxml
new file mode 100644
index 0000000..751e427
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/DataBindingExample.mxml
@@ -0,0 +1,53 @@
+<?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.*"
+ xmlns:controllers="controllers.*"
+ initialize="MyModel(model).stockSymbol='ADBE'"
+ >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:model>
+ <models:MyModel />
+ </js:model>
+ <js:controller>
+ <controllers:MyController />
+ </js:controller>
+ <js:beads>
+ <js:HTTPService id="service">
+ <js:LazyCollection id="collection">
+ <js:inputParser>
+ <js:JSONInputParser />
+ </js:inputParser>
+ <js:itemConverter>
+ <local:StockDataJSONItemConverter />
+ </js:itemConverter>
+ </js:LazyCollection>
+ </js:HTTPService>
+ <js:CSSFontFaceBead />
+ <js:ViewSourceContextMenuOption />
+ </js:beads>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_Flat/src/DataBindingTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/DataBindingTest.mxml b/examples/DataBindingExample_Flat/src/DataBindingTest.mxml
deleted file mode 100644
index 751e427..0000000
--- a/examples/DataBindingExample_Flat/src/DataBindingTest.mxml
+++ /dev/null
@@ -1,53 +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.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).stockSymbol='ADBE'"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
- <js:controller>
- <controllers:MyController />
- </js:controller>
- <js:beads>
- <js:HTTPService id="service">
- <js:LazyCollection id="collection">
- <js:inputParser>
- <js:JSONInputParser />
- </js:inputParser>
- <js:itemConverter>
- <local:StockDataJSONItemConverter />
- </js:itemConverter>
- </js:LazyCollection>
- </js:HTTPService>
- <js:CSSFontFaceBead />
- <js:ViewSourceContextMenuOption />
- </js:beads>
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_Flat/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/controllers/MyController.as b/examples/DataBindingExample_Flat/src/controllers/MyController.as
index 83c2cd5..2ee16ae 100644
--- a/examples/DataBindingExample_Flat/src/controllers/MyController.as
+++ b/examples/DataBindingExample_Flat/src/controllers/MyController.as
@@ -31,14 +31,14 @@ package controllers
{
if (app)
{
- this.app = app as DataBindingTest;
+ this.app = app as DataBindingExample;
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:DataBindingTest;
+ private var app:DataBindingExample;
private function viewChangeHandler(event:Event):void
{
@@ -73,7 +73,7 @@ package controllers
public function setDocument(document:Object, id:String = null):void
{
- this.app = document as DataBindingTest;
+ this.app = document as DataBindingExample;
app.addEventListener("viewChanged", viewChangeHandler);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_as/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/build.xml b/examples/DataBindingExample_as/build.xml
index 3a04dfa..3e40bfd 100644
--- a/examples/DataBindingExample_as/build.xml
+++ b/examples/DataBindingExample_as/build.xml
@@ -19,9 +19,9 @@
-->
-<project name="databindingtest_as" default="main" basedir=".">
+<project name="databindingexample_as" default="main" basedir=".">
<property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="DataBindingTest" />
+ <property name="example" value="DataBindingExample" />
<property file="${FLEXJS_HOME}/env.properties"/>
<property environment="env"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_as/src/DataBindingExample.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/DataBindingExample.as b/examples/DataBindingExample_as/src/DataBindingExample.as
new file mode 100644
index 0000000..5e7af98
--- /dev/null
+++ b/examples/DataBindingExample_as/src/DataBindingExample.as
@@ -0,0 +1,257 @@
+/**
+
+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.core.Application;
+import org.apache.flex.core.ItemRendererClassFactory;
+import org.apache.flex.core.SimpleCSSValuesImpl;
+import org.apache.flex.events.Event;
+import org.apache.flex.html.beads.CSSButtonView;
+import org.apache.flex.html.beads.CSSTextButtonView;
+import org.apache.flex.html.beads.CheckBoxView;
+import org.apache.flex.html.beads.ContainerView;
+import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData;
+import org.apache.flex.html.beads.DropDownListView;
+import org.apache.flex.html.beads.ListView;
+import org.apache.flex.html.beads.RadioButtonView;
+import org.apache.flex.html.beads.SingleLineBorderBead;
+import org.apache.flex.html.beads.SolidBackgroundBead;
+import org.apache.flex.html.beads.TextAreaView;
+import org.apache.flex.html.beads.TextButtonMeasurementBead;
+import org.apache.flex.html.beads.TextFieldLabelMeasurementBead;
+import org.apache.flex.html.beads.TextFieldView;
+import org.apache.flex.html.beads.TextInputWithBorderView;
+import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData;
+import org.apache.flex.html.beads.controllers.DropDownListController;
+import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
+import org.apache.flex.html.beads.controllers.EditableTextKeyboardController;
+import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController;
+import org.apache.flex.html.beads.layouts.VerticalScrollingLayout;
+import org.apache.flex.html.beads.models.ArraySelectionModel;
+import org.apache.flex.html.beads.models.SingleLineBorderModel;
+import org.apache.flex.html.beads.models.TextModel;
+import org.apache.flex.html.beads.models.ToggleButtonModel;
+import org.apache.flex.html.beads.models.ValueToggleButtonModel;
+import org.apache.flex.html.supportClasses.DropDownListList;
+import org.apache.flex.html.supportClasses.DataGroup;
+import org.apache.flex.html.supportClasses.StringItemRenderer;
+import org.apache.flex.net.HTTPService;
+import org.apache.flex.collections.parsers.JSONInputParser;
+import org.apache.flex.collections.LazyCollection;
+import org.apache.flex.utils.ViewSourceContextMenuOption;
+
+import models.MyModel;
+import controllers.MyController;
+
+public class DataBindingExample extends Application
+{
+
+ public function DataBindingExample()
+ {
+ addEventListener("initialize", initializeHandler);
+ var vi:SimpleCSSValuesImpl = new SimpleCSSValuesImpl();
+ setupStyles(vi);
+ valuesImpl = vi;
+ initialView = new MyInitialView();
+ model = new MyModel();
+ controller = new MyController(this);
+ service = new HTTPService();
+ collection = new LazyCollection();
+ collection.inputParser = new JSONInputParser();
+ collection.itemConverter = new StockDataJSONItemConverter();
+ service.addBead(collection);
+ addBead(service);
+ addBead(new ViewSourceContextMenuOption());
+ }
+
+ public var service:HTTPService;
+ public var collection:LazyCollection;
+
+ private function initializeHandler(event:Event):void
+ {
+ MyModel(model).stockSymbol="ADBE";
+ }
+
+ private function setupStyles(vi:SimpleCSSValuesImpl):void
+ {
+ var viv:Object = vi.values = {};
+ viv["global"] =
+ {
+ fontFamily: "Arial",
+ fontSize: 12
+ };
+
+ var o:Object;
+
+ o = viv[makeDefinitionName("org.apache.flex.html::Container")] =
+ {
+
+ iBeadView: ContainerView
+ };
+
+ CONFIG::as_only {
+ o.iBackgroundBead = SolidBackgroundBead;
+ o.iBorderBead = SingleLineBorderBead;
+ }
+
+ viv[makeDefinitionName("org.apache.flex.html::List")] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iBeadView: ListView,
+ iBeadController: ListSingleSelectionMouseController,
+ iBeadLayout: VerticalScrollingLayout,
+ iDataGroup: DataGroup,
+ iDataProviderItemRendererMapper: DataItemRendererFactoryForArrayData,
+ iItemRendererClassFactory: ItemRendererClassFactory,
+ iItemRenderer: StringItemRenderer
+ };
+
+ o = viv[makeDefinitionName("org.apache.flex.html::Button")] =
+ {
+ backgroundColor: 0xd8d8d8,
+ border: [1, "solid", 0x000000],
+ padding: 4
+ };
+ CONFIG::as_only {
+ o.iBeadView = CSSButtonView;
+ }
+
+ viv[makeDefinitionName("org.apache.flex.html::Button:hover")] =
+ {
+ backgroundColor: 0x9fa0a1,
+ border: [1, "solid", 0x000000],
+ padding: 4
+ };
+
+ viv[makeDefinitionName("org.apache.flex.html::Button:active")] =
+ {
+ backgroundColor: 0x929496,
+ border: [1, "solid", 0x000000],
+ padding: 4
+ };
+
+ CONFIG::as_only {
+ viv["org.apache.flex.html::CheckBox"] =
+ {
+ iBeadModel: ToggleButtonModel,
+ iBeadView: CheckBoxView
+ };
+
+ viv["org.apache.flex.html::DropDownList"] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iBeadView: DropDownListView,
+ iBeadController: DropDownListController,
+ iPopUp: DropDownListList
+ };
+
+ viv["org.apache.flex.html.supportClasses::DropDownListList"] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
+ iItemRendererClassFactory: ItemRendererClassFactory,
+ iItemRenderer: StringItemRenderer
+ };
+
+ viv["org.apache.flex.html::Label"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: TextFieldView,
+ iMeasurementBead: TextFieldLabelMeasurementBead
+ };
+
+ viv["org.apache.flex.html::List"] =
+ {
+ iBorderBead: SingleLineBorderBead,
+ iBorderModel: SingleLineBorderModel
+ };
+
+ viv["org.apache.flex.html::RadioButton"] =
+ {
+ iBeadModel: ValueToggleButtonModel,
+ iBeadView: RadioButtonView
+ };
+
+ viv["org.apache.flex.html::TextArea"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: TextAreaView,
+ iBeadController: EditableTextKeyboardController,
+ iBorderBead: SingleLineBorderBead,
+ iBorderModel: SingleLineBorderModel,
+ width: 135,
+ height: 20
+ };
+
+ viv["org.apache.flex.html::TextButton"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: CSSTextButtonView,
+ iMeasurementBead: TextButtonMeasurementBead
+ };
+
+ viv["org.apache.flex.html::TextInput"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: TextInputWithBorderView,
+ iBeadController: EditableTextKeyboardController,
+ iBorderBead: SingleLineBorderBead,
+ iBorderModel: SingleLineBorderModel,
+ width: 135,
+ height: 20
+ };
+
+ viv["org.apache.flex.html::ToggleTextButton"] =
+ {
+ iBeadModel: ToggleButtonModel,
+ iBeadView: CSSTextButtonView
+ };
+
+ viv["org.apache.flex.html::SimpleList"] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iBeadView: ListView,
+ iBeadController: ListSingleSelectionMouseController,
+ iBeadLayout: VerticalScrollingLayout,
+ iDataGroup: DataGroup,
+ iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
+ iItemRendererClassFactory: ItemRendererClassFactory,
+ iItemRenderer: StringItemRenderer
+ }
+
+ viv["org.apache.flex.html.supportClasses::StringItemRenderer"] =
+ {
+ iBeadController: ItemRendererMouseController,
+ height: 16
+ }
+ }
+ }
+
+ private function makeDefinitionName(s:String):String
+ {
+ CONFIG::js_only {
+ s = s.replace(/\./g, "_");
+ s = s.replace("::", "_");
+ }
+ return s;
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_as/src/DataBindingTest.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/DataBindingTest.as b/examples/DataBindingExample_as/src/DataBindingTest.as
deleted file mode 100644
index 56d1a0e..0000000
--- a/examples/DataBindingExample_as/src/DataBindingTest.as
+++ /dev/null
@@ -1,257 +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.core.Application;
-import org.apache.flex.core.ItemRendererClassFactory;
-import org.apache.flex.core.SimpleCSSValuesImpl;
-import org.apache.flex.events.Event;
-import org.apache.flex.html.beads.CSSButtonView;
-import org.apache.flex.html.beads.CSSTextButtonView;
-import org.apache.flex.html.beads.CheckBoxView;
-import org.apache.flex.html.beads.ContainerView;
-import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData;
-import org.apache.flex.html.beads.DropDownListView;
-import org.apache.flex.html.beads.ListView;
-import org.apache.flex.html.beads.RadioButtonView;
-import org.apache.flex.html.beads.SingleLineBorderBead;
-import org.apache.flex.html.beads.SolidBackgroundBead;
-import org.apache.flex.html.beads.TextAreaView;
-import org.apache.flex.html.beads.TextButtonMeasurementBead;
-import org.apache.flex.html.beads.TextFieldLabelMeasurementBead;
-import org.apache.flex.html.beads.TextFieldView;
-import org.apache.flex.html.beads.TextInputWithBorderView;
-import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData;
-import org.apache.flex.html.beads.controllers.DropDownListController;
-import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
-import org.apache.flex.html.beads.controllers.EditableTextKeyboardController;
-import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController;
-import org.apache.flex.html.beads.layouts.VerticalScrollingLayout;
-import org.apache.flex.html.beads.models.ArraySelectionModel;
-import org.apache.flex.html.beads.models.SingleLineBorderModel;
-import org.apache.flex.html.beads.models.TextModel;
-import org.apache.flex.html.beads.models.ToggleButtonModel;
-import org.apache.flex.html.beads.models.ValueToggleButtonModel;
-import org.apache.flex.html.supportClasses.DropDownListList;
-import org.apache.flex.html.supportClasses.DataGroup;
-import org.apache.flex.html.supportClasses.StringItemRenderer;
-import org.apache.flex.net.HTTPService;
-import org.apache.flex.collections.parsers.JSONInputParser;
-import org.apache.flex.collections.LazyCollection;
-import org.apache.flex.utils.ViewSourceContextMenuOption;
-
-import models.MyModel;
-import controllers.MyController;
-
-public class DataBindingTest extends Application
-{
-
- public function DataBindingTest()
- {
- addEventListener("initialize", initializeHandler);
- var vi:SimpleCSSValuesImpl = new SimpleCSSValuesImpl();
- setupStyles(vi);
- valuesImpl = vi;
- initialView = new MyInitialView();
- model = new MyModel();
- controller = new MyController(this);
- service = new HTTPService();
- collection = new LazyCollection();
- collection.inputParser = new JSONInputParser();
- collection.itemConverter = new StockDataJSONItemConverter();
- service.addBead(collection);
- addBead(service);
- addBead(new ViewSourceContextMenuOption());
- }
-
- public var service:HTTPService;
- public var collection:LazyCollection;
-
- private function initializeHandler(event:Event):void
- {
- MyModel(model).stockSymbol="ADBE";
- }
-
- private function setupStyles(vi:SimpleCSSValuesImpl):void
- {
- var viv:Object = vi.values = {};
- viv["global"] =
- {
- fontFamily: "Arial",
- fontSize: 12
- };
-
- var o:Object;
-
- o = viv[makeDefinitionName("org.apache.flex.html::Container")] =
- {
-
- iBeadView: ContainerView
- };
-
- CONFIG::as_only {
- o.iBackgroundBead = SolidBackgroundBead;
- o.iBorderBead = SingleLineBorderBead;
- }
-
- viv[makeDefinitionName("org.apache.flex.html::List")] =
- {
- iBeadModel: ArraySelectionModel,
- iBeadView: ListView,
- iBeadController: ListSingleSelectionMouseController,
- iBeadLayout: VerticalScrollingLayout,
- iDataGroup: DataGroup,
- iDataProviderItemRendererMapper: DataItemRendererFactoryForArrayData,
- iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
- };
-
- o = viv[makeDefinitionName("org.apache.flex.html::Button")] =
- {
- backgroundColor: 0xd8d8d8,
- border: [1, "solid", 0x000000],
- padding: 4
- };
- CONFIG::as_only {
- o.iBeadView = CSSButtonView;
- }
-
- viv[makeDefinitionName("org.apache.flex.html::Button:hover")] =
- {
- backgroundColor: 0x9fa0a1,
- border: [1, "solid", 0x000000],
- padding: 4
- };
-
- viv[makeDefinitionName("org.apache.flex.html::Button:active")] =
- {
- backgroundColor: 0x929496,
- border: [1, "solid", 0x000000],
- padding: 4
- };
-
- CONFIG::as_only {
- viv["org.apache.flex.html::CheckBox"] =
- {
- iBeadModel: ToggleButtonModel,
- iBeadView: CheckBoxView
- };
-
- viv["org.apache.flex.html::DropDownList"] =
- {
- iBeadModel: ArraySelectionModel,
- iBeadView: DropDownListView,
- iBeadController: DropDownListController,
- iPopUp: DropDownListList
- };
-
- viv["org.apache.flex.html.supportClasses::DropDownListList"] =
- {
- iBeadModel: ArraySelectionModel,
- iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
- iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
- };
-
- viv["org.apache.flex.html::Label"] =
- {
- iBeadModel: TextModel,
- iBeadView: TextFieldView,
- iMeasurementBead: TextFieldLabelMeasurementBead
- };
-
- viv["org.apache.flex.html::List"] =
- {
- iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel
- };
-
- viv["org.apache.flex.html::RadioButton"] =
- {
- iBeadModel: ValueToggleButtonModel,
- iBeadView: RadioButtonView
- };
-
- viv["org.apache.flex.html::TextArea"] =
- {
- iBeadModel: TextModel,
- iBeadView: TextAreaView,
- iBeadController: EditableTextKeyboardController,
- iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel,
- width: 135,
- height: 20
- };
-
- viv["org.apache.flex.html::TextButton"] =
- {
- iBeadModel: TextModel,
- iBeadView: CSSTextButtonView,
- iMeasurementBead: TextButtonMeasurementBead
- };
-
- viv["org.apache.flex.html::TextInput"] =
- {
- iBeadModel: TextModel,
- iBeadView: TextInputWithBorderView,
- iBeadController: EditableTextKeyboardController,
- iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel,
- width: 135,
- height: 20
- };
-
- viv["org.apache.flex.html::ToggleTextButton"] =
- {
- iBeadModel: ToggleButtonModel,
- iBeadView: CSSTextButtonView
- };
-
- viv["org.apache.flex.html::SimpleList"] =
- {
- iBeadModel: ArraySelectionModel,
- iBeadView: ListView,
- iBeadController: ListSingleSelectionMouseController,
- iBeadLayout: VerticalScrollingLayout,
- iDataGroup: DataGroup,
- iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
- iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
- }
-
- viv["org.apache.flex.html.supportClasses::StringItemRenderer"] =
- {
- iBeadController: ItemRendererMouseController,
- height: 16
- }
- }
- }
-
- private function makeDefinitionName(s:String):String
- {
- CONFIG::js_only {
- s = s.replace(/\./g, "_");
- s = s.replace("::", "_");
- }
- return s;
- }
-}
-
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b6f8a80/examples/DataBindingExample_as/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/controllers/MyController.as b/examples/DataBindingExample_as/src/controllers/MyController.as
index 83c2cd5..2ee16ae 100644
--- a/examples/DataBindingExample_as/src/controllers/MyController.as
+++ b/examples/DataBindingExample_as/src/controllers/MyController.as
@@ -31,14 +31,14 @@ package controllers
{
if (app)
{
- this.app = app as DataBindingTest;
+ this.app = app as DataBindingExample;
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:DataBindingTest;
+ private var app:DataBindingExample;
private function viewChangeHandler(event:Event):void
{
@@ -73,7 +73,7 @@ package controllers
public function setDocument(document:Object, id:String = null):void
{
- this.app = document as DataBindingTest;
+ this.app = document as DataBindingExample;
app.addEventListener("viewChanged", viewChangeHandler);
}
[5/7] git commit: [flex-asjs] [refs/heads/develop] - fix warning
Posted by ah...@apache.org.
fix warning
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/81627427
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/81627427
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/81627427
Branch: refs/heads/develop
Commit: 81627427123a3448eea97592eb8b281a55cef004
Parents: 4b6f8a8
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 21 10:28:11 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 21 10:28:11 2015 -0700
----------------------------------------------------------------------
.../as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/81627427/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
index 56e1c08..fd741b4 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
@@ -92,7 +92,7 @@ package org.apache.flex.html.beads.layouts
var maxWidth:Number = 0;
// asking for contentView.width can result in infinite loop if host isn't sized already
var w:Number = hostSizedToContent ? 0 : contentView.width;
- var h = contentView.height;
+ var h:Number = contentView.height;
for (var i:int = 0; i < n; i++)
{
[7/7] git commit: [flex-asjs] [refs/heads/develop] - get as version
to compile and mostly run. Probably needs API to add styles so they can be
reflected into the JS/CSS.
Posted by ah...@apache.org.
get as version to compile and mostly run. Probably needs API to add styles so they can be reflected into the JS/CSS.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/002449f9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/002449f9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/002449f9
Branch: refs/heads/develop
Commit: 002449f929b021875e4023e6f3e28bcd9885a8cb
Parents: 3e32bbf
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 21 11:42:46 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 21 11:42:46 2015 -0700
----------------------------------------------------------------------
.../src/DataBindingExample.as | 37 +++++++++++++-------
1 file changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/002449f9/examples/DataBindingExample_as/src/DataBindingExample.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/DataBindingExample.as b/examples/DataBindingExample_as/src/DataBindingExample.as
index 5e7af98..d89b6f1 100644
--- a/examples/DataBindingExample_as/src/DataBindingExample.as
+++ b/examples/DataBindingExample_as/src/DataBindingExample.as
@@ -25,6 +25,7 @@ import org.apache.flex.core.SimpleCSSValuesImpl;
import org.apache.flex.events.Event;
import org.apache.flex.html.beads.CSSButtonView;
import org.apache.flex.html.beads.CSSTextButtonView;
+import org.apache.flex.html.beads.CSSTextToggleButtonView;
import org.apache.flex.html.beads.CheckBoxView;
import org.apache.flex.html.beads.ContainerView;
import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData;
@@ -43,7 +44,7 @@ import org.apache.flex.html.beads.controllers.DropDownListController;
import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
import org.apache.flex.html.beads.controllers.EditableTextKeyboardController;
import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController;
-import org.apache.flex.html.beads.layouts.VerticalScrollingLayout;
+import org.apache.flex.html.beads.layouts.VerticalLayout;
import org.apache.flex.html.beads.models.ArraySelectionModel;
import org.apache.flex.html.beads.models.SingleLineBorderModel;
import org.apache.flex.html.beads.models.TextModel;
@@ -51,6 +52,7 @@ import org.apache.flex.html.beads.models.ToggleButtonModel;
import org.apache.flex.html.beads.models.ValueToggleButtonModel;
import org.apache.flex.html.supportClasses.DropDownListList;
import org.apache.flex.html.supportClasses.DataGroup;
+import org.apache.flex.html.supportClasses.ScrollingViewport;
import org.apache.flex.html.supportClasses.StringItemRenderer;
import org.apache.flex.net.HTTPService;
import org.apache.flex.collections.parsers.JSONInputParser;
@@ -116,9 +118,10 @@ public class DataBindingExample extends Application
iBeadModel: ArraySelectionModel,
iBeadView: ListView,
iBeadController: ListSingleSelectionMouseController,
- iBeadLayout: VerticalScrollingLayout,
+ iBeadLayout: VerticalLayout,
iDataGroup: DataGroup,
iDataProviderItemRendererMapper: DataItemRendererFactoryForArrayData,
+ IViewport: ScrollingViewport,
iItemRendererClassFactory: ItemRendererClassFactory,
iItemRenderer: StringItemRenderer
};
@@ -167,7 +170,13 @@ public class DataBindingExample extends Application
iBeadModel: ArraySelectionModel,
iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
+ iItemRenderer: StringItemRenderer,
+ iBackgroundBead: SolidBackgroundBead,
+ borderStyle: "solid",
+ borderRadius: 4,
+ borderColor: 0,
+ borderWidth: 1,
+ backgroundColor: 0xFFFFFF
};
viv["org.apache.flex.html::Label"] =
@@ -196,8 +205,10 @@ public class DataBindingExample extends Application
iBeadController: EditableTextKeyboardController,
iBorderBead: SingleLineBorderBead,
iBorderModel: SingleLineBorderModel,
- width: 135,
- height: 20
+ borderStyle: "solid",
+ borderColor: 0,
+ borderWidth: 1,
+ backgroundColor: 0xFFFFFF
};
viv["org.apache.flex.html::TextButton"] =
@@ -213,15 +224,17 @@ public class DataBindingExample extends Application
iBeadView: TextInputWithBorderView,
iBeadController: EditableTextKeyboardController,
iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel,
- width: 135,
- height: 20
+ iBackgroundBead: SolidBackgroundBead,
+ borderStyle: "solid",
+ borderColor: 0,
+ borderWidth: 1,
+ backgroundColor: 0xFFFFFF
};
viv["org.apache.flex.html::ToggleTextButton"] =
{
iBeadModel: ToggleButtonModel,
- iBeadView: CSSTextButtonView
+ iBeadView: CSSTextToggleButtonView
};
viv["org.apache.flex.html::SimpleList"] =
@@ -229,9 +242,10 @@ public class DataBindingExample extends Application
iBeadModel: ArraySelectionModel,
iBeadView: ListView,
iBeadController: ListSingleSelectionMouseController,
- iBeadLayout: VerticalScrollingLayout,
+ iBeadLayout: VerticalLayout,
iDataGroup: DataGroup,
iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
+ IViewport: ScrollingViewport,
iItemRendererClassFactory: ItemRendererClassFactory,
iItemRenderer: StringItemRenderer
}
@@ -247,8 +261,7 @@ public class DataBindingExample extends Application
private function makeDefinitionName(s:String):String
{
CONFIG::js_only {
- s = s.replace(/\./g, "_");
- s = s.replace("::", "_");
+ s = s.replace("::", ".");
}
return s;
}
[3/7] git commit: [flex-asjs] [refs/heads/develop] - rename
DataBindingTest* to DataBindingExample*
Posted by ah...@apache.org.
rename DataBindingTest* to DataBindingExample*
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9c7e00b1
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9c7e00b1
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9c7e00b1
Branch: refs/heads/develop
Commit: 9c7e00b1c09c397933d84796a94fed044cfb5c49
Parents: b7fba06
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 21 09:36:11 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 21 09:36:11 2015 -0700
----------------------------------------------------------------------
examples/DataBindingExample/build.xml | 47 +++
.../DataBindingExample/src/DataBindingTest.mxml | 53 ++++
.../DataBindingExample/src/MyInitialView.mxml | 144 ++++++++++
examples/DataBindingExample/src/README.txt | 52 ++++
.../src/StockDataJSONItemConverter.as | 40 +++
.../src/controllers/MyController.as | 81 ++++++
.../DataBindingExample/src/models/MyModel.as | 125 ++++++++
examples/DataBindingExample_Flat/build.xml | 48 ++++
.../src/DataBindingTest.mxml | 53 ++++
.../src/MyInitialView.mxml | 144 ++++++++++
examples/DataBindingExample_Flat/src/README.txt | 52 ++++
.../src/StockDataJSONItemConverter.as | 40 +++
.../src/controllers/MyController.as | 81 ++++++
.../src/models/MyModel.as | 125 ++++++++
examples/DataBindingExample_as/build.xml | 47 +++
.../src/DataBindingTest.as | 257 +++++++++++++++++
.../DataBindingExample_as/src/MyInitialView.as | 283 +++++++++++++++++++
.../src/StockDataJSONItemConverter.as | 40 +++
.../src/controllers/MyController.as | 81 ++++++
.../DataBindingExample_as/src/models/MyModel.as | 127 +++++++++
examples/DataBindingTest/build.xml | 47 ---
.../DataBindingTest/src/DataBindingTest.mxml | 53 ----
examples/DataBindingTest/src/MyInitialView.mxml | 144 ----------
examples/DataBindingTest/src/README.txt | 52 ----
.../src/StockDataJSONItemConverter.as | 40 ---
.../src/controllers/MyController.as | 81 ------
examples/DataBindingTest/src/models/MyModel.as | 125 --------
examples/DataBindingTest_Flat/build.xml | 48 ----
.../src/DataBindingTest.mxml | 53 ----
.../DataBindingTest_Flat/src/MyInitialView.mxml | 144 ----------
examples/DataBindingTest_Flat/src/README.txt | 52 ----
.../src/StockDataJSONItemConverter.as | 40 ---
.../src/controllers/MyController.as | 81 ------
.../DataBindingTest_Flat/src/models/MyModel.as | 125 --------
examples/DataBindingTest_as/build.xml | 47 ---
.../DataBindingTest_as/src/DataBindingTest.as | 257 -----------------
.../DataBindingTest_as/src/MyInitialView.as | 283 -------------------
.../src/StockDataJSONItemConverter.as | 40 ---
.../src/controllers/MyController.as | 81 ------
.../DataBindingTest_as/src/models/MyModel.as | 127 ---------
40 files changed, 1920 insertions(+), 1920 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/build.xml b/examples/DataBindingExample/build.xml
new file mode 100644
index 0000000..9c551dd
--- /dev/null
+++ b/examples/DataBindingExample/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="databindingtest" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="DataBindingTest" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
+ <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/src/DataBindingTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/DataBindingTest.mxml b/examples/DataBindingExample/src/DataBindingTest.mxml
new file mode 100644
index 0000000..751e427
--- /dev/null
+++ b/examples/DataBindingExample/src/DataBindingTest.mxml
@@ -0,0 +1,53 @@
+<?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.*"
+ xmlns:controllers="controllers.*"
+ initialize="MyModel(model).stockSymbol='ADBE'"
+ >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:model>
+ <models:MyModel />
+ </js:model>
+ <js:controller>
+ <controllers:MyController />
+ </js:controller>
+ <js:beads>
+ <js:HTTPService id="service">
+ <js:LazyCollection id="collection">
+ <js:inputParser>
+ <js:JSONInputParser />
+ </js:inputParser>
+ <js:itemConverter>
+ <local:StockDataJSONItemConverter />
+ </js:itemConverter>
+ </js:LazyCollection>
+ </js:HTTPService>
+ <js:CSSFontFaceBead />
+ <js:ViewSourceContextMenuOption />
+ </js:beads>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/MyInitialView.mxml b/examples/DataBindingExample/src/MyInitialView.mxml
new file mode 100644
index 0000000..667254d
--- /dev/null
+++ b/examples/DataBindingExample/src/MyInitialView.mxml
@@ -0,0 +1,144 @@
+<?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:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ initComplete="initControls()">
+ <fx:Script>
+ <![CDATA[
+ import models.MyModel;
+
+ import org.apache.flex.events.CustomEvent;
+
+ private var _symbol:String;
+
+ public function get symbol():String
+ {
+ return _symbol;
+ }
+
+ public function get requestedField():String
+ {
+ return radio1.selectedValue as String;
+ }
+
+ [Bindable]
+ public var fieldText:String;
+
+ private function radioChanged(e:org.apache.flex.events.Event):void
+ {
+ dispatchEvent(new CustomEvent("radioClicked"));
+ fieldText = RadioButton(e.target).text;
+ }
+
+ private function initControls():void
+ {
+ list.selectedItem = MyModel(applicationModel).stockSymbol;
+ radio1.selectedValue = MyModel(applicationModel).requestedField;
+ if (radio1.selected)
+ fieldText = radio1.text;
+ else if (radio2.selected)
+ fieldText = radio2.text;
+ else if (radio3.selected)
+ fieldText = radio3.text;
+ else if (radio4.selected)
+ fieldText = radio4.text;
+
+ }
+
+ private function setState():void
+ {
+ currentState = showAllData.selected ? "showAll" : "hideAll";
+ }
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+
+ .output {
+ font-size: 20px;
+ }
+
+ .topContainer {
+ padding: 10px;
+
+ }
+ .leftSide {
+ vertical-align: top;
+ margin-right: 10px;
+ }
+
+ .rightSide {
+ vertical-align: top;
+ margin-left: 10px;
+ padding-left: 10px;
+ }
+
+ .quoteButton {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ }
+ </fx:Style>
+ <js:states>
+ <js:State name="hideAll" />
+ <js:State name="showAll" />
+ </js:states>
+ <js:beads>
+ <js:ViewBaseDataBinding />
+ </js:beads>
+ <js:Container x="0" y="0" className="topContainer" >
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:Label width="300" text="Enter Stock Symbol or choose from list:" />
+ <js:Container>
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Container className="leftSide">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:TextInput id="symbolTI" text="{MyModel(applicationModel).stockSymbol}" />
+ <js:TextButton text="Get Quote" className="quoteButton"
+ click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" />
+ <js:Label id="field" text="{fieldText}"/>
+ <js:Label className="output" height="24" text="{MyModel(applicationModel).responseText}" />
+ </js:Container>
+ <js:Container className="rightSide">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:DropDownList id="list" width="100"
+ change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))"
+ dataProvider="{MyModel(applicationModel).strings}" />
+ <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/>
+ <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/>
+ <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/>
+ <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/>
+ <js:CheckBox id="showAllData" text="Show All Data" change="setState()" />
+ </js:Container>
+ </js:Container>
+ <js:Label id="bindtest" text="{fieldText + ' expression binding'}" />
+ <js:Label width="300" text.showAll="110" includeIn="showAll" />
+ <js:TextArea id="ta" width="300" height="100" height.showAll="110"
+ includeIn="showAll"
+ text="{MyModel(applicationModel).allData}" />
+ </js:Container>
+</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/README.txt b/examples/DataBindingExample/src/README.txt
new file mode 100644
index 0000000..afe521b
--- /dev/null
+++ b/examples/DataBindingExample/src/README.txt
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+DESCRIPTION
+
+The DataBindingTest example shows a Flex application that can communicate with
+a third-party data source (in this case, yahoo.finance) and display the values
+returned using data binding.
+
+This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
+into JavaScript and HTML and run without Flash.
+
+The DataBindingTest example also shows how the model-view-controller (MVC) pattern
+can be used to separate the parts of the application. This is facilitated by
+the use of FlexJS beads added to the main application that provide the
+data connection (via HTTPService) and interacting with the rest of the application
+via events.
+
+COMPONENTS and BEADS
+
+- Button
+- CheckBox
+- ComboBox
+- Container
+- Label
+- RadioButton
+- TextArea
+- TextInput
+
+- Data binding: the text properties of TextArea and Label are linked with results
+from the remote server calls.
+
+NOTES
+
+The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
+should be addressed in future releases of the Falcon JX compiler.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/StockDataJSONItemConverter.as b/examples/DataBindingExample/src/StockDataJSONItemConverter.as
new file mode 100644
index 0000000..a39606b
--- /dev/null
+++ b/examples/DataBindingExample/src/StockDataJSONItemConverter.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.collections.converters.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"]["count"] == 0)
+ return "No Data";
+
+ obj = obj["query"]["results"]["quote"];
+ return obj;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/controllers/MyController.as b/examples/DataBindingExample/src/controllers/MyController.as
new file mode 100644
index 0000000..83c2cd5
--- /dev/null
+++ b/examples/DataBindingExample/src/controllers/MyController.as
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events.Event;
+
+ import org.apache.flex.core.Application;
+ import org.apache.flex.core.IDocument;
+
+ import models.MyModel;
+
+ public class MyController implements IDocument
+ {
+ public function MyController(app:Application = null)
+ {
+ if (app)
+ {
+ this.app = app as DataBindingTest;
+ 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:DataBindingTest;
+
+ private function viewChangeHandler(event:Event):void
+ {
+ app.initialView.addEventListener("buttonClicked", buttonClickHandler);
+ app.initialView.addEventListener("radioClicked", radioClickHandler);
+ app.initialView.addEventListener("listChanged", listChangedHandler);
+ }
+
+ 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 radioClickHandler(event:Event):void
+ {
+ var field:String = MyInitialView(app.initialView).requestedField;
+ MyModel(app.model).requestedField = field;
+ }
+
+ private function completeHandler(event:Event):void
+ {
+ MyModel(app.model).responseData = app.collection.getItemAt(0);
+ }
+
+ private function listChangedHandler(event:Event):void
+ {
+ MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.app = document as DataBindingTest;
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample/src/models/MyModel.as b/examples/DataBindingExample/src/models/MyModel.as
new file mode 100644
index 0000000..5a16d02
--- /dev/null
+++ b/examples/DataBindingExample/src/models/MyModel.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 _requestedField:String = "Ask";
+
+ [Bindable("requestedFieldChanged")]
+ public function get requestedField():String
+ {
+ return _requestedField;
+ }
+
+ public function set requestedField(value:String):void
+ {
+ if (value != _requestedField)
+ {
+ _requestedField = value;
+ dispatchEvent(new Event("requestedFieldChanged"));
+ if (_responseData)
+ dispatchEvent(new Event("responseTextChanged"));
+ }
+ }
+
+ [Bindable("responseTextChanged")]
+ public function get responseText():String
+ {
+ if (_responseData == null)
+ return "";
+ if (_responseData == "No Data")
+ return _responseData as String;
+ var s:String = _responseData[_requestedField];
+ if (s == null)
+ {
+ if (_requestedField == "Ask")
+ s = _responseData["Bid"];
+ }
+ return s;
+ }
+
+ private var _responseData:Object;
+
+ [Bindable("responseDataChanged")]
+ public function get responseData():Object
+ {
+ return _responseData;
+ }
+
+ public function set responseData(value:Object):void
+ {
+ if (value != _responseData)
+ {
+ _responseData = value;
+ _allData = "";
+ dispatchEvent(new Event("responseDataChanged"));
+ dispatchEvent(new Event("responseTextChanged"));
+ }
+ }
+
+ private var _allData:String = "";
+
+ [Bindable("responseDataChanged")]
+ public function get allData():String
+ {
+ if (_allData == "" && _responseData != null)
+ {
+ for (var p:String in _responseData)
+ {
+ _allData += p + ": " + _responseData[p] + "\n";
+ }
+ }
+ return _allData;
+ }
+
+
+ private var _stockSymbol:String;
+
+ [Bindable("stockSymbolChanged")]
+ public function get stockSymbol():String
+ {
+ return _stockSymbol;
+ }
+
+ public function set stockSymbol(value:String):void
+ {
+ if (value != _stockSymbol)
+ {
+ _stockSymbol = value;
+ dispatchEvent(new Event("stockSymbolChanged"));
+ }
+ }
+
+ private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+ [Bindable("__NoChangeEvent__")]
+ public function get strings():Array
+ {
+ return _strings;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/build.xml b/examples/DataBindingExample_Flat/build.xml
new file mode 100644
index 0000000..ab55f2f
--- /dev/null
+++ b/examples/DataBindingExample_Flat/build.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="databindingtest_flat" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="DataBindingTest" />
+ <property name="theme_arg" value="-theme=${FLEXJS_HOME}/frameworks/libs/Flat.swc" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
+ <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/src/DataBindingTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/DataBindingTest.mxml b/examples/DataBindingExample_Flat/src/DataBindingTest.mxml
new file mode 100644
index 0000000..751e427
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/DataBindingTest.mxml
@@ -0,0 +1,53 @@
+<?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.*"
+ xmlns:controllers="controllers.*"
+ initialize="MyModel(model).stockSymbol='ADBE'"
+ >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:model>
+ <models:MyModel />
+ </js:model>
+ <js:controller>
+ <controllers:MyController />
+ </js:controller>
+ <js:beads>
+ <js:HTTPService id="service">
+ <js:LazyCollection id="collection">
+ <js:inputParser>
+ <js:JSONInputParser />
+ </js:inputParser>
+ <js:itemConverter>
+ <local:StockDataJSONItemConverter />
+ </js:itemConverter>
+ </js:LazyCollection>
+ </js:HTTPService>
+ <js:CSSFontFaceBead />
+ <js:ViewSourceContextMenuOption />
+ </js:beads>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/MyInitialView.mxml b/examples/DataBindingExample_Flat/src/MyInitialView.mxml
new file mode 100644
index 0000000..b153ba5
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/MyInitialView.mxml
@@ -0,0 +1,144 @@
+<?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:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/flat"
+ initComplete="initControls()">
+ <fx:Script>
+ <![CDATA[
+ import models.MyModel;
+
+ import org.apache.flex.events.CustomEvent;
+
+ private var _symbol:String;
+
+ public function get symbol():String
+ {
+ return _symbol;
+ }
+
+ public function get requestedField():String
+ {
+ return radio1.selectedValue as String;
+ }
+
+ [Bindable]
+ public var fieldText:String;
+
+ private function radioChanged(e:org.apache.flex.events.Event):void
+ {
+ dispatchEvent(new CustomEvent("radioClicked"));
+ fieldText = RadioButton(e.target).text;
+ }
+
+ private function initControls():void
+ {
+ list.selectedItem = MyModel(applicationModel).stockSymbol;
+ radio1.selectedValue = MyModel(applicationModel).requestedField;
+ if (radio1.selected)
+ fieldText = radio1.text;
+ else if (radio2.selected)
+ fieldText = radio2.text;
+ else if (radio3.selected)
+ fieldText = radio3.text;
+ else if (radio4.selected)
+ fieldText = radio4.text;
+
+ }
+
+ private function setState():void
+ {
+ currentState = showAllData.selected ? "showAll" : "hideAll";
+ }
+ ]]>
+ </fx:Script>
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+
+ .output {
+ font-size: 20px;
+ }
+
+ .topContainer {
+ padding: 10px;
+
+ }
+ .leftSide {
+ vertical-align: top;
+ margin-right: 10px;
+ }
+
+ .rightSide {
+ vertical-align: top;
+ margin-left: 10px;
+ padding-left: 10px;
+ }
+
+ .quoteButton {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ }
+ </fx:Style>
+ <js:states>
+ <js:State name="hideAll" />
+ <js:State name="showAll" />
+ </js:states>
+ <js:beads>
+ <js:ViewBaseDataBinding />
+ </js:beads>
+ <js:Container x="0" y="0" className="topContainer" >
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:Label width="300" text="Enter Stock Symbol or choose from list:" />
+ <js:Container>
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Container className="leftSide">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:TextInput id="symbolTI" text="{MyModel(applicationModel).stockSymbol}" />
+ <js:TextButton text="Get Quote" className="quoteButton"
+ click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" />
+ <js:Label id="field" text="{fieldText}"/>
+ <js:Label className="output" height="24" text="{MyModel(applicationModel).responseText}" />
+ </js:Container>
+ <js:Container className="rightSide">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:DropDownList id="list" width="100"
+ change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))"
+ dataProvider="{MyModel(applicationModel).strings}" />
+ <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/>
+ <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/>
+ <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/>
+ <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/>
+ <js:CheckBox id="showAllData" text="Show All Data" change="setState()" />
+ </js:Container>
+ </js:Container>
+ <js:Label id="bindtest" text="{fieldText + ' expression binding'}" />
+ <js:Label width="300" text.showAll="110" includeIn="showAll" />
+ <js:TextArea id="ta" width="300" height="100" height.showAll="110"
+ includeIn="showAll"
+ text="{MyModel(applicationModel).allData}" />
+ </js:Container>
+</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/README.txt b/examples/DataBindingExample_Flat/src/README.txt
new file mode 100644
index 0000000..afe521b
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/README.txt
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+DESCRIPTION
+
+The DataBindingTest example shows a Flex application that can communicate with
+a third-party data source (in this case, yahoo.finance) and display the values
+returned using data binding.
+
+This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
+into JavaScript and HTML and run without Flash.
+
+The DataBindingTest example also shows how the model-view-controller (MVC) pattern
+can be used to separate the parts of the application. This is facilitated by
+the use of FlexJS beads added to the main application that provide the
+data connection (via HTTPService) and interacting with the rest of the application
+via events.
+
+COMPONENTS and BEADS
+
+- Button
+- CheckBox
+- ComboBox
+- Container
+- Label
+- RadioButton
+- TextArea
+- TextInput
+
+- Data binding: the text properties of TextArea and Label are linked with results
+from the remote server calls.
+
+NOTES
+
+The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
+should be addressed in future releases of the Falcon JX compiler.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/StockDataJSONItemConverter.as b/examples/DataBindingExample_Flat/src/StockDataJSONItemConverter.as
new file mode 100644
index 0000000..a39606b
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/StockDataJSONItemConverter.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.collections.converters.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"]["count"] == 0)
+ return "No Data";
+
+ obj = obj["query"]["results"]["quote"];
+ return obj;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/controllers/MyController.as b/examples/DataBindingExample_Flat/src/controllers/MyController.as
new file mode 100644
index 0000000..83c2cd5
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/controllers/MyController.as
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events.Event;
+
+ import org.apache.flex.core.Application;
+ import org.apache.flex.core.IDocument;
+
+ import models.MyModel;
+
+ public class MyController implements IDocument
+ {
+ public function MyController(app:Application = null)
+ {
+ if (app)
+ {
+ this.app = app as DataBindingTest;
+ 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:DataBindingTest;
+
+ private function viewChangeHandler(event:Event):void
+ {
+ app.initialView.addEventListener("buttonClicked", buttonClickHandler);
+ app.initialView.addEventListener("radioClicked", radioClickHandler);
+ app.initialView.addEventListener("listChanged", listChangedHandler);
+ }
+
+ 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 radioClickHandler(event:Event):void
+ {
+ var field:String = MyInitialView(app.initialView).requestedField;
+ MyModel(app.model).requestedField = field;
+ }
+
+ private function completeHandler(event:Event):void
+ {
+ MyModel(app.model).responseData = app.collection.getItemAt(0);
+ }
+
+ private function listChangedHandler(event:Event):void
+ {
+ MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.app = document as DataBindingTest;
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_Flat/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_Flat/src/models/MyModel.as b/examples/DataBindingExample_Flat/src/models/MyModel.as
new file mode 100644
index 0000000..5a16d02
--- /dev/null
+++ b/examples/DataBindingExample_Flat/src/models/MyModel.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 _requestedField:String = "Ask";
+
+ [Bindable("requestedFieldChanged")]
+ public function get requestedField():String
+ {
+ return _requestedField;
+ }
+
+ public function set requestedField(value:String):void
+ {
+ if (value != _requestedField)
+ {
+ _requestedField = value;
+ dispatchEvent(new Event("requestedFieldChanged"));
+ if (_responseData)
+ dispatchEvent(new Event("responseTextChanged"));
+ }
+ }
+
+ [Bindable("responseTextChanged")]
+ public function get responseText():String
+ {
+ if (_responseData == null)
+ return "";
+ if (_responseData == "No Data")
+ return _responseData as String;
+ var s:String = _responseData[_requestedField];
+ if (s == null)
+ {
+ if (_requestedField == "Ask")
+ s = _responseData["Bid"];
+ }
+ return s;
+ }
+
+ private var _responseData:Object;
+
+ [Bindable("responseDataChanged")]
+ public function get responseData():Object
+ {
+ return _responseData;
+ }
+
+ public function set responseData(value:Object):void
+ {
+ if (value != _responseData)
+ {
+ _responseData = value;
+ _allData = "";
+ dispatchEvent(new Event("responseDataChanged"));
+ dispatchEvent(new Event("responseTextChanged"));
+ }
+ }
+
+ private var _allData:String = "";
+
+ [Bindable("responseDataChanged")]
+ public function get allData():String
+ {
+ if (_allData == "" && _responseData != null)
+ {
+ for (var p:String in _responseData)
+ {
+ _allData += p + ": " + _responseData[p] + "\n";
+ }
+ }
+ return _allData;
+ }
+
+
+ private var _stockSymbol:String;
+
+ [Bindable("stockSymbolChanged")]
+ public function get stockSymbol():String
+ {
+ return _stockSymbol;
+ }
+
+ public function set stockSymbol(value:String):void
+ {
+ if (value != _stockSymbol)
+ {
+ _stockSymbol = value;
+ dispatchEvent(new Event("stockSymbolChanged"));
+ }
+ }
+
+ private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+ [Bindable("__NoChangeEvent__")]
+ public function get strings():Array
+ {
+ return _strings;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_as/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/build.xml b/examples/DataBindingExample_as/build.xml
new file mode 100644
index 0000000..3a04dfa
--- /dev/null
+++ b/examples/DataBindingExample_as/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="databindingtest_as" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="DataBindingTest" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
+ <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compileas,build_example.compileasjs" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_as/src/DataBindingTest.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/DataBindingTest.as b/examples/DataBindingExample_as/src/DataBindingTest.as
new file mode 100644
index 0000000..56d1a0e
--- /dev/null
+++ b/examples/DataBindingExample_as/src/DataBindingTest.as
@@ -0,0 +1,257 @@
+/**
+
+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.core.Application;
+import org.apache.flex.core.ItemRendererClassFactory;
+import org.apache.flex.core.SimpleCSSValuesImpl;
+import org.apache.flex.events.Event;
+import org.apache.flex.html.beads.CSSButtonView;
+import org.apache.flex.html.beads.CSSTextButtonView;
+import org.apache.flex.html.beads.CheckBoxView;
+import org.apache.flex.html.beads.ContainerView;
+import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData;
+import org.apache.flex.html.beads.DropDownListView;
+import org.apache.flex.html.beads.ListView;
+import org.apache.flex.html.beads.RadioButtonView;
+import org.apache.flex.html.beads.SingleLineBorderBead;
+import org.apache.flex.html.beads.SolidBackgroundBead;
+import org.apache.flex.html.beads.TextAreaView;
+import org.apache.flex.html.beads.TextButtonMeasurementBead;
+import org.apache.flex.html.beads.TextFieldLabelMeasurementBead;
+import org.apache.flex.html.beads.TextFieldView;
+import org.apache.flex.html.beads.TextInputWithBorderView;
+import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData;
+import org.apache.flex.html.beads.controllers.DropDownListController;
+import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
+import org.apache.flex.html.beads.controllers.EditableTextKeyboardController;
+import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController;
+import org.apache.flex.html.beads.layouts.VerticalScrollingLayout;
+import org.apache.flex.html.beads.models.ArraySelectionModel;
+import org.apache.flex.html.beads.models.SingleLineBorderModel;
+import org.apache.flex.html.beads.models.TextModel;
+import org.apache.flex.html.beads.models.ToggleButtonModel;
+import org.apache.flex.html.beads.models.ValueToggleButtonModel;
+import org.apache.flex.html.supportClasses.DropDownListList;
+import org.apache.flex.html.supportClasses.DataGroup;
+import org.apache.flex.html.supportClasses.StringItemRenderer;
+import org.apache.flex.net.HTTPService;
+import org.apache.flex.collections.parsers.JSONInputParser;
+import org.apache.flex.collections.LazyCollection;
+import org.apache.flex.utils.ViewSourceContextMenuOption;
+
+import models.MyModel;
+import controllers.MyController;
+
+public class DataBindingTest extends Application
+{
+
+ public function DataBindingTest()
+ {
+ addEventListener("initialize", initializeHandler);
+ var vi:SimpleCSSValuesImpl = new SimpleCSSValuesImpl();
+ setupStyles(vi);
+ valuesImpl = vi;
+ initialView = new MyInitialView();
+ model = new MyModel();
+ controller = new MyController(this);
+ service = new HTTPService();
+ collection = new LazyCollection();
+ collection.inputParser = new JSONInputParser();
+ collection.itemConverter = new StockDataJSONItemConverter();
+ service.addBead(collection);
+ addBead(service);
+ addBead(new ViewSourceContextMenuOption());
+ }
+
+ public var service:HTTPService;
+ public var collection:LazyCollection;
+
+ private function initializeHandler(event:Event):void
+ {
+ MyModel(model).stockSymbol="ADBE";
+ }
+
+ private function setupStyles(vi:SimpleCSSValuesImpl):void
+ {
+ var viv:Object = vi.values = {};
+ viv["global"] =
+ {
+ fontFamily: "Arial",
+ fontSize: 12
+ };
+
+ var o:Object;
+
+ o = viv[makeDefinitionName("org.apache.flex.html::Container")] =
+ {
+
+ iBeadView: ContainerView
+ };
+
+ CONFIG::as_only {
+ o.iBackgroundBead = SolidBackgroundBead;
+ o.iBorderBead = SingleLineBorderBead;
+ }
+
+ viv[makeDefinitionName("org.apache.flex.html::List")] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iBeadView: ListView,
+ iBeadController: ListSingleSelectionMouseController,
+ iBeadLayout: VerticalScrollingLayout,
+ iDataGroup: DataGroup,
+ iDataProviderItemRendererMapper: DataItemRendererFactoryForArrayData,
+ iItemRendererClassFactory: ItemRendererClassFactory,
+ iItemRenderer: StringItemRenderer
+ };
+
+ o = viv[makeDefinitionName("org.apache.flex.html::Button")] =
+ {
+ backgroundColor: 0xd8d8d8,
+ border: [1, "solid", 0x000000],
+ padding: 4
+ };
+ CONFIG::as_only {
+ o.iBeadView = CSSButtonView;
+ }
+
+ viv[makeDefinitionName("org.apache.flex.html::Button:hover")] =
+ {
+ backgroundColor: 0x9fa0a1,
+ border: [1, "solid", 0x000000],
+ padding: 4
+ };
+
+ viv[makeDefinitionName("org.apache.flex.html::Button:active")] =
+ {
+ backgroundColor: 0x929496,
+ border: [1, "solid", 0x000000],
+ padding: 4
+ };
+
+ CONFIG::as_only {
+ viv["org.apache.flex.html::CheckBox"] =
+ {
+ iBeadModel: ToggleButtonModel,
+ iBeadView: CheckBoxView
+ };
+
+ viv["org.apache.flex.html::DropDownList"] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iBeadView: DropDownListView,
+ iBeadController: DropDownListController,
+ iPopUp: DropDownListList
+ };
+
+ viv["org.apache.flex.html.supportClasses::DropDownListList"] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
+ iItemRendererClassFactory: ItemRendererClassFactory,
+ iItemRenderer: StringItemRenderer
+ };
+
+ viv["org.apache.flex.html::Label"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: TextFieldView,
+ iMeasurementBead: TextFieldLabelMeasurementBead
+ };
+
+ viv["org.apache.flex.html::List"] =
+ {
+ iBorderBead: SingleLineBorderBead,
+ iBorderModel: SingleLineBorderModel
+ };
+
+ viv["org.apache.flex.html::RadioButton"] =
+ {
+ iBeadModel: ValueToggleButtonModel,
+ iBeadView: RadioButtonView
+ };
+
+ viv["org.apache.flex.html::TextArea"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: TextAreaView,
+ iBeadController: EditableTextKeyboardController,
+ iBorderBead: SingleLineBorderBead,
+ iBorderModel: SingleLineBorderModel,
+ width: 135,
+ height: 20
+ };
+
+ viv["org.apache.flex.html::TextButton"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: CSSTextButtonView,
+ iMeasurementBead: TextButtonMeasurementBead
+ };
+
+ viv["org.apache.flex.html::TextInput"] =
+ {
+ iBeadModel: TextModel,
+ iBeadView: TextInputWithBorderView,
+ iBeadController: EditableTextKeyboardController,
+ iBorderBead: SingleLineBorderBead,
+ iBorderModel: SingleLineBorderModel,
+ width: 135,
+ height: 20
+ };
+
+ viv["org.apache.flex.html::ToggleTextButton"] =
+ {
+ iBeadModel: ToggleButtonModel,
+ iBeadView: CSSTextButtonView
+ };
+
+ viv["org.apache.flex.html::SimpleList"] =
+ {
+ iBeadModel: ArraySelectionModel,
+ iBeadView: ListView,
+ iBeadController: ListSingleSelectionMouseController,
+ iBeadLayout: VerticalScrollingLayout,
+ iDataGroup: DataGroup,
+ iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
+ iItemRendererClassFactory: ItemRendererClassFactory,
+ iItemRenderer: StringItemRenderer
+ }
+
+ viv["org.apache.flex.html.supportClasses::StringItemRenderer"] =
+ {
+ iBeadController: ItemRendererMouseController,
+ height: 16
+ }
+ }
+ }
+
+ private function makeDefinitionName(s:String):String
+ {
+ CONFIG::js_only {
+ s = s.replace(/\./g, "_");
+ s = s.replace("::", "_");
+ }
+ return s;
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_as/src/MyInitialView.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/MyInitialView.as b/examples/DataBindingExample_as/src/MyInitialView.as
new file mode 100644
index 0000000..1c31b58
--- /dev/null
+++ b/examples/DataBindingExample_as/src/MyInitialView.as
@@ -0,0 +1,283 @@
+/**
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package
+{
+
+//import mx.states.State;
+
+import models.MyModel;
+
+import org.apache.flex.binding.ConstantBinding;
+import org.apache.flex.binding.SimpleBinding;
+import org.apache.flex.core.SimpleCSSValuesImpl;
+import org.apache.flex.core.ValuesManager;
+import org.apache.flex.core.ViewBase;
+import org.apache.flex.events.CustomEvent;
+import org.apache.flex.events.Event;
+import org.apache.flex.html.CheckBox;
+import org.apache.flex.html.Container;
+import org.apache.flex.html.DropDownList;
+import org.apache.flex.html.Label;
+import org.apache.flex.html.RadioButton;
+import org.apache.flex.html.TextArea;
+import org.apache.flex.html.TextButton;
+import org.apache.flex.html.TextInput;
+import org.apache.flex.html.beads.layouts.HorizontalLayout;
+import org.apache.flex.html.beads.layouts.VerticalLayout;
+
+public class MyInitialView extends ViewBase
+{
+
+ public function MyInitialView()
+ {
+ addEventListener("initComplete", initCompleteHandler);
+ /*
+ var statesArray = [];
+ var state:State = new mx.states.State();
+ state.name = "hideAll";
+ statesArray.push(state);
+ state = new mx.states.State();
+ state.name = "showAll";
+ statesArray.push(state);
+ states = statesArray;
+ */
+ var vi:SimpleCSSValuesImpl = ValuesManager.valuesImpl as SimpleCSSValuesImpl;
+ var viv:Object = vi.values;
+ viv[".output"]= {
+ fontSize: 20
+ };
+
+ viv[".topContainer"] = {
+ padding: 10
+ };
+
+ viv[".leftSide"] = {
+ verticalAlign: "top",
+ marginRight: 10
+ }
+
+ viv[".rightSide"] = {
+ verticalAlign: "top",
+ marginLeft: 10,
+ paddingLeft: 10
+ }
+
+ viv[".quoteButton"] = {
+ marginTop: 10,
+ marginBottom: 10
+ }
+
+ }
+
+ private function initCompleteHandler(event:Event):void
+ {
+ initControls();
+ }
+
+ private var _symbol:String;
+
+ public function get symbol():String
+ {
+ return _symbol;
+ }
+
+ public function get requestedField():String
+ {
+ return radio1.selectedValue as String;
+ }
+
+ [Bindable]
+ public var fieldText:String;
+
+ private function radioChanged(e:org.apache.flex.events.Event):void
+ {
+ dispatchEvent(new CustomEvent("radioClicked"));
+ fieldText = RadioButton(e.target).text;
+ }
+
+ private function initControls():void
+ {
+ list.selectedItem = MyModel(applicationModel).stockSymbol;
+ radio1.selectedValue = MyModel(applicationModel).requestedField;
+ if (radio1.selected)
+ fieldText = radio1.text;
+ else if (radio2.selected)
+ fieldText = radio2.text;
+ else if (radio3.selected)
+ fieldText = radio3.text;
+ else if (radio4.selected)
+ fieldText = radio4.text;
+
+ }
+
+ private function setState():void
+ {
+ currentState = showAllData.selected ? "showAll" : "hideAll";
+ }
+
+ override public function get MXMLDescriptor():Array
+ {
+ var c:Container = new Container();
+ c.x = 0;
+ c.y = 0;
+ c.className = "topContainer";
+ c.addBead(new VerticalLayout());
+ addElement(c);
+ var l:Label = new Label();
+ l.width = 300;
+ l.text = "Enter Stock Symbol or choose from list:";
+ c.addElement(l);
+ var c2:Container = new Container();
+ c2.addBead(new HorizontalLayout());
+ c.addElement(c2);
+ var c3:Container = new Container();
+ c3.className = "leftSide";
+ c3.addBead(new VerticalLayout());
+ c2.addElement(c3);
+ symbolTI = new TextInput();
+ var sb:SimpleBinding = new SimpleBinding();
+ sb.sourceID = "applicationModel";
+ sb.sourcePropertyName = "stockSymbol";
+ sb.eventName = "stockSymbolChanged";
+ sb.destination = symbolTI;
+ sb.destinationPropertyName = "text";
+ sb.setDocument(this);
+ addBead(sb);
+ c3.addElement(symbolTI);
+ var tb:TextButton = new TextButton();
+ tb.text = "Get Quote";
+ tb.className = "quoteButton";
+ tb.addEventListener("click", tb_clickHandler);
+ c3.addElement(tb);
+ field = new Label();
+ sb = new SimpleBinding();
+ sb.sourcePropertyName = "fieldText";
+ sb.eventName = "valueChange";
+ sb.destination = field;
+ sb.destinationPropertyName = "text";
+ sb.setDocument(this);
+ addBead(sb);
+ c3.addElement(field);
+ output = new Label();
+ output.className = "output";
+ output.height=24;
+ sb = new SimpleBinding();
+ sb.sourceID = "applicationModel";
+ sb.sourcePropertyName = "responseText";
+ sb.eventName = "responseTextChanged";
+ sb.destination = output;
+ sb.destinationPropertyName = "text";
+ sb.setDocument(this);
+ addBead(sb);
+ c3.addElement(output);
+ c3.childrenAdded();
+
+ c3 = new Container();
+ c3.className="rightSide";
+ c3.addBead(new VerticalLayout());
+ c2.addElement(c3);
+ list = new DropDownList();
+ list.width=100;
+ list.height=17;
+ var cb:ConstantBinding = new ConstantBinding();
+ cb.sourceID = "applicationModel";
+ cb.sourcePropertyName = "strings";
+ cb.destination = list;
+ cb.destinationPropertyName = "dataProvider";
+ cb.setDocument(this);
+ addBead(cb);
+ list.addEventListener("change", list_changeHandler);
+ c3.addElement(list);
+ radio1 = new RadioButton();
+ radio1.text = "Price";
+ radio1.value = "Ask";
+ radio1.groupName = "group1";
+ radio1.addEventListener("change", radioChanged);
+ c3.addElement(radio1);
+ radio2 = new RadioButton();
+ radio2.text = "Change";
+ radio2.value = "Change";
+ radio2.groupName = "group1";
+ radio2.addEventListener("change", radioChanged);
+ c3.addElement(radio2);
+ radio3 = new RadioButton();
+ radio3.text = "Day's High";
+ radio3.value = "DaysHight";
+ radio3.groupName = "group1";
+ radio3.addEventListener("change", radioChanged);
+ c3.addElement(radio3);
+ radio4 = new RadioButton();
+ radio4.text = "Day's Low";
+ radio4.value = "DaysLow";
+ radio4.groupName = "group1";
+ radio4.addEventListener("change", radioChanged);
+ c3.addElement(radio4);
+ showAllData = new CheckBox();
+ showAllData.text = "Show All Data";
+ showAllData.addEventListener("change", showAllData_changeHandler);
+ c3.addElement(showAllData);
+ c3.childrenAdded();
+ ta = new TextArea();
+ ta.width = 300;
+ ta.height = 100;
+ sb = new SimpleBinding();
+ sb.sourceID = "applicationModel";
+ sb.sourcePropertyName = "allData";
+ sb.eventName = "responseDataChanged";
+ sb.destination = ta;
+ sb.destinationPropertyName = "text";
+ sb.setDocument(this);
+ addBead(sb);
+ c.addElement(ta);
+ c2.childrenAdded();
+ c.childrenAdded();
+
+ return super.MXMLDescriptor;
+
+ }
+
+ public var symbolTI:TextInput;
+ public var output:Label;
+ public var field:Label;
+ public var list:DropDownList;
+ public var radio1:RadioButton;
+ public var radio2:RadioButton;
+ public var radio3:RadioButton;
+ public var radio4:RadioButton;
+ public var showAllData:CheckBox;
+ public var ta:TextArea;
+
+ private function tb_clickHandler(event:Event):void
+ {
+ _symbol = symbolTI.text;
+ dispatchEvent(new CustomEvent('buttonClicked'));
+ }
+
+ private function list_changeHandler(event:Event):void
+ {
+ _symbol = list.selectedItem as String;
+ dispatchEvent(new CustomEvent('listChanged'));
+ }
+
+ private function showAllData_changeHandler(event:Event):void
+ {
+ setState();
+ }
+}
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_as/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/StockDataJSONItemConverter.as b/examples/DataBindingExample_as/src/StockDataJSONItemConverter.as
new file mode 100644
index 0000000..a39606b
--- /dev/null
+++ b/examples/DataBindingExample_as/src/StockDataJSONItemConverter.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.collections.converters.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"]["count"] == 0)
+ return "No Data";
+
+ obj = obj["query"]["results"]["quote"];
+ return obj;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_as/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/controllers/MyController.as b/examples/DataBindingExample_as/src/controllers/MyController.as
new file mode 100644
index 0000000..83c2cd5
--- /dev/null
+++ b/examples/DataBindingExample_as/src/controllers/MyController.as
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events.Event;
+
+ import org.apache.flex.core.Application;
+ import org.apache.flex.core.IDocument;
+
+ import models.MyModel;
+
+ public class MyController implements IDocument
+ {
+ public function MyController(app:Application = null)
+ {
+ if (app)
+ {
+ this.app = app as DataBindingTest;
+ 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:DataBindingTest;
+
+ private function viewChangeHandler(event:Event):void
+ {
+ app.initialView.addEventListener("buttonClicked", buttonClickHandler);
+ app.initialView.addEventListener("radioClicked", radioClickHandler);
+ app.initialView.addEventListener("listChanged", listChangedHandler);
+ }
+
+ 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 radioClickHandler(event:Event):void
+ {
+ var field:String = MyInitialView(app.initialView).requestedField;
+ MyModel(app.model).requestedField = field;
+ }
+
+ private function completeHandler(event:Event):void
+ {
+ MyModel(app.model).responseData = app.collection.getItemAt(0);
+ }
+
+ private function listChangedHandler(event:Event):void
+ {
+ MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.app = document as DataBindingTest;
+ app.addEventListener("viewChanged", viewChangeHandler);
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingExample_as/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingExample_as/src/models/MyModel.as b/examples/DataBindingExample_as/src/models/MyModel.as
new file mode 100644
index 0000000..4a17f22
--- /dev/null
+++ b/examples/DataBindingExample_as/src/models/MyModel.as
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 _requestedField:String = "Ask";
+
+ [Bindable("requestedFieldChanged")]
+ public function get requestedField():String
+ {
+ return _requestedField;
+ }
+
+ public function set requestedField(value:String):void
+ {
+ if (value != _requestedField)
+ {
+ _requestedField = value;
+ dispatchEvent(new Event("requestedFieldChanged"));
+ if (_responseData)
+ dispatchEvent(new Event("responseTextChanged"));
+ }
+ }
+
+ private var _responseText:String;
+
+ [Bindable("responseTextChanged")]
+ public function get responseText():String
+ {
+ if (_responseData == null)
+ return "";
+ if (_responseData == "No Data")
+ return _responseData as String;
+ var s:String = _responseData[_requestedField];
+ if (s == null)
+ {
+ if (_requestedField == "Ask")
+ s = _responseData["Bid"];
+ }
+ return s;
+ }
+
+ private var _responseData:Object;
+
+ [Bindable("responseDataChanged")]
+ public function get responseData():Object
+ {
+ return _responseData;
+ }
+
+ public function set responseData(value:Object):void
+ {
+ if (value != _responseData)
+ {
+ _responseData = value;
+ _allData = "";
+ dispatchEvent(new Event("responseDataChanged"));
+ dispatchEvent(new Event("responseTextChanged"));
+ }
+ }
+
+ private var _allData:String = "";
+
+ [Bindable("responseDataChanged")]
+ public function get allData():String
+ {
+ if (_allData == "" && _responseData != null)
+ {
+ for (var p:String in _responseData)
+ {
+ _allData += p + ": " + _responseData[p] + "\n";
+ }
+ }
+ return _allData;
+ }
+
+
+ private var _stockSymbol:String;
+
+ [Bindable("stockSymbolChanged")]
+ public function get stockSymbol():String
+ {
+ return _stockSymbol;
+ }
+
+ public function set stockSymbol(value:String):void
+ {
+ if (value != _stockSymbol)
+ {
+ _stockSymbol = value;
+ dispatchEvent(new Event("stockSymbolChanged"));
+ }
+ }
+
+ private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+ [Bindable("__NoChangeEvent__")]
+ public function get strings():Array
+ {
+ return _strings;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/build.xml b/examples/DataBindingTest/build.xml
deleted file mode 100644
index 9c551dd..0000000
--- a/examples/DataBindingTest/build.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-
-<project name="databindingtest" default="main" basedir=".">
- <property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="DataBindingTest" />
-
- <property file="${FLEXJS_HOME}/env.properties"/>
- <property environment="env"/>
- <property file="${FLEXJS_HOME}/build.properties"/>
- <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
- <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
- <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
- <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
-
- <include file="${basedir}/../build_example.xml" />
-
- <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
- </target>
-
- <target name="clean">
- <delete dir="${basedir}/bin" failonerror="false" />
- <delete dir="${basedir}/bin-debug" failonerror="false" />
- <delete dir="${basedir}/bin-release" failonerror="false" />
- </target>
-
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/src/DataBindingTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/src/DataBindingTest.mxml b/examples/DataBindingTest/src/DataBindingTest.mxml
deleted file mode 100644
index 751e427..0000000
--- a/examples/DataBindingTest/src/DataBindingTest.mxml
+++ /dev/null
@@ -1,53 +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.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).stockSymbol='ADBE'"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
- <js:controller>
- <controllers:MyController />
- </js:controller>
- <js:beads>
- <js:HTTPService id="service">
- <js:LazyCollection id="collection">
- <js:inputParser>
- <js:JSONInputParser />
- </js:inputParser>
- <js:itemConverter>
- <local:StockDataJSONItemConverter />
- </js:itemConverter>
- </js:LazyCollection>
- </js:HTTPService>
- <js:CSSFontFaceBead />
- <js:ViewSourceContextMenuOption />
- </js:beads>
-</js:Application>
[2/7] git commit: [flex-asjs] [refs/heads/develop] - rename
DataBindingTest* to DataBindingExample*
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/src/MyInitialView.mxml b/examples/DataBindingTest/src/MyInitialView.mxml
deleted file mode 100644
index 667254d..0000000
--- a/examples/DataBindingTest/src/MyInitialView.mxml
+++ /dev/null
@@ -1,144 +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:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:js="library://ns.apache.org/flexjs/basic"
- initComplete="initControls()">
- <fx:Script>
- <![CDATA[
- import models.MyModel;
-
- import org.apache.flex.events.CustomEvent;
-
- private var _symbol:String;
-
- public function get symbol():String
- {
- return _symbol;
- }
-
- public function get requestedField():String
- {
- return radio1.selectedValue as String;
- }
-
- [Bindable]
- public var fieldText:String;
-
- private function radioChanged(e:org.apache.flex.events.Event):void
- {
- dispatchEvent(new CustomEvent("radioClicked"));
- fieldText = RadioButton(e.target).text;
- }
-
- private function initControls():void
- {
- list.selectedItem = MyModel(applicationModel).stockSymbol;
- radio1.selectedValue = MyModel(applicationModel).requestedField;
- if (radio1.selected)
- fieldText = radio1.text;
- else if (radio2.selected)
- fieldText = radio2.text;
- else if (radio3.selected)
- fieldText = radio3.text;
- else if (radio4.selected)
- fieldText = radio4.text;
-
- }
-
- private function setState():void
- {
- currentState = showAllData.selected ? "showAll" : "hideAll";
- }
- ]]>
- </fx:Script>
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
-
- .output {
- font-size: 20px;
- }
-
- .topContainer {
- padding: 10px;
-
- }
- .leftSide {
- vertical-align: top;
- margin-right: 10px;
- }
-
- .rightSide {
- vertical-align: top;
- margin-left: 10px;
- padding-left: 10px;
- }
-
- .quoteButton {
- margin-top: 10px;
- margin-bottom: 10px;
- }
- </fx:Style>
- <js:states>
- <js:State name="hideAll" />
- <js:State name="showAll" />
- </js:states>
- <js:beads>
- <js:ViewBaseDataBinding />
- </js:beads>
- <js:Container x="0" y="0" className="topContainer" >
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:Label width="300" text="Enter Stock Symbol or choose from list:" />
- <js:Container>
- <js:beads>
- <js:HorizontalLayout />
- </js:beads>
- <js:Container className="leftSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:TextInput id="symbolTI" text="{MyModel(applicationModel).stockSymbol}" />
- <js:TextButton text="Get Quote" className="quoteButton"
- click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" />
- <js:Label id="field" text="{fieldText}"/>
- <js:Label className="output" height="24" text="{MyModel(applicationModel).responseText}" />
- </js:Container>
- <js:Container className="rightSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:DropDownList id="list" width="100"
- change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))"
- dataProvider="{MyModel(applicationModel).strings}" />
- <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/>
- <js:CheckBox id="showAllData" text="Show All Data" change="setState()" />
- </js:Container>
- </js:Container>
- <js:Label id="bindtest" text="{fieldText + ' expression binding'}" />
- <js:Label width="300" text.showAll="110" includeIn="showAll" />
- <js:TextArea id="ta" width="300" height="100" height.showAll="110"
- includeIn="showAll"
- text="{MyModel(applicationModel).allData}" />
- </js:Container>
-</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/src/README.txt b/examples/DataBindingTest/src/README.txt
deleted file mode 100644
index afe521b..0000000
--- a/examples/DataBindingTest/src/README.txt
+++ /dev/null
@@ -1,52 +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.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-DESCRIPTION
-
-The DataBindingTest example shows a Flex application that can communicate with
-a third-party data source (in this case, yahoo.finance) and display the values
-returned using data binding.
-
-This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
-into JavaScript and HTML and run without Flash.
-
-The DataBindingTest example also shows how the model-view-controller (MVC) pattern
-can be used to separate the parts of the application. This is facilitated by
-the use of FlexJS beads added to the main application that provide the
-data connection (via HTTPService) and interacting with the rest of the application
-via events.
-
-COMPONENTS and BEADS
-
-- Button
-- CheckBox
-- ComboBox
-- Container
-- Label
-- RadioButton
-- TextArea
-- TextInput
-
-- Data binding: the text properties of TextArea and Label are linked with results
-from the remote server calls.
-
-NOTES
-
-The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
-should be addressed in future releases of the Falcon JX compiler.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/src/StockDataJSONItemConverter.as b/examples/DataBindingTest/src/StockDataJSONItemConverter.as
deleted file mode 100644
index a39606b..0000000
--- a/examples/DataBindingTest/src/StockDataJSONItemConverter.as
+++ /dev/null
@@ -1,40 +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.collections.converters.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"]["count"] == 0)
- return "No Data";
-
- obj = obj["query"]["results"]["quote"];
- return obj;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/src/controllers/MyController.as b/examples/DataBindingTest/src/controllers/MyController.as
deleted file mode 100644
index 83c2cd5..0000000
--- a/examples/DataBindingTest/src/controllers/MyController.as
+++ /dev/null
@@ -1,81 +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.events.Event;
-
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
-
- import models.MyModel;
-
- public class MyController implements IDocument
- {
- public function MyController(app:Application = null)
- {
- if (app)
- {
- this.app = app as DataBindingTest;
- 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:DataBindingTest;
-
- private function viewChangeHandler(event:Event):void
- {
- app.initialView.addEventListener("buttonClicked", buttonClickHandler);
- app.initialView.addEventListener("radioClicked", radioClickHandler);
- app.initialView.addEventListener("listChanged", listChangedHandler);
- }
-
- 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 radioClickHandler(event:Event):void
- {
- var field:String = MyInitialView(app.initialView).requestedField;
- MyModel(app.model).requestedField = field;
- }
-
- private function completeHandler(event:Event):void
- {
- MyModel(app.model).responseData = app.collection.getItemAt(0);
- }
-
- private function listChangedHandler(event:Event):void
- {
- MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
- }
-
- public function setDocument(document:Object, id:String = null):void
- {
- this.app = document as DataBindingTest;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest/src/models/MyModel.as b/examples/DataBindingTest/src/models/MyModel.as
deleted file mode 100644
index 5a16d02..0000000
--- a/examples/DataBindingTest/src/models/MyModel.as
+++ /dev/null
@@ -1,125 +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 _requestedField:String = "Ask";
-
- [Bindable("requestedFieldChanged")]
- public function get requestedField():String
- {
- return _requestedField;
- }
-
- public function set requestedField(value:String):void
- {
- if (value != _requestedField)
- {
- _requestedField = value;
- dispatchEvent(new Event("requestedFieldChanged"));
- if (_responseData)
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- [Bindable("responseTextChanged")]
- public function get responseText():String
- {
- if (_responseData == null)
- return "";
- if (_responseData == "No Data")
- return _responseData as String;
- var s:String = _responseData[_requestedField];
- if (s == null)
- {
- if (_requestedField == "Ask")
- s = _responseData["Bid"];
- }
- return s;
- }
-
- private var _responseData:Object;
-
- [Bindable("responseDataChanged")]
- public function get responseData():Object
- {
- return _responseData;
- }
-
- public function set responseData(value:Object):void
- {
- if (value != _responseData)
- {
- _responseData = value;
- _allData = "";
- dispatchEvent(new Event("responseDataChanged"));
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _allData:String = "";
-
- [Bindable("responseDataChanged")]
- public function get allData():String
- {
- if (_allData == "" && _responseData != null)
- {
- for (var p:String in _responseData)
- {
- _allData += p + ": " + _responseData[p] + "\n";
- }
- }
- return _allData;
- }
-
-
- private var _stockSymbol:String;
-
- [Bindable("stockSymbolChanged")]
- public function get stockSymbol():String
- {
- return _stockSymbol;
- }
-
- public function set stockSymbol(value:String):void
- {
- if (value != _stockSymbol)
- {
- _stockSymbol = value;
- dispatchEvent(new Event("stockSymbolChanged"));
- }
- }
-
- private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
- [Bindable("__NoChangeEvent__")]
- public function get strings():Array
- {
- return _strings;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/build.xml b/examples/DataBindingTest_Flat/build.xml
deleted file mode 100644
index ab55f2f..0000000
--- a/examples/DataBindingTest_Flat/build.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-
-<project name="databindingtest_flat" default="main" basedir=".">
- <property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="DataBindingTest" />
- <property name="theme_arg" value="-theme=${FLEXJS_HOME}/frameworks/libs/Flat.swc" />
-
- <property file="${FLEXJS_HOME}/env.properties"/>
- <property environment="env"/>
- <property file="${FLEXJS_HOME}/build.properties"/>
- <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
- <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
- <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
- <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
-
- <include file="${basedir}/../build_example.xml" />
-
- <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
- </target>
-
- <target name="clean">
- <delete dir="${basedir}/bin" failonerror="false" />
- <delete dir="${basedir}/bin-debug" failonerror="false" />
- <delete dir="${basedir}/bin-release" failonerror="false" />
- </target>
-
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/src/DataBindingTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/src/DataBindingTest.mxml b/examples/DataBindingTest_Flat/src/DataBindingTest.mxml
deleted file mode 100644
index 751e427..0000000
--- a/examples/DataBindingTest_Flat/src/DataBindingTest.mxml
+++ /dev/null
@@ -1,53 +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.*"
- xmlns:controllers="controllers.*"
- initialize="MyModel(model).stockSymbol='ADBE'"
- >
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl />
- </js:valuesImpl>
- <js:initialView>
- <local:MyInitialView />
- </js:initialView>
- <js:model>
- <models:MyModel />
- </js:model>
- <js:controller>
- <controllers:MyController />
- </js:controller>
- <js:beads>
- <js:HTTPService id="service">
- <js:LazyCollection id="collection">
- <js:inputParser>
- <js:JSONInputParser />
- </js:inputParser>
- <js:itemConverter>
- <local:StockDataJSONItemConverter />
- </js:itemConverter>
- </js:LazyCollection>
- </js:HTTPService>
- <js:CSSFontFaceBead />
- <js:ViewSourceContextMenuOption />
- </js:beads>
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/src/MyInitialView.mxml b/examples/DataBindingTest_Flat/src/MyInitialView.mxml
deleted file mode 100644
index b153ba5..0000000
--- a/examples/DataBindingTest_Flat/src/MyInitialView.mxml
+++ /dev/null
@@ -1,144 +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:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:js="library://ns.apache.org/flexjs/flat"
- initComplete="initControls()">
- <fx:Script>
- <![CDATA[
- import models.MyModel;
-
- import org.apache.flex.events.CustomEvent;
-
- private var _symbol:String;
-
- public function get symbol():String
- {
- return _symbol;
- }
-
- public function get requestedField():String
- {
- return radio1.selectedValue as String;
- }
-
- [Bindable]
- public var fieldText:String;
-
- private function radioChanged(e:org.apache.flex.events.Event):void
- {
- dispatchEvent(new CustomEvent("radioClicked"));
- fieldText = RadioButton(e.target).text;
- }
-
- private function initControls():void
- {
- list.selectedItem = MyModel(applicationModel).stockSymbol;
- radio1.selectedValue = MyModel(applicationModel).requestedField;
- if (radio1.selected)
- fieldText = radio1.text;
- else if (radio2.selected)
- fieldText = radio2.text;
- else if (radio3.selected)
- fieldText = radio3.text;
- else if (radio4.selected)
- fieldText = radio4.text;
-
- }
-
- private function setState():void
- {
- currentState = showAllData.selected ? "showAll" : "hideAll";
- }
- ]]>
- </fx:Script>
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
-
- .output {
- font-size: 20px;
- }
-
- .topContainer {
- padding: 10px;
-
- }
- .leftSide {
- vertical-align: top;
- margin-right: 10px;
- }
-
- .rightSide {
- vertical-align: top;
- margin-left: 10px;
- padding-left: 10px;
- }
-
- .quoteButton {
- margin-top: 10px;
- margin-bottom: 10px;
- }
- </fx:Style>
- <js:states>
- <js:State name="hideAll" />
- <js:State name="showAll" />
- </js:states>
- <js:beads>
- <js:ViewBaseDataBinding />
- </js:beads>
- <js:Container x="0" y="0" className="topContainer" >
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:Label width="300" text="Enter Stock Symbol or choose from list:" />
- <js:Container>
- <js:beads>
- <js:HorizontalLayout />
- </js:beads>
- <js:Container className="leftSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:TextInput id="symbolTI" text="{MyModel(applicationModel).stockSymbol}" />
- <js:TextButton text="Get Quote" className="quoteButton"
- click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" />
- <js:Label id="field" text="{fieldText}"/>
- <js:Label className="output" height="24" text="{MyModel(applicationModel).responseText}" />
- </js:Container>
- <js:Container className="rightSide">
- <js:beads>
- <js:VerticalLayout />
- </js:beads>
- <js:DropDownList id="list" width="100"
- change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))"
- dataProvider="{MyModel(applicationModel).strings}" />
- <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/>
- <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/>
- <js:CheckBox id="showAllData" text="Show All Data" change="setState()" />
- </js:Container>
- </js:Container>
- <js:Label id="bindtest" text="{fieldText + ' expression binding'}" />
- <js:Label width="300" text.showAll="110" includeIn="showAll" />
- <js:TextArea id="ta" width="300" height="100" height.showAll="110"
- includeIn="showAll"
- text="{MyModel(applicationModel).allData}" />
- </js:Container>
-</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/src/README.txt b/examples/DataBindingTest_Flat/src/README.txt
deleted file mode 100644
index afe521b..0000000
--- a/examples/DataBindingTest_Flat/src/README.txt
+++ /dev/null
@@ -1,52 +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.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-DESCRIPTION
-
-The DataBindingTest example shows a Flex application that can communicate with
-a third-party data source (in this case, yahoo.finance) and display the values
-returned using data binding.
-
-This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
-into JavaScript and HTML and run without Flash.
-
-The DataBindingTest example also shows how the model-view-controller (MVC) pattern
-can be used to separate the parts of the application. This is facilitated by
-the use of FlexJS beads added to the main application that provide the
-data connection (via HTTPService) and interacting with the rest of the application
-via events.
-
-COMPONENTS and BEADS
-
-- Button
-- CheckBox
-- ComboBox
-- Container
-- Label
-- RadioButton
-- TextArea
-- TextInput
-
-- Data binding: the text properties of TextArea and Label are linked with results
-from the remote server calls.
-
-NOTES
-
-The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
-should be addressed in future releases of the Falcon JX compiler.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/src/StockDataJSONItemConverter.as b/examples/DataBindingTest_Flat/src/StockDataJSONItemConverter.as
deleted file mode 100644
index a39606b..0000000
--- a/examples/DataBindingTest_Flat/src/StockDataJSONItemConverter.as
+++ /dev/null
@@ -1,40 +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.collections.converters.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"]["count"] == 0)
- return "No Data";
-
- obj = obj["query"]["results"]["quote"];
- return obj;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/src/controllers/MyController.as b/examples/DataBindingTest_Flat/src/controllers/MyController.as
deleted file mode 100644
index 83c2cd5..0000000
--- a/examples/DataBindingTest_Flat/src/controllers/MyController.as
+++ /dev/null
@@ -1,81 +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.events.Event;
-
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
-
- import models.MyModel;
-
- public class MyController implements IDocument
- {
- public function MyController(app:Application = null)
- {
- if (app)
- {
- this.app = app as DataBindingTest;
- 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:DataBindingTest;
-
- private function viewChangeHandler(event:Event):void
- {
- app.initialView.addEventListener("buttonClicked", buttonClickHandler);
- app.initialView.addEventListener("radioClicked", radioClickHandler);
- app.initialView.addEventListener("listChanged", listChangedHandler);
- }
-
- 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 radioClickHandler(event:Event):void
- {
- var field:String = MyInitialView(app.initialView).requestedField;
- MyModel(app.model).requestedField = field;
- }
-
- private function completeHandler(event:Event):void
- {
- MyModel(app.model).responseData = app.collection.getItemAt(0);
- }
-
- private function listChangedHandler(event:Event):void
- {
- MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
- }
-
- public function setDocument(document:Object, id:String = null):void
- {
- this.app = document as DataBindingTest;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_Flat/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_Flat/src/models/MyModel.as b/examples/DataBindingTest_Flat/src/models/MyModel.as
deleted file mode 100644
index 5a16d02..0000000
--- a/examples/DataBindingTest_Flat/src/models/MyModel.as
+++ /dev/null
@@ -1,125 +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 _requestedField:String = "Ask";
-
- [Bindable("requestedFieldChanged")]
- public function get requestedField():String
- {
- return _requestedField;
- }
-
- public function set requestedField(value:String):void
- {
- if (value != _requestedField)
- {
- _requestedField = value;
- dispatchEvent(new Event("requestedFieldChanged"));
- if (_responseData)
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- [Bindable("responseTextChanged")]
- public function get responseText():String
- {
- if (_responseData == null)
- return "";
- if (_responseData == "No Data")
- return _responseData as String;
- var s:String = _responseData[_requestedField];
- if (s == null)
- {
- if (_requestedField == "Ask")
- s = _responseData["Bid"];
- }
- return s;
- }
-
- private var _responseData:Object;
-
- [Bindable("responseDataChanged")]
- public function get responseData():Object
- {
- return _responseData;
- }
-
- public function set responseData(value:Object):void
- {
- if (value != _responseData)
- {
- _responseData = value;
- _allData = "";
- dispatchEvent(new Event("responseDataChanged"));
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _allData:String = "";
-
- [Bindable("responseDataChanged")]
- public function get allData():String
- {
- if (_allData == "" && _responseData != null)
- {
- for (var p:String in _responseData)
- {
- _allData += p + ": " + _responseData[p] + "\n";
- }
- }
- return _allData;
- }
-
-
- private var _stockSymbol:String;
-
- [Bindable("stockSymbolChanged")]
- public function get stockSymbol():String
- {
- return _stockSymbol;
- }
-
- public function set stockSymbol(value:String):void
- {
- if (value != _stockSymbol)
- {
- _stockSymbol = value;
- dispatchEvent(new Event("stockSymbolChanged"));
- }
- }
-
- private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
- [Bindable("__NoChangeEvent__")]
- public function get strings():Array
- {
- return _strings;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_as/build.xml
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_as/build.xml b/examples/DataBindingTest_as/build.xml
deleted file mode 100644
index 3a04dfa..0000000
--- a/examples/DataBindingTest_as/build.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-
-<project name="databindingtest_as" default="main" basedir=".">
- <property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="DataBindingTest" />
-
- <property file="${FLEXJS_HOME}/env.properties"/>
- <property environment="env"/>
- <property file="${FLEXJS_HOME}/build.properties"/>
- <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
- <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
- <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
- <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
-
- <include file="${basedir}/../build_example.xml" />
-
- <target name="main" depends="clean,build_example.compileas,build_example.compileasjs" description="Clean build of ${example}">
- </target>
-
- <target name="clean">
- <delete dir="${basedir}/bin" failonerror="false" />
- <delete dir="${basedir}/bin-debug" failonerror="false" />
- <delete dir="${basedir}/bin-release" failonerror="false" />
- </target>
-
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_as/src/DataBindingTest.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_as/src/DataBindingTest.as b/examples/DataBindingTest_as/src/DataBindingTest.as
deleted file mode 100644
index 56d1a0e..0000000
--- a/examples/DataBindingTest_as/src/DataBindingTest.as
+++ /dev/null
@@ -1,257 +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.core.Application;
-import org.apache.flex.core.ItemRendererClassFactory;
-import org.apache.flex.core.SimpleCSSValuesImpl;
-import org.apache.flex.events.Event;
-import org.apache.flex.html.beads.CSSButtonView;
-import org.apache.flex.html.beads.CSSTextButtonView;
-import org.apache.flex.html.beads.CheckBoxView;
-import org.apache.flex.html.beads.ContainerView;
-import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData;
-import org.apache.flex.html.beads.DropDownListView;
-import org.apache.flex.html.beads.ListView;
-import org.apache.flex.html.beads.RadioButtonView;
-import org.apache.flex.html.beads.SingleLineBorderBead;
-import org.apache.flex.html.beads.SolidBackgroundBead;
-import org.apache.flex.html.beads.TextAreaView;
-import org.apache.flex.html.beads.TextButtonMeasurementBead;
-import org.apache.flex.html.beads.TextFieldLabelMeasurementBead;
-import org.apache.flex.html.beads.TextFieldView;
-import org.apache.flex.html.beads.TextInputWithBorderView;
-import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData;
-import org.apache.flex.html.beads.controllers.DropDownListController;
-import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
-import org.apache.flex.html.beads.controllers.EditableTextKeyboardController;
-import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController;
-import org.apache.flex.html.beads.layouts.VerticalScrollingLayout;
-import org.apache.flex.html.beads.models.ArraySelectionModel;
-import org.apache.flex.html.beads.models.SingleLineBorderModel;
-import org.apache.flex.html.beads.models.TextModel;
-import org.apache.flex.html.beads.models.ToggleButtonModel;
-import org.apache.flex.html.beads.models.ValueToggleButtonModel;
-import org.apache.flex.html.supportClasses.DropDownListList;
-import org.apache.flex.html.supportClasses.DataGroup;
-import org.apache.flex.html.supportClasses.StringItemRenderer;
-import org.apache.flex.net.HTTPService;
-import org.apache.flex.collections.parsers.JSONInputParser;
-import org.apache.flex.collections.LazyCollection;
-import org.apache.flex.utils.ViewSourceContextMenuOption;
-
-import models.MyModel;
-import controllers.MyController;
-
-public class DataBindingTest extends Application
-{
-
- public function DataBindingTest()
- {
- addEventListener("initialize", initializeHandler);
- var vi:SimpleCSSValuesImpl = new SimpleCSSValuesImpl();
- setupStyles(vi);
- valuesImpl = vi;
- initialView = new MyInitialView();
- model = new MyModel();
- controller = new MyController(this);
- service = new HTTPService();
- collection = new LazyCollection();
- collection.inputParser = new JSONInputParser();
- collection.itemConverter = new StockDataJSONItemConverter();
- service.addBead(collection);
- addBead(service);
- addBead(new ViewSourceContextMenuOption());
- }
-
- public var service:HTTPService;
- public var collection:LazyCollection;
-
- private function initializeHandler(event:Event):void
- {
- MyModel(model).stockSymbol="ADBE";
- }
-
- private function setupStyles(vi:SimpleCSSValuesImpl):void
- {
- var viv:Object = vi.values = {};
- viv["global"] =
- {
- fontFamily: "Arial",
- fontSize: 12
- };
-
- var o:Object;
-
- o = viv[makeDefinitionName("org.apache.flex.html::Container")] =
- {
-
- iBeadView: ContainerView
- };
-
- CONFIG::as_only {
- o.iBackgroundBead = SolidBackgroundBead;
- o.iBorderBead = SingleLineBorderBead;
- }
-
- viv[makeDefinitionName("org.apache.flex.html::List")] =
- {
- iBeadModel: ArraySelectionModel,
- iBeadView: ListView,
- iBeadController: ListSingleSelectionMouseController,
- iBeadLayout: VerticalScrollingLayout,
- iDataGroup: DataGroup,
- iDataProviderItemRendererMapper: DataItemRendererFactoryForArrayData,
- iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
- };
-
- o = viv[makeDefinitionName("org.apache.flex.html::Button")] =
- {
- backgroundColor: 0xd8d8d8,
- border: [1, "solid", 0x000000],
- padding: 4
- };
- CONFIG::as_only {
- o.iBeadView = CSSButtonView;
- }
-
- viv[makeDefinitionName("org.apache.flex.html::Button:hover")] =
- {
- backgroundColor: 0x9fa0a1,
- border: [1, "solid", 0x000000],
- padding: 4
- };
-
- viv[makeDefinitionName("org.apache.flex.html::Button:active")] =
- {
- backgroundColor: 0x929496,
- border: [1, "solid", 0x000000],
- padding: 4
- };
-
- CONFIG::as_only {
- viv["org.apache.flex.html::CheckBox"] =
- {
- iBeadModel: ToggleButtonModel,
- iBeadView: CheckBoxView
- };
-
- viv["org.apache.flex.html::DropDownList"] =
- {
- iBeadModel: ArraySelectionModel,
- iBeadView: DropDownListView,
- iBeadController: DropDownListController,
- iPopUp: DropDownListList
- };
-
- viv["org.apache.flex.html.supportClasses::DropDownListList"] =
- {
- iBeadModel: ArraySelectionModel,
- iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
- iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
- };
-
- viv["org.apache.flex.html::Label"] =
- {
- iBeadModel: TextModel,
- iBeadView: TextFieldView,
- iMeasurementBead: TextFieldLabelMeasurementBead
- };
-
- viv["org.apache.flex.html::List"] =
- {
- iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel
- };
-
- viv["org.apache.flex.html::RadioButton"] =
- {
- iBeadModel: ValueToggleButtonModel,
- iBeadView: RadioButtonView
- };
-
- viv["org.apache.flex.html::TextArea"] =
- {
- iBeadModel: TextModel,
- iBeadView: TextAreaView,
- iBeadController: EditableTextKeyboardController,
- iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel,
- width: 135,
- height: 20
- };
-
- viv["org.apache.flex.html::TextButton"] =
- {
- iBeadModel: TextModel,
- iBeadView: CSSTextButtonView,
- iMeasurementBead: TextButtonMeasurementBead
- };
-
- viv["org.apache.flex.html::TextInput"] =
- {
- iBeadModel: TextModel,
- iBeadView: TextInputWithBorderView,
- iBeadController: EditableTextKeyboardController,
- iBorderBead: SingleLineBorderBead,
- iBorderModel: SingleLineBorderModel,
- width: 135,
- height: 20
- };
-
- viv["org.apache.flex.html::ToggleTextButton"] =
- {
- iBeadModel: ToggleButtonModel,
- iBeadView: CSSTextButtonView
- };
-
- viv["org.apache.flex.html::SimpleList"] =
- {
- iBeadModel: ArraySelectionModel,
- iBeadView: ListView,
- iBeadController: ListSingleSelectionMouseController,
- iBeadLayout: VerticalScrollingLayout,
- iDataGroup: DataGroup,
- iDataProviderItemRendererMapper: TextItemRendererFactoryForArrayData,
- iItemRendererClassFactory: ItemRendererClassFactory,
- iItemRenderer: StringItemRenderer
- }
-
- viv["org.apache.flex.html.supportClasses::StringItemRenderer"] =
- {
- iBeadController: ItemRendererMouseController,
- height: 16
- }
- }
- }
-
- private function makeDefinitionName(s:String):String
- {
- CONFIG::js_only {
- s = s.replace(/\./g, "_");
- s = s.replace("::", "_");
- }
- return s;
- }
-}
-
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_as/src/MyInitialView.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_as/src/MyInitialView.as b/examples/DataBindingTest_as/src/MyInitialView.as
deleted file mode 100644
index 1c31b58..0000000
--- a/examples/DataBindingTest_as/src/MyInitialView.as
+++ /dev/null
@@ -1,283 +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 mx.states.State;
-
-import models.MyModel;
-
-import org.apache.flex.binding.ConstantBinding;
-import org.apache.flex.binding.SimpleBinding;
-import org.apache.flex.core.SimpleCSSValuesImpl;
-import org.apache.flex.core.ValuesManager;
-import org.apache.flex.core.ViewBase;
-import org.apache.flex.events.CustomEvent;
-import org.apache.flex.events.Event;
-import org.apache.flex.html.CheckBox;
-import org.apache.flex.html.Container;
-import org.apache.flex.html.DropDownList;
-import org.apache.flex.html.Label;
-import org.apache.flex.html.RadioButton;
-import org.apache.flex.html.TextArea;
-import org.apache.flex.html.TextButton;
-import org.apache.flex.html.TextInput;
-import org.apache.flex.html.beads.layouts.HorizontalLayout;
-import org.apache.flex.html.beads.layouts.VerticalLayout;
-
-public class MyInitialView extends ViewBase
-{
-
- public function MyInitialView()
- {
- addEventListener("initComplete", initCompleteHandler);
- /*
- var statesArray = [];
- var state:State = new mx.states.State();
- state.name = "hideAll";
- statesArray.push(state);
- state = new mx.states.State();
- state.name = "showAll";
- statesArray.push(state);
- states = statesArray;
- */
- var vi:SimpleCSSValuesImpl = ValuesManager.valuesImpl as SimpleCSSValuesImpl;
- var viv:Object = vi.values;
- viv[".output"]= {
- fontSize: 20
- };
-
- viv[".topContainer"] = {
- padding: 10
- };
-
- viv[".leftSide"] = {
- verticalAlign: "top",
- marginRight: 10
- }
-
- viv[".rightSide"] = {
- verticalAlign: "top",
- marginLeft: 10,
- paddingLeft: 10
- }
-
- viv[".quoteButton"] = {
- marginTop: 10,
- marginBottom: 10
- }
-
- }
-
- private function initCompleteHandler(event:Event):void
- {
- initControls();
- }
-
- private var _symbol:String;
-
- public function get symbol():String
- {
- return _symbol;
- }
-
- public function get requestedField():String
- {
- return radio1.selectedValue as String;
- }
-
- [Bindable]
- public var fieldText:String;
-
- private function radioChanged(e:org.apache.flex.events.Event):void
- {
- dispatchEvent(new CustomEvent("radioClicked"));
- fieldText = RadioButton(e.target).text;
- }
-
- private function initControls():void
- {
- list.selectedItem = MyModel(applicationModel).stockSymbol;
- radio1.selectedValue = MyModel(applicationModel).requestedField;
- if (radio1.selected)
- fieldText = radio1.text;
- else if (radio2.selected)
- fieldText = radio2.text;
- else if (radio3.selected)
- fieldText = radio3.text;
- else if (radio4.selected)
- fieldText = radio4.text;
-
- }
-
- private function setState():void
- {
- currentState = showAllData.selected ? "showAll" : "hideAll";
- }
-
- override public function get MXMLDescriptor():Array
- {
- var c:Container = new Container();
- c.x = 0;
- c.y = 0;
- c.className = "topContainer";
- c.addBead(new VerticalLayout());
- addElement(c);
- var l:Label = new Label();
- l.width = 300;
- l.text = "Enter Stock Symbol or choose from list:";
- c.addElement(l);
- var c2:Container = new Container();
- c2.addBead(new HorizontalLayout());
- c.addElement(c2);
- var c3:Container = new Container();
- c3.className = "leftSide";
- c3.addBead(new VerticalLayout());
- c2.addElement(c3);
- symbolTI = new TextInput();
- var sb:SimpleBinding = new SimpleBinding();
- sb.sourceID = "applicationModel";
- sb.sourcePropertyName = "stockSymbol";
- sb.eventName = "stockSymbolChanged";
- sb.destination = symbolTI;
- sb.destinationPropertyName = "text";
- sb.setDocument(this);
- addBead(sb);
- c3.addElement(symbolTI);
- var tb:TextButton = new TextButton();
- tb.text = "Get Quote";
- tb.className = "quoteButton";
- tb.addEventListener("click", tb_clickHandler);
- c3.addElement(tb);
- field = new Label();
- sb = new SimpleBinding();
- sb.sourcePropertyName = "fieldText";
- sb.eventName = "valueChange";
- sb.destination = field;
- sb.destinationPropertyName = "text";
- sb.setDocument(this);
- addBead(sb);
- c3.addElement(field);
- output = new Label();
- output.className = "output";
- output.height=24;
- sb = new SimpleBinding();
- sb.sourceID = "applicationModel";
- sb.sourcePropertyName = "responseText";
- sb.eventName = "responseTextChanged";
- sb.destination = output;
- sb.destinationPropertyName = "text";
- sb.setDocument(this);
- addBead(sb);
- c3.addElement(output);
- c3.childrenAdded();
-
- c3 = new Container();
- c3.className="rightSide";
- c3.addBead(new VerticalLayout());
- c2.addElement(c3);
- list = new DropDownList();
- list.width=100;
- list.height=17;
- var cb:ConstantBinding = new ConstantBinding();
- cb.sourceID = "applicationModel";
- cb.sourcePropertyName = "strings";
- cb.destination = list;
- cb.destinationPropertyName = "dataProvider";
- cb.setDocument(this);
- addBead(cb);
- list.addEventListener("change", list_changeHandler);
- c3.addElement(list);
- radio1 = new RadioButton();
- radio1.text = "Price";
- radio1.value = "Ask";
- radio1.groupName = "group1";
- radio1.addEventListener("change", radioChanged);
- c3.addElement(radio1);
- radio2 = new RadioButton();
- radio2.text = "Change";
- radio2.value = "Change";
- radio2.groupName = "group1";
- radio2.addEventListener("change", radioChanged);
- c3.addElement(radio2);
- radio3 = new RadioButton();
- radio3.text = "Day's High";
- radio3.value = "DaysHight";
- radio3.groupName = "group1";
- radio3.addEventListener("change", radioChanged);
- c3.addElement(radio3);
- radio4 = new RadioButton();
- radio4.text = "Day's Low";
- radio4.value = "DaysLow";
- radio4.groupName = "group1";
- radio4.addEventListener("change", radioChanged);
- c3.addElement(radio4);
- showAllData = new CheckBox();
- showAllData.text = "Show All Data";
- showAllData.addEventListener("change", showAllData_changeHandler);
- c3.addElement(showAllData);
- c3.childrenAdded();
- ta = new TextArea();
- ta.width = 300;
- ta.height = 100;
- sb = new SimpleBinding();
- sb.sourceID = "applicationModel";
- sb.sourcePropertyName = "allData";
- sb.eventName = "responseDataChanged";
- sb.destination = ta;
- sb.destinationPropertyName = "text";
- sb.setDocument(this);
- addBead(sb);
- c.addElement(ta);
- c2.childrenAdded();
- c.childrenAdded();
-
- return super.MXMLDescriptor;
-
- }
-
- public var symbolTI:TextInput;
- public var output:Label;
- public var field:Label;
- public var list:DropDownList;
- public var radio1:RadioButton;
- public var radio2:RadioButton;
- public var radio3:RadioButton;
- public var radio4:RadioButton;
- public var showAllData:CheckBox;
- public var ta:TextArea;
-
- private function tb_clickHandler(event:Event):void
- {
- _symbol = symbolTI.text;
- dispatchEvent(new CustomEvent('buttonClicked'));
- }
-
- private function list_changeHandler(event:Event):void
- {
- _symbol = list.selectedItem as String;
- dispatchEvent(new CustomEvent('listChanged'));
- }
-
- private function showAllData_changeHandler(event:Event):void
- {
- setState();
- }
-}
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_as/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_as/src/StockDataJSONItemConverter.as b/examples/DataBindingTest_as/src/StockDataJSONItemConverter.as
deleted file mode 100644
index a39606b..0000000
--- a/examples/DataBindingTest_as/src/StockDataJSONItemConverter.as
+++ /dev/null
@@ -1,40 +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.collections.converters.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"]["count"] == 0)
- return "No Data";
-
- obj = obj["query"]["results"]["quote"];
- return obj;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_as/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_as/src/controllers/MyController.as b/examples/DataBindingTest_as/src/controllers/MyController.as
deleted file mode 100644
index 83c2cd5..0000000
--- a/examples/DataBindingTest_as/src/controllers/MyController.as
+++ /dev/null
@@ -1,81 +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.events.Event;
-
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
-
- import models.MyModel;
-
- public class MyController implements IDocument
- {
- public function MyController(app:Application = null)
- {
- if (app)
- {
- this.app = app as DataBindingTest;
- 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:DataBindingTest;
-
- private function viewChangeHandler(event:Event):void
- {
- app.initialView.addEventListener("buttonClicked", buttonClickHandler);
- app.initialView.addEventListener("radioClicked", radioClickHandler);
- app.initialView.addEventListener("listChanged", listChangedHandler);
- }
-
- 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 radioClickHandler(event:Event):void
- {
- var field:String = MyInitialView(app.initialView).requestedField;
- MyModel(app.model).requestedField = field;
- }
-
- private function completeHandler(event:Event):void
- {
- MyModel(app.model).responseData = app.collection.getItemAt(0);
- }
-
- private function listChangedHandler(event:Event):void
- {
- MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol;
- }
-
- public function setDocument(document:Object, id:String = null):void
- {
- this.app = document as DataBindingTest;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9c7e00b1/examples/DataBindingTest_as/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/DataBindingTest_as/src/models/MyModel.as b/examples/DataBindingTest_as/src/models/MyModel.as
deleted file mode 100644
index 4a17f22..0000000
--- a/examples/DataBindingTest_as/src/models/MyModel.as
+++ /dev/null
@@ -1,127 +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 _requestedField:String = "Ask";
-
- [Bindable("requestedFieldChanged")]
- public function get requestedField():String
- {
- return _requestedField;
- }
-
- public function set requestedField(value:String):void
- {
- if (value != _requestedField)
- {
- _requestedField = value;
- dispatchEvent(new Event("requestedFieldChanged"));
- if (_responseData)
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _responseText:String;
-
- [Bindable("responseTextChanged")]
- public function get responseText():String
- {
- if (_responseData == null)
- return "";
- if (_responseData == "No Data")
- return _responseData as String;
- var s:String = _responseData[_requestedField];
- if (s == null)
- {
- if (_requestedField == "Ask")
- s = _responseData["Bid"];
- }
- return s;
- }
-
- private var _responseData:Object;
-
- [Bindable("responseDataChanged")]
- public function get responseData():Object
- {
- return _responseData;
- }
-
- public function set responseData(value:Object):void
- {
- if (value != _responseData)
- {
- _responseData = value;
- _allData = "";
- dispatchEvent(new Event("responseDataChanged"));
- dispatchEvent(new Event("responseTextChanged"));
- }
- }
-
- private var _allData:String = "";
-
- [Bindable("responseDataChanged")]
- public function get allData():String
- {
- if (_allData == "" && _responseData != null)
- {
- for (var p:String in _responseData)
- {
- _allData += p + ": " + _responseData[p] + "\n";
- }
- }
- return _allData;
- }
-
-
- private var _stockSymbol:String;
-
- [Bindable("stockSymbolChanged")]
- public function get stockSymbol():String
- {
- return _stockSymbol;
- }
-
- public function set stockSymbol(value:String):void
- {
- if (value != _stockSymbol)
- {
- _stockSymbol = value;
- dispatchEvent(new Event("stockSymbolChanged"));
- }
- }
-
- private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
- [Bindable("__NoChangeEvent__")]
- public function get strings():Array
- {
- return _strings;
- }
-
- }
-}
\ No newline at end of file
[6/7] git commit: [flex-asjs] [refs/heads/develop] - fix sizing logic
Posted by ah...@apache.org.
fix sizing logic
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/3e32bbfe
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/3e32bbfe
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/3e32bbfe
Branch: refs/heads/develop
Commit: 3e32bbfeac6e11f3e052613144d55f29a1ea4e8f
Parents: 8162742
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 21 10:28:30 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 21 10:28:30 2015 -0700
----------------------------------------------------------------------
.../js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3e32bbfe/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
index a83c3a7..e351995 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
@@ -84,6 +84,11 @@ org.apache.flex.html.beads.layouts.VerticalLayout.
child.flexjs_wrapper.dispatchEvent('sizeChanged');
}
if (!hasWidth && n > 0 && !isNaN(maxWidth) && (!(scv.left != 'auto' && scv.right != 'auto'))) {
+ var pl = scv['padding-left'];
+ var pr = scv['padding-right'];
+ pl = parseInt(pl.substring(0, pl.length - 2), 10);
+ pr = parseInt(pr.substring(0, pr.length - 2), 10);
+ maxWidth += scv.paddingLeft + pl + pr;
this.lastWidth_ = sps.width = maxWidth.toString() + 'px';
}
};