Port of Mobile project.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/44a1bb9a Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/44a1bb9a Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/44a1bb9a Branch: refs/heads/core_js_to_as Commit: 44a1bb9a092ba100293d087f7cfb482571dd57b4 Parents: 845bc6d Author: Peter Ent <[email protected]> Authored: Wed Nov 18 14:55:12 2015 -0500 Committer: Peter Ent <[email protected]> Committed: Wed Nov 18 14:55:12 2015 -0500 ---------------------------------------------------------------------- frameworks/build.xml | 5 +- frameworks/projects/Mobile/as/defaults.css | 33 +++ .../projects/Mobile/as/src/CordovaClasses.as | 36 +++ .../projects/Mobile/as/src/MobileClasses.as | 13 +- .../as/src/org/apache/flex/mobile/IView.as | 43 +++ .../src/org/apache/flex/mobile/IViewManager.as | 42 +++ .../src/org/apache/flex/mobile/ManagerBase.as | 35 ++- .../apache/flex/mobile/StackedViewManager.as | 161 ++++++++++++ .../org/apache/flex/mobile/TabbedViewManager.as | 85 ++++++ .../as/src/org/apache/flex/mobile/View.as | 103 ++++++++ .../org/apache/flex/mobile/ViewManagerBase.as | 236 +++++++++++++++++ .../flex/mobile/beads/StackedViewManagerView.as | 127 +++++++++ .../flex/mobile/beads/TabbedViewManagerView.as | 139 ++++++++++ .../apache/flex/mobile/beads/ViewManagerView.as | 165 ++++++++++++ .../apache/flex/mobile/chrome/NavigationBar.as | 103 ++++++++ .../src/org/apache/flex/mobile/chrome/TabBar.as | 50 ++++ .../org/apache/flex/mobile/chrome/ToolBar.as | 80 ++++++ .../flex/mobile/models/ViewManagerModel.as | 263 +++++++++++++++++++ frameworks/projects/Mobile/asjs/defaults.css | 33 --- .../asjs/src/org/apache/flex/mobile/IView.as | 43 --- .../src/org/apache/flex/mobile/IViewManager.as | 42 --- .../apache/flex/mobile/StackedViewManager.as | 161 ------------ .../org/apache/flex/mobile/TabbedViewManager.as | 85 ------ .../asjs/src/org/apache/flex/mobile/View.as | 96 ------- .../org/apache/flex/mobile/ViewManagerBase.as | 229 ---------------- .../flex/mobile/beads/StackedViewManagerView.as | 127 --------- .../flex/mobile/beads/TabbedViewManagerView.as | 139 ---------- .../apache/flex/mobile/beads/ViewManagerView.as | 165 ------------ .../apache/flex/mobile/chrome/NavigationBar.as | 103 -------- .../src/org/apache/flex/mobile/chrome/TabBar.as | 50 ---- .../org/apache/flex/mobile/chrome/ToolBar.as | 81 ------ .../flex/mobile/models/ViewManagerModel.as | 263 ------------------- frameworks/projects/Mobile/build.xml | 101 +++---- .../projects/Mobile/compile-asjs-config.xml | 30 ++- frameworks/projects/Mobile/compile-config.xml | 12 +- 35 files changed, 1782 insertions(+), 1697 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44a1bb9a/frameworks/build.xml ---------------------------------------------------------------------- diff --git a/frameworks/build.xml b/frameworks/build.xml index 02e225b..bb0c1c0 100644 --- a/frameworks/build.xml +++ b/frameworks/build.xml @@ -100,7 +100,6 @@ <ant dir="${basedir}/projects/GoogleMaps" target="compile-asjs"/> <ant dir="${basedir}/projects/HTML5" target="compile-asjs"/> <ant dir="${basedir}/projects/JQuery" target="compile-asjs"/> - <ant dir="${basedir}/projects/Mobile" target="compile-asjs"/> </target> <target name="lint-js" description="Cross-compiles all SWCs"> @@ -110,7 +109,6 @@ <ant dir="${basedir}/projects/GoogleMaps" target="lint-js"/> <ant dir="${basedir}/projects/HTML5" target="lint-js"/> <ant dir="${basedir}/projects/JQuery" target="lint-js"/> - <ant dir="${basedir}/projects/Mobile" target="lint-js"/> </target> <target name="re-compile" description="Builds all SWCs which should pick up the JS files from asjs"> @@ -121,7 +119,6 @@ <ant dir="${basedir}/projects/GoogleMaps" target="compile"/> <ant dir="${basedir}/projects/HTML5" target="compile"/> <ant dir="${basedir}/projects/JQuery" target="compile"/> - <ant dir="${basedir}/projects/Mobile" target="compile"/> </target> <target name="js" depends="compile-asjs, lint-js" /> @@ -243,7 +240,7 @@ </target> <target name="Mobile" description="Clean build of Mobile.swc"> - <ant dir="${basedir}/projects/Mobile"/> + <ant dir="${basedir}/projects/Mobile" target="all"/> </target> <target name="Network" description="Clean build of Network.swc"> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44a1bb9a/frameworks/projects/Mobile/as/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/defaults.css b/frameworks/projects/Mobile/as/defaults.css new file mode 100644 index 0000000..d529595 --- /dev/null +++ b/frameworks/projects/Mobile/as/defaults.css @@ -0,0 +1,33 @@ +/* + * + * 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. + * + */ + +@namespace "library://ns.apache.org/flexjs/basic"; +@namespace svg "library://ns.apache.org/flexjs/svg"; + +StackedViewManager +{ + IBeadModel: ClassReference("org.apache.flex.mobile.models.ViewManagerModel"); + IBeadView: ClassReference("org.apache.flex.mobile.beads.StackedViewManagerView"); +} + +TabbedViewManager +{ + IBeadModel: ClassReference("org.apache.flex.mobile.models.ViewManagerModel"); + IBeadView: ClassReference("org.apache.flex.mobile.beads.TabbedViewManagerView"); +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44a1bb9a/frameworks/projects/Mobile/as/src/CordovaClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/CordovaClasses.as b/frameworks/projects/Mobile/as/src/CordovaClasses.as new file mode 100644 index 0000000..3b9dc98 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/MobileClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/MobileClasses.as b/frameworks/projects/Mobile/as/src/MobileClasses.as index 75d2960..fc933aa 100644 --- a/frameworks/projects/Mobile/as/src/MobileClasses.as +++ b/frameworks/projects/Mobile/as/src/MobileClasses.as @@ -27,11 +27,16 @@ package */ internal class MobileClasses { - import org.apache.cordova.camera.Camera; Camera; - import org.apache.cordova.Application; Application; - import org.apache.cordova.Weinre; Weinre; - 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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/IView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/IView.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/IView.as new file mode 100644 index 0000000..232d212 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/IViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/IViewManager.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/IViewManager.as new file mode 100644 index 0000000..54bb22a --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ManagerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ManagerBase.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ManagerBase.as index 8d444a5..5c2e149 100644 --- a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ManagerBase.as +++ b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ManagerBase.as @@ -21,6 +21,10 @@ 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 @@ -47,17 +51,38 @@ package org.apache.flex.mobile 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%'; - addEventListener("initComplete", handleInitComplete); - addEventListener("sizeChanged", handleInitComplete); - addEventListener("widthChanged", handleInitComplete); - addEventListener("heightChanged", handleInitComplete); + return element; } private function handleInitComplete(event:Event):void { - trace("Manager base event: "+event.type+"; width="+width+", height="+height); _contentArea.setWidthAndHeight(width, height, true); // todo: listen for changes to this item http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/StackedViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/StackedViewManager.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/StackedViewManager.as new file mode 100644 index 0000000..4b29d28 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/TabbedViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/TabbedViewManager.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/TabbedViewManager.as new file mode 100644 index 0000000..43fc6a6 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/View.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/View.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/View.as new file mode 100644 index 0000000..490d8bf --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ViewManagerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ViewManagerBase.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/ViewManagerBase.as new file mode 100644 index 0000000..0da3f4d --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/StackedViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/StackedViewManagerView.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/StackedViewManagerView.as new file mode 100644 index 0000000..fd1a58b --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/TabbedViewManagerView.as new file mode 100644 index 0000000..be20d2c --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/ViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/ViewManagerView.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/beads/ViewManagerView.as new file mode 100644 index 0000000..59baf94 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/NavigationBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/NavigationBar.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/NavigationBar.as new file mode 100644 index 0000000..5e7873e --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/TabBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/TabBar.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/TabBar.as new file mode 100644 index 0000000..6e54326 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/ToolBar.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/ToolBar.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/chrome/ToolBar.as new file mode 100644 index 0000000..af63d49 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/models/ViewManagerModel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/models/ViewManagerModel.as b/frameworks/projects/Mobile/as/src/org/apache/flex/mobile/models/ViewManagerModel.as new file mode 100644 index 0000000..c57cc61 --- /dev/null +++ b/frameworks/projects/Mobile/as/src/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/44a1bb9a/frameworks/projects/Mobile/asjs/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/defaults.css b/frameworks/projects/Mobile/asjs/defaults.css deleted file mode 100644 index d529595..0000000 --- a/frameworks/projects/Mobile/asjs/defaults.css +++ /dev/null @@ -1,33 +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. - * - */ - -@namespace "library://ns.apache.org/flexjs/basic"; -@namespace svg "library://ns.apache.org/flexjs/svg"; - -StackedViewManager -{ - IBeadModel: ClassReference("org.apache.flex.mobile.models.ViewManagerModel"); - IBeadView: ClassReference("org.apache.flex.mobile.beads.StackedViewManagerView"); -} - -TabbedViewManager -{ - IBeadModel: ClassReference("org.apache.flex.mobile.models.ViewManagerModel"); - IBeadView: ClassReference("org.apache.flex.mobile.beads.TabbedViewManagerView"); -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44a1bb9a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as deleted file mode 100644 index 232d212..0000000 --- a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IView.as +++ /dev/null @@ -1,43 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package 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/44a1bb9a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as deleted file mode 100644 index 54bb22a..0000000 --- a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/IViewManager.as +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package 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/44a1bb9a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as deleted file mode 100644 index 4b29d28..0000000 --- a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/StackedViewManager.as +++ /dev/null @@ -1,161 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package 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/44a1bb9a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as deleted file mode 100644 index 43fc6a6..0000000 --- a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/TabbedViewManager.as +++ /dev/null @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package 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/44a1bb9a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as deleted file mode 100644 index 8b48536..0000000 --- a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/View.as +++ /dev/null @@ -1,96 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package 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; - } - - override 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/44a1bb9a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/ViewManagerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/ViewManagerBase.as b/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/ViewManagerBase.as deleted file mode 100644 index d435157..0000000 --- a/frameworks/projects/Mobile/asjs/src/org/apache/flex/mobile/ViewManagerBase.as +++ /dev/null @@ -1,229 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package 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; - } - - /** - * @private - */ - override 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
