http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/compile-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/compile-config.xml b/frameworks/projects/Mobile/compile-config.xml deleted file mode 100644 index 8a4b4ed..0000000 --- a/frameworks/projects/Mobile/compile-config.xml +++ /dev/null @@ -1,89 +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. - ---> -<flex-config> - - <compiler> - <accessible>false</accessible> - - <external-library-path> - <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> - <path-element>../../libs/Core.swc</path-element> - <path-element>../../libs/Graphics.swc</path-element> - <path-element>../../libs/HTML.swc</path-element> - </external-library-path> - - <mxml> - <children-as-data>true</children-as-data> - </mxml> - <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> - <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> - <binding-value-change-event-type>valueChange</binding-value-change-event-type> - - <keep-as3-metadata> - <name>Bindable</name> - <name>Managed</name> - <name>ChangeEvent</name> - <name>NonCommittingChangeEvent</name> - <name>Transient</name> - </keep-as3-metadata> - - <locale/> - - <library-path/> - - <namespaces> - <namespace> - <uri>library://ns.apache.org/flexjs/basic</uri> - <manifest>basic-manifest.xml</manifest> - </namespace> - <namespace> - <uri>library://ns.apache.org/flexjs/cordova</uri> - <manifest>cordova-manifest.xml</manifest> - </namespace> - </namespaces> - - <source-path> - <path-element>as/src</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <include-file> - <name>defaults.css</name> - <path>as/defaults.css</path> - </include-file> - <include-file> - <name>js/out/*</name> - <path>js/out/*</path> - </include-file> - - <include-classes> - <class>MobileClasses</class> - </include-classes> - - <include-namespaces> - <uri>library://ns.apache.org/flexjs/basic</uri> - <uri>library://ns.apache.org/flexjs/cordova</uri> - </include-namespaces> - - <target-player>${playerglobal.version}</target-player> - - -</flex-config>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/cordova-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/cordova-manifest.xml b/frameworks/projects/Mobile/cordova-manifest.xml deleted file mode 100644 index 002eed1..0000000 --- a/frameworks/projects/Mobile/cordova-manifest.xml +++ /dev/null @@ -1,28 +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. - ---> - - -<componentPackage> - - <component id="Application" class="org.apache.cordova.Application"/> - <component id="Camera" class="org.apache.cordova.camera.Camera"/> - <component id="Weinre" class="org.apache.cordova.Weinre"/> - -</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as b/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as new file mode 100644 index 0000000..3b9dc98 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/CordovaClasses.as @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + +/** + * @private + * This class is used to link additional classes into rpc.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ +internal class CordovaClasses +{ + import org.apache.cordova.camera.Camera; Camera; + import org.apache.cordova.Application; Application; + import org.apache.cordova.Weinre; Weinre; +} + +} + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as b/frameworks/projects/Mobile/src/main/flex/MobileClasses.as new file mode 100644 index 0000000..fc933aa --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/MobileClasses.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 +{ + +/** + * @private + * This class is used to link additional classes into rpc.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ +internal class MobileClasses +{ + import org.apache.flex.mobile.ManagerBase; ManagerBase; + + import org.apache.flex.mobile.ViewManagerBase; ViewManagerBase; + import org.apache.flex.mobile.beads.StackedViewManagerView; StackedViewManagerView; + import org.apache.flex.mobile.beads.TabbedViewManagerView; TabbedViewManagerView; + import org.apache.flex.mobile.beads.ViewManagerView; ViewManagerView; + import org.apache.flex.mobile.chrome.NavigationBar; NavigationBar; + import org.apache.flex.mobile.chrome.TabBar; TabBar; + import org.apache.flex.mobile.chrome.ToolBar; ToolBar; + import org.apache.flex.mobile.models.ViewManagerModel; ViewManagerModel; +} + +} + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Application.as b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Application.as new file mode 100644 index 0000000..c19f26a --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Application.as @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.cordova +{ + import org.apache.flex.events.Event; + import org.apache.flex.core.Application; + import org.apache.flex.core.IFlexInfo; + + /** + * Dispatched at startup after the initial view has been + * put on the display list. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="deviceready", type="org.apache.flex.events.Event")] + + /** + * A customized Application that dispatches the Cordova deviceReady event + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Application extends org.apache.flex.core.Application implements IFlexInfo + { + public function Application() + { + addEventListener("applicationComplete", appCompleteHandler); + } + + private function appCompleteHandler(event:Event):void + { + dispatchEvent(new Event("deviceready")); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Weinre.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Weinre.as b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Weinre.as new file mode 100644 index 0000000..2e4b579 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/Weinre.as @@ -0,0 +1,88 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.cordova +{ + COMPILE::AS3 + { + import flash.net.URLRequest; + import flash.net.navigateToURL; + } + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + + /** + * A class that helps set up to use Weinre for debugging + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Weinre implements IBead + { + public function Weinre() + { + } + + 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; + } + + /** + * The guid to use at the Weinre server + * http://debug.phonegap.com + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion HTMLScriptElement + * @flexjsignorecoercion HTMLHeadElement + */ + public function set guid(value:String):void + { + COMPILE::AS3 + { + navigateToURL(new URLRequest("http://debug.phonegap.com/client/#" + value), "_blank"); + } + COMPILE::JS + { + var scriptNode:HTMLScriptElement = document.createElement('SCRIPT') as HTMLScriptElement; + scriptNode.type = 'text/javascript'; + scriptNode.src = 'http://debug.phonegap.com/target/target-script-min.js#' + value; + + var headNode:HTMLHeadElement = document.getElementsByTagName('HEAD') as HTMLHeadElement; + if (headNode[0] != null) + headNode[0].appendChild(scriptNode); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/camera/Camera.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/camera/Camera.as b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/camera/Camera.as new file mode 100644 index 0000000..faea7c0 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/cordova/camera/Camera.as @@ -0,0 +1,179 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.cordova.camera +{ + COMPILE::AS3 + { + import flash.display.BitmapData; + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + import flash.display.Sprite; + import flash.events.ActivityEvent; + import flash.events.KeyboardEvent; + import flash.events.MouseEvent; + import flash.filesystem.File; + import flash.filesystem.FileMode; + import flash.filesystem.FileStream; + import flash.geom.Rectangle; + import flash.media.Camera; + import flash.media.Video; + import flash.ui.Keyboard; + import flash.utils.ByteArray; + + import org.apache.flex.utils.PNGEncoder; + } + + [Mixin] + public class Camera + { + public static var DestinationType:Object = { + DATA_URL : 0, // Return image as base64-encoded string + FILE_URI : 1, // Return image file URI + NATIVE_URI : 2 // Return image native URI (e.g., assets-library:// on iOS or content:// on Android) + }; + + public static var PictureSourceType:Object = { + PHOTOLIBRARY : 0, + CAMERA : 1, + SAVEDPHOTOALBUM : 2 + }; + + public static var EncodingType:Object = { + JPEG : 0, // Return JPEG encoded image + PNG : 1 // Return PNG encoded image + }; + + public static var MediaType:Object = { + PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType + VIDEO: 1, // allow selection of video only, WILL ALWAYS RETURN FILE_URI + ALLMEDIA : 2 // allow selection from all media types + }; + + public static var Direction:Object = { + BACK : 0, // Use the back-facing camera + FRONT : 1 // Use the front-facing camera + }; + + COMPILE::AS3 + private static var root:DisplayObjectContainer; + + COMPILE::AS3 + public static function init(r:DisplayObjectContainer):void + { + root = r; + } + + public function Camera() + { + pictureSourceType = org.apache.cordova.camera.Camera.PictureSourceType.PHOTOLIBRARY; + destinationType = org.apache.cordova.camera.Camera.DestinationType.DATA_URL; + mediaType = org.apache.cordova.camera.Camera.MediaType.PICTURE; + encodingType = org.apache.cordova.camera.Camera.EncodingType.JPEG; + direction = org.apache.cordova.camera.Camera.Direction.BACK; + } + + public var pictureSourceType:int; + public var destinationType:int; + public var mediaType:int; + public var encodingType:int; + public var direction:int; + + private var cameraSuccess:Function; + private var cameraError:Function; + COMPILE::AS3 + private var ui:Sprite; + COMPILE::AS3 + private var camera:flash.media.Camera; + + public function getPicture( cameraSuccess:Function, cameraError:Function, cameraOptions:Object ) : void + { + COMPILE::AS3 + { + this.cameraSuccess = cameraSuccess; + this.cameraError = cameraError; + + camera = flash.media.Camera.getCamera(); + + if (camera != null) { + ui = new Sprite(); + var video:Video = new Video(camera.width * 2, camera.height * 2); + video.attachCamera(camera); + ui.addChild(video); + root.addChild(ui); + ui.addEventListener(MouseEvent.CLICK, mouseClickHandler); + ui.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); + } else { + trace("You need a camera."); + } + } + COMPILE::JS + { + // TODO: (aharui) Cordova externs + navigator["camera"].getPicture(cameraSuccess, cameraError, cameraOptions); + } + } + + COMPILE::AS3 + private function mouseClickHandler(event:MouseEvent):void + { + savePicture(); + root.removeChild(ui); + } + + COMPILE::AS3 + private function keyDownHandler(event:KeyboardEvent):void + { + if (event.keyCode == Keyboard.ESCAPE) + root.removeChild(ui); + else if (event.keyCode == Keyboard.ENTER || event.keyCode == Keyboard.SPACE) + { + savePicture(); + root.removeChild(ui); + } + } + + COMPILE::AS3 + private function savePicture():void + { + var f:File = File.createTempFile(); + var bd:BitmapData = new BitmapData(camera.width, camera.height, false); + var pix:ByteArray = new ByteArray(); + var rect:Rectangle = new Rectangle(0, 0, camera.width, camera.height); + camera.copyToByteArray(rect, pix); + pix.position = 0; + bd.setPixels(rect, pix); + var png:PNGEncoder = new PNGEncoder(); + var ba:ByteArray = png.encode(bd); + var fs:FileStream = new FileStream(); + fs.open(f, FileMode.WRITE); + fs.writeBytes(ba); + fs.close(); + cameraSuccess(f.url); + } + + public function cleanup( cameraSuccess:Function, cameraError:Function ) : void + { + // no cleanup required in Flash + COMPILE::JS + { + navigator["camera"].cleanup(); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IView.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IView.as new file mode 100644 index 0000000..232d212 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IView.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 org.apache.flex.mobile +{ + /** + * The IView interface is implemented by any class that can be managed by + * an IViewManager. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IView + { + /** + * The parent view manager. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get viewManager():IViewManager; + function set viewManager(value:IViewManager):void; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManager.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManager.as new file mode 100644 index 0000000..54bb22a --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManager.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 org.apache.flex.mobile +{ + /** + * The IViewManager interface is implemented by classes that manage or control + * IViews. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IViewManager extends IView + { + /** + * The view that is currently active in the view manager. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get selectedView():IView; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagerBase.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagerBase.as new file mode 100644 index 0000000..5c2e149 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagerBase.as @@ -0,0 +1,184 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile +{ + import org.apache.flex.core.IChrome; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The ManagerBase is a base class for mobile display managers such as StackedViewManager + * and TabbedViewManager. This class encapsulates the features common to all view + * managers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ManagerBase extends UIBase + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ManagerBase() + { + super(); + + _contentArea = new UIBase(); + + COMPILE::AS3 { + addEventListener("initComplete", handleInitComplete); + addEventListener("sizeChanged", handleInitComplete); + addEventListener("widthChanged", handleInitComplete); + addEventListener("heightChanged", handleInitComplete); + } + + COMPILE::JS { + createElement(); + } + + super.addElement(_contentArea,false); + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + super.createElement(); + element.className = 'ManagerBase'; + + _contentArea.positioner.style['width'] = '100%'; + _contentArea.positioner.style['height'] = '100%'; + + return element; + } + + private function handleInitComplete(event:Event):void + { + _contentArea.setWidthAndHeight(width, height, true); + // todo: listen for changes to this item + + var num:Number = UIBase(_contentArea).numElements; + for (var i:int = 0; i < num; i++) { + var child:UIBase = UIBase(_contentArea).getElementAt(i) as UIBase; + child.setWidthAndHeight(width, height); + } + } + + private var _contentArea:UIBase; + + /** + * The contentArea of a view manager is where the child elements are placed. Areas outside + * of the contentArea are chrome (identified by implementing IChrome). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get contentArea():UIBase + { + return _contentArea; + } + + /** + * Adds elements to the view manager. If an element implements IChrome it is placed + * in the chrome area otherwise it is placed in the contentArea. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function addElement(c:Object, dispatchEvent:Boolean=true):void + { + if (c is IChrome) { + super.addElementAt(c,0,dispatchEvent); + } + else { + _contentArea.addElement(c, dispatchEvent); +// (c as UIBase).setWidthAndHeight(_contentArea.width, _contentArea.height, false); +// (c as UIBase).width = _contentArea.width; +// (c as UIBase).height = _contentArea.height; + } + } + + /** + * @private. + */ + override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean=true):void + { + if (c is IChrome) { + super.addElementAt(c, index, dispatchEvent); + } + else { + _contentArea.addElement(c, dispatchEvent); + } + } + + /** + * @private + */ + override public function removeElement(c:Object, dispatchEvent:Boolean=true):void + { + if (c is IChrome) { + super.removeElement(c, dispatchEvent); + } + else { + _contentArea.removeElement(c, dispatchEvent); + } + } + + /** + * @private + */ + override public function getElementAt(index:int):Object + { + return _contentArea.getElementAt(index); + } + + /** + * @private + */ + override public function getElementIndex(c:Object):int + { + return _contentArea.getElementIndex(c); + } + + /** + * @private + */ + override public function get numElements():int + { + return _contentArea.numElements; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as new file mode 100644 index 0000000..4b29d28 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as @@ -0,0 +1,161 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile +{ + import org.apache.flex.events.Event; + import org.apache.flex.html.Container; + import org.apache.flex.mobile.IView; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.chrome.ToolBar; + import org.apache.flex.mobile.models.ViewManagerModel; + + /** + * The StackedViewManager displays a single View at a time from a + * collection of Views where views[0] is at the bottom and views[n-1] + * is at the top and displayed. + * + * The StackedViewManager has an optional navigation bar at the top + * and an optional tool bar at the bottom. The views are displayed + * within the StackedViewManager's content area. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class StackedViewManager extends ViewManagerBase implements IViewManager + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function StackedViewManager() + { + super(); + + className = "StackedViewManager"; + } + + /** + * True if this view manager is displaying a ToolBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get hasToolBar():Boolean + { + return ViewManagerModel(model).toolBarItems != null; + } + + /** + * The contents of the ToolBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get toolBarItems():Array + { + return ViewManagerModel(model).toolBarItems; + } + public function set toolBarItems(value:Array):void + { + ViewManagerModel(model).toolBarItems = value; + } + + /** + * The ToolBar (or null if not present). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get toolBar():ToolBar + { + return ViewManagerModel(model).toolBar; + } + + + private var _topView:IView; + + /** + * The top-most (current) view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function get selectedView():IView + { + return _topView; + } + + + /** + * Pushes the next view onto the navigation stack. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function push(nextView:IView):void + { + nextView.viewManager = this; + ViewManagerModel(model).pushView(nextView); + + removeElement(_topView); + _topView = nextView; + addElement(_topView); + + dispatchEvent( new Event("viewChanged") ); + } + + /** + * Pops the top-most view from the navigation stack. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function pop():void + { + if (ViewManagerModel(model).views.length > 1) { + var lastView:Object = ViewManagerModel(model).popView(); + removeElement(_topView); + addElement(lastView); + _topView = lastView as IView; + + dispatchEvent( new Event("viewChanged") ); + } + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as new file mode 100644 index 0000000..43fc6a6 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as @@ -0,0 +1,85 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile +{ + import org.apache.flex.html.Container; + import org.apache.flex.mobile.IView; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.chrome.TabBar; + import org.apache.flex.mobile.models.ViewManagerModel; + + /** + * The TabbedViewManager displays a set of views, only one of which is active at + * a time. The other views are reachable via a set of tab buttons at the bottom of + * the view manager's space. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class TabbedViewManager extends ViewManagerBase implements IViewManager + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function TabbedViewManager() + { + super(); + + className = "TabbedViewManager"; + } + + /** + * The TabBar (or null if not present). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get tabBar():TabBar + { + return ViewManagerModel(model).tabBar; + } + + /** + * The index (starting at zero) of the currently visible view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedIndex():Number + { + return ViewManagerModel(model).selectedIndex; + } + public function set selectedIndex(value:Number):void + { + ViewManagerModel(model).selectedIndex = value; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/View.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/View.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/View.as new file mode 100644 index 0000000..490d8bf --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/View.as @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IBeadController; + import org.apache.flex.core.IUIBase; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.html.Container; + + /** + * The View class represents the area for a mobile app's primary + * interface elements. + */ + public class View extends Container implements IView + { + public function View() + { + super(); + + // views always take up 100% of their space + percentWidth = 100; + percentHeight = 100; + } + + private var _title:String; + public function get title():String + { + return _title; + } + public function set title(value:String):void + { + _title = value; + } + + COMPILE::AS3 + override public function toString():String + { + return _title; + } + + COMPILE::JS + public function toString():String + { + return _title; + } + + private var _viewManager:IViewManager; + public function get viewManager():IViewManager + { + return _viewManager; + } + public function set viewManager(value:IViewManager):void + { + _viewManager = value; + } + + private var _controller:IBeadController; + + /** + * Get the controller for the view. + * + * @flexjsignorecoercion Class + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get controller():IBeadController + { + if (_controller == null) { + _controller = getBeadByType(IBeadController) as IBeadController; + if (_controller == null) { + var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class; + _controller = new c() as IBeadController; + addBead(_controller); + } + } + return _controller; + } + public function set controller(value:IBeadController):void + { + _controller = value; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as new file mode 100644 index 0000000..0da3f4d --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as @@ -0,0 +1,236 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile +{ + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + import org.apache.flex.html.Container; + import org.apache.flex.mobile.IView; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.models.ViewManagerModel; + +// import org.apache.flex.html.beads.SolidBackgroundBead; +// import org.apache.flex.html.beads.SingleLineBorderBead; + + /** + * Event dispatched when the current (selected) view changes. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="viewChanged")] + + /** + * Base class for mobile navigation controls. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ViewManagerBase extends UIBase implements IViewManager + { + /** + * Constructor. + */ + public function ViewManagerBase() + { + super(); + + // views always fill their space + percentWidth = 100; + percentHeight = 100; + + model.addEventListener("selectedIndexChanged", changeView); + +// addBead(new SolidBackgroundBead()); +// addBead(new SingleLineBorderBead()); + } + + /** + * A title that can be used in the NavigationBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get title():String + { + return ViewManagerModel(model).title; + } + public function set title(value:String):void + { + ViewManagerModel(model).title = value; + } + + COMPILE::AS3 + override public function toString():String + { + return ViewManagerModel(model).title; + } + + /** + * @private + */ + COMPILE::JS + public function toString():String + { + return ViewManagerModel(model).title; + } + + /** + * True if this view manager instance is displaying a NavigationBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get hasNavigationBar():Boolean + { + return ViewManagerModel(model).navigationBarItems != null; + } + + /** + * The items that make up the NavigationBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get navigationBarItems():Array + { + return ViewManagerModel(model).navigationBarItems; + } + public function set navigationBarItems(value:Array):void + { + ViewManagerModel(model).navigationBarItems = value; + } + + /** + * The NavigationBar (or null if not present). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get navigationBar():NavigationBar + { + return ViewManagerModel(model).navigationBar; + } + + /** + * The current set of views in the stack. The last entry is + * the top-most (visible) view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get views():Array + { + return ViewManagerModel(model).views; + } + public function set views(value:Array):void + { + ViewManagerModel(model).views = value; + } + + /** + * @private + */ + override public function addedToParent():void + { + super.addedToParent(); + + var n:int = ViewManagerModel(model).views.length; + if (n > 0) { + for (var i:int = 0; i < n; i++) + { + var view:IView = ViewManagerModel(model).views[i] as IView; + view.viewManager = this; + if (i == 0) { + addElement(view, true); + } + } + ViewManagerModel(model).selectedIndex = 0; + } + } + + /** + * @private + */ + private function changeView( event:Event ):void + { + var index:Number = ViewManagerModel(model).selectedIndex; + if (_currentView) { + removeElement(_currentView); + } + _currentView = views[index]; + addElement(_currentView); + + dispatchEvent( new Event("viewChanged") ); + } + + private var _currentView:IView; + + /** + * The currently visible view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedView():IView + { + return _currentView; + } + + /** + * IViewManager + */ + + private var _viewManager:IViewManager; + + /** + * This view manager's parent view manager, if any. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get viewManager():IViewManager + { + return _viewManager; + } + public function set viewManager(value:IViewManager):void + { + _viewManager = value; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as new file mode 100644 index 0000000..fd1a58b --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.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 org.apache.flex.mobile.beads +{ + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IViewportModel; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.Event; + import org.apache.flex.html.beads.ContainerView; + import org.apache.flex.html.beads.layouts.HorizontalLayout; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.chrome.ToolBar; + import org.apache.flex.mobile.models.ViewManagerModel; + + /** + * The StackedViewManagerView creates the visual elements of the StackedViewManager. This + * includes a NavigationBar, ToolBar, and contentArea. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class StackedViewManagerView extends ViewManagerView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function StackedViewManagerView() + { + super(); + } + + private var _toolBar:ToolBar; + + override public function set strand(value:IStrand):void + { + var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel; + + if (model.toolBarItems) + { + _toolBar = new ToolBar(); + _toolBar.controls = model.toolBarItems; + _toolBar.addBead(new HorizontalLayout()); + UIBase(value).addElement(_toolBar,false); + } + + super.strand = value; + } + override public function get strand():IStrand + { + return super.strand; + } + + /** + * @private + */ + override protected function layoutChromeElements():void + { + var host:UIBase = strand as UIBase; + var contentAreaY:Number = 0; + var contentAreaHeight:Number = host.height; + var toolbarHeight:Number = _toolBar == null ? 0 : _toolBar.height; + + var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel; + + if (navigationBar) + { + navigationBar.x = 0; + navigationBar.y = 0; + navigationBar.width = host.width; + + contentAreaHeight -= navigationBar.height; + contentAreaY = navigationBar.height; + + model.navigationBar = navigationBar; + } + + if (_toolBar) + { + _toolBar.x = 0; + _toolBar.y = host.height - toolbarHeight; + _toolBar.width = host.width; + + contentAreaHeight -= toolbarHeight; + + model.toolBar = _toolBar; + } + + if (contentAreaY < 0) contentAreaY = 0; + if (contentAreaHeight < 0) contentAreaHeight = 0; + + model.contentX = 0; + model.contentY = contentAreaY; + model.contentWidth = host.width; + model.contentHeight = contentAreaHeight; + + sizeViewsToFitContentArea(); + + // notify the views that the content size has changed + IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") ); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as new file mode 100644 index 0000000..be20d2c --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as @@ -0,0 +1,139 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile.beads +{ + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IViewportModel; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.Event; + import org.apache.flex.html.beads.ContainerView; + import org.apache.flex.html.beads.layouts.HorizontalLayout; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.chrome.TabBar; + import org.apache.flex.mobile.models.ViewManagerModel; + + /** + * The TabbedViewManagerView constructs the visual elements of the TabbedViewManager. The + * elements may be a navigation bar, a tab bar, and the contentArea. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class TabbedViewManagerView extends ViewManagerView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function TabbedViewManagerView() + { + super(); + } + + private var _tabBar:TabBar; + + private var _strand:IStrand; + override public function get strand():IStrand + { + return _strand; + } + override public function set strand(value:IStrand):void + { + _strand = value; + + var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel; + + // TabbedViewManager always has a TabBar + _tabBar = new TabBar(); + _tabBar.dataProvider = model.views; + _tabBar.labelField = "title"; + _tabBar.addEventListener("change",handleButtonBarChange); + UIBase(_strand).addElement(_tabBar, false); + + super.strand = value; + } + + /** + * @private + */ + private function handleButtonBarChange(event:Event):void + { + var newIndex:Number = _tabBar.selectedIndex; + var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel; + + // doing this will trigger the selectedIndexChanged event which will + // tell the strand to switch views + model.selectedIndex = newIndex; + } + + /** + * @private + */ + override protected function layoutChromeElements():void + { + var host:UIBase = _strand as UIBase; + var contentAreaY:Number = 0; + var contentAreaHeight:Number = host.height; + + var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel; + + if (navigationBar) + { + navigationBar.x = 0; + navigationBar.y = 0; + navigationBar.width = host.width; + + contentAreaHeight -= navigationBar.height; + contentAreaY = navigationBar.height; + + model.navigationBar = navigationBar; + } + + if (_tabBar) + { + _tabBar.x = 0; + _tabBar.y = host.height - _tabBar.height; + _tabBar.width = host.width; + _tabBar.dispatchEvent(new Event("layoutNeeded")); + + contentAreaHeight -= _tabBar.height; + + model.tabBar = _tabBar; + } + + model.contentX = 0; + model.contentY = contentAreaY; + model.contentWidth = host.width; + model.contentHeight = contentAreaHeight; + + sizeViewsToFitContentArea(); + + // notify the views that the content size has changed + IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") ); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerView.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerView.as new file mode 100644 index 0000000..59baf94 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerView.as @@ -0,0 +1,165 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile.beads +{ + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IUIBase; + import org.apache.flex.core.IViewportModel; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.Event; + import org.apache.flex.html.Container; + import org.apache.flex.html.beads.layouts.HorizontalLayout; + import org.apache.flex.mobile.IView; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.models.ViewManagerModel; + + /** + * The ViewManagerView creates the visual elements of the StackedViewManager. This + * includes a NavigationBar, ToolBar, and contentArea. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ViewManagerView implements IBeadView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ViewManagerView() + { + super(); + } + + public function get host():IUIBase + { + return _strand as IUIBase; + } + public function set host(value:IUIBase):void + { + // not implemented; getter only. + } + + private var _navigationBar:NavigationBar; + public function get navigationBar():NavigationBar + { + return _navigationBar; + } + public function set navigationBar(value:NavigationBar):void + { + // not implemented; getter only. + } + + private var _strand:IStrand; + public function get strand():IStrand + { + return _strand; + } + public function set strand(value:IStrand):void + { + _strand = value; + UIBase(_strand).addEventListener("sizeChanged", sizeChangedHandler); + UIBase(_strand).addEventListener("widthChanged", sizeChangedHandler); + UIBase(_strand).addEventListener("heightChanged", sizeChangedHandler); + + var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel; + model.addEventListener("selectedIndexChanged", viewsChangedHandler); + + if (model.navigationBarItems) + { + _navigationBar = new NavigationBar(); + _navigationBar.controls = model.navigationBarItems; + _navigationBar.addBead(new HorizontalLayout()); + UIBase(_strand).addElement(_navigationBar, false); + } + } + + /** + * @private + */ + protected function viewsChangedHandler(event:Event):void + { + layoutChromeElements(); + } + + /** + * @private + */ + protected function sizeChangedHandler(event:Event):void + { + layoutChromeElements(); + } + + /** + * @private + */ + protected function layoutChromeElements():void + { + var host:UIBase = _strand as UIBase; + var contentAreaY:Number = 0; + var contentAreaHeight:Number = host.height; + + var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel; + + if (_navigationBar) + { + _navigationBar.x = 0; + _navigationBar.y = 0; + _navigationBar.width = host.width; + + contentAreaHeight -= _navigationBar.height; + contentAreaY = _navigationBar.height; + + model.navigationBar = _navigationBar; + } + + model.contentX = 0; + model.contentY = contentAreaY; + model.contentWidth = host.width; + model.contentHeight = contentAreaHeight; + + sizeViewsToFitContentArea(); + } + + protected function sizeViewsToFitContentArea():void + { + var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel; + + var n:int = ViewManagerModel(model).views.length; + if (n > 0) { + for (var i:int = 0; i < n; i++) + { + var view:IView = ViewManagerModel(model).views[i] as IView; + UIBase(view).x = model.contentX; + UIBase(view).y = model.contentY; + UIBase(view).setWidthAndHeight(model.contentWidth, model.contentHeight, true); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/NavigationBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/NavigationBar.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/NavigationBar.as new file mode 100644 index 0000000..5e7873e --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/NavigationBar.as @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile.chrome +{ + import org.apache.flex.core.IChrome; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.html.Container; + + /** + * The NavigationBar class is part of the mobile view manager's chrome. When present, + * it provides a place for content at the top of the view, above the contentArea. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NavigationBar extends Container implements IChrome + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function NavigationBar() + { + super(); + + className = "NavigationBar"; + } + + public function hidesBackButton(value:Boolean):void + { + + } + + private var _controls:Array; + + /** + * The controls of the NavigationBar (eg, a button to go back and a title). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set controls(value:Array):void + { + _controls = value; + } + public function get controls():Array + { + return _controls; + } + + /** + * @private + */ + override public function addedToParent():void + { + super.addedToParent(); + + for (var i:int=0; i < _controls.length; i++) + { + addElement( _controls[i], false ); + + var ctrl:IEventDispatcher = _controls[i] as IEventDispatcher; + ctrl.addEventListener("show", handleVisibilityChange); + ctrl.addEventListener("hide", handleVisibilityChange); + } + + dispatchEvent(new Event("layoutNeeded")); + } + + /** + * @private + */ + private function handleVisibilityChange(event:Event):void + { + dispatchEvent(new Event("layoutNeeded")); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/TabBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/TabBar.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/TabBar.as new file mode 100644 index 0000000..6e54326 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/TabBar.as @@ -0,0 +1,50 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile.chrome +{ + import org.apache.flex.core.IChrome; + import org.apache.flex.html.ButtonBar; + + /** + * The TabBar class displays a set of buttons that can be used to + * switch between navigation panels. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class TabBar extends ButtonBar implements IChrome + { + /** + * Constructor + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function TabBar() + { + super(); + + className = "TabBar"; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/ToolBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/ToolBar.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/ToolBar.as new file mode 100644 index 0000000..af63d49 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/chrome/ToolBar.as @@ -0,0 +1,80 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile.chrome +{ + import org.apache.flex.core.IBeadLayout; + import org.apache.flex.core.IChrome; + import org.apache.flex.events.Event; + import org.apache.flex.html.Container; + + /** + * The ToolBar class provides a space below the contentArea of a view manager which can + * be used to house controls for the view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ToolBar extends Container implements IChrome + { + public function ToolBar() + { + super(); + + className = "ToolBar"; + } + + private var _controls:Array; + + /** + * The control components of the ToolBar (eg, a settings button). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set controls(value:Array):void + { + _controls = value; + } + public function get controls():Array + { + return _controls; + } + + /** + * @private + */ + override public function addedToParent():void + { + super.addedToParent(); + + var layout:IBeadLayout = this.getBeadByType(IBeadLayout) as IBeadLayout; + + for (var i:int=0; i < _controls.length; i++) + { + addElement( _controls[i], false ); + } + + dispatchEvent(new Event("layoutNeeded")); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/models/ViewManagerModel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/models/ViewManagerModel.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/models/ViewManagerModel.as new file mode 100644 index 0000000..c57cc61 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/models/ViewManagerModel.as @@ -0,0 +1,263 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mobile.models +{ + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.chrome.TabBar; + import org.apache.flex.mobile.chrome.ToolBar; + + /** + * The ViewManagerModel houses properties and values common to the components + * which make up view managers. These properties include the title, which view + * is currently active and selected. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ViewManagerModel extends EventDispatcher implements IBeadModel + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ViewManagerModel() + { + super(); + + _views = new Array(); + } + + private var _strand:IStrand; + + public function set strand(value:IStrand):void + { + _strand = value; + } + + public var contentX:Number = 0; + public var contentY:Number = 0; + public var contentWidth:Number = 0; + public var contentHeight:Number = 0; + + private var _views:Array; + + /** + * The array of views displayed in the contentArea of the ViewManager. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get views():Array + { + return _views; + } + public function set views(value:Array):void + { + if (value != _views) { + _views = value; + _selectedIndex = value.length - 1; + dispatchEvent(new Event("viewsChanged")); + } + } + + /** + * Pushes a view onto the top/end of the stack of views. This view becomes + * the active view. Mostly used by the StackedViewManager. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function pushView(value:Object):void + { + _views.push(value); + _selectedIndex = _views.length - 1; + dispatchEvent(new Event("viewPushed")); + } + + /** + * Removes the most recently added view. The next view in the stack becomes the + * active view. Mostly used by StackedViewManager. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function popView():Object + { + if (_views.length > 1) { + var discard:Object = _views.pop(); + _selectedIndex = _views.length - 1; + dispatchEvent(new Event("viewPopped")); + } + return _views[_views.length-1]; + } + + private var _selectedIndex:Number = -1; + + /** + * The index into the views array of the currently active view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedIndex():Number + { + return _selectedIndex; + } + public function set selectedIndex(value:Number):void + { + if (value != _selectedIndex) { + _selectedIndex = value; + dispatchEvent(new Event("selectedIndexChanged")); + } + } + + private var _title:String; + + /** + * The title of the view.. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get title():String + { + return _title; + } + public function set title(value:String):void + { + _title = value; + } + + private var _navigationBarItems:Array; + + /** + * The array of controls that make up the NavigationBar. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get navigationBarItems():Array + { + return _navigationBarItems; + } + public function set navigationBarItems(value:Array):void + { + _navigationBarItems = value; + } + + private var _navigationBar:NavigationBar; + + /** + * The NavigationBar (or null if not present). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get navigationBar():NavigationBar + { + return _navigationBar; + } + public function set navigationBar(value:NavigationBar):void + { + _navigationBar = value; + } + + private var _toolBarItems:Array; + + /** + * The array of controls that make up the ToolBar.. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get toolBarItems():Array + { + return _toolBarItems; + } + public function set toolBarItems(value:Array):void + { + _toolBarItems = value; + } + + private var _toolBar:ToolBar; + + /** + * The ToolBar (or null if not present). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get toolBar():ToolBar + { + return _toolBar; + } + public function set toolBar(value:ToolBar):void + { + _toolBar = value; + } + + private var _tabBar:TabBar; + + /** + * The TabBar (or null if not present). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get tabBar():TabBar + { + return _tabBar; + } + public function set tabBar(value:TabBar):void + { + _tabBar = value; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml b/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml new file mode 100644 index 0000000..4f54235 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml @@ -0,0 +1,29 @@ +<?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. + +--> + + +<componentPackage> + <component id="StackedViewManager" class="org.apache.flex.mobile.StackedViewManager" /> + <component id="TabbedViewManager" class="org.apache.flex.mobile.TabbedViewManager" /> + <component id="View" class="org.apache.flex.mobile.View" /> + <component id="NavigationBar" class="org.apache.flex.mobile.chrome.NavigationBar" /> + <component id="ToolBar" class="org.apache.flex.mobile.chrome.ToolBar" /> + <component id="TabBar" class="org.apache.flex.mobile.chrome.TabBar" /> +</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f58df6a/frameworks/projects/Mobile/src/main/resources/compile-asjs-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/resources/compile-asjs-config.xml b/frameworks/projects/Mobile/src/main/resources/compile-asjs-config.xml new file mode 100644 index 0000000..ba49185 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/resources/compile-asjs-config.xml @@ -0,0 +1,89 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path> + <!-- asjscompc won't 'link' these classes in, but will list their requires + if these swcs are on the external-library-path then their requires + will not be listed --> + <path-element>../../externs/Core.swc</path-element> + <path-element>../../externs/Graphics.swc</path-element> + <path-element>../../externs/HTML.swc</path-element> + </library-path> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/basic</uri> + <manifest>basic-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/flexjs/cordova</uri> + <manifest>cordova-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>as/src</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + </include-file> + + <include-sources> + </include-sources> + + <include-classes> + <class>MobileClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/basic</uri> + <uri>library://ns.apache.org/flexjs/cordova</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</flex-config>
