You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/05/01 03:48:04 UTC
[05/50] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - Merge
branch 'develop' into dual. Clean build. Now to get it to run
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
index 0000000,0000000..f495acc
new file mode 100644
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
@@@ -1,0 -1,0 +1,260 @@@
++////////////////////////////////////////////////////////////////////////////////
++//
++// 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.beads.layouts
++{
++ //import org.apache.flex.html.beads.layouts.VerticalLayout;
++
++ import org.apache.flex.core.LayoutBase;
++ import org.apache.flex.core.ILayoutChild;
++ import org.apache.flex.core.ILayoutHost;
++ import org.apache.flex.core.ILayoutView;
++ import org.apache.flex.core.ILayoutParent;
++ import org.apache.flex.core.IStrand;
++ import org.apache.flex.core.UIBase;
++ import org.apache.flex.core.IParentIUIBase;
++
++ COMPILE::SWF {
++ import org.apache.flex.core.IUIBase;
++ import org.apache.flex.core.ValuesManager;
++ import org.apache.flex.events.Event;
++ import org.apache.flex.events.IEventDispatcher;
++ import org.apache.flex.geom.Rectangle;
++ import org.apache.flex.utils.CSSUtils;
++ import org.apache.flex.utils.CSSContainerUtils;
++ }
++
++ public class VerticalFlexLayout extends LayoutBase
++ {
++ /**
++ * Constructor.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
++ */
++ public function VerticalFlexLayout()
++ {
++ super();
++ }
++
++ private var _grow:Number = -1;
++
++ /**
++ * Sets the amount items grow in proportion to other items.
++ * The default is 0 which prevents the items from expanding to
++ * fit the space. Use a negative value to unset this property.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
++ */
++ public function get grow():Number {
++ return _grow;
++ }
++ public function set grow(value:Number):void {
++ _grow = value;
++ }
++
++ private var _shrink:Number = -1;
++
++ /**
++ * Sets the amount an item may shrink in proportion to other items.
++ * The default is 1 which allows items to shrink to fit into the space.
++ * Set this to 0 if you want to allow scrolling of the space. Use a negative
++ * value to unset this property.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
++ */
++ public function get shrink():Number {
++ return _shrink;
++ }
++ public function set shrink(value:Number):void {
++ _shrink = value;
++ }
++
++ /**
++ *
++ * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
++ */
++ override public function layout():Boolean
++ {
++ COMPILE::SWF {
++ var contentView:ILayoutView = layoutView;
++
++ var n:Number = contentView.numElements;
++ if (n == 0) return false;
++
++ var spacing:String = "none";
++
++ var maxWidth:Number = 0;
++ var maxHeight:Number = 0;
++ var growCount:Number = 0;
++ var childData:Array = [];
++ var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
++ var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
++ var hostWidth:Number = hostWidthSizedToContent ? host.width : contentView.width;
++ var hostHeight:Number = hostHeightSizedToContent ? host.height : contentView.height;
++
++ var ilc:ILayoutChild;
++ var data:Object;
++ var canAdjust:Boolean = false;
++
++ var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
++ var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
++
++ // adjust the host's usable size by the metrics. If hostSizedToContent, then the
++ // resulting adjusted value may be less than zero.
++ hostWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
++ hostHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
++
++ var remainingHeight:Number = hostHeight;
++
++ //trace("VerticalFlexLayout for "+UIBase(host).id+" with remainingHeight: "+remainingHeight);
++
++ // First pass determines the data about the child.
++ for(var i:int=0; i < n; i++)
++ {
++ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
++ if (child == null || !child.visible) {
++ childData.push({width:0, height:0, mt:0, ml:0, mr:0, mb:0, grow:0, canAdjust:false});
++ continue;
++ }
++
++ ilc = child as ILayoutChild;
++
++ var margins:Object = childMargins(child, hostWidth, hostHeight);
++
++ var flexGrow:Object = ValuesManager.valuesImpl.getValue(child, "flex-grow");
++ var growValue:Number = 0;
++ if (flexGrow != null) {
++ growValue = Number(flexGrow);
++ if (!isNaN(growValue) && growValue > 0) growCount++;
++ else growValue = 0;
++ }
++
++ var useWidth:Number = -1;
++ if (!hostWidthSizedToContent) {
++ if (ilc) {
++ if (!isNaN(ilc.percentWidth)) useWidth = hostWidth * (ilc.percentWidth/100.0);
++ else if (!isNaN(ilc.explicitWidth)) useWidth = ilc.explicitWidth;
++ else useWidth = hostWidth;
++ }
++ }
++
++ var useHeight:Number = -1;
++ if (ilc) {
++ if (!isNaN(ilc.explicitHeight)) useHeight = ilc.explicitHeight;
++ else if (!isNaN(ilc.percentHeight)) useHeight = hostHeight * (ilc.percentHeight/100.0);
++ else if (ilc.height > 0) useHeight = ilc.height;
++ }
++ if (growValue == 0 && useHeight > 0) remainingHeight -= useHeight + margins.top + margins.bottom;
++ else remainingHeight -= margins.top + margins.bottom;
++
++ if (maxWidth < useWidth) maxWidth = useWidth;
++ if (maxHeight < useHeight) maxHeight = useHeight;
++
++ childData.push({width:useWidth, height:useHeight,
++ mt:margins.top, ml:margins.left, mr:margins.right, mb:margins.bottom,
++ grow:growValue, canAdjust:canAdjust});
++ }
++
++ var xpos:Number = borderMetrics.left + paddingMetrics.left;
++ var ypos:Number = borderMetrics.top + paddingMetrics.top;
++
++ // Second pass sizes and positions the children based on the data gathered.
++ for(i=0; i < n; i++)
++ {
++ child = contentView.getElementAt(i) as IUIBase;
++ data = childData[i];
++
++ useWidth = (data.width < 0 ? hostWidth : data.width);
++
++ var setHeight:Boolean = true;
++ if (data.height != 0) {
++ if (data.grow > 0 && growCount > 0) {
++ useHeight = remainingHeight / growCount;
++ setHeight = false;
++ } else {
++ useHeight = data.height;
++ }
++ } else {
++ useHeight = child.height;
++ }
++
++ ilc = child as ILayoutChild;
++ if (ilc) {
++ ilc.setX(xpos + data.ml);
++ ilc.setY(ypos + data.mt);
++ if (data.width > 0) {
++ //ilc.width = useWidth;
++ ilc.setWidth(useWidth);
++ }
++ if (useHeight > 0) {
++ if (setHeight) ilc.setHeight(useHeight);
++ else ilc.height = useHeight;
++ }
++ } else {
++ child.x = xpos + data.ml;
++ child.y = ypos + data.mt;
++ child.width = useWidth;
++ if (useHeight > 0) {
++ child.height = useHeight;
++ }
++ }
++
++ ypos += useHeight + data.mt + data.mb;
++
++ //trace("VerticalFlexLayout: setting child "+i+" to "+child.width+" x "+child.height+" at "+child.x+", "+child.y);
++ }
++
++ //trace("VerticalFlexLayout: complete");
++
++ return true;
++ }
++
++ COMPILE::JS {
++ var contentView:ILayoutView = layoutView;
++
++ contentView.element.style["display"] = "flex";
++ contentView.element.style["flex-flow"] = "column";
++
++ var n:int = contentView.numElements;
++ if (n == 0) return false;
++
++ for(var i:int=0; i < n; i++) {
++ var child:UIBase = contentView.getElementAt(i) as UIBase;
++ if (grow >= 0) child.element.style["flex-grow"] = String(grow);
++ if (shrink >= 0) child.element.style["flex-shrink"] = String(shrink);
++ }
++
++ return true;
++ }
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
index 857a458,dd02989..a8b9774
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
@@@ -18,41 -18,40 +18,44 @@@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.beads.layouts
{
++ import org.apache.flex.core.LayoutBase;
++
import org.apache.flex.core.IBeadLayout;
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.ILayoutView;
++ import org.apache.flex.core.ILayoutParent;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.IUIBase;
import org.apache.flex.core.ValuesManager;
COMPILE::JS
{
-- import org.apache.flex.core.WrappedHTMLElement;
++ import org.apache.flex.core.WrappedHTMLElement;
}
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.geom.Rectangle;
import org.apache.flex.utils.CSSContainerUtils;
import org.apache.flex.utils.CSSUtils;
--
++
/**
* The VerticalLayout class is a simple layout
* bead. It takes the set of children and lays them out
* vertically in one column, separating them according to
* CSS layout rules for margin and horizontal-align styles.
-- *
++ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
-- public class VerticalLayout implements IBeadLayout
++ public class VerticalLayout extends LayoutBase implements IBeadLayout
{
/**
* Constructor.
-- *
++ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
@@@ -60,304 -59,304 +63,123 @@@
*/
public function VerticalLayout()
{
++ super();
}
--
-- // the strand/host container is also an ILayoutChild because
-- // can have its size dictated by the host's parent which is
-- // important to know for layout optimization
-- private var host:ILayoutChild;
--
-- /**
-- * @copy org.apache.flex.core.IBead#strand
-- *
-- * @langversion 3.0
-- * @playerversion Flash 10.2
-- * @playerversion AIR 2.6
-- * @productversion FlexJS 0.0
-- */
-- public function set strand(value:IStrand):void
-- {
-- host = value as ILayoutChild;
-- }
--
++
/**
* Layout children vertically
-- *
++ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
* @flexjsignorecoercion org.apache.flex.core.ILayoutHost
*/
-- public function layout():Boolean
++ override public function layout():Boolean
{
COMPILE::SWF
{
- var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
- var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
-- var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
-- var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
--
-- var n:int = contentView.numElements;
-- var hasHorizontalFlex:Boolean;
-- var hostSizedToContent:Boolean = host.isWidthSizedToContent();
-- var flexibleHorizontalMargins:Array = [];
-- var ilc:ILayoutChild;
-- var marginLeft:Object;
-- var marginRight:Object;
-- var marginTop:Object;
-- var marginBottom:Object;
-- var margin:Object;
++ var contentView:ILayoutView = layoutView;
++
++ var n:Number = contentView.numElements;
++ if (n == 0) return false;
++
var maxWidth:Number = 0;
-- var cssValue:*;
-- // asking for contentView.width can result in infinite loop if host isn't sized already
-- var w:Number = hostSizedToContent ? 0 : contentView.width;
-- var h:Number = contentView.height;
++ var maxHeight:Number = 0;
++ var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
++ var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
++ var hostWidth:Number = hostWidthSizedToContent ? 0 : contentView.width;
++ var hostHeight:Number = hostHeightSizedToContent ? 0 : contentView.height;
++
++ var ilc:ILayoutChild;
++ var data:Object;
++ var canAdjust:Boolean = false;
++
++ var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
++ var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
-- for (var i:int = 0; i < n; i++)
++ // adjust the host's usable size by the metrics. If hostSizedToContent, then the
++ // resulting adjusted value may be less than zero.
++ hostWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
++ hostHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
++
++ var xpos:Number = borderMetrics.left + paddingMetrics.left;
++ var ypos:Number = borderMetrics.top + paddingMetrics.left;
++
++ // First pass determines the data about the child.
++ for(var i:int=0; i < n; i++)
{
var child:IUIBase = contentView.getElementAt(i) as IUIBase;
if (child == null || !child.visible) continue;
++ var positions:Object = childPositions(child);
++ var margins:Object = childMargins(child, hostWidth, hostHeight);
++
ilc = child as ILayoutChild;
-- var left:Number = NaN;
-- cssValue = ValuesManager.valuesImpl.getValue(child, "left");
-- if (cssValue !== undefined)
-- left = CSSUtils.toNumber(cssValue);
-- var right:Number = NaN;
-- cssValue = ValuesManager.valuesImpl.getValue(child, "right");
-- if (cssValue !== undefined)
-- right = CSSUtils.toNumber(cssValue);
-- margin = ValuesManager.valuesImpl.getValue(child, "margin");
-- marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
-- marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
-- marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
-- marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
-- var ml:Number = CSSUtils.getLeftValue(marginLeft, margin, w);
-- var mr:Number = CSSUtils.getRightValue(marginRight, margin, w);
-- var mt:Number = CSSUtils.getTopValue(marginTop, margin, h);
-- var mb:Number = CSSUtils.getBottomValue(marginBottom, margin, h);
-- var lastmb:Number;
-- var yy:Number;
-- if (i == 0)
-- {
-- if (ilc)
-- ilc.setY(mt + padding.top);
-- else
-- child.y = mt + padding.top;
-- }
-- else
-- {
-- if (ilc)
-- ilc.setY(yy + Math.max(mt, lastmb));
-- else
-- child.y = yy + Math.max(mt, lastmb);
-- }
-- if (ilc)
-- {
-- if (!isNaN(ilc.percentHeight))
-- ilc.setHeight(contentView.height * ilc.percentHeight / 100, !isNaN(ilc.percentWidth));
-- }
-- lastmb = mb;
-- var marginObject:Object = {};
-- flexibleHorizontalMargins[i] = marginObject;
-- if (marginLeft == "auto")
-- {
-- ml = 0;
-- marginObject.marginLeft = marginLeft;
-- hasHorizontalFlex = true;
-- }
-- else
-- {
-- ml = Number(marginLeft);
-- if (isNaN(ml))
-- {
-- ml = 0;
-- marginObject.marginLeft = marginLeft;
-- }
-- else
-- marginObject.marginLeft = ml;
-- }
-- if (marginRight == "auto")
-- {
-- mr = 0;
-- marginObject.marginRight = marginRight;
-- hasHorizontalFlex = true;
-- }
-- else
-- {
-- mr = Number(marginRight);
-- if (isNaN(mr))
-- {
-- mr = 0;
-- marginObject.marginRight = marginRight;
-- }
-- else
-- marginObject.marginRight = mr;
-- }
-- if (!hostSizedToContent)
-- {
-- // if host is sized by parent,
-- // we can position and size children horizontally now
-- setPositionAndWidth(child, left, ml, padding.left,
-- right, mr, padding.right, w);
-- }
-- else
-- {
-- if (!isNaN(left))
-- {
-- ml = left;
-- marginObject.left = ml;
-- }
-- if (!isNaN(right))
-- {
-- mr = right;
-- marginObject.right = mr;
++
++ ypos += margins.top;
++
++ var childXpos:Number = xpos + margins.left; // default x position
++
++ if (!hostWidthSizedToContent) {
++ var childWidth:Number = child.width;
++ if (ilc != null && !isNaN(ilc.percentWidth)) {
++ childWidth = hostWidth * ilc.percentWidth/100.0;
++ ilc.setWidth(childWidth);
}
-- maxWidth = Math.max(maxWidth, ml + child.width + mr);
++ // the following code center-aligns the child, but since HTML does not
++ // do this normally, this code is commented. (Use VerticalFlexLayout for
++ // horizontally centered elements in a vertical column).
++ // childXpos = hostWidth/2 - (childWidth + ml + mr)/2;
}
-- yy = child.y + child.height;
-- }
-- if (hostSizedToContent)
-- {
-- for (i = 0; i < n; i++)
-- {
-- child = contentView.getElementAt(i) as IUIBase;
-- if (child == null || !child.visible) continue;
-- var obj:Object = flexibleHorizontalMargins[i];
-- setPositionAndWidth(child, obj.left, obj.marginLeft, padding.left,
-- obj.right, obj.marginRight, padding.right, maxWidth);
-- }
-- }
-- if (hasHorizontalFlex)
-- {
-- for (i = 0; i < n; i++)
-- {
-- child = contentView.getElementAt(i) as IUIBase;
-- if (child == null || !child.visible) continue;
-- ilc = child as ILayoutChild;
-- obj = flexibleHorizontalMargins[i];
-- if (hasHorizontalFlex)
-- {
-- if (ilc)
-- {
-- if (obj.marginLeft == "auto" && obj.marginRight == "auto")
-- ilc.setX(maxWidth - child.width / 2);
-- else if (obj.marginLeft == "auto")
-- ilc.setX(maxWidth - child.width - obj.marginRight - padding.right);
-- }
-- else
-- {
-- if (obj.marginLeft == "auto" && obj.marginRight == "auto")
-- child.x = maxWidth - child.width / 2;
-- else if (obj.marginLeft == "auto")
-- child.x = maxWidth - child.width - obj.marginRight - padding.right;
-- }
++
++ if (ilc) {
++ ilc.setX(childXpos);
++ ilc.setY(ypos);
++
++ if (!hostHeightSizedToContent && !isNaN(ilc.percentHeight)) {
++ var newHeight:Number = hostHeight * ilc.percentHeight / 100;
++ ilc.setHeight(newHeight);
}
++
++ } else {
++ child.x = childXpos;
++ child.y = ypos;
}
++
++ ypos += child.height + margins.bottom;
}
--
-- // Only return true if the contentView needs to be larger; that new
-- // size is stored in the model.
-- var sizeChanged:Boolean = true;
--
-- host.dispatchEvent( new Event("layoutComplete") );
--
-- return sizeChanged;
--
++
++ return true;
}
COMPILE::JS
{
var children:Array;
var i:int;
var n:int;
++ var contentView:IParentIUIBase = layoutView as IParentIUIBase;
- var viewBead:ILayoutHost = (host as ILayoutParent).getLayoutHost()
- var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
-- var contentView:IParentIUIBase = viewBead.contentView;
children = contentView.internalChildren();
-- var scv:Object = getComputedStyle(host.positioner);
-- var hasWidth:Boolean = !host.isWidthSizedToContent();
-- var maxWidth:Number = 0;
n = children.length;
for (i = 0; i < n; i++)
{
var child:WrappedHTMLElement = children[i];
child.flexjs_wrapper.setDisplayStyleForLayout('block');
-- if (child.style.display === 'none')
++ if (child.style.display === 'none')
{
child.flexjs_wrapper.setDisplayStyleForLayout('block');
-- }
-- else
++ }
++ else
{
// block elements don't measure width correctly so set to inline for a second
child.style.display = 'inline-block';
-- maxWidth = Math.max(maxWidth, child.offsetLeft + child.offsetWidth);
child.style.display = 'block';
}
child.flexjs_wrapper.dispatchEvent('sizeChanged');
}
-- if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
-- var pl:String = scv['padding-left'];
-- var pr:String = scv['padding-right'];
-- var npl:int = parseInt(pl.substring(0, pl.length - 2), 10);
-- var npr:int = parseInt(pr.substring(0, pr.length - 2), 10);
-- maxWidth += npl + npr;
-- contentView.width = maxWidth;
-- }
++
return true;
}
}
--
-- COMPILE::SWF
-- private function setPositionAndWidth(child:IUIBase, left:Number, ml:Number, pl:Number,
-- right:Number, mr:Number, pr:Number, w:Number):void
-- {
-- var widthSet:Boolean = false;
--
-- var ww:Number = w;
-- var ilc:ILayoutChild = child as ILayoutChild;
-- if (!isNaN(left))
-- {
-- if (ilc)
-- ilc.setX(left + ml);
-- else
-- child.x = left + ml;
-- ww -= left + ml;
-- }
-- else
-- {
-- if (ilc)
-- ilc.setX(ml + pl);
-- else
-- child.x = ml + pl;
-- ww -= ml + pl;
-- }
-- if (!isNaN(right))
-- {
-- if (!isNaN(left))
-- {
-- if (ilc)
-- ilc.setWidth(ww - right - mr, true);
-- else
-- {
-- child.width = ww - right - mr;
-- widthSet = true;
-- }
-- }
-- else
-- {
-- if (ilc)
-- ilc.setX(w - right - mr - child.width);
-- else
-- child.x = w - right - mr - child.width;
-- }
-- }
-- if (ilc)
-- {
-- if (!isNaN(ilc.percentWidth))
-- ilc.setWidth(w * ilc.percentWidth / 100, true);
-- }
-- if (!widthSet)
-- child.dispatchEvent(new Event("sizeChanged"));
-- }
--
++
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ButtonBarModel.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ButtonBarModel.as
index 0000000,0000000..9eb6a24
new file mode 100644
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ButtonBarModel.as
@@@ -1,0 -1,0 +1,102 @@@
++////////////////////////////////////////////////////////////////////////////////
++//
++// 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.beads.models
++{
++ import org.apache.flex.core.IRollOverModel;
++ import org.apache.flex.core.ISelectionModel;
++ import org.apache.flex.core.IStrand;
++ import org.apache.flex.events.Event;
++ import org.apache.flex.events.EventDispatcher;
++
++ /**
++ * The ArraySelectionModel class is a selection model for
++ * a dataProvider that is an array. It assumes that items
++ * can be fetched from the dataProvider
++ * dataProvider[index]. Other selection models
++ * would support other kinds of data providers.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public class ButtonBarModel extends ArraySelectionModel
++ {
++ public static const PIXEL_WIDTHS:Number = 0;
++ public static const PROPORTIONAL_WIDTHS:Number = 1;
++ public static const PERCENT_WIDTHS:Number = 2;
++
++ /**
++ * Constructor.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function ButtonBarModel()
++ {
++ }
++
++ private var _buttonWidths:Array = null;
++
++ /**
++ * The widths of each button. This property may be null (the default) in which
++ * case the buttons are equally sized. Or this array may contain values, one per
++ * button, which either indicate each button's width in pixels (set .widthType
++ * to ButtonBarModel.PIXEL_WIDTHS) or proportional to other buttons (set
++ * .widthType to ButtonBarModel.PROPORTIONAL_WIDTHS). The array can also contain
++ * specific percentages (set .widthType to ButtonBarModel.PERCENT_WIDTHS). If
++ * this array is set, the number of entries must match the number of buttons.
++ * However, any entry may be null to indicate the button's default size is to be used.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get buttonWidths():Array
++ {
++ return _buttonWidths;
++ }
++ public function set buttonWidths(value:Array):void
++ {
++ _buttonWidths = value;
++ dispatchEvent(new Event("buttonWidthsChanged"));
++ }
++
++ private var _widthType:Number = ButtonBarModel.PIXEL_WIDTHS;
++
++ /**
++ * Indicates how to interpret the values of the buttonWidths array.
++ *
++ * PIXEL_WIDTHS: all of the values are exact pixel widths (unless a value is null).
++ * PROPORTIONAL_WIDTHS: all of the values are proportions. Use 1 to indicate normal, 2 to be 2x, etc. Use 0 (or null) to mean fixed default size.
++ */
++ public function get widthType():Number
++ {
++ return _widthType;
++ }
++ public function set widthType(value:Number):void
++ {
++ _widthType = value;
++ dispatchEvent(new Event("widthTypeChanged"));
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/NonNullTextModel.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/NonNullTextModel.as
index 0000000,0000000..aefb25f
new file mode 100644
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/NonNullTextModel.as
@@@ -1,0 -1,0 +1,125 @@@
++////////////////////////////////////////////////////////////////////////////////
++//
++// 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.beads.models
++{
++ import org.apache.flex.core.IBead;
++ import org.apache.flex.core.IStrand;
++ import org.apache.flex.core.ITextModel;
++ import org.apache.flex.events.Event;
++ import org.apache.flex.events.EventDispatcher;
++ import org.apache.flex.events.IEventDispatcher;
++
++ /**
++ * The TextModel class is most basic data model for a
++ * component that displays text. All FlexJS components
++ * that display text should also support HTML, although
++ * the Flash Player implementations may only support
++ * a subset of HTML.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public class NonNullTextModel extends EventDispatcher implements IBead, ITextModel
++ {
++ /**
++ * Constructor.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function NonNullTextModel()
++ {
++ }
++
++ private var _strand:IStrand;
++
++ /**
++ * @copy org.apache.flex.core.IBead#strand
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function set strand(value:IStrand):void
++ {
++ _strand = value;
++ }
++
++ private var _text:String = "";
++
++ /**
++ * @copy org.apache.flex.core.ITextModel#text
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get text():String
++ {
++ return _text;
++ }
++
++ /**
++ * @private
++ */
++ public function set text(value:String):void
++ {
++ if (value == null)
++ value = "";
++ if (value != _text)
++ {
++ _text = value;
++ dispatchEvent(new Event("textChange"));
++ }
++ }
++
++ private var _html:String;
++
++ /**
++ * @copy org.apache.flex.core.ITextModel#html
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get html():String
++ {
++ return _html;
++ }
++
++ /**
++ * @private
++ */
++ public function set html(value:String):void
++ {
++ if (value != _html)
++ {
++ _html = value;
++ dispatchEvent(new Event("htmlChange"));
++ }
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
index 1d320e3,1d320e3..214125e
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
@@@ -92,6 -92,6 +92,24 @@@ package org.apache.flex.html.supportCla
}
/**
++ * @private
++ */
++ override public function setWidth(value:Number, noEvent:Boolean = false):void
++ {
++ super.setWidth(value, noEvent);
++ textButton.width = value;
++ }
++
++ /**
++ * @private
++ */
++ override public function setHeight(value:Number, noEvent:Boolean = false):void
++ {
++ super.setHeight(value, noEvent);
++ textButton.height = value;
++ }
++
++ /**
* The data to be displayed by the itemRenderer instance. For ButtonBarItemRenderer, the
* data's string version is used as the label for the Button.
*
@@@ -107,6 -107,6 +125,7 @@@
var added:Boolean = false;
if (textButton == null) {
textButton = new TextButton();
++ textButton.percentWidth = 100;
// listen for clicks on the button and translate them into
// an itemClicked event.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
index 92c3f53,92c3f53..c9eeefb
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
@@@ -82,7 -82,7 +82,7 @@@ package org.apache.flex.html.supportCla
element = input as WrappedHTMLElement;
positioner = element;
-- positioner.style.position = 'relative';
++ //positioner.style.position = 'relative';
(element as WrappedHTMLElement).flexjs_wrapper = this;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ClippingViewport.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ClippingViewport.as
index 9ef88cf,0000000..16d6d3e
mode 100644,000000..100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ClippingViewport.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ClippingViewport.as
@@@ -1,137 -1,0 +1,132 @@@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.geom.Size;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.IStrand;
+ }
+ COMPILE::SWF
+ {
+ import flash.geom.Rectangle;
+ }
+
+ /**
+ * The ClippingViewport extends the Viewport class and makes
+ * sure that items extending outside the Container are hidden.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ClippingViewport extends Viewport implements IBead, IViewport
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ClippingViewport()
+ {
+ }
+
+ /**
+ * @flexjsignorecoercion HTMLElement
+ */
+ COMPILE::JS
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ (contentView.element as HTMLElement).style.overflow = 'hidden';
+ }
+
+ private var viewportWidth:Number;
+ private var viewportHeight:Number;
+
+ /**
+ * @copy org.apache.flex.core.IViewport
+ */
+ override public function layoutViewportBeforeContentLayout(width:Number, height:Number):void
+ {
+ super.layoutViewportBeforeContentLayout(width, height);
+ viewportWidth = width;
+ viewportHeight = height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IViewport
+ */
- override public function layoutViewportAfterContentLayout():Size
++ override public function layoutViewportAfterContentLayout(contentSize:Size):void
+ {
+ COMPILE::SWF
+ {
- var contentSize:Size;
++ //var contentSize:Size;
+ do
+ {
- contentSize = super.layoutViewportAfterContentLayout();
++ /*contentSize = */super.layoutViewportAfterContentLayout(contentSize);
+ if (isNaN(viewportHeight))
+ viewportHeight = contentSize.height;
+ if (isNaN(viewportWidth))
+ viewportWidth = contentSize.width;
+
+ var host:UIBase = UIBase(_strand);
+ var visibleWidth:Number;
+ var visibleHeight:Number;
+
+ var needsLayout:Boolean = false;
+ // resize content area
+ if (!isNaN(visibleWidth) || !isNaN(visibleHeight))
+ {
+ if (!isNaN(visibleWidth))
+ needsLayout = visibleWidth != contentView.width;
+ if (!isNaN(visibleHeight))
+ needsLayout = visibleHeight != contentView.height;
+ if (!isNaN(visibleWidth) && !isNaN(visibleHeight))
+ contentArea.setWidthAndHeight(visibleWidth, visibleHeight, false);
+ else if (!isNaN(visibleWidth))
+ contentArea.setWidth(visibleWidth, false);
+ else if (!isNaN(visibleHeight))
+ contentArea.setHeight(visibleHeight, false);
+ }
+ if (needsLayout)
+ {
+ var layout:IBeadLayout = host.getBeadByType(IBeadLayout) as IBeadLayout;
+ layout.layout();
+ }
+ } while (needsLayout);
+
+ var rect:Rectangle = new Rectangle(0, 0, viewportWidth,viewportHeight);
+ contentArea.scrollRect = rect;
- return contentSize;
+
+ }
- COMPILE::JS
- {
- return new Size(contentView.width, contentView.height);
- }
+
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
index 461c57e,6e1bb69..53d9bd5
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
@@@ -18,29 -18,26 +18,28 @@@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.supportClasses
{
-- import org.apache.flex.core.IContentView;
++ import org.apache.flex.core.IBead;
++ import org.apache.flex.core.IStrand;
import org.apache.flex.core.UIBase;
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
- COMPILE::SWF {
- import org.apache.flex.core.IChild;
- }
-
++ import org.apache.flex.core.IChild;
++ import org.apache.flex.core.ILayoutView;
+
/**
* The ContainerContentArea class implements the contentView for
-- * a Container. Container's don't always parent their children directly as
-- * that makes it harder to handle scrolling.
-- *
++ * a Container on the SWF platform.
++ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
-- public class ContainerContentArea extends UIBase implements IContentView
++ public class ContainerContentArea extends UIBase implements IBead, ILayoutView
{
/**
* Constructor.
-- *
++ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
@@@ -51,39 -48,34 +50,18 @@@
super();
addEventListener("layoutNeeded", forwardEventHandler);
}
--
++
++ protected var host:IStrand;
++
++ public function set strand(value:IStrand):void
++ {
++ host = value;
++ }
++
private function forwardEventHandler(event:Event):void
{
if (parent is IEventDispatcher)
(parent as IEventDispatcher).dispatchEvent(event);
}
--
-- /**
-- * @copy org.apache.flex.core.IItemRendererParent#removeAllElements()
-- *
-- * @langversion 3.0
-- * @playerversion Flash 10.2
-- * @playerversion AIR 2.6
-- * @productversion FlexJS 0.0
-- */
-- public function removeAllElements():void
-- {
-- COMPILE::SWF
-- {
- var n:Number = numElements;
- for (var i:Number = n-1; i >= 0; i--) {
- var child:IChild = getElementAt(i);
- removeElement(child,false);
- }
-- removeChildren(0);
-- }
-- COMPILE::JS
-- {
-- while (element.hasChildNodes())
-- {
-- element.removeChild(element.lastChild);
-- }
-- }
-- }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
index f6663a5,f6663a5..d05036f
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
@@@ -66,6 -66,6 +66,7 @@@ package org.apache.flex.html.supportCla
var added:Boolean = false;
if (textButton == null) {
textButton = new DataGridButtonBarTextButton();
++ textButton.percentWidth = 100;
// listen for clicks on the button and translate them into
// an itemClicked event.
@@@ -77,5 -77,5 +78,14 @@@
if (added) addElement(textButton);
}
++
++ /**
++ * @private
++ */
++ COMPILE::JS
++ override public function adjustSize():void
++ {
++ // not neeed for JS platform
++ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
index bb0fa65,bb0fa65..e612517
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
@@@ -56,6 -56,6 +56,7 @@@ package org.apache.flex.html.supportCla
public function DataGridColumnList()
{
super();
++ typeNames = "DataGridColumnList";
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
index f7ebf01,f7ebf01..b6ebb71
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
@@@ -41,7 -41,7 +41,7 @@@ package org.apache.flex.html.supportCla
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
-- public class DataGroup extends ContainerContentArea implements IItemRendererParent, IContentView
++ public class DataGroup extends ContainerContentArea implements IItemRendererParent
{
/**
* Constructor.
@@@ -56,55 -56,55 +56,87 @@@
super();
}
++ /*
++ * IItemRendererParent
++ */
++
/**
++ * @copy org.apache.flex.core.IItemRendererParent#addItemRenderer()
* @private
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
*/
-- override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
++ public function addItemRenderer(renderer:IItemRenderer):void
{
-- super.addElement(c, dispatchEvent);
++ addElement(renderer, true);
var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-- newEvent.item = c;
++ newEvent.item = renderer;
-- var strand:IEventDispatcher = parent as IEventDispatcher;
-- strand.dispatchEvent(newEvent);
++ (host as IEventDispatcher).dispatchEvent(newEvent);
}
/**
++ * @copy org.apache.flex.core.IItemRendererParent#removeItemRenderer()
* @private
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
*/
-- override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
-- {
-- super.removeElement(c, dispatchEvent);
++ public function removeItemRenderer(renderer:IItemRenderer):void
++ {
++ removeElement(renderer, true);
var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
-- newEvent.item = c;
++ newEvent.item = renderer;
-- var strand:IEventDispatcher = parent as IEventDispatcher;
-- strand.dispatchEvent(newEvent);
++ (host as IEventDispatcher).dispatchEvent(newEvent);
}
--
-- /**
-- * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
-- *
-- * @langversion 3.0
-- * @playerversion Flash 10.2
-- * @playerversion AIR 2.6
-- * @productversion FlexJS 0.0
-- */
-- public function getItemRendererForIndex(index:int):IItemRenderer
-- {
++
++ /**
++ * @copy org.apache.flex.core.IItemRendererParent#removeAllItemRenderers()
++ * @private
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
++ */
++ public function removeAllItemRenderers():void
++ {
++ while (numElements > 0) {
++ var child:IChild = getElementAt(0);
++ removeItemRenderer(child as IItemRenderer);
++ }
++ }
++
++ /**
++ * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
++ */
++ public function getItemRendererForIndex(index:int):IItemRenderer
++ {
if (index < 0 || index >= numElements) return null;
-- return getElementAt(index) as IItemRenderer;
-- }
++ return getElementAt(index) as IItemRenderer;
++ }
/**
* Refreshes the itemRenderers. Useful after a size change by the data group.
-- *
-- * @langversion 3.0
-- * @playerversion Flash 10.2
-- * @playerversion AIR 2.6
-- * @productversion FlexJS 0.0
++ *
++ * @copy org.apache.flex.core.IItemRendererParent#updateAllItemRenderers()
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.8
*/
public function updateAllItemRenderers():void
{
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
index 8b4ad5b,8b4ad5b..7154689
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
@@@ -163,7 -163,7 +163,7 @@@ package org.apache.flex.html.supportCla
{
element = document.createElement('div') as WrappedHTMLElement;
positioner = element;
-- positioner.style.position = 'relative';
++ //positioner.style.position = 'relative';
element.flexjs_wrapper = this;
className = 'DataItemRenderer';
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
index 0000000,0000000..6c7eb08
new file mode 100644
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataProviderNotifierBase.as
@@@ -1,0 -1,0 +1,154 @@@
++////////////////////////////////////////////////////////////////////////////////
++//
++// 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.IBead;
++ import org.apache.flex.core.IBeadModel;
++ import org.apache.flex.core.IDocument;
++ import org.apache.flex.core.ISelectionModel;
++ import org.apache.flex.core.IStrand;
++ import org.apache.flex.core.UIBase;
++ import org.apache.flex.events.IEventDispatcher;
++ import org.apache.flex.events.Event;
++ import org.apache.flex.collections.ArrayList;
++
++ /**
++ * Base class for all data provider notifiers.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public class DataProviderNotifierBase implements IBead, IDocument
++ {
++ /**
++ * constructor.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function DataProviderNotifierBase()
++ {
++ }
++
++ protected var dataProvider:ArrayList;
++
++ protected var _strand:IStrand;
++
++ /**
++ * @copy org.apache.flex.core.IBead#strand
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function set strand(value:IStrand):void
++ {
++ _strand = value;
++
++ if (_strand[destinationPropertyName] == null) {
++ var model:IBeadModel = UIBase(_strand).model as IBeadModel;
++ IEventDispatcher(model).addEventListener(changeEventName, destinationChangedHandler);
++ }
++ else {
++ destinationChangedHandler(null);
++ }
++ }
++
++ protected function destinationChangedHandler(event:Event):void
++ {
++
++ }
++
++ protected var document:Object;
++
++ /**
++ * @private
++ */
++ public function setDocument(document:Object, id:String = null):void
++ {
++ this.document = document;
++ }
++
++ private var _destinationPropertyName:String;
++
++ public function get destinationPropertyName():String
++ {
++ return _destinationPropertyName;
++ }
++ public function set destinationPropertyName(value:String):void
++ {
++ _destinationPropertyName = value;
++ }
++
++ private var _changeEventName:String;
++
++ public function get changeEventName():String
++ {
++ return _changeEventName;
++ }
++ public function set changeEventName(value:String):void
++ {
++ _changeEventName = value;
++ }
++
++ private var _sourceID:String;
++
++ /**
++ * The ID of the object holding the ArrayList, usually a model.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get sourceID():String
++ {
++ return _sourceID;
++ }
++ public function set sourceID(value:String):void
++ {
++ _sourceID = value;
++ }
++
++ private var _propertyName:String;
++
++ /**
++ * The property in the sourceID that is the ArrayList.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get propertyName():String
++ {
++ return _propertyName;
++ }
++
++ public function set propertyName(value:String):void
++ {
++ _propertyName = value;
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserHeader.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserHeader.as
index 775a140,0000000..0fde1c9
mode 100644,000000..100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserHeader.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserHeader.as
@@@ -1,66 -1,0 +1,64 @@@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.DataContainer;
- import org.apache.flex.html.beads.layouts.TileLayout;
++ import org.apache.flex.html.beads.layouts.HorizontalFlexLayout;
+
+ /**
+ * The DateChooserHeader is the container for the days of the week labels
+ * in the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserHeader extends DataContainer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserHeader()
+ {
+ super();
+
- tileLayout = new TileLayout();
- tileLayout.numColumns = 7;
- addBead(tileLayout);
++ myLayout = new HorizontalFlexLayout();
++ addBead(myLayout);
+ }
+
+ /**
+ * @private
+ */
- private var tileLayout:TileLayout;
++ private var myLayout:HorizontalFlexLayout;
+
+ /**
+ * @private
+ */
+ override public function set height(value:Number):void
+ {
+ super.height = value;
- tileLayout.rowHeight = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
index cacac1e,0000000..de1b304
mode 100644,000000..100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/MXMLItemRenderer.as
@@@ -1,83 -1,0 +1,84 @@@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ILayoutView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.events.Event;
+
+ /**
+ * 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
++ public class MXMLItemRenderer extends DataItemRenderer implements ILayoutParent, ILayoutHost, IStrand, ILayoutView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MXMLItemRenderer()
+ {
+ super();
+ }
-
++
+ [Bindable("dataChange")]
+ override public function set data(value:Object):void
+ {
+ if (value != data)
+ {
+ super.data = value;
+ dispatchEvent(new Event("dataChange"));
+ }
+ }
-
++
+ public function getLayoutHost():ILayoutHost
+ {
- return this;
++ return this;
+ }
-
- public function get contentView():IParentIUIBase
++
++ public function get contentView():ILayoutView
+ {
+ 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/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/PanelLayoutProxy.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/PanelLayoutProxy.as
index 0000000,0000000..4ebc174
new file mode 100644
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/PanelLayoutProxy.as
@@@ -1,0 -1,0 +1,132 @@@
++////////////////////////////////////////////////////////////////////////////////
++//
++// 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.UIBase;
++ import org.apache.flex.core.ILayoutView;
++ import org.apache.flex.core.IChild;
++ import org.apache.flex.events.IEventDispatcher;
++
++ import org.apache.flex.html.Panel;
++
++ COMPILE::JS {
++ import org.apache.flex.core.WrappedHTMLElement;
++ }
++
++ /**
++ * The PanelLayoutProxy class is used by Panel in order for layouts to operate
++ * on the Panel itself. If Panel were being used, its numElements, getElementAt, etc.
++ * functions would actually redirect to its Container content. In order for a layout
++ * to work on the Panel directly (its TitleBar, Container, and ControlBar children),
++ * this proxy is used which will invoke the Panel's $numElements, $getElementAt, etc
++ * functions.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public class PanelLayoutProxy implements ILayoutView
++ {
++ /**
++ * Constructor.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function PanelLayoutProxy(host:Object)
++ {
++ super();
++ _host = host;
++ }
++
++ private var _host:Object;
++
++ public function get host():Object
++ {
++ return _host;
++ }
++
++ /**
++ * The width of the bounding box.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get width():Number {
++ return (host as Panel).width;
++ }
++
++ /**
++ * The height of the bounding box.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get height():Number {
++ return (host as Panel).height;
++ }
++
++ /**
++ * The number of elements in the parent.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function get numElements():int
++ {
++ return (host as Panel).$numElements;
++ }
++
++ /**
++ * Get a component from the parent.
++ *
++ * @param c The index of the subcomponent.
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function getElementAt(index:int):IChild
++ {
++ return (host as Panel).$getElementAt(index);
++ }
++
++ COMPILE::JS
++ public function get somethingelse():WrappedHTMLElement
++ {
++ return (host as Panel).element;
++ }
++
++ COMPILE::JS
++ public function get element():WrappedHTMLElement
++ {
++ return (host as Panel).element;
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
index 119400f,119400f..3c29ae5
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
@@@ -101,7 -101,7 +101,7 @@@ package org.apache.flex.html.supportCla
element = input as WrappedHTMLElement;
positioner = element;
-- positioner.style.position = 'relative';
++ //positioner.style.position = 'relative';
(element as WrappedHTMLElement).flexjs_wrapper = this;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9fd9b78b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --cc frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
index 46ba9a6,46ba9a6..444606b
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@@ -18,12 -18,12 +18,9 @@@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.supportClasses
{
-- COMPILE::SWF
-- {
-- import flash.geom.Rectangle;
-- }
import org.apache.flex.core.IBead;
import org.apache.flex.core.IBeadLayout;
++ import org.apache.flex.core.IContainer;
import org.apache.flex.core.IContentViewHost;
import org.apache.flex.core.IParentIUIBase;
import org.apache.flex.core.IStrand;
@@@ -33,12 -33,12 +30,16 @@@
COMPILE::SWF
{
import org.apache.flex.core.IViewportScroller;
++ import org.apache.flex.utils.CSSContainerUtils;
++ import flash.geom.Rectangle;
++ import org.apache.flex.geom.Rectangle;
}
import org.apache.flex.core.UIBase;
import org.apache.flex.events.Event;
import org.apache.flex.geom.Size;
import org.apache.flex.html.beads.ScrollBarView;
import org.apache.flex.html.beads.models.ScrollBarModel;
++ import org.apache.flex.geom.Rectangle;
/**
* The ScrollingViewport extends the Viewport class by adding horizontal and
@@@ -51,6 -51,6 +52,71 @@@
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
++ COMPILE::JS
++ public class ScrollingViewport extends Viewport implements IBead, IViewport
++ {
++ /**
++ * Constructor
++ *
++ * @langversion 3.0
++ * @playerversion Flash 10.2
++ * @playerversion AIR 2.6
++ * @productversion FlexJS 0.0
++ */
++ public function ScrollingViewport()
++ {
++ super();
++ }
++
++ public function get verticalScrollPosition():Number
++ {
++ return this.contentView.positioner.scrollTop;
++ }
++ public function set verticalScrollPosition(value:Number):void
++ {
++ this.contentView.positioner.scrollTop = value;
++ }
++
++ public function get horizontalScrollPosition():Number
++ {
++ return this.contentView.positioner.scrollLeft;
++ }
++ public function set horizontalScrollPosition(value:Number):void
++ {
++ this.contentView.positioner.scrollLeft = value;
++ }
++
++ /**
++ * @flexjsignorecoercion HTMLElement
++ */
++ override public function set strand(value:IStrand):void
++ {
++ super.strand = value;
++ if (contentView == null) {
++ (value as UIBase).element.style.overflow = "auto";
++ } else {
++ (contentView as UIBase).element.style.overflow = "auto";
++ }
++ }
++
++ /**
++ * @copy org.apache.flex.core.IViewport
++ */
++ override public function layoutViewportBeforeContentLayout(width:Number, height:Number):void
++ {
++ // does nothing for the JS platform
++ }
++
++ /**
++ * @copy org.apache.flex.core.IViewport
++ */
++ override public function layoutViewportAfterContentLayout(contentSize:Size):void
++ {
++ // does nothing for the JS platform
++ }
++ }
++
++ COMPILE::SWF
public class ScrollingViewport extends Viewport implements IBead, IViewport
{
/**
@@@ -63,88 -63,88 +129,45 @@@
*/
public function ScrollingViewport()
{
++ super();
}
-- COMPILE::SWF
private var _verticalScroller:ScrollBar;
-- COMPILE::SWF
public function get verticalScroller():IViewportScroller
{
return _verticalScroller;
}
-- COMPILE::SWF
private var _horizontalScroller:ScrollBar
-- COMPILE::SWF
public function get horizontalScroller():IViewportScroller
{
return _horizontalScroller;
}
-- COMPILE::SWF
private var _verticalScrollPosition:Number = 0;
public function get verticalScrollPosition():Number
{
-- COMPILE::SWF
-- {
-- return _verticalScrollPosition;
-- }
-- COMPILE::JS
-- {
-- return this.contentView.positioner.scrollTop;
-- }
++ return _verticalScrollPosition;
}
public function set verticalScrollPosition(value:Number):void
{
-- COMPILE::SWF
-- {
-- _verticalScrollPosition = value;
-- handleVerticalScrollChange();
-- }
-- COMPILE::JS
-- {
-- this.contentView.positioner.scrollTop = value;
-- }
++ _verticalScrollPosition = value;
++ handleVerticalScrollChange();
}
-- COMPILE::SWF
private var _horizontalScrollPosition:Number = 0;
public function get horizontalScrollPosition():Number
{
-- COMPILE::SWF
-- {
-- return _horizontalScrollPosition;
-- }
-- COMPILE::JS
-- {
-- return this.contentView.positioner.scrollLeft;
-- }
++ return _horizontalScrollPosition;
}
public function set horizontalScrollPosition(value:Number):void
{
-- COMPILE::SWF
-- {
-- _horizontalScrollPosition = value;
-- handleHorizontalScrollChange();
-- }
-- COMPILE::JS
-- {
-- this.contentView.positioner.scrollLeft = value;
-- }
-- }
--
-- /**
-- * @flexjsignorecoercion HTMLElement
-- */
-- COMPILE::JS
-- override public function set strand(value:IStrand):void
-- {
-- super.strand = value;
-- (contentView.element as HTMLElement).style.overflow = 'auto';
++ _horizontalScrollPosition = value;
++ handleHorizontalScrollChange();
}
private var viewportWidth:Number;
@@@ -155,127 -155,127 +178,90 @@@
*/
override public function layoutViewportBeforeContentLayout(width:Number, height:Number):void
{
-- super.layoutViewportBeforeContentLayout(width, height);
-- viewportWidth = width;
-- viewportHeight = height;
++ super.layoutViewportBeforeContentLayout(width, height);
++ viewportWidth = width;
++ viewportHeight = height;
}
/**
* @copy org.apache.flex.core.IViewport
*/
-- override public function layoutViewportAfterContentLayout():Size
++ override public function layoutViewportAfterContentLayout(contentSize:Size):void
{
-- COMPILE::SWF
-- {
-- var hadV:Boolean = _verticalScroller != null && _verticalScroller.visible;
-- var hadH:Boolean = _horizontalScroller != null && _horizontalScroller.visible;
-- var contentSize:Size;
-- do
-- {
-- contentSize = super.layoutViewportAfterContentLayout();
-- if (isNaN(viewportHeight))
-- viewportHeight = contentSize.height;
-- if (isNaN(viewportWidth))
-- viewportWidth = contentSize.width;
--
-- var host:UIBase = UIBase(_strand);
-- var visibleWidth:Number;
-- var visibleHeight:Number;
-- var needV:Boolean = contentSize.height > viewportHeight;
-- var needH:Boolean = contentSize.width > viewportWidth;
--
-- if (needV)
-- {
-- if (_verticalScroller == null) {
-- _verticalScroller = createVerticalScrollBar();
-- (host as IContentViewHost).strandChildren.addElement(_verticalScroller);
-- }
-- }
-- if (needH)
-- {
-- if (_horizontalScroller == null) {
-- _horizontalScroller = createHorizontalScrollBar();
-- (host as IContentViewHost).strandChildren.addElement(_horizontalScroller);
-- }
-- }
--
-- if (needV)
-- {
-- _verticalScroller.visible = true;
-- _verticalScroller.x = contentArea.x + viewportWidth - _verticalScroller.width;
-- _verticalScroller.y = contentArea.y;
-- _verticalScroller.setHeight(viewportHeight - (needH ? _horizontalScroller.height : 0), true);
-- visibleWidth = _verticalScroller.x;
-- }
-- else if (_verticalScroller)
-- _verticalScroller.visible = false;
--
-- if (needH)
-- {
-- _horizontalScroller.visible = true;
-- _horizontalScroller.x = contentArea.x;
-- _horizontalScroller.y = contentArea.y + viewportHeight - _horizontalScroller.height;
-- _horizontalScroller.setWidth(viewportWidth - (needV ? _verticalScroller.width : 0), true);
-- visibleHeight = _horizontalScroller.y;
-- }
--
-- var needsLayout:Boolean = false;
-- // resize content area if needed to get out from under scrollbars
-- if (!isNaN(visibleWidth) || !isNaN(visibleHeight))
-- {
-- if (!isNaN(visibleWidth))
-- needsLayout = visibleWidth != contentView.width;
-- if (!isNaN(visibleHeight))
-- needsLayout = visibleHeight != contentView.height;
-- if (!isNaN(visibleWidth) && !isNaN(visibleHeight))
-- contentArea.setWidthAndHeight(visibleWidth, visibleHeight, false);
-- else if (!isNaN(visibleWidth))
-- contentArea.setWidth(visibleWidth, false);
-- else if (!isNaN(visibleHeight))
-- contentArea.setHeight(visibleHeight, false);
-- }
-- if (needsLayout)
-- {
-- var layout:IBeadLayout = host.getBeadByType(IBeadLayout) as IBeadLayout;
-- layout.layout();
-- }
-- } while (needsLayout && (needV != hadV || needH == hadH));
-- if (_verticalScroller)
-- {
-- ScrollBarModel(_verticalScroller.model).maximum = contentSize.height;
-- ScrollBarModel(_verticalScroller.model).pageSize = contentArea.height;
-- ScrollBarModel(_verticalScroller.model).pageStepSize = contentArea.height;
-- if (contentSize.height > contentArea.height &&
-- (contentSize.height - contentArea.height) < _verticalScrollPosition)
-- _verticalScrollPosition = contentSize.height - contentArea.height;
-- }
-- if (_horizontalScroller)
-- {
-- ScrollBarModel(_horizontalScroller.model).maximum = contentSize.width;
-- ScrollBarModel(_horizontalScroller.model).pageSize = contentArea.width;
-- ScrollBarModel(_horizontalScroller.model).pageStepSize = contentArea.width;
-- if (contentSize.width > contentArea.width &&
-- (contentSize.width - contentArea.width) < _horizontalScrollPosition)
-- _horizontalScrollPosition = contentSize.width - contentArea.width;
-- }
--
-- var rect:Rectangle = new Rectangle(_horizontalScrollPosition, _verticalScrollPosition,
-- (_verticalScroller != null && _verticalScroller.visible) ?
-- _verticalScroller.x : viewportWidth,
-- (_horizontalScroller != null && _horizontalScroller.visible) ?
-- _horizontalScroller.y : viewportHeight);
-- contentArea.scrollRect = rect;
-- return contentSize;
--
-- }
-- COMPILE::JS
-- {
-- return new Size(contentView.width, contentView.height);
-- }
--
++ var hadV:Boolean = _verticalScroller != null && _verticalScroller.visible;
++ var hadH:Boolean = _horizontalScroller != null && _horizontalScroller.visible;
++
++ var hostWidth:Number = UIBase(_strand).width;
++ var hostHeight:Number = UIBase(_strand).height;
++
++ var borderMetrics:org.apache.flex.geom.Rectangle = CSSContainerUtils.getBorderMetrics(_strand);
++
++ hostWidth -= borderMetrics.left + borderMetrics.right;
++ hostHeight -= borderMetrics.top + borderMetrics.bottom;
++
++ var needV:Boolean = contentSize.height > viewportHeight;
++ var needH:Boolean = contentSize.width > viewportWidth;
++
++ if (needV)
++ {
++ if (_verticalScroller == null) {
++ _verticalScroller = createVerticalScrollBar();
++ (_strand as IContainer).strandChildren.addElement(_verticalScroller);
++ }
++ }
++ if (needH)
++ {
++ if (_horizontalScroller == null) {
++ _horizontalScroller = createHorizontalScrollBar();
++ (_strand as IContainer).strandChildren.addElement(_horizontalScroller);
++ }
++ }
++
++ if (needV)
++ {
++ _verticalScroller.visible = true;
++ _verticalScroller.x = UIBase(_strand).width - borderMetrics.right - _verticalScroller.width;
++ _verticalScroller.y = borderMetrics.top;
++ _verticalScroller.setHeight(hostHeight - (needH ? _horizontalScroller.height : 0), true);
++
++ ScrollBarModel(_verticalScroller.model).maximum = contentSize.height;
++ ScrollBarModel(_verticalScroller.model).pageSize = contentArea.height;
++ ScrollBarModel(_verticalScroller.model).pageStepSize = contentArea.height;
++
++ if (contentSize.height > contentArea.height &&
++ (contentSize.height - contentArea.height) < _verticalScrollPosition)
++ _verticalScrollPosition = contentSize.height - contentArea.height;
++ }
++ else if (_verticalScroller) {
++ _verticalScroller.visible = false;
++ }
++
++ if (needH)
++ {
++ _horizontalScroller.visible = true;
++ _horizontalScroller.x = 0;
++ _horizontalScroller.y = UIBase(_strand).height - borderMetrics.bottom - _horizontalScroller.height;
++ _horizontalScroller.setWidth(hostWidth - (needV ? _verticalScroller.width : 0), true);
++
++ ScrollBarModel(_horizontalScroller.model).maximum = contentSize.width;
++ ScrollBarModel(_horizontalScroller.model).pageSize = contentArea.width;
++ ScrollBarModel(_horizontalScroller.model).pageStepSize = contentArea.width;
++
++ if (contentSize.width > contentArea.width &&
++ (contentSize.width - contentArea.width) < _horizontalScrollPosition)
++ _horizontalScrollPosition = contentSize.width - contentArea.width;
++ }
++ else if (_horizontalScroller) {
++ _horizontalScroller.visible = false;
++ }
++
++ var rect:flash.geom.Rectangle = new flash.geom.Rectangle(_horizontalScrollPosition, _verticalScrollPosition,
++ (_verticalScroller != null && _verticalScroller.visible) ? _verticalScroller.x : hostWidth,
++ (_horizontalScroller != null && _horizontalScroller.visible) ? _horizontalScroller.y : hostHeight);
++
++ contentArea.scrollRect = rect;
}
-- COMPILE::SWF
private function createVerticalScrollBar():ScrollBar
{
var vsbm:ScrollBarModel = new ScrollBarModel();
@@@ -293,7 -293,7 +279,6 @@@
return vsb;
}
-- COMPILE::SWF
private function createHorizontalScrollBar():ScrollBar
{
var hsbm:ScrollBarModel = new ScrollBarModel();
@@@ -311,31 -311,31 +296,28 @@@
return hsb;
}
-- COMPILE::SWF
private function handleVerticalScroll(event:Event):void
{
var host:UIBase = UIBase(_strand);
var vpos:Number = ScrollBarModel(_verticalScroller.model).value;
-- var rect:Rectangle = contentArea.scrollRect;
++ var rect:flash.geom.Rectangle = contentArea.scrollRect;
rect.y = vpos;
contentArea.scrollRect = rect;
_verticalScrollPosition = vpos;
}
-- COMPILE::SWF
private function handleHorizontalScroll(event:Event):void
{
var host:UIBase = UIBase(_strand);
var hpos:Number = ScrollBarModel(_horizontalScroller.model).value;
-- var rect:Rectangle = contentArea.scrollRect;
++ var rect:flash.geom.Rectangle = contentArea.scrollRect;
rect.x = hpos;
contentArea.scrollRect = rect;
_horizontalScrollPosition = hpos;
}
-- COMPILE::SWF
private function handleVerticalScrollChange():void
{
if (_verticalScroller) {
@@@ -343,7 -343,7 +325,6 @@@
}
}
-- COMPILE::SWF
private function handleHorizontalScrollChange():void
{
if (_horizontalScroller) {