Fairly big change to the Container structure: removed the "chrome" concept in favor of letting "advanced" components have access to the strand-as-parent.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/031ad2e7 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/031ad2e7 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/031ad2e7 Branch: refs/heads/develop Commit: 031ad2e79750fe0ea560c43d1b4b37f939bb704a Parents: 58dee53 Author: Peter Ent <[email protected]> Authored: Fri Sep 18 14:30:53 2015 -0400 Committer: Peter Ent <[email protected]> Committed: Fri Sep 18 14:30:53 2015 -0400 ---------------------------------------------------------------------- .../charts/beads/layouts/ChartBaseLayout.as | 4 +- .../layouts/LineChartCategoryVsLinearLayout.as | 4 +- .../layouts/LineChartLinearVsLinearLayout.as | 4 +- .../flex/charts/beads/layouts/PieChartLayout.as | 4 +- .../beads/layouts/StackedBarChartLayout.as | 4 +- .../beads/layouts/StackedColumnChartLayout.as | 4 +- frameworks/projects/Core/as/src/CoreClasses.as | 6 +- .../src/org/apache/flex/core/ContainerBase.as | 207 ++++++++++--------- .../flex/core/ContainerBaseStrandChildren.as | 98 +++++++++ .../src/org/apache/flex/core/IContainerView.as | 33 +++ .../org/apache/flex/core/IContentViewHost.as | 35 ++++ .../as/src/org/apache/flex/core/ILayoutHost.as | 44 ++++ .../src/org/apache/flex/core/ILayoutParent.as | 56 ----- .../as/src/org/apache/flex/core/ListBase.as | 123 +++++++++++ .../apache/flex/core/ListBaseStrandChildren.as | 99 +++++++++ .../as/src/org/apache/flex/core/ViewBase.as | 2 - .../src/org/apache/flex/core/ContainerBase.js | 205 ++++++++++++------ .../flex/core/ContainerBaseStrandChildren.js | 112 ++++++++++ .../src/org/apache/flex/core/IContainerView.js | 44 ++++ .../org/apache/flex/core/IContentViewHost.js | 52 +++++ .../js/src/org/apache/flex/core/ILayoutHost.js | 46 +++++ .../src/org/apache/flex/core/ILayoutParent.js | 59 ------ .../Core/js/src/org/apache/flex/core/IParent.js | 9 +- .../js/src/org/apache/flex/core/ListBase.js | 75 ++++++- .../apache/flex/core/ListBaseStrandChildren.js | 112 ++++++++++ .../Core/js/src/org/apache/flex/core/UIBase.js | 23 +++ frameworks/projects/Flat/flat-manifest.xml | 2 +- .../HTML/as/src/org/apache/flex/html/List.as | 27 ++- .../src/org/apache/flex/html/NumericStepper.as | 3 +- .../org/apache/flex/html/beads/ButtonBarView.as | 1 - .../org/apache/flex/html/beads/ContainerView.as | 58 +++++- .../src/org/apache/flex/html/beads/ListView.as | 1 - .../flex/html/beads/NumericStepperView.as | 7 +- .../src/org/apache/flex/html/beads/PanelView.as | 3 +- .../flex/html/beads/PanelWithControlBarView.as | 5 +- .../flex/html/beads/layouts/BasicLayout.as | 4 +- .../flex/html/beads/layouts/ButtonBarLayout.as | 4 +- .../flex/html/beads/layouts/HorizontalLayout.as | 4 +- .../flex/html/beads/layouts/TileLayout.as | 4 +- .../flex/html/beads/layouts/VerticalLayout.as | 4 +- .../html/supportClasses/ScrollingViewport.as | 5 +- .../org/apache/flex/html/MXMLBeadViewBase.as | 4 +- .../FlexibleFirstChildHorizontalLayout.as | 4 +- .../layouts/OneFlexibleChildHorizontalLayout.as | 4 +- .../layouts/OneFlexibleChildVerticalLayout.as | 4 +- .../html/beads/layouts/VerticalColumnLayout.as | 4 +- frameworks/projects/HTML/basic-manifest.xml | 2 +- .../HTML/js/src/org/apache/flex/html/List.js | 3 + .../src/org/apache/flex/html/NumericStepper.js | 1 + .../org/apache/flex/html/beads/ContainerView.js | 74 ++++++- .../src/org/apache/flex/html/beads/PanelView.js | 2 +- .../flex/html/beads/layouts/BasicLayout.js | 3 +- .../flex/html/beads/layouts/ButtonBarLayout.js | 3 +- .../flex/html/beads/layouts/HorizontalLayout.js | 3 +- .../flex/html/beads/layouts/TileLayout.js | 4 +- .../flex/html/beads/layouts/VerticalLayout.js | 3 +- 56 files changed, 1366 insertions(+), 348 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as index 3f2fd27..88dd0a4 100644 --- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as +++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as @@ -23,7 +23,7 @@ package org.apache.flex.charts.beads.layouts import org.apache.flex.charts.core.IHorizontalAxisBead; import org.apache.flex.charts.core.IVerticalAxisBead; import org.apache.flex.core.IBeadLayout; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IStrand; import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; @@ -116,7 +116,7 @@ package org.apache.flex.charts.beads.layouts public function get chartDataGroup():IChartDataGroup { if (_chartDataGroup == null) { - var layoutParent:ILayoutParent = chart.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = chart.getBeadByType(ILayoutHost) as ILayoutHost; _chartDataGroup = layoutParent.contentView as IChartDataGroup; } return _chartDataGroup; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as index 77b9fd6..b28ace9 100644 --- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as +++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as @@ -25,7 +25,7 @@ package org.apache.flex.charts.beads.layouts import org.apache.flex.charts.supportClasses.LineSeries; import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.UIBase; import org.apache.flex.events.Event; @@ -56,7 +56,7 @@ package org.apache.flex.charts.beads.layouts if (!dp) return; - var layoutParent:ILayoutParent = strand.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase; var n:int = dp.length; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as index 8088a6a..a001bfa 100644 --- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as +++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as @@ -25,7 +25,7 @@ package org.apache.flex.charts.beads.layouts import org.apache.flex.charts.supportClasses.LineSeries; import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.UIBase; import org.apache.flex.events.Event; @@ -56,7 +56,7 @@ package org.apache.flex.charts.beads.layouts if (!dp) return; - var layoutParent:ILayoutParent = strand.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase; var n:int = dp.length; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as index 22e4145..901da7f 100644 --- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as +++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as @@ -24,7 +24,7 @@ package org.apache.flex.charts.beads.layouts import org.apache.flex.charts.supportClasses.PieSeries; import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.graphics.IFill; import org.apache.flex.core.graphics.SolidColor; @@ -64,7 +64,7 @@ package org.apache.flex.charts.beads.layouts if (!dp) return; - var layoutParent:ILayoutParent = strand.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase; var n:int = dp.length; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as index 705d5d8..c75f7bc 100644 --- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as +++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as @@ -24,7 +24,7 @@ package org.apache.flex.charts.beads.layouts import org.apache.flex.charts.supportClasses.BarSeries; import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.UIBase; import org.apache.flex.events.Event; @@ -84,7 +84,7 @@ package org.apache.flex.charts.beads.layouts if (!dp) return; - var layoutParent:ILayoutParent = strand.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase; var n:int = dp.length; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as index 7474b6f..31c4a41 100644 --- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as +++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as @@ -23,7 +23,7 @@ package org.apache.flex.charts.beads.layouts import org.apache.flex.charts.supportClasses.ColumnSeries; import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.ISelectionModel; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.UIBase; import org.apache.flex.events.Event; @@ -83,7 +83,7 @@ package org.apache.flex.charts.beads.layouts if (!dp) return; - var layoutParent:ILayoutParent = strand.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase; var n:int = dp.length; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/CoreClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/CoreClasses.as b/frameworks/projects/Core/as/src/CoreClasses.as index ba56798..66df6d0 100644 --- a/frameworks/projects/Core/as/src/CoreClasses.as +++ b/frameworks/projects/Core/as/src/CoreClasses.as @@ -46,13 +46,15 @@ internal class CoreClasses import org.apache.flex.core.IChrome; IChrome; import org.apache.flex.core.IComboBoxModel; IComboBoxModel; import org.apache.flex.core.IContainer; IContainer; + import org.apache.flex.core.IContainerView; IContainerView; import org.apache.flex.core.IContentView; IContentView; + import org.apache.flex.core.IContentViewHost; IContentViewHost; import org.apache.flex.core.IDataProviderItemRendererMapper; IDataProviderItemRendererMapper; import org.apache.flex.core.IDocument; IDocument; import org.apache.flex.core.IFormatBead; IFormatBead; import org.apache.flex.core.IImageModel; IImageModel; import org.apache.flex.core.ILayoutChild; ILayoutChild; - import org.apache.flex.core.ILayoutParent; ILayoutParent; + import org.apache.flex.core.ILayoutHost; ILayoutHost; import org.apache.flex.core.IPanelModel; IPanelModel; import org.apache.flex.core.IParent; IParent; import org.apache.flex.core.IParentIUIBase; IParentIUIBase; @@ -71,6 +73,8 @@ internal class CoreClasses import org.apache.flex.core.IViewport; IViewport; import org.apache.flex.core.IViewportModel; IViewportModel; import org.apache.flex.core.IViewportScroller; IViewportScroller; + import org.apache.flex.core.ListBase; ListBase; + import org.apache.flex.core.ListBaseStrandChildren; ListBaseStrandChildren; import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl; import org.apache.flex.core.SimpleApplication; SimpleApplication; import org.apache.flex.core.DataBindingBase; DataBindingBase; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as index bd2ade4..0d8005a 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as @@ -74,7 +74,7 @@ package org.apache.flex.core * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer + public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer, IContentViewHost { /** * Constructor. @@ -87,46 +87,31 @@ package org.apache.flex.core public function ContainerBase() { super(); - actualParent = this; + + _strandChildren = new ContainerBaseStrandChildren(this); } - /** - * False if IChrome children are treated just like - * any other children. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected var supportsChromeChildren:Boolean = true; - - private var actualParent:DisplayObjectContainer; - - /** - * Set a platform-specific object as the actual parent for - * children. This must be public so it can be accessed - * by beads. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function setActualParent(parent:DisplayObjectContainer):void - { - actualParent = parent; - } + private var _strandChildren:ContainerBaseStrandChildren; + + /** + * @private + */ + public function get strandChildren():IParent + { + return _strandChildren; + } /** * @private */ override public function getElementIndex(c:Object):int { - if (c is IUIBase) - return actualParent.getChildIndex(IUIBase(c).element as DisplayObject); - else - return actualParent.getChildIndex(c as DisplayObject); + var contentView:IContentViewHost = view as IContentViewHost; + if (contentView != null) { + return contentView.getElementIndex(c); + } else { + return getChildIndex(c as DisplayObject); + } } /** @@ -134,27 +119,15 @@ package org.apache.flex.core */ override public function addElement(c:Object, dispatchEvent:Boolean = true):void { - if (c is IUIBase) - { - if (supportsChromeChildren && c is IChrome) { - addChild(IUIBase(c).element as DisplayObject); - IUIBase(c).addedToParent(); - } - else { - actualParent.addChild(IUIBase(c).element as DisplayObject); - IUIBase(c).addedToParent(); - } - } - else { - if (supportsChromeChildren && c is IChrome) { - addChild(c as DisplayObject); - } - else { - actualParent.addChild(c as DisplayObject); - } - } - if (dispatchEvent) - this.dispatchEvent(new Event("childrenAdded")); + var contentView:IParent = view as IParent; + if (contentView != null) { + contentView.addElement(c, dispatchEvent); + } + else { + addChild(c as DisplayObject); + if (dispatchEvent) + this.dispatchEvent(new Event("childrenAdded")); + } } /** @@ -162,26 +135,15 @@ package org.apache.flex.core */ override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void { - if (c is IUIBase) - { - if (supportsChromeChildren && c is IChrome) { - addChildAt(IUIBase(c).element as DisplayObject, index); - IUIBase(c).addedToParent(); - } - else { - actualParent.addChildAt(IUIBase(c).element as DisplayObject, index); - IUIBase(c).addedToParent(); - } - } - else { - if (supportsChromeChildren && c is IChrome) { - addChildAt(c as DisplayObject, index); - } else { - actualParent.addChildAt(c as DisplayObject, index); - } - } - if (dispatchEvent) - this.dispatchEvent(new Event("childrenAdded")); + var contentView:IParent = view as IParent; + if (contentView != null) { + contentView.addElementAt(c, index, dispatchEvent); + } + else { + addChildAt(c as DisplayObject, index); + if (dispatchEvent) + this.dispatchEvent(new Event("childrenAdded")); + } } /** @@ -189,21 +151,15 @@ package org.apache.flex.core */ override public function removeElement(c:Object, dispatchEvent:Boolean = true):void { - if (c is IUIBase) - { - if (supportsChromeChildren && c is IChrome) { - removeChild(IUIBase(c).element as DisplayObject); - } - else { - actualParent.removeChild(IUIBase(c).element as DisplayObject); - } + var contentView:IParent = view as IParent; + if (contentView != null) { + contentView.removeElement(c, dispatchEvent); } else { - actualParent.removeChild(c as DisplayObject); - } - - if (dispatchEvent) - this.dispatchEvent(new Event("childrenRemoved")); + removeChild(c as DisplayObject); + if (dispatchEvent) + this.dispatchEvent(new Event("childrenRemoved")); + } } /** @@ -212,11 +168,24 @@ package org.apache.flex.core */ public function getChildren():Array { - var children:Array = []; - var n:int = actualParent.numChildren; - for (var i:int = 0; i < n; i++) - children.push(actualParent.getChildAt(i)); - return children; + var contentView:IParent = view as IParent; + var children:Array = []; + var n:int = 0; + var i:int = 0; + + if (contentView != null) { + n = contentView.numElements; + for (i=0; i < n; i++) { + children.push(contentView.getElementAt(i)); + } + } + else { + for (i = 0; i < n; i++) { + children.push(getChildAt(i)); + } + } + + return children; } /** @@ -255,6 +224,60 @@ package org.apache.flex.core _initialized = true; } } + + /** + * @private + * Support strandChildren. + */ + public function $numElements():int + { + return super.numElements(); + } + + /** + * @private + * Support strandChildren. + */ + public function $addElement(c:Object, dispatchEvent:Boolean = true):void + { + super.addElement(c, dispatchEvent); + } + + /** + * @private + * Support strandChildren. + */ + public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + super.addElementAt(c, index, dispatchEvent); + } + + /** + * @private + * Support strandChildren. + */ + public function $removeElement(c:Object, dispatchEvent:Boolean = true):void + { + super.removeElement(c, dispatchEvent); + } + + /** + * @private + * Support strandChildren. + */ + public function $getElementIndex(c:Object):int + { + return super.getElementIndex(c); + } + + /** + * @private + * Support strandChildren. + */ + public function $getElementAt(index:int):Object + { + return super.getElementAt(index); + } private var _mxmlDescriptor:Array; private var _mxmlDocument:Object = this; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBaseStrandChildren.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBaseStrandChildren.as new file mode 100644 index 0000000..dd78ba2 --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBaseStrandChildren.as @@ -0,0 +1,98 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + /** + * The ContainerBaseStrandChildren class the provides a way for advanced + * components to place children directly into the strand unlike the + * addElement() APIs on the Container which place children into the contentView. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ContainerBaseStrandChildren implements IParent + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ContainerBaseStrandChildren(owner:IParent) + { + super(); + + this.owner = owner as ContainerBase; + } + + public var owner:ContainerBase; + + /** + * @private + */ + public function get numElements():int + { + return owner.$numElements(); + } + + /** + * @private + */ + public function addElement(c:Object, dispatchEvent:Boolean = true):void + { + owner.$addElement(c, dispatchEvent); + } + + /** + * @private + */ + public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + owner.$addElementAt(c, index, dispatchEvent); + } + + /** + * @private + */ + public function removeElement(c:Object, dispatchEvent:Boolean = true):void + { + owner.$removeElement(c, dispatchEvent); + } + + /** + * @private + */ + public function getElementIndex(c:Object):int + { + return owner.$getElementIndex(c); + } + + /** + * @private + */ + public function getElementAt(index:int):Object + { + return owner.$getElementAt(index); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/IContainerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IContainerView.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IContainerView.as new file mode 100644 index 0000000..ae07cb7 --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IContainerView.as @@ -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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.core +{ + /** + * The IContainerView interface should be implemented by any view bead + * that acts as the primary view for a ContainerBase-derived class. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IContainerView extends IParent + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/IContentViewHost.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IContentViewHost.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IContentViewHost.as new file mode 100644 index 0000000..b7ff5ff --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IContentViewHost.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + /** + * This interface is implemented by components that provide + * access to "behind the scenes" children that are not accessible + * through the addElement()/removeElement() APIs. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IContentViewHost extends IParent + { + function get strandChildren():IParent; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutHost.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutHost.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutHost.as new file mode 100644 index 0000000..3f36723 --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutHost.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + /** + * The ILayoutHost interface is the basic interface for the + * container views that have an IBeadLayout. The layout implementation + * often needs to know certain things about other objects in + * the view. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface ILayoutHost + { + /** + * The container that parents all of the content. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get contentView():IParentIUIBase; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutParent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutParent.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutParent.as deleted file mode 100644 index 0d06b50..0000000 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/ILayoutParent.as +++ /dev/null @@ -1,56 +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.core -{ - /** - * The ILayoutParent interface is the basic interface for the - * container views that have an IBeadLayout. The layout implementation - * often needs to know certain things about other objects in - * the view. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public interface ILayoutParent - { - /** - * The container that parents all of the content. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - function get contentView():IParentIUIBase; - - /** - * The container whose size changes - * imply the need for another layout pass. This - * is normally the host component. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - function get resizableView():IUIBase; - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as new file mode 100644 index 0000000..48c3438 --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as @@ -0,0 +1,123 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + + import org.apache.flex.core.IMXMLDocument; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.Event; + import org.apache.flex.events.ValueChangeEvent; + import org.apache.flex.states.State; + import org.apache.flex.utils.MXMLDataInterpreter; + + /** + * The ListBase class is the base class for most lists + * in FlexJS. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ListBase extends UIBase implements IContentViewHost + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ListBase() + { + super(); + + _strandChildren = new ListBaseStrandChildren(this); + } + + private var _strandChildren:ListBaseStrandChildren; + + /** + * @private + */ + public function get strandChildren():IParent + { + return _strandChildren; + } + + /** + * @private + * Support strandChildren. + */ + public function $numElements():int + { + return super.numElements(); + } + + + /** + * @private + * Support strandChildren. + */ + public function $addElement(c:Object, dispatchEvent:Boolean = true):void + { + super.addElement(c, dispatchEvent); + } + + /** + * @private + * Support strandChildren. + */ + public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + super.addElementAt(c, index, dispatchEvent); + } + + /** + * @private + * Support strandChildren. + */ + public function $removeElement(c:Object, dispatchEvent:Boolean = true):void + { + super.removeElement(c, dispatchEvent); + } + + /** + * @private + * Support strandChildren. + */ + public function $getElementIndex(c:Object):int + { + return super.getElementIndex(c); + } + + /** + * @private + * Support strandChildren. + */ + public function $getElementAt(index:int):Object + { + return super.getElementAt(index); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ListBaseStrandChildren.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ListBaseStrandChildren.as new file mode 100644 index 0000000..899c171 --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ListBaseStrandChildren.as @@ -0,0 +1,99 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + + + /** + * The ListBaseStrandChildren exists so that Lists are compatible with + * the ListView/ContainerView beads. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ListBaseStrandChildren implements IParent + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ListBaseStrandChildren(owner:IParent) + { + super(); + + this.owner = owner as ListBase; + } + + public var owner:ListBase; + + /** + * @private + */ + public function get numElements():int + { + return owner.$numElements(); + } + + /** + * @private + */ + public function addElement(c:Object, dispatchEvent:Boolean = true):void + { + owner.$addElement(c, dispatchEvent); + } + + /** + * @private + */ + public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + owner.$addElementAt(c, index, dispatchEvent); + } + + /** + * @private + */ + public function removeElement(c:Object, dispatchEvent:Boolean = true):void + { + owner.$removeElement(c, dispatchEvent); + } + + /** + * @private + */ + public function getElementIndex(c:Object):int + { + return owner.$getElementIndex(c); + } + + /** + * @private + */ + public function getElementAt(index:int):Object + { + return owner.$getElementAt(index); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as index 74c30ce..e1cc8e6 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as @@ -62,8 +62,6 @@ package org.apache.flex.core public function ViewBase() { super(); - - supportsChromeChildren = false; className = "flexjs"; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js index 34a3d7a..4de63f6 100644 --- a/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBase.js @@ -14,7 +14,8 @@ goog.provide('org.apache.flex.core.ContainerBase'); -goog.require('org.apache.flex.core.IChrome'); +goog.require('org.apache.flex.core.ContainerBaseStrandChildren'); +goog.require('org.apache.flex.core.IContentViewHost'); goog.require('org.apache.flex.core.IMXMLDocument'); goog.require('org.apache.flex.core.UIBase'); goog.require('org.apache.flex.core.ValuesManager'); @@ -24,6 +25,8 @@ goog.require('org.apache.flex.core.ValuesManager'); /** * @constructor * @extends {org.apache.flex.core.UIBase} + * @implements {org.apache.flex.core.IMXMLDocument} + * @implements {org.apache.flex.core.IContentViewHost} */ org.apache.flex.core.ContainerBase = function() { this.mxmlProperties = null; @@ -53,6 +56,12 @@ org.apache.flex.core.ContainerBase = function() { */ this.currentState_ = null; + /** + * @private + * @type {Object} + */ + this.strandChildren_ = new org.apache.flex.core.ContainerBaseStrandChildren(this); + this.document = this; this.actualParent_ = this; @@ -103,7 +112,8 @@ org.apache.flex.core.ContainerBase.prototype.supportsChrome = true; org.apache.flex.core.ContainerBase.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'ContainerBase', qName: 'org.apache.flex.core.ContainerBase'}] , - interfaces: [org.apache.flex.core.IMXMLDocument]}; + interfaces: [org.apache.flex.core.IMXMLDocument, + org.apache.flex.core.IContentViewHost]}; /** @@ -146,67 +156,41 @@ org.apache.flex.core.ContainerBase.prototype.setMXMLDescriptor = /** - * @expose - * @param {Object} parent The component to use as the parent of the children for the container. - */ -org.apache.flex.core.ContainerBase.prototype.setActualParent = function(parent) { - this.actualParent_ = parent; -}; - - -/** * @override + * @param {Object} c + * @param {boolean=} opt_dispatchEvent */ org.apache.flex.core.ContainerBase.prototype.addElement = function(c, opt_dispatchEvent) { if (opt_dispatchEvent === undefined) opt_dispatchEvent = true; - if (this.supportsChromeChildren && org.apache.flex.utils.Language.is(c, org.apache.flex.core.IChrome)) { - //org.apache.flex.core.ContainerBase.base(this, 'addElement', c); - this.element.appendChild(c.positioner); - c.addedToParent(); + var contentView = this.view; + if (contentView != null) { + contentView.addElement(c, opt_dispatchEvent); } else { - //this.actualParent.addElement(c); - this.actualParent.element.appendChild(c.positioner); - c.addedToParent(); + this.$addElement(c, opt_dispatchEvent); } - if (opt_dispatchEvent) - this.dispatchEvent('childrenAdded'); }; /** * @override + * @param {Object} c + * @param {number} index + * @param {boolean=} opt_dispatchEvent */ org.apache.flex.core.ContainerBase.prototype.addElementAt = function(c, index, opt_dispatchEvent) { if (opt_dispatchEvent === undefined) opt_dispatchEvent = true; - if (this.supportsChromeChildren && org.apache.flex.utils.Language.is(c, org.apache.flex.core.IChrome)) { - //org.apache.flex.core.ContainerBase.base(this, 'addElementAt', c, index); - var children1 = this.internalChildren(); - if (index >= children1.length) { - this.addElement(c); - } else { - this.element.insertBefore(c.positioner, - children1[index]); - c.addedToParent(); - } - } else { - //this.actualParent.addElementAt(c, index); - var children2 = this.actualParent.internalChildren(); - if (index >= children2.length) { - this.actualParent.element.appendChild(c.positioner); - c.addedToParent(); - } else { - this.actualParent.element.insertBefore(c.positioner, - children2[index]); - c.addedToParent(); - } - } - if (opt_dispatchEvent) - this.dispatchEvent('childrenAdded'); + var contentView = this.view; + if (contentView != null) { + contentView.addElementAt(c, index, opt_dispatchEvent); + } + else { + this.$addElementAt(c, index, opt_dispatchEvent); + } }; @@ -214,20 +198,26 @@ org.apache.flex.core.ContainerBase.prototype.addElementAt = function(c, index, o * @override */ org.apache.flex.core.ContainerBase.prototype.getElementAt = function(index) { - var children = this.actualParent.internalChildren(); - return children[index].flexjs_wrapper; + var contentView = this.view; + if (contentView != null) { + return contentView.getElementAt(index); + } else { + return this.$getElementAt(index); + } }; /** - * @param {Object} c The child element. + * @override + * @param {Object} c + * @param {boolean=} opt_dispatchEvent */ -org.apache.flex.core.ContainerBase.prototype.removeElement = function(c) { - if (this.supportsChromeChildren && org.apache.flex.utils.Language.is(c, org.apache.flex.core.IChrome)) { - this.element.removeChild(c.element); - } - else { - this.actualParent.element.removeChild(c.element); +org.apache.flex.core.ContainerBase.prototype.removeElement = function(c, opt_dispatchEvent) { + var contentView = this.view; + if (contentView != null) { + contentView.removeElement(c, opt_dispatchEvent); + } else { + this.$removeElement(c, opt_dispatchEvent); } }; @@ -236,20 +226,98 @@ org.apache.flex.core.ContainerBase.prototype.removeElement = function(c) { * @override */ org.apache.flex.core.ContainerBase.prototype.getElementIndex = function(c) { - var children; - if (this.supportsChromeChildren && org.apache.flex.utils.Language.is(c, org.apache.flex.core.IChrome)) { - children = this.internalChildren(); + var contentView = this.view; + if (contentView != null) { + return contentView(c); + } else { + return this.$getElementIndex(c); } - else { - children = this.actualParent.internalChildren(); - } - var n = children.length; - for (var i = 0; i < n; i++) - { - if (children[i] == c.element) - return i; +}; + + +/** + * @expose + * @return {number} The number of raw elements. + */ +org.apache.flex.core.ContainerBase.prototype.$numElements = function() { + return this.internalChildren().length; +}; + + +/** + * @expose + * @param {Object} c The element to add. + * @param {boolean=} opt_dispatchEvent If true, an event is dispatched. + */ +org.apache.flex.core.ContainerBase.prototype.$addElement = function(c, opt_dispatchEvent) { + if (opt_dispatchEvent === undefined) + opt_dispatchEvent = true; + this.element.appendChild(c.positioner); + c.addedToParent(); + if (opt_dispatchEvent) + this.dispatchEvent('childrenAdded'); +}; + + +/** + * @expose + * @param {Object} c The element to add. + * @param {number} index The index of the element. + * @param {boolean=} opt_dispatchEvent If true, an event is dispatched. + */ +org.apache.flex.core.ContainerBase.prototype.$addElementAt = function(c, index, opt_dispatchEvent) { + if (opt_dispatchEvent === undefined) + opt_dispatchEvent = true; + var children1 = this.internalChildren(); + if (index >= children1.length) { + this.$addElement(c, false); + } else { + this.element.insertBefore(c.positioner, + children1[index]); + c.addedToParent(); } - return -1; + if (opt_dispatchEvent) + this.dispatchEvent('childrenAdded'); +}; + + +/** + * @expose + * @param {Object} c The element to add. + * @param {boolean=} opt_dispatchEvent If true, an event is dispatched. + */ +org.apache.flex.core.ContainerBase.prototype.$removeElement = function(c, opt_dispatchEvent) { + this.element.removeChild(c.element); + if (opt_dispatchEvent) + this.dispatchEvent('childrenRemoved'); +}; + + +/** + * @expose + * @param {number} index The index of the number. + * @return {Object} The element at the given index. + */ +org.apache.flex.core.ContainerBase.prototype.$getElementAt = function(index) { + var children = this.internalChildren(); + return children[index].flexjs_wrapper; +}; + + +/** + * @expose + * @param {Object} c The element being queried. + * @return {number} The index of the element. + */ +org.apache.flex.core.ContainerBase.prototype.$getElementIndex = function(c) { + var children = this.internalChildren(); + var n = children.length; + for (var i = 0; i < n; i++) + { + if (children[i] == c.element) + return i; + } + return -1; }; @@ -318,5 +386,12 @@ Object.defineProperties(org.apache.flex.core.ContainerBase.prototype, { set: function(s) { this.actualParent_ = s; } + }, + /** @export */ + strandChildren: { + /** @this {org.apache.flex.core.ContainerBase} */ + get: function() { + return this.strandChildren_; + } } }); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBaseStrandChildren.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBaseStrandChildren.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBaseStrandChildren.js new file mode 100644 index 0000000..51ac09a --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ContainerBaseStrandChildren.js @@ -0,0 +1,112 @@ +/** + * Licensed 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. + */ + +goog.provide('org.apache.flex.core.ContainerBaseStrandChildren'); + +goog.require('org.apache.flex.core.IParent'); + + + +/** + * @constructor + * @implements {org.apache.flex.core.IParent} + * @param {Object} owner The base owner of this object. + */ +org.apache.flex.core.ContainerBaseStrandChildren = function(owner) { + this.owner_ = owner; +}; + + +/** + * @private + * @type {Object} + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.owner_ = null; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ContainerBaseStrandChildren', + qName: 'org.apache.flex.core.ContainerBaseStrandChildren'}] , + interfaces: [org.apache.flex.core.IParent]}; + + +/** + * @export + * @return {number} The number of non-content children elements + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.numElements = + function() { + return this.owner_.$numElements(); +}; + + +/** + * @export + * @param {Object} c The element to be added. + * @param {boolean=} opt_dispatchEvent Whether or not to dispatch an event. + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.addElement = + function(c, opt_dispatchEvent) { + this.owner_.$addElement(c, opt_dispatchEvent); +}; + + +/** + * @export + * @param {Object} c The element to be added. + * @param {number} index The index of the new element. + * @param {boolean=} opt_dispatchEvent Whether or not to dispatch an event. + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.addElementAt = + function(c, index, opt_dispatchEvent) { + this.owner_.$addElementAt(c, index, opt_dispatchEvent); +}; + + +/** + * @export + * @param {Object} c The element to be removed. + * @param {boolean=} opt_dispatchEvent Whether or not to dispatch an event. + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.removeElement = + function(c, opt_dispatchEvent) { + this.owner_.$removeElement(c, opt_dispatchEvent); +}; + + +/** + * @export + * @param {number} index The index of the element sought. + * @return {Object} The element at the given index. + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.getElementAt = + function(index) { + return this.owner_.$getElementAt(index); +}; + + +/** + * @export + * @param {Object} c The element in question. + * @return {number} The index of the element. + */ +org.apache.flex.core.ContainerBaseStrandChildren.prototype.getElementIndex = + function(c) { + return this.owner_.$getElementIndex(c); +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/IContainerView.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IContainerView.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IContainerView.js new file mode 100644 index 0000000..4b74c52 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IContainerView.js @@ -0,0 +1,44 @@ +/** + * Licensed 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. + */ + +/** + * org.apache.flex.core.IContainerView + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org.apache.flex.core.IContainerView'); + +goog.require('org.apache.flex.core.IParent'); + + + +/** + * @interface + */ +org.apache.flex.core.IContainerView = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.core.IContainerView.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IContainerView', qName: 'org.apache.flex.core.IContainerView'}], + interfaces: [org.apache.flex.core.IParent] +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/IContentViewHost.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IContentViewHost.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IContentViewHost.js new file mode 100644 index 0000000..708e532 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IContentViewHost.js @@ -0,0 +1,52 @@ +/** + * Licensed 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. + */ + +/** + * org.apache.flex.core.IContentViewHost + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org.apache.flex.core.IContentViewHost'); + +goog.require('org.apache.flex.core.IParent'); + + + +/** + * @interface + */ +org.apache.flex.core.IContentViewHost = function() { +}; + + +Object.defineProperties(org.apache.flex.core.IContentViewHost.prototype, { + /** @export */ + strandChildren: { + get: function() {} + } +}); + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.core.IContentViewHost.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IContentViewHost', qName: 'org.apache.flex.core.IContentViewHost'}], + interfaces: [org.apache.flex.core.IParent] +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutHost.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutHost.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutHost.js new file mode 100644 index 0000000..efada4a --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutHost.js @@ -0,0 +1,46 @@ +/** + * Licensed 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org.apache.flex.core.ILayoutHost'); + + + +/** + * @interface + */ +org.apache.flex.core.ILayoutHost = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.core.ILayoutHost.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ILayoutHost', + qName: 'org.apache.flex.core.ILayoutHost' }] }; + + +Object.defineProperties(org.apache.flex.core.ILayoutHost.prototype, { + /** @export */ + contentView: { + get: function() {} + } +}); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js deleted file mode 100644 index 6e553b9..0000000 --- a/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed 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. - */ - -/** - * @fileoverview - * @suppress {checkTypes} - */ - -goog.provide('org.apache.flex.core.ILayoutParent'); - - - -/** - * @interface - */ -org.apache.flex.core.ILayoutParent = function() { -}; - - -/** - * Metadata - * - * @type {Object.<string, Array.<Object>>} - */ -org.apache.flex.core.ILayoutParent.prototype.FLEXJS_CLASS_INFO = - { names: [{ name: 'ILayoutParent', - qName: 'org.apache.flex.core.ILayoutParent' }] }; - - -Object.defineProperties(org.apache.flex.core.ILayoutParent.prototype, { - /** @export */ - contentView: { - get: function() {} - }, - /** @export */ - border: { - get: function() {} - }, - /** @export */ - vScrollBar: { - get: function() {}, - set: function(value) {} - }, - /** @export */ - resizeableView: { - get: function() {} - } -}); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js index 2b58163..8bae15a 100644 --- a/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js @@ -33,15 +33,17 @@ org.apache.flex.core.IParent = function() { /** * @param {Object} c + * @param {boolean=} opt_dispatchEvent */ -org.apache.flex.core.IParent.prototype.addElement = function(c) {}; +org.apache.flex.core.IParent.prototype.addElement = function(c, opt_dispatchEvent) {}; /** * @param {Object} c * @param {number} index + * @param {boolean=} opt_dispatchEvent */ -org.apache.flex.core.IParent.prototype.addElementAt = function(c, index) {}; +org.apache.flex.core.IParent.prototype.addElementAt = function(c, index, opt_dispatchEvent) {}; /** @@ -53,8 +55,9 @@ org.apache.flex.core.IParent.prototype.getElementIndex = function(c) {}; /** * @param {Object} c + * @param {boolean=} opt_dispatchEvent */ -org.apache.flex.core.IParent.prototype.removeElement = function(c) {}; +org.apache.flex.core.IParent.prototype.removeElement = function(c, opt_dispatchEvent) {}; /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js index 234cf30..70811bf 100644 --- a/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js @@ -14,14 +14,17 @@ goog.provide('org.apache.flex.core.ListBase'); -goog.require('org.apache.flex.core.ContainerBase'); +goog.require('org.apache.flex.core.IContentViewHost'); +goog.require('org.apache.flex.core.ListBaseStrandChildren'); +goog.require('org.apache.flex.core.UIBase'); goog.require('org.apache.flex.html.supportClasses.StringItemRenderer'); /** * @constructor - * @extends {org.apache.flex.core.ContainerBase} + * @extends {org.apache.flex.core.UIBase} + * @implements {org.apache.flex.core.IContentViewHost} */ org.apache.flex.core.ListBase = function() { org.apache.flex.core.ListBase.base(this, 'constructor'); @@ -31,9 +34,15 @@ org.apache.flex.core.ListBase = function() { * @type {number} */ this.selectedIndex_ = -1; + + /** + * @private + * @type {Object} + */ + this.strandChildren_ = new org.apache.flex.core.ListBaseStrandChildren(this); }; goog.inherits(org.apache.flex.core.ListBase, - org.apache.flex.core.ContainerBase); + org.apache.flex.core.UIBase); /** @@ -43,7 +52,8 @@ goog.inherits(org.apache.flex.core.ListBase, */ org.apache.flex.core.ListBase.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'ListBase', - qName: 'org.apache.flex.core.ListBase' }] }; + qName: 'org.apache.flex.core.ListBase' }], + interfaces: [org.apache.flex.core.IContentViewHost] }; /** @@ -66,6 +76,56 @@ org.apache.flex.core.ListBase.prototype.createElement = function() { }; +/** + * @expose + * @return {number} The number of raw elements. + */ +org.apache.flex.core.ListBase.prototype.$numElements = function() { + return this.numElements(); +}; + + +/** + * @expose + * @param {Object} c The element to add. + * @param {boolean=} opt_dispatchEvent If true, an event is dispatched. + */ +org.apache.flex.core.ListBase.prototype.$addElement = function(c, opt_dispatchEvent) { + this.addElement(c, opt_dispatchEvent); +}; + + +/** + * @expose + * @param {Object} c The element to add. + * @param {number} index The index of the element. + * @param {boolean=} opt_dispatchEvent If true, an event is dispatched. + */ +org.apache.flex.core.ListBase.prototype.$addElementAt = function(c, index, opt_dispatchEvent) { + this.addElementAt(c, index, opt_dispatchEvent); +}; + + +/** + * @expose + * @param {number} index The index of the number. + * @return {Object} The element at the given index. + */ +org.apache.flex.core.ListBase.prototype.$getElementAt = function(index) { + return this.getElementAt(index); +}; + + +/** + * @expose + * @param {Object} c The element being queried. + * @return {number} The index of the element. + */ +org.apache.flex.core.ListBase.prototype.$getElementIndex = function(c) { + return this.getElementIndex(c); +}; + + Object.defineProperties(org.apache.flex.core.ListBase.prototype, { /** @export */ dataProvider: { @@ -99,6 +159,13 @@ Object.defineProperties(org.apache.flex.core.ListBase.prototype, { set: function(value) { this.model.selectedItem = value; } + }, + /** @export */ + strandChildren: { + /** @this {org.apache.flex.core.ListBase} */ + get: function() { + return this.strandChildren_; + } } }); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/ListBaseStrandChildren.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ListBaseStrandChildren.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ListBaseStrandChildren.js new file mode 100644 index 0000000..ccc04a2 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ListBaseStrandChildren.js @@ -0,0 +1,112 @@ +/** + * Licensed 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. + */ + +goog.provide('org.apache.flex.core.ListBaseStrandChildren'); + +goog.require('org.apache.flex.core.IParent'); + + + +/** + * @constructor + * @implements {org.apache.flex.core.IParent} + * @param {Object} owner The base owner of this object. + */ +org.apache.flex.core.ListBaseStrandChildren = function(owner) { + this.owner_ = owner; +}; + + +/** + * @private + * @type {Object} + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.owner_ = null; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ListBaseStrandChildren', + qName: 'org.apache.flex.core.ListBaseStrandChildren'}] , + interfaces: [org.apache.flex.core.IParent]}; + + +/** + * @export + * @return {number} The number of non-content children elements + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.numElements = + function() { + return this.owner_.$numElements(); +}; + + +/** + * @export + * @param {Object} c The element to be added. + * @param {boolean=} opt_dispatchEvent Whether or not to dispatch an event. + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.addElement = + function(c, opt_dispatchEvent) { + this.owner_.$addElement(c, opt_dispatchEvent); +}; + + +/** + * @export + * @param {Object} c The element to be added. + * @param {number} index The index of the new element. + * @param {boolean=} opt_dispatchEvent Whether or not to dispatch an event. + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.addElementAt = + function(c, index, opt_dispatchEvent) { + this.owner_.$addElementAt(c, index, opt_dispatchEvent); +}; + + +/** + * @export + * @param {Object} c The element to be removed. + * @param {boolean=} opt_dispatchEvent Whether or not to dispatch an event. + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.removeElement = + function(c, opt_dispatchEvent) { + this.owner_.$removeElement(c, opt_dispatchEvent); +}; + + +/** + * @export + * @param {number} index The index of the element sought. + * @return {Object} The element at the given index. + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.getElementAt = + function(index) { + return this.owner_.$getElementAt(index); +}; + + +/** + * @export + * @param {Object} c The element in question. + * @return {number} The index of the element. + */ +org.apache.flex.core.ListBaseStrandChildren.prototype.getElementIndex = + function(c) { + return this.owner_.$getElementIndex(c); +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js index ef667c9..5642cd0 100644 --- a/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js @@ -682,6 +682,29 @@ Object.defineProperties(org.apache.flex.core.UIBase.prototype, { } }, /** @export */ + view: { + /** @this {org.apache.flex.core.UIBase} */ + get: function() { + if (this.view_ == null) { + /** + * @type {Function} + */ + var v = /** @type {Function} */(org.apache.flex.core.ValuesManager.valuesImpl. + getValue(this, 'iBeadView')); + this.view_ = new v(); + this.addBead(this.view_); + } + return this.view_; + }, + /** @this {org.apache.flex.core.UIBase} */ + set: function(value) { + if (this.view_ != value) { + this.view_ = value; + this.addBead(value); + } + } + }, + /** @export */ visible: { /** @this {org.apache.flex.core.UIBase} */ get: function() { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/Flat/flat-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/flat-manifest.xml b/frameworks/projects/Flat/flat-manifest.xml index 253aaf6..b289d9a 100644 --- a/frameworks/projects/Flat/flat-manifest.xml +++ b/frameworks/projects/Flat/flat-manifest.xml @@ -54,7 +54,7 @@ <component id="HorizontalLayout" class="org.apache.flex.html.beads.layouts.HorizontalLayout" lookupOnly="true" /> <component id="TileLayout" class="org.apache.flex.html.beads.layouts.TileLayout" lookupOnly="true" /> <component id="ListView" class="org.apache.flex.html.beads.ListView" lookupOnly="true" /> - <component id="ListViewNoSelectionState" class="org.apache.flex.html.beads.ListViewNoSelectionState" lookupOnly="true" /> + <!--component id="ListViewNoSelectionState" class="org.apache.flex.html.beads.ListViewNoSelectionState" lookupOnly="true" /--> <component id="MultilineTextFieldView" class="org.apache.flex.html.beads.MultilineTextFieldView" lookupOnly="true" /> <component id="SimpleAlert" class="org.apache.flex.html.SimpleAlert" lookupOnly="true" /> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/List.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/List.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/List.as index 7e4d744..10a2304 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/List.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/List.as @@ -20,18 +20,38 @@ package org.apache.flex.html { import org.apache.flex.core.IFactory; - import org.apache.flex.core.ContainerBase; + import org.apache.flex.core.ContainerBaseStrandChildren; + import org.apache.flex.core.IContentViewHost; import org.apache.flex.core.IDataProviderItemRendererMapper; import org.apache.flex.core.IItemRendererClassFactory; import org.apache.flex.core.IListPresentationModel; import org.apache.flex.core.IRollOverModel; import org.apache.flex.core.ISelectionModel; + import org.apache.flex.core.ListBase; import org.apache.flex.core.UIBase; import org.apache.flex.core.ValuesManager; import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; import org.apache.flex.html.beads.models.ListPresentationModel; + /** + * Indicates that the initialization of the list is complete. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="initComplete", type="org.apache.flex.events.Event")] + + /** + * The change event is dispatched whenever the list's selection changes. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ [Event(name="change", type="org.apache.flex.events.Event")] /** @@ -51,7 +71,7 @@ package org.apache.flex.html * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class List extends ContainerBase + public class List extends ListBase { /** * constructor. @@ -226,7 +246,8 @@ package org.apache.flex.html itemRendererFactory = new (ValuesManager.valuesImpl.getValue(this, "iItemRendererClassFactory")) as IItemRendererClassFactory; addBead(itemRendererFactory); } -// IEventDispatcher(this).dispatchEvent(new Event("layoutNeeded")); + + dispatchEvent(new Event("initComplete")); } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/NumericStepper.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/NumericStepper.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/NumericStepper.as index b7e6c13..66b8407 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/NumericStepper.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/NumericStepper.as @@ -19,6 +19,7 @@ package org.apache.flex.html { import org.apache.flex.core.IRangeModel; + import org.apache.flex.core.UIBase; [Event(name="valueChange", type="org.apache.flex.events.Event")] @@ -36,7 +37,7 @@ package org.apache.flex.html * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class NumericStepper extends Container + public class NumericStepper extends UIBase { /** * constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ButtonBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ButtonBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ButtonBarView.as index cf7ad85..7add594 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ButtonBarView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ButtonBarView.as @@ -23,7 +23,6 @@ package org.apache.flex.html.beads import org.apache.flex.core.IBead; import org.apache.flex.core.IBeadModel; - import org.apache.flex.core.ILayoutParent; import org.apache.flex.core.IParent; import org.apache.flex.core.IStrand; import org.apache.flex.core.ValuesManager; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as index 609b2a9..f71a4ef 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as @@ -26,8 +26,10 @@ package org.apache.flex.html.beads import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.IBeadView; import org.apache.flex.core.IContainer; + import org.apache.flex.core.IContainerView; + import org.apache.flex.core.IContentViewHost; import org.apache.flex.core.ILayoutChild; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.IStrand; import org.apache.flex.core.IUIBase; @@ -61,7 +63,7 @@ package org.apache.flex.html.beads * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class ContainerView extends BeadViewBase implements IBeadView, ILayoutParent + public class ContainerView extends BeadViewBase implements IBeadView, IContainerView, ILayoutHost { /** * The ContainerView class is the default view for @@ -142,6 +144,54 @@ package org.apache.flex.html.beads private var layoutRunning:Boolean; /** + * @private + */ + public function addElement(c:Object, dispatchEvent:Boolean = true):void + { + contentView.addElement(c, dispatchEvent); + } + + /** + * @private + */ + public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + contentView.addElementAt(c, index, dispatchEvent); + } + + /** + * @private + */ + public function getElementIndex(c:Object):int + { + return contentView.getElementIndex(c); + } + + /** + * @private + */ + public function removeElement(c:Object, dispatchEvent:Boolean = true):void + { + contentView.removeElement(c, dispatchEvent); + } + + /** + * @private + */ + public function get numElements():int + { + return contentView.numElements(); + } + + /** + * @private + */ + public function getElementAt(index:int):Object + { + return contentView.getElementAt(index); + } + + /** * Strand setter. * * @langversion 3.0 @@ -155,8 +205,8 @@ package org.apache.flex.html.beads super.strand = value; createViewport(); - (host as UIBase).addElement(viewport.contentView, false); - ContainerBase(host).setActualParent(viewport.contentView as DisplayObjectContainer); + + (host as IContentViewHost).strandChildren.addElement(viewport.contentView, false); displayBackgroundAndBorder(host as UIBase); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as index 258de18..9deec3e 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ListView.as @@ -27,7 +27,6 @@ package org.apache.flex.html.beads import org.apache.flex.core.ISelectableItemRenderer; import org.apache.flex.core.IItemRenderer; import org.apache.flex.core.IItemRendererParent; - import org.apache.flex.core.IScrollingLayoutParent; import org.apache.flex.core.IParent; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.IRollOverModel; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as index ab2bb96..7cc229d 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/NumericStepperView.as @@ -21,7 +21,6 @@ package org.apache.flex.html.beads import org.apache.flex.core.BeadViewBase; import org.apache.flex.core.IBeadView; import org.apache.flex.core.ILayoutChild; - import org.apache.flex.core.ILayoutParent; import org.apache.flex.core.IParent; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.IRangeModel; @@ -33,7 +32,6 @@ package org.apache.flex.html.beads import org.apache.flex.html.Label; import org.apache.flex.html.Spinner; import org.apache.flex.html.TextInput; - import org.apache.flex.html.beads.layouts.HorizontalLayout; import org.apache.flex.html.supportClasses.Border; import org.apache.flex.html.supportClasses.ScrollBar; @@ -48,7 +46,7 @@ package org.apache.flex.html.beads * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class NumericStepperView extends BeadViewBase implements IBeadView, ILayoutParent + public class NumericStepperView extends BeadViewBase implements IBeadView { /** * constructor. @@ -77,9 +75,6 @@ package org.apache.flex.html.beads override public function set strand(value:IStrand):void { super.strand = value; - - // add a horizontal layout bead - value.addBead(new HorizontalLayout()); // add an input field input = new TextInput(); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as index aaa06eb..b3970af 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as @@ -22,6 +22,7 @@ package org.apache.flex.html.beads import org.apache.flex.core.IBeadView; import org.apache.flex.core.ILayoutChild; + import org.apache.flex.core.IContentViewHost; import org.apache.flex.core.IStrand; import org.apache.flex.core.IUIBase; import org.apache.flex.core.IViewportModel; @@ -113,7 +114,7 @@ package org.apache.flex.html.beads override protected function completeSetup():void { - UIBase(_strand).addElement(titleBar); + (host as IContentViewHost).strandChildren.addElement(titleBar); super.completeSetup(); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as index e513963..8dfcd42 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as @@ -21,6 +21,7 @@ package org.apache.flex.html.beads import flash.display.Sprite; import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IContentViewHost; import org.apache.flex.core.ILayoutChild; import org.apache.flex.core.IPanelModel; import org.apache.flex.core.IStrand; @@ -133,10 +134,10 @@ package org.apache.flex.html.beads { super.completeSetup(); - UIBase(_strand).addElement(titleBar, false); + (_strand as IContentViewHost).strandChildren.addElement(titleBar, false); if (controlBar) { - UIBase(_strand).addElement(_controlBar, false); + (_strand as IContentViewHost).strandChildren.addElement(_controlBar, false); } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/031ad2e7/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/BasicLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/BasicLayout.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/BasicLayout.as index 6ae249f..4b6aa2a 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/BasicLayout.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/BasicLayout.as @@ -21,7 +21,7 @@ package org.apache.flex.html.beads.layouts import org.apache.flex.core.IBeadLayout; import org.apache.flex.core.ILayoutChild; - import org.apache.flex.core.ILayoutParent; + import org.apache.flex.core.ILayoutHost; import org.apache.flex.core.IParentIUIBase; import org.apache.flex.core.IStrand; import org.apache.flex.core.IUIBase; @@ -80,7 +80,7 @@ package org.apache.flex.html.beads.layouts public function layout():Boolean { //trace(DOMPathUtil.getPath(host), event ? event.type : "fixed size"); - var layoutParent:ILayoutParent = host.getBeadByType(ILayoutParent) as ILayoutParent; + var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host); var gotMargin:Boolean;
