http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormExample/src/FormExample.mxml ---------------------------------------------------------------------- diff --git a/manualtests/FormExample/src/FormExample.mxml b/manualtests/FormExample/src/FormExample.mxml new file mode 100644 index 0000000..4ea7b3b --- /dev/null +++ b/manualtests/FormExample/src/FormExample.mxml @@ -0,0 +1,33 @@ +<?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:models="models.*" + xmlns:js="library://ns.apache.org/flexjs/basic" + > + + <js:valuesImpl> + <js:SimpleCSSValuesImpl /> + </js:valuesImpl> + <js:initialView> + <local:MyFormView /> + </js:initialView> +</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormExample/src/MyFormView.mxml ---------------------------------------------------------------------- diff --git a/manualtests/FormExample/src/MyFormView.mxml b/manualtests/FormExample/src/MyFormView.mxml new file mode 100644 index 0000000..894d7a2 --- /dev/null +++ b/manualtests/FormExample/src/MyFormView.mxml @@ -0,0 +1,73 @@ +<?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:local="*" + xmlns:models="models.*" + xmlns:acc="org.apache.flex.html.accessories.*"> + + <fx:Style> + .title { + font-size: 14pt; + font-weight: bold; + } + + </fx:Style> + + <fx:Script> + <![CDATA[ + import org.apache.flex.core.IPopUpHost; + import org.apache.flex.events.Event; + import org.apache.flex.utils.UIUtils; + + ]]> + </fx:Script> + + <js:Container width="600" height="700" x="50" y="50"> + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:Label text="Loan Form" className="title" /> + + <js:Container width="500"> + <js:beads> + <js:VerticalColumnLayout numColumns="2" /> + </js:beads> + <js:Label text="Name:" /> + <js:TextInput id="nameField" /> + <js:Label text="Age:" /> + <js:TextInput id="ageField"> + <js:beads> + <js:NumericOnlyTextInputBead /> + </js:beads> + </js:TextInput> + <js:Label text="Phone Number:" /> + <js:TextInput id="phoneField" > + </js:TextInput> + <js:Label text="Date of Loan:" /> + <js:DateField id="dateOfLoan"/> + <js:Label text="Loan Amount:" /> + <js:TextInput id="loanAmount"> + </js:TextInput> + </js:Container> + </js:Container> + +</js:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormExample/src/README.txt ---------------------------------------------------------------------- diff --git a/manualtests/FormExample/src/README.txt b/manualtests/FormExample/src/README.txt new file mode 100644 index 0000000..f38df7f --- /dev/null +++ b/manualtests/FormExample/src/README.txt @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 FormExample application demonstrates several FlexJS components and how they +can be aligned in a column, much like you would see in a form. + +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 components are placed into a Container with a VerticalColumnLayout bead. This bead +examines each of the children in the Container and aligns them in two columns. + +COMPONENTS and BEADS + +- Container +- DateField +- Label +- 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/0485c8b6/manualtests/FormatExample/build.xml ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/build.xml b/manualtests/FormatExample/build.xml new file mode 100644 index 0000000..00c6a9e --- /dev/null +++ b/manualtests/FormatExample/build.xml @@ -0,0 +1,77 @@ +<?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="formatexample" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../.."/> + <property name="example" value="FormatExample" /> + + <property file="${FLEXJS_HOME}/env.properties"/> + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${env.FALCON_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/> + + <available file="${env.FALCONJX_HOME}/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${env.FALCONJX_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/> + + <available file="${env.GOOG_HOME}/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${env.GOOG_HOME}"/> + + <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${FLEXJS_HOME}/js/lib/google/closure-library"/> + + <include file="${basedir}/../build_example.xml" /> + + <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}"> + </target> + <!-- Uncomment to reproduce cross-compilation error in compilejs step + <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/0485c8b6/manualtests/FormatExample/src/FormatExample.mxml ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/src/FormatExample.mxml b/manualtests/FormatExample/src/FormatExample.mxml new file mode 100644 index 0000000..4ea7b3b --- /dev/null +++ b/manualtests/FormatExample/src/FormatExample.mxml @@ -0,0 +1,33 @@ +<?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:models="models.*" + xmlns:js="library://ns.apache.org/flexjs/basic" + > + + <js:valuesImpl> + <js:SimpleCSSValuesImpl /> + </js:valuesImpl> + <js:initialView> + <local:MyFormView /> + </js:initialView> +</js:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormatExample/src/MyFormView.mxml ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/src/MyFormView.mxml b/manualtests/FormatExample/src/MyFormView.mxml new file mode 100644 index 0000000..d974bf5 --- /dev/null +++ b/manualtests/FormatExample/src/MyFormView.mxml @@ -0,0 +1,133 @@ +<?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:local="*" + xmlns:models="models.*" + xmlns:acc="org.apache.flex.html.accessories.*"> + + <fx:Style> + .title { + font-size: 14pt; + font-weight: bold; + } + + </fx:Style> + + <fx:Script> + <![CDATA[ + import dialogs.LoginDialog; + + import org.apache.flex.core.IPopUpHost; + import org.apache.flex.events.Event; + import org.apache.flex.utils.UIUtils; + + + private function showLogin():void + { + var dialog:LoginDialog = new LoginDialog(); + var host:IPopUpHost = UIUtils.findPopUpHost(this); + host.addElement(dialog); + UIUtils.center(dialog,this); + + dialog.addEventListener("close",closeDialog); + } + + private function closeDialog(event:org.apache.flex.events.Event):void + { + var dialog:LoginDialog = event.currentTarget as LoginDialog; + UIUtils.removePopUp(dialog); + } + ]]> + </fx:Script> + + <js:Container width="600" height="700" x="50" y="50"> + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:Label text="Loan Form" className="title" /> + + <js:Container width="500"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="Your Name:" /> + <js:TextInput id="nameField" /> + </js:Container> + + <js:Container width="500"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="Your Age:" /> + <js:TextInput id="ageField"> + <js:beads> + <js:NumericOnlyTextInputBead /> + </js:beads> + </js:TextInput> + </js:Container> + + <js:Container width="500"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="Phone Number:" /> + <js:TextInput id="phoneField" > + <js:beads> + <js:TextPromptBead prompt="9995551235" /> + <js:FormatableTextInputView /> + <acc:PhoneNumberFormatter propertyName="text" /> + </js:beads> + </js:TextInput> + </js:Container> + + <js:Container width="500"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="Date of Loan:" /> + <js:DateField id="dateOfLoan"/> + </js:Container> + + <js:Container width="500"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="Loan Amount:" /> + <js:TextInput id="loanAmount"> + <js:beads> + <js:TextPromptBead prompt="US dollars" /> + <js:FormatableTextInputView /> + <acc:NumberFormatter /> + </js:beads> + </js:TextInput> + </js:Container> + + <js:Container width="500"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:TextButton text="Login" click="showLogin()" /> + </js:Container> + + </js:Container> + +</js:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormatExample/src/dialogs/DialogView.as ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/src/dialogs/DialogView.as b/manualtests/FormatExample/src/dialogs/DialogView.as new file mode 100644 index 0000000..0122c06 --- /dev/null +++ b/manualtests/FormatExample/src/dialogs/DialogView.as @@ -0,0 +1,38 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package dialogs +{ + import org.apache.flex.core.IStrand; + import org.apache.flex.html.beads.PanelView; + + public class DialogView extends PanelView + { + public function DialogView() + { + trace("This is DialogView"); + super(); + } + + override public function set strand(value:IStrand):void + { + trace("DialogView strand setter"); + super.strand = value; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormatExample/src/dialogs/LoginDialog.mxml ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/src/dialogs/LoginDialog.mxml b/manualtests/FormatExample/src/dialogs/LoginDialog.mxml new file mode 100644 index 0000000..527983c --- /dev/null +++ b/manualtests/FormatExample/src/dialogs/LoginDialog.mxml @@ -0,0 +1,70 @@ +<?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:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:local="*" + className="LoginDialog" + width="280" height="90" title="Login"> + + <!-- fx:Metadata is not recognized by FalconJX --> + <!--<fx:Metadata> + [Event(name="close", type="org.apache.flex.events.Event")] + </fx:Metadata>--> + + <fx:Script> + <![CDATA[ + import org.apache.flex.events.Event; + + private function cancelLogin():void + { + dispatchEvent( new org.apache.flex.events.Event("close") ); + } + ]]> + </fx:Script> + + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:Container width="200"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="User Name:" /> + <js:TextInput /> + </js:Container> + + <js:Container width="200"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:Label text="Password:" /> + <js:TextInput /> + </js:Container> + + <js:Container width="200"> + <js:beads> + <js:HorizontalLayout /> + </js:beads> + <js:TextButton text="Login" click="cancelLogin()" /> + <js:TextButton text="Cancel" click="cancelLogin()" /> + </js:Container> + +</js:Panel> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/NumberFormatter.as ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/NumberFormatter.as b/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/NumberFormatter.as new file mode 100644 index 0000000..0d1b613 --- /dev/null +++ b/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/NumberFormatter.as @@ -0,0 +1,210 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.flex.html.accessories +{ + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IFormatBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.events.IEventDispatcher; + + /** + * The NumberFormatter class formats a value in separated groups. The formatter listens + * to a property on a model and when the property changes, formats it and dispatches a + * formatChanged event. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NumberFormatter extends EventDispatcher implements IFormatBead + { + /** + * constructor + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function NumberFormatter() + { + super(); + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + + // Listen for the beadsAdded event which signals when all of a strand's + // beads have been added. + IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded); + } + + /** + * @private + */ + private function handleBeadsAdded(event:Event):void + { + // Listen for the change in the model + var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; + model.addEventListener(eventName,propertyChangeHandler); + model.addEventListener(propertyName+"Change",propertyChangeHandler); + + // format the current value of that property + propertyChangeHandler(null); + } + + private var _propertyName:String; + private var _eventName:String; + private var _formattedResult:String; + private var _groupSize:Number = 3; + private var _thousandsSeparator:String = ","; + + /** + * The name of the property on the model to format. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get propertyName():String + { + if (_propertyName == null) { + return "text"; + } + return _propertyName; + } + public function set propertyName(value:String):void + { + _propertyName = value; + } + + /** + * The event dispatched by the model when the property changes. The + * default is propertyName+"Changed". + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get eventName():String + { + if (_eventName == null) { + return _propertyName+"Changed"; + } + return _eventName; + } + public function set eventName(value:String):void + { + _eventName = value; + } + + /** + * Character to use to separate thousands groups. The default is + * the comma (,). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get thousandsSeparator():String + { + return _thousandsSeparator; + } + public function set thousandsSeparator(value:String):void + { + _thousandsSeparator = value; + } + + /** + * The formatted string. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get formattedString():String + { + return _formattedResult; + } + + /** + * @private + */ + private function propertyChangeHandler(event:Event):void + { + // When the property changes, fetch it from the model and + // format it, storing the result in _formattedResult. + var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; + var value:Object = model[propertyName]; + _formattedResult = format(value); + + // Dispatch the formatChanged event so any bead that's interested in + // the formatted string knows to use it. + var newEvent:Event = new Event("formatChanged"); + this.dispatchEvent(newEvent); + } + + /** + * @private + */ + private function format(value:Object):String + { + if (value == null) return ""; + + var num:Number = Number(value); + var source:String = String(value); + var parts:Array = source.split(thousandsSeparator); + source = parts.join(""); + + var l:int = source.length; + var result:String = ""; + var group:int = 0; + + for(var i:int=l-1; i >= 0; i--) + { + if (group == _groupSize && result.length > 0) { + result = thousandsSeparator + result; + group = 0; + } + result = source.charAt(i) + result; + group++; + } + + return result; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/PhoneNumberFormatter.as ---------------------------------------------------------------------- diff --git a/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/PhoneNumberFormatter.as b/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/PhoneNumberFormatter.as new file mode 100644 index 0000000..7523c96 --- /dev/null +++ b/manualtests/FormatExample/src/org/apache/flex/html/staticControls/accessories/PhoneNumberFormatter.as @@ -0,0 +1,195 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.flex.html.accessories +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IFormatBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.events.IEventDispatcher; + + /** + * The PhoneNumberFormatter class bead formats a numeric string into a + * US style phone number. The format bead listens for changes to a property + * in a model, formats the value, and dispatches a formatChanged event. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class PhoneNumberFormatter extends EventDispatcher implements IBead, IFormatBead + { + /** + * constructor + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function PhoneNumberFormatter() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + + // Listen for the beadsAdded event which signals when all of a strand's + // beads have been added. + IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded); + } + + /** + * @private + */ + private function handleBeadsAdded(event:Event):void + { + // Listen for the change in the model. + var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; + model.addEventListener(eventName,propertyChangeHandler); + model.addEventListener(propertyName+"Change",propertyChangeHandler); + + // format the current value of that property + propertyChangeHandler(null); + } + + private var _propertyName:String; + private var _eventName:String; + private var _formattedResult:String; + + /** + * The name of the property in the model holding the value to be + * formatted. The default is text. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get propertyName():String + { + if (_propertyName == null) { + return "text"; + } + return _propertyName; + } + public function set propertyName(value:String):void + { + _propertyName = value; + } + + /** + * The name of the event dispatched when the property changes. The + * default is propertyName + "Changed". + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get eventName():String + { + if (_eventName == null) { + return _propertyName+"Changed"; + } + return _eventName; + } + public function set eventName(value:String):void + { + _eventName = value; + } + + /** + * The formatted string. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get formattedString():String + { + return _formattedResult; + } + + /** + * @private + */ + private function propertyChangeHandler(event:Event):void + { + // When the model's value changes, format it and store it in + // _formattedResult. + var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; + var value:Object = model[propertyName]; + _formattedResult = format(value); + + // Dispatch the formatChanged event so other beads can use the newly + // formatted value. + var newEvent:Event = new Event("formatChanged"); + this.dispatchEvent(newEvent); + } + + /** + * @private + */ + private function format(value:Object):String + { + if (value == null) return ""; + + var source:String = String(value); + if (source.length != 10) return source; + + var areaCode:String = ""; + var exchange:String; + var num:String; + + var pos:int = 0; + if (source.length == 10) { + areaCode = source.substr(pos,3); + pos += 3; + } + + exchange = source.substr(pos,3); + pos += 3; + + num = source.substr(pos,4); + + var result:String = ""; + if (source.length == 10) { + result = result + "("+areaCode+") "; + } + result = result + exchange + "-" + num; + return result; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ImageTest/build.xml ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/build.xml b/manualtests/ImageTest/build.xml new file mode 100644 index 0000000..5b5fbfa --- /dev/null +++ b/manualtests/ImageTest/build.xml @@ -0,0 +1,70 @@ +<?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="imagetest" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../.."/> + <property name="example" value="ImageTest" /> + + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${env.FALCON_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/> + + <available file="${env.FALCONJX_HOME}/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${env.FALCONJX_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/> + + <available file="${env.GOOG_HOME}/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${env.GOOG_HOME}"/> + + <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${FLEXJS_HOME}/js/lib/google/closure-library"/> + + <include file="${basedir}/../build_example.xml" /> + + <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of FlexJSUI.swc"> + </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/0485c8b6/manualtests/ImageTest/src/ImageTest.mxml ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/ImageTest.mxml b/manualtests/ImageTest/src/ImageTest.mxml new file mode 100644 index 0000000..2d5c972 --- /dev/null +++ b/manualtests/ImageTest/src/ImageTest.mxml @@ -0,0 +1,33 @@ +<?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:models="models.*" + xmlns:js="library://ns.apache.org/flexjs/basic" + > + + <js:valuesImpl> + <js:SimpleCSSValuesImpl /> + </js:valuesImpl> + <js:initialView> + <local:MyInitialView /> + </js:initialView> +</js:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ImageTest/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/MyInitialView.mxml b/manualtests/ImageTest/src/MyInitialView.mxml new file mode 100644 index 0000000..342abcc --- /dev/null +++ b/manualtests/ImageTest/src/MyInitialView.mxml @@ -0,0 +1,45 @@ +<?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:local="*"> + <fx:Script> + <![CDATA[ + + ]]> + </fx:Script> + + <fx:Style> + + </fx:Style> + + <js:Container> + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:Image width="48" height="48" source="smallbluerect.jpg" /> + <js:Image width="183" height="178" source="largegreenrect.png" /> + <js:Image width="48" height="48" source="smallorangerect.gif" /> + <js:Image width="48" height="48" source="smallgreenrect.jpg" /> + + </js:Container> + +</js:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ImageTest/src/README.txt ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/README.txt b/manualtests/ImageTest/src/README.txt new file mode 100644 index 0000000..e6a0c71 --- /dev/null +++ b/manualtests/ImageTest/src/README.txt @@ -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. +// +//////////////////////////////////////////////////////////////////////////////// + +DESCRIPTION + +The ImageTest example is a simple demonstration of the FlexJS Image component. +You can use this test to see if your image loads properly. + +This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX) +into JavaScript and HTML and run without Flash. + +All of the images are placed into a Container and then given various sizes. + +COMPONENTS and BEADS + +- Container +- Image + +- NonVirtualVerticalLayout + +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/0485c8b6/manualtests/ImageTest/src/largegreenrect.png ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/largegreenrect.png b/manualtests/ImageTest/src/largegreenrect.png new file mode 100644 index 0000000..3f10b02 Binary files /dev/null and b/manualtests/ImageTest/src/largegreenrect.png differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ImageTest/src/smallbluerect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/smallbluerect.jpg b/manualtests/ImageTest/src/smallbluerect.jpg new file mode 100644 index 0000000..80ed275 Binary files /dev/null and b/manualtests/ImageTest/src/smallbluerect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ImageTest/src/smallgreenrect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/smallgreenrect.jpg b/manualtests/ImageTest/src/smallgreenrect.jpg new file mode 100644 index 0000000..c5f9ce6 Binary files /dev/null and b/manualtests/ImageTest/src/smallgreenrect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ImageTest/src/smallorangerect.gif ---------------------------------------------------------------------- diff --git a/manualtests/ImageTest/src/smallorangerect.gif b/manualtests/ImageTest/src/smallorangerect.gif new file mode 100644 index 0000000..603f810 Binary files /dev/null and b/manualtests/ImageTest/src/smallorangerect.gif differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/build.xml ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/build.xml b/manualtests/LanguageTests/build.xml new file mode 100644 index 0000000..6de5e8a --- /dev/null +++ b/manualtests/LanguageTests/build.xml @@ -0,0 +1,71 @@ +<?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="languagetests" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../.."/> + <property name="example" value="LanguageTests" /> + + <property file="${FLEXJS_HOME}/env.properties"/> + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${env.FALCON_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/> + + <available file="${env.FALCONJX_HOME}/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${env.FALCONJX_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/> + + <available file="${env.GOOG_HOME}/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${env.GOOG_HOME}"/> + + <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${FLEXJS_HOME}/js/lib/google/closure-library"/> + + <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/0485c8b6/manualtests/LanguageTests/src/LanguageTests.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/LanguageTests.as b/manualtests/LanguageTests/src/LanguageTests.as new file mode 100644 index 0000000..1343abe --- /dev/null +++ b/manualtests/LanguageTests/src/LanguageTests.as @@ -0,0 +1,159 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.SimpleApplication; +import org.apache.flex.events.Event; + +import classes.B; + +import interfaces.IA; +import interfaces.IB; +import interfaces.IC; +import interfaces.ID; +import interfaces.IE; +import interfaces.IF; + +public class LanguageTests extends SimpleApplication implements IA, IE +{ + public function LanguageTests() + { + var testResult:Boolean; + var testObject:Object; + + var b:B = new B(); + + testResult = this instanceof SimpleApplication; + trace('this instanceof SimpleApplication - true: ' + testResult.toString()); + testResult = this instanceof B; + trace('this instanceof classes.B - false: ' + testResult.toString()); + testResult = b instanceof classes.B; + trace('b instanceof classes.B - true: ' + testResult.toString()); + testResult = b instanceof classes.C; + trace('b instanceof classes.C - true: ' + testResult.toString()); + testResult = b instanceof interfaces.IC; + trace('b instanceof interfaces.IC - false: ' + testResult.toString()); + testResult = b instanceof interfaces.IF; + trace('b instanceof interfaces.IF - false: ' + testResult.toString()); + testResult = this instanceof IA; + trace('this instanceof interfaces.IA - false: ' + testResult.toString()); + testResult = this instanceof IB; + trace('this instanceof interfaces.IB - false: ' + testResult.toString()); + testResult = this instanceof IC; + trace('this instanceof interfaces.IC - false: ' + testResult.toString()); + testResult = this instanceof ID; + trace('this instanceof interfaces.ID - false: ' + testResult.toString()); + testResult = this instanceof IE; + trace('this instanceof interfaces.IE - false: ' + testResult.toString()); + trace(); + testResult = this is SimpleApplication; + trace('this is SimpleApplication - true: ' + testResult.toString()); + testResult = this is B; + trace('this is classes.B - false: ' + testResult.toString()); + testResult = b is classes.B; + trace('b is classes.B - true: ' + testResult.toString()); + testResult = b is classes.C; + trace('b is classes.C - true: ' + testResult.toString()); + testResult = b is interfaces.IC; + trace('b is interfaces.IC - false: ' + testResult.toString()); + testResult = b is interfaces.IF; + trace('b is interfaces.IF - true: ' + testResult.toString()); + testResult = this is IA; + trace('this is interfaces.IA - true: ' + testResult.toString()); + testResult = this is IB; + trace('this is interfaces.IB - false: ' + testResult.toString()); + testResult = this is IC; + trace('this is interfaces.IC - true: ' + testResult.toString()); + testResult = this is ID; + trace('this is interfaces.ID - true: ' + testResult.toString()); + testResult = this is IE; + trace('this is interfaces.IE - true: ' + testResult.toString()); + trace(); + testObject = (this as SimpleApplication) ? this as SimpleApplication : 'null'; + trace('this as SimpleApplication - [object ...]: ' + testObject.toString()); + testObject = (this as B) ? this as B : 'null'; + trace('this as classes.B - null: ' + testObject.toString()); + testObject = (b as classes.B) ? b as classes.B : 'null'; + trace('b as classes.B - [object ...]: ' + testObject.toString()); + testObject = (b as classes.C) ? b as classes.C : 'null'; + trace('b as classes.C - [object ...]: ' + testObject.toString()); + testObject = (b as interfaces.IC) ? b as interfaces.IC : 'null'; + trace('b as interfaces.IC - null: ' + testObject.toString()); + testObject = (b as interfaces.IF) ? b as interfaces.IF : 'null'; + trace('b as interfaces.IF - [object ...]: ' + testObject.toString()); + testObject = (this as IA) ? this as IA : 'null'; + trace('this as interfaces.IA - [object ...]: ' + testObject.toString()); + testObject = (this as IB) ? this as IB : 'null'; + trace('this as interfaces.IB - null: ' + testObject.toString()); + testObject = (this as IC) ? this as IC : 'null'; + trace('this as interfaces.IC - [object ...]: ' + testObject.toString()); + testObject = (this as ID) ? this as ID : 'null'; + trace('this as interfaces.ID - [object ...]: ' + testObject.toString()); + testObject = (this as IE) ? this as IE : 'null'; + trace('this as interfaces.IE - [object ...]: ' + testObject.toString()); + trace(); + try { + testObject = SimpleApplication(this); + trace('SimpleApplication(this) - [object ...]: ' + testObject.toString()); + } catch (e:Error) + { + trace("This shouldn't show!"); + } + try { + testObject = B(this); + trace("This shouldn't show!"); + } catch (e:Error) + { + trace('B(this) - exception expected: ' + e.message); + } + try { + testObject = interfaces.IC(b); + trace("This shouldn't show!"); + } catch (e:Error) + { + trace('IC(b) - exception expected: ' + e.message); + } + try { + testObject = interfaces.IF(b); + trace('IF(b) - [object ...]: ' + testObject.toString()); + } catch (e:Error) + { + trace("This shouldn't show!"); + } + + addEventListener("foo", eventHandler); + if (hasEventListener("foo")) + trace("addEventListener worked"); + else + trace("This shouldn't show!"); + + removeEventListener("foo", eventHandler); + if (!hasEventListener("foo")) + trace("removeEventListener worked"); + else + trace("This shouldn't show!"); + } + + public function eventHandler(e:Event):void + { + + } +} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/README.txt ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/README.txt b/manualtests/LanguageTests/src/README.txt new file mode 100644 index 0000000..89f12b2 --- /dev/null +++ b/manualtests/LanguageTests/src/README.txt @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 LanguageTests example is used to test the ActionScript and cross-compiler, +FalconJX. + +Compile the project using ANT and the build.xml script and then run the resulting +index.html file in browser. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/classes/B.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/classes/B.as b/manualtests/LanguageTests/src/classes/B.as new file mode 100644 index 0000000..d8bd2c7 --- /dev/null +++ b/manualtests/LanguageTests/src/classes/B.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 classes +{ + public class B extends C + { + public function B() {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/classes/C.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/classes/C.as b/manualtests/LanguageTests/src/classes/C.as new file mode 100644 index 0000000..fe49eb5 --- /dev/null +++ b/manualtests/LanguageTests/src/classes/C.as @@ -0,0 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 classes +{ + import interfaces.IF; + + public class C implements IF + { + public function C() {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/interfaces/IA.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/interfaces/IA.as b/manualtests/LanguageTests/src/interfaces/IA.as new file mode 100644 index 0000000..5fbd6c2 --- /dev/null +++ b/manualtests/LanguageTests/src/interfaces/IA.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 interfaces +{ + public interface IA extends IC {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/interfaces/IB.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/interfaces/IB.as b/manualtests/LanguageTests/src/interfaces/IB.as new file mode 100644 index 0000000..a995635 --- /dev/null +++ b/manualtests/LanguageTests/src/interfaces/IB.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 interfaces +{ + public interface IB {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/interfaces/IC.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/interfaces/IC.as b/manualtests/LanguageTests/src/interfaces/IC.as new file mode 100644 index 0000000..9183bac --- /dev/null +++ b/manualtests/LanguageTests/src/interfaces/IC.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 interfaces +{ + public interface IC extends ID {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/interfaces/ID.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/interfaces/ID.as b/manualtests/LanguageTests/src/interfaces/ID.as new file mode 100644 index 0000000..d5e9543 --- /dev/null +++ b/manualtests/LanguageTests/src/interfaces/ID.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 interfaces +{ + public interface ID {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/interfaces/IE.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/interfaces/IE.as b/manualtests/LanguageTests/src/interfaces/IE.as new file mode 100644 index 0000000..ae1848a --- /dev/null +++ b/manualtests/LanguageTests/src/interfaces/IE.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 interfaces +{ + public interface IE {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/LanguageTests/src/interfaces/IF.as ---------------------------------------------------------------------- diff --git a/manualtests/LanguageTests/src/interfaces/IF.as b/manualtests/LanguageTests/src/interfaces/IF.as new file mode 100644 index 0000000..f62be45 --- /dev/null +++ b/manualtests/LanguageTests/src/interfaces/IF.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 interfaces +{ + public interface IF {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/build.xml ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/build.xml b/manualtests/ListsTest/build.xml new file mode 100644 index 0000000..e6d7c8b --- /dev/null +++ b/manualtests/ListsTest/build.xml @@ -0,0 +1,71 @@ +<?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="liststest" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../.."/> + <property name="example" value="ListsTests" /> + + <property file="${FLEXJS_HOME}/env.properties"/> + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${env.FALCON_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/> + + <available file="${env.FALCONJX_HOME}/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${env.FALCONJX_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/> + + <available file="${env.GOOG_HOME}/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${env.GOOG_HOME}"/> + + <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${FLEXJS_HOME}/js/lib/google/closure-library"/> + + <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/0485c8b6/manualtests/ListsTest/src/FirstView.mxml ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/FirstView.mxml b/manualtests/ListsTest/src/FirstView.mxml new file mode 100644 index 0000000..4bfc146 --- /dev/null +++ b/manualtests/ListsTest/src/FirstView.mxml @@ -0,0 +1,63 @@ +<?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:local="*"> + <fx:Script> + <![CDATA[ + + private function handleListChange() : void + { + pickLabel.text = "Selected: "+productList.selectedItem.title; + } + ]]> + </fx:Script> + + <fx:Style> + @namespace basic "library://ns.apache.org/flexjs/basic"; + @namespace sample "products.*"; + + /* use className="productList" on the List element in place of itemRenderer if you want to specify + * the itemRenderer in a style definition along with other settings. + */ + .productList { + IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData"); + IItemRenderer: ClassReference("products.ProductItemRenderer"); + } + + sample|ProductItemRenderer { + height: 40; + IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController"); + } + + </fx:Style> + + <js:List id="productList" itemRenderer="products.ProductItemRenderer" x="20" y="20" width="200" height="150" change="handleListChange()"> + <js:beads> + <js:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="products" + destinationPropertyName="dataProvider" /> + </js:beads> + </js:List> + + <js:Label id="pickLabel" x="250" y="20" width="200" /> + +</js:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/ListsTests.mxml ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/ListsTests.mxml b/manualtests/ListsTest/src/ListsTests.mxml new file mode 100644 index 0000000..9904c05 --- /dev/null +++ b/manualtests/ListsTest/src/ListsTests.mxml @@ -0,0 +1,36 @@ +<?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:models="models.*" + xmlns:js="library://ns.apache.org/flexjs/basic" + > + + <js:valuesImpl> + <js:SimpleCSSValuesImpl /> + </js:valuesImpl> + <js:model> + <models:ProductsModel /> + </js:model> + <js:initialView> + <local:FirstView /> + </js:initialView> +</js:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/README.txt ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/README.txt b/manualtests/ListsTest/src/README.txt new file mode 100644 index 0000000..dc48ab4 --- /dev/null +++ b/manualtests/ListsTest/src/README.txt @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 ListsTests example demonstrates the FlexJS List component using custom data +and a custom itemRenderer. + +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 data for the list is found in the application model and is bound to the list +via ConstantBinding bead which maps the application data model's products property +to the List's dataProvider property. + +The display of each element of the list is through a custom itemRenderer, +ProductItemRenderer, which can found in the example's source tree. The itemRenderer +uses and Image component to display an image and a Label to give a title. + +COMPONENTS and BEADS + +- Image +- Label +- List + +- ConstantBinding + +NOTES + +More control of the itemRenderer via styles would be a nice addition. ItemRenderers +based on row or data would require a custom itemRendererFactory bead. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/models/ProductsModel.as ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/models/ProductsModel.as b/manualtests/ListsTest/src/models/ProductsModel.as new file mode 100644 index 0000000..9807ee0 --- /dev/null +++ b/manualtests/ListsTest/src/models/ProductsModel.as @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.EventDispatcher; + + public class ProductsModel extends EventDispatcher + { + public function ProductsModel() + { + } + + private var _products:Array = [ + {id:"ps100", title:"Widgets", detail:"44", image:"smallbluerect.jpg"}, + {id:"tx200", title:"Thingys", detail:"out of stock", image:"smallgreenrect.jpg"}, + {id:"rz300", title:"Sprockets", detail:"8,000", image:"smallyellowrect.jpg"}, + {id:"dh440", title:"DooHickies", detail:"out of stock", image:"smallredrect.jpg"}, + {id:"ps220", title:"Weejets", detail:"235", image:"smallorangerect.jpg"} + ]; + public function get products():Array + { + return _products; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/products/Product.as ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/products/Product.as b/manualtests/ListsTest/src/products/Product.as new file mode 100644 index 0000000..b4854a3 --- /dev/null +++ b/manualtests/ListsTest/src/products/Product.as @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 products +{ + public class Product + { + public function Product(id:String,title:String,detail:String,sales:Number,image:String) + { + this.id = id; + this.title = title; + this.detail = detail; + this.sales = sales; + this.image = image; + } + + public var id:String; + public var title:String; + public var detail:String; + public var image:String; + public var sales:Number; + + public function toString():String + { + return title; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/products/ProductItemRenderer.as ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/products/ProductItemRenderer.as b/manualtests/ListsTest/src/products/ProductItemRenderer.as new file mode 100644 index 0000000..c1bab26 --- /dev/null +++ b/manualtests/ListsTest/src/products/ProductItemRenderer.as @@ -0,0 +1,83 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 products +{ + import org.apache.flex.html.Label; + import org.apache.flex.html.Image; + import org.apache.flex.html.supportClasses.DataItemRenderer; + + public class ProductItemRenderer extends DataItemRenderer + { + public function ProductItemRenderer() + { + super(); + } + + private var image:Image; + private var title:Label; + private var detail:Label; + + override public function addedToParent():void + { + super.addedToParent(); + + // add an image and two labels + image = new Image(); + addElement(image); + + title = new Label(); + addElement(title); + + detail = new Label(); + addElement(detail); + } + + override public function get data():Object + { + return super.data; + } + + override public function set data(value:Object):void + { + super.data = value; + + image.source = data.image; + title.text = data.title; + detail.text = data.detail; + } + + override public function adjustSize():void + { + var cy:Number = this.height/2; + + image.x = 4; + image.y = cy - 16; + image.width = 32; + image.height = 32; + + title.x = 40; + title.y = cy - 16; + + detail.x = 40; + detail.y = cy; + + updateRenderer(); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallbluerect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallbluerect.jpg b/manualtests/ListsTest/src/smallbluerect.jpg new file mode 100755 index 0000000..80ed275 Binary files /dev/null and b/manualtests/ListsTest/src/smallbluerect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallgreenrect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallgreenrect.jpg b/manualtests/ListsTest/src/smallgreenrect.jpg new file mode 100755 index 0000000..c5f9ce6 Binary files /dev/null and b/manualtests/ListsTest/src/smallgreenrect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallorangerect.gif ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallorangerect.gif b/manualtests/ListsTest/src/smallorangerect.gif new file mode 100644 index 0000000..603f810 Binary files /dev/null and b/manualtests/ListsTest/src/smallorangerect.gif differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallorangerect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallorangerect.jpg b/manualtests/ListsTest/src/smallorangerect.jpg new file mode 100755 index 0000000..4982d87 Binary files /dev/null and b/manualtests/ListsTest/src/smallorangerect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallpurplerect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallpurplerect.jpg b/manualtests/ListsTest/src/smallpurplerect.jpg new file mode 100755 index 0000000..201f625 Binary files /dev/null and b/manualtests/ListsTest/src/smallpurplerect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallredrect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallredrect.jpg b/manualtests/ListsTest/src/smallredrect.jpg new file mode 100644 index 0000000..d2cfa31 Binary files /dev/null and b/manualtests/ListsTest/src/smallredrect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/ListsTest/src/smallyellowrect.jpg ---------------------------------------------------------------------- diff --git a/manualtests/ListsTest/src/smallyellowrect.jpg b/manualtests/ListsTest/src/smallyellowrect.jpg new file mode 100755 index 0000000..b17b62d Binary files /dev/null and b/manualtests/ListsTest/src/smallyellowrect.jpg differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0485c8b6/manualtests/RollEventsTest/build.xml ---------------------------------------------------------------------- diff --git a/manualtests/RollEventsTest/build.xml b/manualtests/RollEventsTest/build.xml new file mode 100644 index 0000000..767c856 --- /dev/null +++ b/manualtests/RollEventsTest/build.xml @@ -0,0 +1,70 @@ +<?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="rolleventstest" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../.."/> + <property name="example" value="RollEventsTest" /> + + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${env.FALCON_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/> + + <available file="${env.FALCONJX_HOME}/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${env.FALCONJX_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar" + type="file" + property="FALCONJX_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/> + + <available file="${env.GOOG_HOME}/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${env.GOOG_HOME}"/> + + <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js" + type="file" + property="GOOG_HOME" + value="${FLEXJS_HOME}/js/lib/google/closure-library"/> + + <include file="${basedir}/../build_example.xml" /> + + <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of FlexJSUI.swc"> + </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>
