You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2016/11/01 19:26:33 UTC
git commit: [flex-asjs] [refs/heads/develop] - Created
MXMLItemRenderer,
a new base class for MXML-based item renderers. Created new protocol,
ILayoutParent, to support using layouts in components other than Container.
Repository: flex-asjs
Updated Branches:
refs/heads/develop 4c78873df -> 5f8b1654f
Created MXMLItemRenderer, a new base class for MXML-based item renderers. Created new protocol, ILayoutParent, to support using layouts in components other than Container.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5f8b1654
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5f8b1654
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5f8b1654
Branch: refs/heads/develop
Commit: 5f8b1654fe44fdc6821c3666a5d112648b1e9be0
Parents: 4c78873
Author: Peter Ent <pe...@apache.org>
Authored: Tue Nov 1 15:26:28 2016 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Tue Nov 1 15:26:28 2016 -0400
----------------------------------------------------------------------
.../projects/Core/src/main/flex/CoreClasses.as | 1 +
.../flex/org/apache/flex/core/ILayoutParent.as | 34 +++++++++
.../main/flex/org/apache/flex/core/ListBase.as | 11 ++-
.../main/flex/org/apache/flex/core/ViewBase.as | 16 ++++-
.../main/flex/org/apache/flex/html/Container.as | 9 ++-
.../DataItemRendererFactoryForArrayData.as | 3 +-
.../DataItemRendererFactoryForArrayList.as | 2 +-
.../DataItemRendererFactoryForColumnData.as | 2 +-
.../flex/html/beads/layouts/BasicLayout.as | 7 +-
.../FlexibleFirstChildHorizontalLayout.as | 5 +-
.../flex/html/beads/layouts/HorizontalLayout.as | 6 +-
.../layouts/OneFlexibleChildHorizontalLayout.as | 6 +-
.../layouts/OneFlexibleChildVerticalLayout.as | 5 +-
.../flex/html/beads/layouts/TileLayout.as | 9 +--
.../html/beads/layouts/VerticalColumnLayout.as | 5 +-
.../flex/html/beads/layouts/VerticalLayout.as | 5 +-
.../html/supportClasses/MXMLItemRenderer.as | 72 ++++++++++++++++++++
.../html/supportClasses/UIItemRendererBase.as | 7 +-
.../HTML/src/main/resources/basic-manifest.xml | 1 +
19 files changed, 182 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 3e86f1c..232c9b3 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -62,6 +62,7 @@ internal class CoreClasses
import org.apache.flex.core.IItemRendererProvider; IItemRendererProvider;
import org.apache.flex.core.ILayoutChild; ILayoutChild;
import org.apache.flex.core.ILayoutHost; ILayoutHost;
+ import org.apache.flex.core.ILayoutParent; ILayoutParent;
import org.apache.flex.core.IListPresentationModel; IListPresentationModel;
import org.apache.flex.core.IPanelModel; IPanelModel;
import org.apache.flex.core.IParent; IParent;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ILayoutParent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ILayoutParent.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ILayoutParent.as
new file mode 100644
index 0000000..1e6c9bd
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ILayoutParent.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 implemented by those components
+ * that allow their children to be manipulated by a layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ILayoutParent
+ {
+ function getLayoutHost():ILayoutHost;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
index dbdcace..07139c5 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
@@ -20,6 +20,7 @@ package org.apache.flex.core
{
import org.apache.flex.core.IMXMLDocument;
import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.events.Event;
import org.apache.flex.events.ValueChangeEvent;
import org.apache.flex.states.State;
@@ -34,7 +35,7 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class ListBase extends UIBase implements IContentViewHost
+ public class ListBase extends UIBase implements IContentViewHost, ILayoutParent
{
/**
* Constructor.
@@ -63,6 +64,14 @@ package org.apache.flex.core
/**
* @private
+ */
+ public function getLayoutHost():ILayoutHost
+ {
+ return view as ILayoutHost;
+ }
+
+ /**
+ * @private
* @suppress {undefinedNames}
* Support strandChildren.
*/
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
index 7e4b65e..73092af 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
@@ -48,7 +48,7 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView
+ public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView, ILayoutParent
{
/**
* Constructor.
@@ -92,6 +92,20 @@ package org.apache.flex.core
_applicationModel = value;
dispatchEvent(new Event("modelChanged"));
}
+
+ /**
+ * Implements the ILayoutParent protocol by returning the bead that
+ * is acting as the host for layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getLayoutHost():ILayoutHost
+ {
+ return getBeadByType(ILayoutHost) as ILayoutHost;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Container.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Container.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Container.as
index ee30b7f..6d2e655 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Container.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Container.as
@@ -21,6 +21,8 @@ package org.apache.flex.html
import org.apache.flex.core.ContainerBase;
import org.apache.flex.core.IChrome;
import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.ILayoutHost;
import org.apache.flex.core.IUIBase;
COMPILE::JS
{
@@ -65,7 +67,7 @@ package org.apache.flex.html
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class Container extends ContainerBase
+ public class Container extends ContainerBase implements ILayoutParent
{
/**
* Constructor.
@@ -79,6 +81,11 @@ package org.apache.flex.html
{
super();
}
+
+ public function getLayoutHost():ILayoutHost
+ {
+ return view as ILayoutHost;
+ }
/**
* @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
index fdfd9b3..36a151f 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
@@ -154,6 +154,7 @@ package org.apache.flex.html.beads
for (var i:int = 0; i < n; i++)
{
var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
+ dataGroup.addElement(ir);
ir.index = i;
ir.labelField = labelField;
if (presentationModel) {
@@ -161,8 +162,8 @@ package org.apache.flex.html.beads
style.marginBottom = presentationModel.separatorThickness;
UIBase(ir).style = style;
UIBase(ir).height = presentationModel.rowHeight;
+ UIBase(ir).percentWidth = 100;
}
- dataGroup.addElement(ir);
ir.data = dp[i];
var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
index 42b159c..41af5b1 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
@@ -171,6 +171,7 @@ package org.apache.flex.html.beads
for (var i:int = 0; i < n; i++)
{
var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
+ dataGroup.addElement(ir);
if (presentationModel) {
UIBase(ir).height = presentationModel.rowHeight;
@@ -180,7 +181,6 @@ package org.apache.flex.html.beads
style.left = 0;
UIBase(ir).style = style;
}
- dataGroup.addElement(ir);
setData(ir, dp.getItemAt(i), i);
var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
index d399cfb..43c5c33 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
@@ -130,9 +130,9 @@ package org.apache.flex.html.beads
for (var i:int = 0; i < n; i++)
{
var tf:DataItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as DataItemRenderer;
+ dataGroup.addElement(tf);
tf.index = i;
tf.labelField = view.column.dataField;
- dataGroup.addElement(tf);
tf.data = dp[i];
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
index b566354..809b259 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
@@ -22,6 +22,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.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -85,7 +86,7 @@ package org.apache.flex.html.beads.layouts
COMPILE::SWF
{
//trace(DOMPathUtil.getPath(host), event ? event.type : "fixed size");
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
var gotMargin:Boolean;
@@ -109,6 +110,7 @@ package org.apache.flex.html.beads.layouts
for (var i:int = 0; i < n; i++)
{
var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
var left:Number = ValuesManager.valuesImpl.getValue(child, "left");
var right:Number = ValuesManager.valuesImpl.getValue(child, "right");
var top:Number = ValuesManager.valuesImpl.getValue(child, "top");
@@ -379,7 +381,7 @@ package org.apache.flex.html.beads.layouts
var h:Number;
var w:Number;
- var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var viewBead:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = viewBead.contentView;
w = contentView.width;
var hasWidth:Boolean = !host.isWidthSizedToContent();
@@ -390,6 +392,7 @@ package org.apache.flex.html.beads.layouts
n = contentView.numElements;
for (i = 0; i < n; i++) {
var child:UIBase = contentView.getElementAt(i) as UIBase;
+ if (child == null || !child.visible) continue;
child.setDisplayStyleForLayout('block');
var left:Number = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'left');
var right:Number = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'right');
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
index 4198fea..13d4092 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
@@ -21,6 +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.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -130,7 +131,7 @@ package org.apache.flex.html.beads.layouts
*/
public function layout():Boolean
{
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
var hostSizedToContent:Boolean = host.isHeightSizedToContent();
@@ -152,6 +153,7 @@ package org.apache.flex.html.beads.layouts
for (var i:int = n - 1; i >= 0; i--)
{
var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
margin = ValuesManager.valuesImpl.getValue(child, "margin");
if (margin is Array)
{
@@ -226,6 +228,7 @@ package org.apache.flex.html.beads.layouts
{
var obj:Object = verticalMargins[0]
child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
if (obj.valign == "middle")
child.y = (maxHeight - child.height) / 2;
else if (valign == "bottom")
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
index 225e0ac..9c01ba5 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
@@ -22,6 +22,7 @@ package org.apache.flex.html.beads.layouts
import org.apache.flex.core.IBeadModel;
import org.apache.flex.core.ILayoutChild;
import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -93,7 +94,7 @@ package org.apache.flex.html.beads.layouts
COMPILE::SWF
{
//trace(DOMPathUtil.getPath(host), event ? event.type : "fixed size");
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost(); //host.getBeadByType(ILayoutHost) as ILayoutHost;
var contentView:IParentIUIBase = layoutParent.contentView;
var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
@@ -211,7 +212,7 @@ package org.apache.flex.html.beads.layouts
var i:int;
var n:int;
- var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var viewBead:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = viewBead.contentView;
children = contentView.internalChildren();
var hasHeight:Boolean = !host.isHeightSizedToContent();
@@ -222,6 +223,7 @@ package org.apache.flex.html.beads.layouts
for (i = 0; i < n; i++)
{
var child:WrappedHTMLElement = children[i] as WrappedHTMLElement;
+ if (child == null) continue;
child.flexjs_wrapper.internalDisplay = 'inline-block';
if (child.style.display == 'none')
child.flexjs_wrapper.setDisplayStyleForLayout('inline-block');
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
index c052442..aedc3dc 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
@@ -22,6 +22,7 @@ package org.apache.flex.html.beads.layouts
import org.apache.flex.core.IDocument;
import org.apache.flex.core.ILayoutChild;
import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -148,7 +149,7 @@ package org.apache.flex.html.beads.layouts
*/
public function layout():Boolean
{
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost(); //host.getBeadByType(ILayoutHost) as ILayoutHost;
var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
actualChild = document[flexibleChild];
@@ -179,6 +180,7 @@ package org.apache.flex.html.beads.layouts
for (var i:int = 0; i < n; i++)
{
var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
if (child == actualChild)
{
flexChildIndex = i;
@@ -213,6 +215,7 @@ package org.apache.flex.html.beads.layouts
for (i = n - 1; i > flexChildIndex; i--)
{
child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
margin = ValuesManager.valuesImpl.getValue(child, "margin");
marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
@@ -266,6 +269,7 @@ package org.apache.flex.html.beads.layouts
{
var obj:Object = verticalMargins[i]
child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
setPositionAndHeight(child, obj.top, obj.marginTop, padding.top,
obj.bottom, obj.marginBottom, padding.bottom, maxHeight, obj.valign);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
index 77af305..3e964d2 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
@@ -22,6 +22,7 @@ package org.apache.flex.html.beads.layouts
import org.apache.flex.core.IDocument;
import org.apache.flex.core.ILayoutChild;
import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -147,7 +148,7 @@ package org.apache.flex.html.beads.layouts
*/
public function layout():Boolean
{
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
actualChild = document[flexibleChild];
@@ -178,6 +179,7 @@ package org.apache.flex.html.beads.layouts
for (var i:int = 0; i < n; i++)
{
var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
ilc = child as ILayoutChild;
left = ValuesManager.valuesImpl.getValue(child, "left");
right = ValuesManager.valuesImpl.getValue(child, "right");
@@ -260,6 +262,7 @@ package org.apache.flex.html.beads.layouts
for (i = n - 1; i > flexChildIndex; i--)
{
child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
ilc = child as ILayoutChild;
left = ValuesManager.valuesImpl.getValue(child, "left");
right = ValuesManager.valuesImpl.getValue(child, "right");
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
index a7917ff..ff869b4 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
@@ -20,6 +20,7 @@ package org.apache.flex.html.beads.layouts
{
import org.apache.flex.core.IBeadLayout;
import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -135,7 +136,7 @@ package org.apache.flex.html.beads.layouts
{
// this is where the layout is calculated
var host:UIBase = _strand as UIBase;
- var p:ILayoutHost = _strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var p:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var area:UIBase = p.contentView as UIBase;
var xpos:Number = 0;
@@ -149,7 +150,7 @@ package org.apache.flex.html.beads.layouts
for(var j:int=0; j < n; j++)
{
var testChild:IUIBase = area.getElementAt(i) as IUIBase;
- if (testChild && !testChild.visible) realN--;
+ if (testChild || !testChild.visible) realN--;
}
if (isNaN(useWidth)) useWidth = Math.floor(host.width / numColumns); // + gap
@@ -165,7 +166,7 @@ package org.apache.flex.html.beads.layouts
for(var i:int=0; i < n; i++)
{
var child:IUIBase = area.getElementAt(i) as IUIBase;
- if (child && !child.visible) continue;
+ if (child == null || !child.visible) continue;
child.width = useWidth;
child.height = useHeight;
child.x = xpos;
@@ -206,7 +207,7 @@ package org.apache.flex.html.beads.layouts
var useHeight:Number;
var host:UIBase = _strand as UIBase;
- var viewBead:ILayoutHost = _strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var viewBead:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = viewBead.contentView;
children = contentView.internalChildren();
n = children.length;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
index 6eaa30a..0d02425 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
@@ -21,6 +21,7 @@ package org.apache.flex.html.beads.layouts
import org.apache.flex.core.IBeadLayout;
import org.apache.flex.core.IContainer;
import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IMeasurementBead;
import org.apache.flex.core.IParent;
import org.apache.flex.core.IStrand;
@@ -98,7 +99,7 @@ package org.apache.flex.html.beads.layouts
public function layout():Boolean
{
var host:UIBase = UIBase(_strand);
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParent = layoutParent.contentView;
var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
var sw:Number = host.width;
@@ -130,6 +131,7 @@ package org.apache.flex.html.beads.layouts
// determine max widths of columns
for (i = 0; i < n; i++) {
e = contentView.getElementAt(i) as IUIBase;
+ if (e == null || !e.visible) continue;
margin = ValuesManager.valuesImpl.getValue(e, "margin");
marginLeft = ValuesManager.valuesImpl.getValue(e, "margin-left");
marginTop = ValuesManager.valuesImpl.getValue(e, "margin-top");
@@ -172,6 +174,7 @@ package org.apache.flex.html.beads.layouts
for (i = 0; i < n; i++)
{
e = contentView.getElementAt(i) as IUIBase;
+ if (e == null || !e.visible) continue;
e.x = curx + ml;
e.y = cury + data[i].mt;
curx += columns[col++];
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
index dd02989..c8970ba 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
@@ -22,6 +22,7 @@ package org.apache.flex.html.beads.layouts
import org.apache.flex.core.IBeadModel;
import org.apache.flex.core.ILayoutChild;
import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
@@ -92,7 +93,7 @@ package org.apache.flex.html.beads.layouts
{
COMPILE::SWF
{
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
@@ -269,7 +270,7 @@ package org.apache.flex.html.beads.layouts
var i:int;
var n:int;
- var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var viewBead:ILayoutHost = (host as ILayoutParent).getLayoutHost();
var contentView:IParentIUIBase = viewBead.contentView;
children = contentView.internalChildren();
var scv:Object = getComputedStyle(host.positioner);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
new file mode 100644
index 0000000..70b4849
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.supportClasses
+{
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IParentIUIBase;
+
+ /**
+ * The MXMLItemRenderer class is the base class for itemRenderers that are MXML-based
+ * and provides support for a layout and a data object.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MXMLItemRenderer extends DataItemRenderer implements ILayoutParent, ILayoutHost, IStrand
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MXMLItemRenderer()
+ {
+ super();
+ }
+
+ public function getLayoutHost():ILayoutHost
+ {
+ return this;
+ }
+
+ public function get contentView():IParentIUIBase
+ {
+ return this;
+ }
+
+ override public function adjustSize():void
+ {
+ var layout:IBeadLayout = getBeadByType(IBeadLayout) as IBeadLayout;
+ if (layout != null) {
+ layout.layout();
+ }
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
index f253bd2..d7826de 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
@@ -55,6 +55,9 @@ package org.apache.flex.html.supportClasses
*/
override public function addedToParent():void
{
+ MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+ MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+
super.addedToParent();
// very common for item renderers to be resized by their containers,
@@ -64,10 +67,6 @@ package org.apache.flex.html.supportClasses
// each MXML file can also have styles in fx:Style block
ValuesManager.valuesImpl.init(this);
-
- MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
- MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
-
dispatchEvent(new Event("initBindings"));
dispatchEvent(new Event("initComplete"));
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f8b1654/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 6737a40..624438f 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -69,6 +69,7 @@
<component id="StringItemRenderer" class="org.apache.flex.html.supportClasses.StringItemRenderer"/>
<component id="TreeItemRenderer" class="org.apache.flex.html.supportClasses.TreeItemRenderer"/>
<component id="DataItemRenderer" class="org.apache.flex.html.supportClasses.DataItemRenderer"/>
+ <component id="MXMLItemRenderer" class="org.apache.flex.html.supportClasses.MXMLItemRenderer"/>
<component id="ButtonBarButtonItemRenderer" class="org.apache.flex.html.supportClasses.ButtonBarButtonItemRenderer"/>
<!--
<component id="TextFieldItemRenderer" class="org.apache.flex.html.supportClasses.TextFieldItemRenderer"/>