http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadViewBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadViewBase.as deleted file mode 100644 index 301e430..0000000 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadViewBase.as +++ /dev/null @@ -1,317 +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.html -{ - import org.apache.flex.states.State; - - import org.apache.flex.core.IBead; - import org.apache.flex.core.ILayoutHost; - import org.apache.flex.core.IParent; - import org.apache.flex.core.IParentIUIBase; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IStatesImpl; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.html.beads.ContainerView; - import org.apache.flex.events.Event; - import org.apache.flex.events.ValueChangeEvent; - import org.apache.flex.utils.MXMLDataInterpreter; - - [DefaultProperty("mxmlContent")] - - /** - * The MXMLBeadViewBase class extends BeadViewBase - * and adds support for databinding and specification - * of children in MXML. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class MXMLBeadViewBase extends ContainerView implements IStrand, ILayoutHost - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function MXMLBeadViewBase() - { - super(); - } - - [Bindable("strandChanged")] - /** - * An MXMLBeadViewBase doesn't create its children until it is added to - * the strand. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function set strand(value:IStrand):void - { - super.strand = value; - // each MXML file can also have styles in fx:Style block - ValuesManager.valuesImpl.init(this); - - dispatchEvent(new Event("strandChanged")); - - for each (var bead:IBead in beads) - addBead(bead); - - dispatchEvent(new org.apache.flex.events.Event("beadsAdded")); - - MXMLDataInterpreter.generateMXMLInstances(this, IParent(value), MXMLDescriptor); - - dispatchEvent(new Event("initBindings")) - dispatchEvent(new Event("initComplete")) - dispatchEvent(new Event("childrenAdded")); - } - - [Bindable("__NoChangeEvent__")] - /** - * The model object. - */ - public function get model():Object - { - return _strand["model"]; - } - - /** - * @copy org.apache.flex.core.Application#MXMLDescriptor - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get MXMLDescriptor():Array - { - return null; - } - - /** - * @copy org.apache.flex.core.Application#generateMXMLAttributes() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function generateMXMLAttributes(data:Array):void - { - MXMLDataInterpreter.generateMXMLProperties(this, data); - } - - /** - * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public var mxmlContent:Array; - - private var _states:Array; - - /** - * The array of view states. These should - * be instances of org.apache.flex.states.State. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get states():Array - { - return _states; - } - - /** - * @private - */ - public function set states(value:Array):void - { - _states = value; - _currentState = _states[0].name; - - try{ - if (getBeadByType(IStatesImpl) == null) - addBead(new (ValuesManager.valuesImpl.getValue(this, "iStatesImpl")) as IBead); - } - //TODO: Need to handle this case more gracefully - catch(e:Error) - { - COMPILE::AS3 - { - trace(e.message); - } - } - - } - - /** - * <code>true</code> if the array of states - * contains a state with this name. - * - * @param state The state namem. - * @return True if state in state array - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function hasState(state:String):Boolean - { - for each (var s:State in _states) - { - if (s.name == state) - return true; - } - return false; - } - - private var _currentState:String; - - [Bindable("currentStateChange")] - /** - * The name of the current state. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get currentState():String - { - return _currentState; - } - - /** - * @private - */ - public function set currentState(value:String):void - { - var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value) - _currentState = value; - dispatchEvent(event); - } - - private var _transitions:Array; - - /** - * The array of transitions. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get transitions():Array - { - return _transitions; - } - - /** - * @private - */ - public function set transitions(value:Array):void - { - _transitions = value; - } - - /** - * @copy org.apache.flex.core.Application#beads - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public var beads:Array; - - private var _beads:Array; - - /** - * @copy org.apache.flex.core.IStrand#addBead() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function addBead(bead:IBead):void - { - if (!_beads) - _beads = []; - _beads.push(bead); - bead.strand = this; - } - - /** - * @copy org.apache.flex.core.IStrand#getBeadByType() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function getBeadByType(classOrInterface:Class):IBead - { - for each (var bead:IBead in _beads) - { - if (bead is classOrInterface) - return bead; - } - return null; - } - - /** - * @copy org.apache.flex.core.IStrand#removeBead() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function removeBead(value:IBead):IBead - { - var n:int = _beads.length; - for (var i:int = 0; i < n; i++) - { - var bead:IBead = _beads[i]; - if (bead == value) - { - _beads.splice(i, 1); - return bead; - } - } - return null; - } - - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml index cebd24b..206f43e 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml @@ -25,7 +25,7 @@ limitations under the License. @playerversion AIR 2.6 @productversion FlexJS 0.0 --> -<js:MXMLBeadViewBase xmlns:fx="http://ns.adobe.com/mxml/2009" +<js:MXMLBeadView xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:js="library://ns.apache.org/flexjs/basic"> <fx:Script> @@ -43,7 +43,7 @@ limitations under the License. ]]> </fx:Script> <js:beads> - <js:MXMLBeadViewBaseDataBinding /> + <js:MXMLBeadViewDataBinding /> <js:LayoutChangeNotifier watchedProperty="{titleLabel.text}" /> </js:beads> @@ -55,4 +55,4 @@ limitations under the License. <js:CloseButton id="closeButton" click="clickHandler()" visible="{ITitleBarModel(model).showCloseButton}"/> -</js:MXMLBeadViewBase> +</js:MXMLBeadView> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml index 9fe03a8..8904c6e 100644 --- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml @@ -101,7 +101,7 @@ <component id="FlexibleFirstChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout"/> <component id="OneFlexibleChildVerticalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout"/> <component id="OneFlexibleChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout"/> - <component id="MXMLBeadViewBase" class="org.apache.flex.html.MXMLBeadViewBase"/> + <component id="MXMLBeadView" class="org.apache.flex.html.MXMLBeadView"/> <component id="Border" class="org.apache.flex.html.supportClasses.Border"/> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/resources/defaults.css b/frameworks/projects/HTML/src/main/resources/defaults.css index 20fcebd..ba63d8e 100644 --- a/frameworks/projects/HTML/src/main/resources/defaults.css +++ b/frameworks/projects/HTML/src/main/resources/defaults.css @@ -355,7 +355,7 @@ ToolTip background-color: #FFFFCC; } -ViewBase +View { IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView"); IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.BasicLayout"); @@ -634,7 +634,7 @@ ToggleTextButton IBeadView: ClassReference("org.apache.flex.html.beads.CSSTextToggleButtonView"); } -ViewBase +View { iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead"); iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead"); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/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 index 411b05c..7c650fd 100644 --- a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as +++ b/frameworks/projects/Mobile/src/main/flex/MobileClasses.as @@ -35,7 +35,7 @@ internal class MobileClasses 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.beads.ViewManagerViewBase; ViewManagerViewBase; import org.apache.flex.mobile.beads.ToggleSwitchView; ToggleSwitchView; import org.apache.flex.mobile.beads.controllers.ToggleSwitchMouseController; ToggleSwitchMouseController; import org.apache.flex.mobile.chrome.NavigationBar; NavigationBar; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/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 deleted file mode 100644 index 232d212..0000000 --- a/frameworks/projects/Mobile/src/main/flex/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/40187884/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 index 54bb22a..75cce3c 100644 --- 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 @@ -27,7 +27,7 @@ package org.apache.flex.mobile * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public interface IViewManager extends IView + public interface IViewManager extends IViewManagerView { /** * The view that is currently active in the view manager. @@ -37,6 +37,6 @@ package org.apache.flex.mobile * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - function get selectedView():IView; + function get selectedView():IViewManagerView; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManagerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManagerView.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManagerView.as new file mode 100644 index 0000000..8735907 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/IViewManagerView.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 IViewManagerView 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 IViewManagerView + { + /** + * 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/40187884/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 index 4b29d28..dc63c65 100644 --- 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 @@ -20,7 +20,7 @@ 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.IViewManagerView; import org.apache.flex.mobile.IViewManager; import org.apache.flex.mobile.chrome.NavigationBar; import org.apache.flex.mobile.chrome.ToolBar; @@ -101,7 +101,7 @@ package org.apache.flex.mobile } - private var _topView:IView; + private var _topView:IViewManagerView; /** * The top-most (current) view. @@ -111,7 +111,7 @@ package org.apache.flex.mobile * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - override public function get selectedView():IView + override public function get selectedView():IViewManagerView { return _topView; } @@ -125,7 +125,7 @@ package org.apache.flex.mobile * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public function push(nextView:IView):void + public function push(nextView:IViewManagerView):void { nextView.viewManager = this; ViewManagerModel(model).pushView(nextView); @@ -151,7 +151,7 @@ package org.apache.flex.mobile var lastView:Object = ViewManagerModel(model).popView(); removeElement(_topView); addElement(lastView); - _topView = lastView as IView; + _topView = lastView as IViewManagerView; dispatchEvent( new Event("viewChanged") ); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/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 index 43fc6a6..347f7c6 100644 --- 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 @@ -19,7 +19,7 @@ package org.apache.flex.mobile { import org.apache.flex.html.Container; - import org.apache.flex.mobile.IView; + import org.apache.flex.mobile.IViewManagerView; import org.apache.flex.mobile.IViewManager; import org.apache.flex.mobile.chrome.TabBar; import org.apache.flex.mobile.models.ViewManagerModel; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as new file mode 100644 index 0000000..b2d2920 --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.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 TitleView class represents a view in a mobile app that has + * a title and is typically used in a ViewManager. + */ + public class TitleView extends Container implements IViewManagerView + { + public function TitleView() + { + 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/40187884/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 deleted file mode 100644 index 490d8bf..0000000 --- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/View.as +++ /dev/null @@ -1,103 +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; - } - - 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/40187884/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 index 0da3f4d..690669b 100644 --- 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 @@ -21,7 +21,7 @@ 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.IViewManagerView; import org.apache.flex.mobile.IViewManager; import org.apache.flex.mobile.chrome.NavigationBar; import org.apache.flex.mobile.models.ViewManagerModel; @@ -170,7 +170,7 @@ package org.apache.flex.mobile if (n > 0) { for (var i:int = 0; i < n; i++) { - var view:IView = ViewManagerModel(model).views[i] as IView; + var view:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView; view.viewManager = this; if (i == 0) { addElement(view, true); @@ -195,7 +195,7 @@ package org.apache.flex.mobile dispatchEvent( new Event("viewChanged") ); } - private var _currentView:IView; + private var _currentView:IViewManagerView; /** * The currently visible view. @@ -205,7 +205,7 @@ package org.apache.flex.mobile * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public function get selectedView():IView + public function get selectedView():IViewManagerView { return _currentView; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/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 index fd1a58b..85368ae 100644 --- 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 @@ -39,7 +39,7 @@ package org.apache.flex.mobile.beads * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class StackedViewManagerView extends ViewManagerView + public class StackedViewManagerView extends ViewManagerViewBase { /** * Constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/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 index be20d2c..787375d 100644 --- 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 @@ -39,7 +39,7 @@ package org.apache.flex.mobile.beads * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class TabbedViewManagerView extends ViewManagerView + public class TabbedViewManagerView extends ViewManagerViewBase { /** * Constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/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 deleted file mode 100644 index 59baf94..0000000 --- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerView.as +++ /dev/null @@ -1,165 +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.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/40187884/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as new file mode 100644 index 0000000..f314fad --- /dev/null +++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.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.IViewManagerView; + import org.apache.flex.mobile.chrome.NavigationBar; + import org.apache.flex.mobile.models.ViewManagerModel; + + /** + * The ViewManagerViewBase 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 ViewManagerViewBase implements IBeadView + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ViewManagerViewBase() + { + 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:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView; + 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/40187884/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 index ddec534..4264191 100644 --- a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml @@ -22,7 +22,7 @@ <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="TitleView" class="org.apache.flex.mobile.TitleView" /> <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" />
