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 2016/05/26 23:05:30 UTC
[46/51] [abbrv] git commit: [flex-asjs] [refs/heads/spark] - more
attempts to get Application and Label to compile
more attempts to get Application and Label to compile
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c4cb764e
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c4cb764e
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c4cb764e
Branch: refs/heads/spark
Commit: c4cb764ebc7011ee97fb870834ab7a5cb8aff9fc
Parents: dc36448
Author: Alex Harui <ah...@apache.org>
Authored: Thu May 26 15:45:09 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu May 26 16:04:24 2016 -0700
----------------------------------------------------------------------
.../mx/containers/errors/ConstraintError.as | 58 +
.../utilityClasses/ApplicationLayout.as | 116 ++
.../mx/containers/utilityClasses/BoxLayout.as | 20 +-
.../flex/mx/containers/utilityClasses/Flex.as | 696 +++++++
.../containers/utilityClasses/FlexChildInfo.as | 142 ++
.../utilityClasses/IConstraintLayout.as | 99 +
.../mx/controls/listClasses/BaseListData.as | 233 +++
.../listClasses/IDropInListItemRenderer.as | 163 ++
.../controls/listClasses/IListItemRenderer.as | 79 +
.../flex/mx/controls/scrollClasses/ScrollBar.as | 1719 ------------------
.../MX/src/main/flex/mx/core/Application.as | 22 +-
.../MX/src/main/flex/mx/core/Container.as | 207 ++-
.../flex/mx/core/ContainerRawChildrenList.as | 227 +++
.../MX/src/main/flex/mx/core/IContainer.as | 4 +
.../MX/src/main/flex/mx/core/IDataRenderer.as | 103 ++
.../src/main/flex/mx/core/INavigatorContent.as | 67 +
.../main/flex/mx/events/IndexChangedEvent.as | 310 ++++
.../flex/mx/managers/IActiveWindowManager.as | 100 +
.../styles/metadata/ModalTransparencyStyles.as | 80 +
.../MX/src/main/flex/mx/utils/LoaderUtil.as | 658 +++++++
20 files changed, 3329 insertions(+), 1774 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/containers/errors/ConstraintError.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/containers/errors/ConstraintError.as b/frameworks/projects/MX/src/main/flex/mx/containers/errors/ConstraintError.as
new file mode 100644
index 0000000..136fa55
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/containers/errors/ConstraintError.as
@@ -0,0 +1,58 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.containers.errors
+{
+
+/**
+ * This error is thrown when a constraint expression is not configured properly;
+ * for example, if the GridColumn reference is invalid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public class ConstraintError extends Error
+{
+ include "../../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param message A message providing information about the error cause.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function ConstraintError(message:String)
+ {
+ super(message);
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/ApplicationLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/ApplicationLayout.as b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/ApplicationLayout.as
new file mode 100644
index 0000000..6cad8bb
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/ApplicationLayout.as
@@ -0,0 +1,116 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.containers.utilityClasses
+{
+
+import mx.core.Container;
+import mx.core.EdgeMetrics;
+import mx.core.IFlexDisplayObject;
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+
+[ExcludeClass]
+
+/**
+ * @private
+ * The ApplicationLayout class is for internal use only.
+ */
+public class ApplicationLayout extends BoxLayout
+{
+ include "../../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function ApplicationLayout()
+ {
+ super();
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ * Lay out children as per Application layout rules.
+ */
+ override public function updateDisplayList(unscaledWidth:Number,
+ unscaledHeight:Number):void
+ {
+ super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+ var target:Container = super.target;
+
+ // If there are scrollbars, and any children are at negative
+ // co-ordinates, make adjustments to bring them into the visible area.
+ COMPILE::LATER
+ {
+ if ((target.horizontalScrollBar && getHorizontalAlignValue() > 0) ||
+ (target.verticalScrollBar && getVerticalAlignValue() > 0))
+ {
+ var paddingLeft:Number = target.getStyle("paddingLeft");
+ var paddingTop:Number = target.getStyle("paddingTop");
+ var oX:Number = 0;
+ var oY:Number = 0;
+
+ var n:int = target.numChildren;
+ var i:int;
+ var child:IFlexDisplayObject;
+
+ for (i = 0; i < n; i++)
+ {
+ child = IFlexDisplayObject(target.getChildAt(i));
+
+ if (child.x < paddingLeft)
+ oX = Math.max(oX, paddingLeft - child.x);
+
+ if (child.y < paddingTop)
+ oY = Math.max(oY, paddingTop - child.y);
+ }
+
+ if (oX != 0 || oY != 0)
+ {
+ for (i = 0; i < n; i++)
+ {
+ child = IFlexDisplayObject(target.getChildAt(i));
+ child.move(child.x + oX, child.y + oY);
+ }
+ }
+ }
+ }
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/BoxLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/BoxLayout.as b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/BoxLayout.as
index db31dcd..60eefd6 100644
--- a/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/BoxLayout.as
+++ b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/BoxLayout.as
@@ -180,8 +180,11 @@ public class BoxLayout extends Layout
var w:Number = Math.max(unscaledWidth, mw) - vm.right - vm.left;
var h:Number = Math.max(unscaledHeight, mh) - vm.bottom - vm.top;
+ COMPILE::LATER
+ {
var horizontalScrollBar:ScrollBar = target.horizontalScrollBar;
var verticalScrollBar:ScrollBar = target.verticalScrollBar;
+ }
var gap:Number;
var numChildrenWithOwnSpace:int;
@@ -227,12 +230,18 @@ public class BoxLayout extends Layout
height = child.getExplicitOrMeasuredHeight();
}
+ COMPILE::LATER
+ {
// if scaled and zoom is playing, best to let the sizes be non-integer
if (child.scaleX == 1 && child.scaleY == 1)
child.setActualSize(Math.floor(width), Math.floor(height));
else
child.setActualSize(width, height);
+ }
+ child.setActualSize(width, height);
+ COMPILE::LATER
+ {
// Ignore scrollbar sizes for child alignment purpose.
if (verticalScrollBar != null &&
target.verticalScrollPolicy == ScrollPolicy.AUTO)
@@ -244,6 +253,7 @@ public class BoxLayout extends Layout
{
h += horizontalScrollBar.minHeight;
}
+ }
// Use the child's width and height because a Resize effect might
// have changed the child's dimensions. Bug 146158.
@@ -268,6 +278,8 @@ public class BoxLayout extends Layout
excessSpace = Flex.flexChildHeightsProportionally(
target, h - (numChildrenWithOwnSpace - 1) * gap, w);
+ COMPILE::LATER
+ {
// Ignore scrollbar sizes for child alignment purpose.
if (horizontalScrollBar != null &&
target.horizontalScrollPolicy == ScrollPolicy.AUTO)
@@ -279,7 +291,8 @@ public class BoxLayout extends Layout
{
w += verticalScrollBar.minWidth;
}
-
+ }
+
top = paddingTop + excessSpace * verticalAlign;
for (i = 0; i < n; i++)
@@ -307,6 +320,8 @@ public class BoxLayout extends Layout
excessSpace = Flex.flexChildWidthsProportionally(
target, w - (numChildrenWithOwnSpace - 1) * gap, h);
+ COMPILE::LATER
+ {
// Ignore scrollbar sizes for child alignment purpose.
if (horizontalScrollBar != null &&
target.horizontalScrollPolicy == ScrollPolicy.AUTO)
@@ -318,7 +333,8 @@ public class BoxLayout extends Layout
{
excessSpace += verticalScrollBar.minWidth;
}
-
+ }
+
left = paddingLeft + excessSpace * horizontalAlign;
for (i = 0; i < n; i++)
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/Flex.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/Flex.as b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/Flex.as
new file mode 100644
index 0000000..6aee0d3
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/Flex.as
@@ -0,0 +1,696 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.containers.utilityClasses
+{
+
+import mx.core.IChildList;
+import mx.core.IUIComponent;
+
+[ExcludeClass]
+
+/**
+ * @private
+ * The Flex class is for internal use only.
+ */
+public class Flex
+{
+ include "../../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Class methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * This function sets the width of each child
+ * so that the widths add up to spaceForChildren.
+ * Each child is set to its preferred width
+ * if its percentWidth is zero.
+ * If it's percentWidth is a positive number
+ * the child grows depending on the size of its parent
+ * The height of each child is set to its preferred height.
+ * The return value is any extra space that's left over
+ * after growing all children to their maxWidth.
+ *
+ * @param parent The parent container of the children.
+ *
+ * @param spaceForChildren The space that is to be
+ * distributed across all the children.
+ *
+ * @param h height for all children.
+ *
+ * @result Any extra space that's left over
+ * after growing all children to their maxWidth.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function flexChildWidthsProportionally(
+ parent:IChildList,
+ spaceForChildren:Number,
+ h:Number):Number
+ {
+ var spaceToDistribute:Number = spaceForChildren;
+ var totalPercentWidth:Number = 0;
+ var childInfoArray:Array = [];
+ var childInfo:FlexChildInfo;
+ var child:IUIComponent;
+ var i:int;
+
+ // If the child is flexible, store information about it in the
+ // childInfoArray. For non-flexible children, just set the child's
+ // width and height immediately.
+ //
+ // Also calculate the sum of all widthFlexes, and calculate the
+ // sum of the width of all non-flexible children.
+ var n:int = parent.numChildren;
+ for (i = 0; i < n; i++)
+ {
+ child = IUIComponent(parent.getChildAt(i));
+
+ var percentWidth:Number = child.percentWidth;
+ var percentHeight:Number = child.percentHeight;
+ var height:Number;
+
+ if (!isNaN(percentHeight) && child.includeInLayout)
+ {
+ height = Math.max(child.minHeight,
+ Math.min(child.maxHeight,
+ ((percentHeight >= 100) ? h : h * percentHeight / 100)));
+ }
+ else
+ {
+ height = child.getExplicitOrMeasuredHeight();
+ }
+
+ if (!isNaN(percentWidth) && child.includeInLayout)
+ {
+ totalPercentWidth += percentWidth;
+
+ childInfo = new FlexChildInfo();
+ childInfo.percent = percentWidth;
+ childInfo.min = child.minWidth;
+ childInfo.max = child.maxWidth;
+ childInfo.height = height;
+ childInfo.child = child;
+
+ childInfoArray.push(childInfo);
+ }
+ else
+ {
+ var width:Number = child.getExplicitOrMeasuredWidth();
+ // if scaled and zoom is playing, best to let the sizes be non-integer
+ // otherwise the rounding creates an error that accumulates in some components like List
+ COMPILE::LATER
+ {
+ if (child.scaleX == 1 && child.scaleY == 1)
+ {
+ child.setActualSize(Math.floor(width),
+ Math.floor(height));
+ }
+ else
+ {
+ child.setActualSize(width, height);
+ }
+ }
+ child.setActualSize(width, height);
+
+ if (child.includeInLayout)
+ {
+ // Need to account for the actual child width since
+ // setActualSize may trigger a Resize effect, which
+ // could change the size of the component.
+ spaceToDistribute -= child.width;
+ }
+ }
+ }
+
+ // Distribute the extra space among the children.
+ if (totalPercentWidth)
+ {
+ spaceToDistribute = flexChildrenProportionally(spaceForChildren,
+ spaceToDistribute, totalPercentWidth, childInfoArray);
+
+ // Set the widths and heights of the flexible children
+ n = childInfoArray.length;
+ for (i = 0; i < n; i++)
+ {
+ childInfo = childInfoArray[i];
+ child = childInfo.child;
+
+ // if scaled and zoom is playing, best to let the sizes be non-integer
+ // otherwise the rounding creates an error that accumulates in some components like List
+ COMPILE::LATER
+ {
+ if (child.scaleX == 1 && child.scaleY == 1)
+ {
+ child.setActualSize(Math.floor(childInfo.size),
+ Math.floor(childInfo.height));
+ }
+ else
+ {
+ child.setActualSize(childInfo.size, childInfo.height);
+ }
+ }
+ child.setActualSize(childInfo.size, childInfo.height);
+ }
+
+ distributeExtraWidth(parent, spaceForChildren);
+ }
+
+ return spaceToDistribute;
+ }
+
+ /**
+ * This function sets the height of each child
+ * so that the heights add up to spaceForChildren.
+ * Each child is set to its preferred height
+ * if its percentHeight is zero.
+ * If its percentHeight is a positive number,
+ * the child grows (or shrinks) to consume its share of extra space.
+ * The width of each child is set to its preferred width.
+ * The return value is any extra space that's left over
+ * after growing all children to their maxHeight.
+ *
+ * @param parent The parent container of the children.
+ *
+ * @param spaceForChildren The space that is to be
+ * distributed across all children .
+ *
+ * @param w width for all children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function flexChildHeightsProportionally(
+ parent:IChildList,
+ spaceForChildren:Number,
+ w:Number):Number
+ {
+ var spaceToDistribute:Number = spaceForChildren;
+ var totalPercentHeight:Number = 0;
+ var childInfoArray:Array = [];
+ var childInfo:FlexChildInfo;
+ var child:IUIComponent;
+ var i:int;
+
+ // If the child is flexible, store information about it in the
+ // childInfoArray. For non-flexible children, just set the child's
+ // width and height immediately.
+ //
+ // Also calculate the sum of all percentHeights, and calculate the
+ // sum of the height of all non-flexible children.
+ var n:int = parent.numChildren;
+ for (i = 0; i < n; i++)
+ {
+ child = IUIComponent(parent.getChildAt(i));
+
+ var percentWidth:Number = child.percentWidth;
+ var percentHeight:Number = child.percentHeight;
+ var width:Number;
+
+ if (!isNaN(percentWidth) && child.includeInLayout)
+ {
+ width = Math.max(child.minWidth,
+ Math.min(child.maxWidth,
+ ((percentWidth >= 100) ? w : w * percentWidth / 100)));
+ }
+ else
+ {
+ width = child.getExplicitOrMeasuredWidth();
+ }
+
+ if (!isNaN(percentHeight) && child.includeInLayout)
+ {
+ totalPercentHeight += percentHeight;
+
+ childInfo = new FlexChildInfo();
+ childInfo.percent = percentHeight;
+ childInfo.min = child.minHeight;
+ childInfo.max = child.maxHeight;
+ childInfo.width = width;
+ childInfo.child = child;
+
+ childInfoArray.push(childInfo);
+ }
+ else
+ {
+ var height:Number = child.getExplicitOrMeasuredHeight();
+ // if scaled and zoom is playing, best to let the sizes be non-integer
+ // otherwise the rounding creates an error that accumulates in some components like List
+ COMPILE::LATER
+ {
+ if (child.scaleX == 1 && child.scaleY == 1)
+ {
+ child.setActualSize(Math.floor(width),
+ Math.floor(height));
+ }
+ else
+ {
+ child.setActualSize(width, height);
+ }
+ }
+ child.setActualSize(width, height);
+
+ if (child.includeInLayout)
+ {
+ // Need to account for the actual child height since
+ // setActualSize may trigger a Resize effect, which
+ // could change the size of the component.
+ spaceToDistribute -= child.height;
+ }
+ }
+ }
+
+ // Distribute the extra space among the children.
+ if (totalPercentHeight)
+ {
+ spaceToDistribute = flexChildrenProportionally(spaceForChildren,
+ spaceToDistribute, totalPercentHeight, childInfoArray);
+
+ // Set the widths and heights of the flexible children
+ n = childInfoArray.length;
+ for (i = 0; i < n; i++)
+ {
+ childInfo = childInfoArray[i];
+ child = childInfo.child;
+
+ // if scaled and zoom is playing, best to let the sizes be non-integer
+ // otherwise the rounding creates an error that accumulates in some components like List
+ COMPILE::LATER
+ {
+ if (child.scaleX == 1 && child.scaleY == 1)
+ {
+ child.setActualSize(Math.floor(childInfo.width),
+ Math.floor(childInfo.size));
+ }
+ else
+ {
+ child.setActualSize(childInfo.width, childInfo.size);
+ }
+ }
+ child.setActualSize(childInfo.width, childInfo.size);
+ }
+
+ distributeExtraHeight(parent, spaceForChildren);
+ }
+
+ return spaceToDistribute;
+ }
+
+ /**
+ * This function distributes excess space among the flexible children.
+ * It does so with a view to keep the children's overall size
+ * close the ratios specified by their percent.
+ *
+ * @param spaceForChildren The total space for all children
+ *
+ * @param spaceToDistribute The space that needs to be distributed
+ * among the flexible children.
+ *
+ * @param childInfoArray An array of Objects. When this function
+ * is called, each object should define the following properties:
+ * - percent: the percentWidth or percentHeight of the child (depending
+ * on whether we're growing in a horizontal or vertical direction)
+ * - min: the minimum width (or height) for that child
+ * - max: the maximum width (or height) for that child
+ *
+ * @return When this function finishes executing, a "size" property
+ * will be defined for each child object. The size property contains
+ * the portion of the spaceToDistribute to be distributed to the child.
+ * Ideally, the sum of all size properties is spaceToDistribute.
+ * If all the children hit their minWidth/maxWidth/minHeight/maxHeight
+ * before the space was distributed, then the remaining unused space
+ * is returned. Otherwise, the return value is zero.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function flexChildrenProportionally(
+ spaceForChildren:Number,
+ spaceToDistribute:Number,
+ totalPercent:Number,
+ childInfoArray:Array):Number
+ {
+ // The algorithm iterivately attempts to break down the space that
+ // is consumed by "flexible" containers into ratios that are related
+ // to the percentWidth/percentHeight of the participating containers.
+
+ var numChildren:int = childInfoArray.length;
+ var flexConsumed:Number; // space consumed by flexible compontents
+ var done:Boolean;
+
+ // Continue as long as there are some remaining flexible children.
+ // The "done" flag isn't strictly necessary, except that it catches
+ // cases where round-off error causes totalPercent to not exactly
+ // equal zero.
+ do
+ {
+ flexConsumed = 0; // space consumed by flexible compontents
+ done = true; // we are optimistic
+
+ // We now do something a little tricky so that we can
+ // support partial filling of the space. If our total
+ // percent < 100% then we can trim off some space.
+ // This unused space can be used to fulfill mins and maxes.
+ var unused:Number = spaceToDistribute -
+ (spaceForChildren * totalPercent / 100);
+ if (unused > 0)
+ spaceToDistribute -= unused;
+ else
+ unused = 0;
+
+ // Space for flexible children is the total amount of space
+ // available minus the amount of space consumed by non-flexible
+ // components.Divide that space in proportion to the percent
+ // of the child
+ var spacePerPercent:Number = spaceToDistribute / totalPercent;
+
+ // Attempt to divide out the space using our percent amounts,
+ // if we hit its limit then that control becomes 'non-flexible'
+ // and we run the whole space to distribute calculation again.
+ for (var i:int = 0; i < numChildren; i++)
+ {
+ var childInfo:FlexChildInfo = childInfoArray[i];
+
+ // Set its size in proportion to its percent.
+ var size:Number = childInfo.percent * spacePerPercent;
+
+ // If our flexiblity calc say grow/shrink more than we are
+ // allowed, then we grow/shrink whatever we can, remove
+ // ourselves from the array for the next pass, and start
+ // the loop over again so that the space that we weren't
+ // able to consume / release can be re-used by others.
+ if (size < childInfo.min)
+ {
+ var min:Number = childInfo.min;
+ childInfo.size = min;
+
+ // Move this object to the end of the array
+ // and decrement the length of the array.
+ // This is slightly expensive, but we don't expect
+ // to hit these min/max limits very often.
+ childInfoArray[i] = childInfoArray[--numChildren];
+ childInfoArray[numChildren] = childInfo;
+
+ totalPercent -= childInfo.percent;
+ // Use unused space first before reducing flexible space.
+ if (unused >= min)
+ {
+ unused -= min;
+ }
+ else
+ {
+ spaceToDistribute -= min - unused;
+ unused = 0;
+ }
+ done = false;
+ break;
+ }
+ else if (size > childInfo.max)
+ {
+ var max:Number = childInfo.max;
+ childInfo.size = max;
+
+ childInfoArray[i] = childInfoArray[--numChildren];
+ childInfoArray[numChildren] = childInfo;
+
+ totalPercent -= childInfo.percent;
+ // Use unused space first before reducing flexible space.
+ if (unused >= max)
+ {
+ unused -= max;
+ }
+ else
+ {
+ spaceToDistribute -= max - unused;
+ unused = 0;
+ }
+ done = false;
+ break;
+ }
+ else
+ {
+ // All is well, let's carry on...
+ childInfo.size = size;
+ flexConsumed += size;
+ }
+ }
+ }
+ while (!done);
+
+ return Math.max(0, Math.floor((spaceToDistribute + unused) - flexConsumed))
+ }
+
+ /**
+ * This function distributes excess space among the flexible children
+ * because of rounding errors where we want to keep children's dimensions
+ * full pixel amounts. This only distributes the extra space
+ * if there was some rounding down and there are still
+ * flexible children.
+ *
+ * @param parent The parent container of the children.
+ *
+ * @param spaceForChildren The total space for all children
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function distributeExtraHeight(
+ parent:IChildList,
+ spaceForChildren:Number):void
+ {
+ // We should only get here after distributing the majority of the
+ // space already. This is done in flexChildHeightsProportionally.
+ // Strategy here is to keep adding 1 pixel at a time to each
+ // component that's flexible (percentHeight defined and hasn't
+ // reached maxHeight yet). We could use another approach where
+ // we add more than a pixel at a time, but we'd have to first
+ // calculate exactly how many flexible components we have first
+ // and see how much space we can add to them without hitting
+ // their maxHeight. Since we're just dealing with rounding
+ // issues, we should only make one pass here (if we hit maxHeight
+ // problems, we might make more than one, but not many more).
+
+ // We just distribute from the top-down and don't care about
+ // who was "rounded down the most"
+
+ // First check if we should distribute any extra space. To do
+ // this, we check to see if someone suffers from rounding error.
+ var n:int = parent.numChildren;
+ var wantToGrow:Boolean = false;
+ var i:int;
+ var percentHeight:Number;
+ var spaceToDistribute:Number = spaceForChildren;
+ var spaceUsed:Number = 0;
+ var child:IUIComponent;
+ var childHeight:Number;
+ var wantSpace:Number;
+
+ for (i = 0; i < n; i++)
+ {
+ child = IUIComponent(parent.getChildAt(i));
+
+ if (!child.includeInLayout)
+ continue;
+
+ childHeight = child.height;
+ percentHeight = child.percentHeight;
+
+ spaceUsed += childHeight;
+
+ if (!isNaN(percentHeight))
+ {
+ wantSpace = Math.ceil(percentHeight/100 * spaceForChildren);
+
+ if (wantSpace > childHeight)
+ wantToGrow = true;
+ }
+ }
+
+ // No need to distribute extra size
+ if (!wantToGrow)
+ return;
+
+ // Start distributing...
+ spaceToDistribute -= spaceUsed;
+
+ // If we still have components that will let us
+ // distribute to them
+ var stillFlexibleComponents:Boolean = true;
+
+ while (stillFlexibleComponents && spaceToDistribute >= 1.0)
+ {
+ // Start optimistically
+ stillFlexibleComponents = false;
+
+ for (i = 0; i < n; i++)
+ {
+ child = IUIComponent(parent.getChildAt(i));
+ childHeight = child.height;
+ percentHeight = child.percentHeight
+
+ // if they have a percentHeight, and we won't reach their
+ // maxHeight by giving them one more pixel, then
+ // give them a pixel
+ if (!isNaN(percentHeight) &&
+ child.includeInLayout &&
+ childHeight < child.maxHeight)
+ {
+ wantSpace = Math.ceil(percentHeight/100 * spaceForChildren);
+
+ if (wantSpace > childHeight)
+ {
+ child.setActualSize(child.width, childHeight+1);
+ spaceToDistribute--;
+ stillFlexibleComponents = true;
+
+ if (spaceToDistribute == 0)
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This function distributes excess space among the flexible children
+ * because of rounding errors where we want to keep children's dimensions
+ * full pixel amounts. This only distributes the extra space
+ * if there was some rounding down and there are still
+ * flexible children.
+ *
+ * @param parent The parent container of the children.
+ *
+ * @param spaceForChildren The total space for all children
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static function distributeExtraWidth(
+ parent:IChildList,
+ spaceForChildren:Number):void
+ {
+ // We should only get here after distributing the majority of the
+ // space already. This is done in flexChildWidthsProportionally.
+ // Strategy here is to keep adding 1 pixel at a time to each
+ // component that's flexible (percentWidth defined and hasn't
+ // reached maxWidth yet). We could use another approach where
+ // we add more than a pixel at a time, but we'd have to first
+ // calculate exactly how many flexible components we have first
+ // and see how much space we can add to them without hitting
+ // their maxWidth. Since we're just dealing with rounding
+ // issues, we should only make one pass here (if we hit maxWidth
+ // problems, we might make more than one, but not many more).
+
+ // We just distribute from the top-down and don't care about
+ // who was "rounded down the most"
+
+ // First check if we should distribute any extra space. To do
+ // this, we check to see if someone suffers from rounding error.
+ var n:int = parent.numChildren;
+ var wantToGrow:Boolean = false;
+ var i:int;
+ var percentWidth:Number;
+ var spaceToDistribute:Number = spaceForChildren;
+ var spaceUsed:Number = 0;
+ var child:IUIComponent;
+ var childWidth:Number;
+ var wantSpace:Number;
+
+ for (i = 0; i < n; i++)
+ {
+ child = IUIComponent(parent.getChildAt(i));
+
+ if (!child.includeInLayout)
+ continue;
+
+ childWidth = child.width;
+ percentWidth = child.percentWidth;
+
+ spaceUsed += childWidth;
+
+ if (!isNaN(percentWidth))
+ {
+ wantSpace = Math.ceil(percentWidth/100 * spaceForChildren);
+
+ if (wantSpace > childWidth)
+ wantToGrow = true;
+ }
+ }
+
+ // No need to distribute extra size
+ if (!wantToGrow)
+ return;
+
+ // Start distributing...
+ spaceToDistribute -= spaceUsed;
+
+ // If we still have components that will let us
+ // distribute to them
+ var stillFlexibleComponents:Boolean = true;
+
+ while (stillFlexibleComponents && spaceToDistribute >= 1.0)
+ {
+ // Start optimistically
+ stillFlexibleComponents = false;
+
+ for (i = 0; i < n; i++)
+ {
+ child = IUIComponent(parent.getChildAt(i));
+ childWidth = child.width;
+ percentWidth = child.percentWidth
+
+ // if they have a percentWidth, and we won't reach their
+ // maxWidth by giving them one more pixel, then
+ // give them a pixel
+ if (!isNaN(percentWidth) &&
+ child.includeInLayout &&
+ childWidth < child.maxWidth)
+ {
+ wantSpace = Math.ceil(percentWidth / 100 * spaceForChildren);
+
+ if (wantSpace > childWidth)
+ {
+ child.setActualSize(childWidth +1, child.height);
+ spaceToDistribute--;
+ stillFlexibleComponents = true;
+
+ if (spaceToDistribute == 0)
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/FlexChildInfo.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/FlexChildInfo.as b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/FlexChildInfo.as
new file mode 100644
index 0000000..e910e03
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/FlexChildInfo.as
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.containers.utilityClasses
+{
+
+import mx.core.IUIComponent;
+
+[ExcludeClass]
+
+/**
+ * @private
+ * Helper class for the Flex.flexChildrenProportionally() method.
+ */
+public class FlexChildInfo
+{
+ include "../../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function FlexChildInfo()
+ {
+ super();
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // child
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var child:IUIComponent;
+
+ //----------------------------------
+ // size
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var size:Number = 0;
+
+ //----------------------------------
+ // preferred
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var preferred:Number = 0;
+
+ //----------------------------------
+ // flex
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var flex:Number = 0;
+
+ //----------------------------------
+ // percent
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var percent:Number;
+
+ //----------------------------------
+ // min
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var min:Number;
+
+ //----------------------------------
+ // max
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var max:Number;
+
+ //----------------------------------
+ // width
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var width:Number;
+
+ //----------------------------------
+ // height
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public var height:Number;
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/IConstraintLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/IConstraintLayout.as b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/IConstraintLayout.as
new file mode 100644
index 0000000..9fcb43b
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/containers/utilityClasses/IConstraintLayout.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers.utilityClasses
+{
+
+/**
+ * IConstraintLayout is a marker interface that indicates that a container
+ * supports ConstraintColumn class and ConstraintRow class within its layout.
+ * Application, Canvas, and Panel containers support ConstraintRow and
+ * ConstraintColumn classes.
+ * To utilize this type of constraint in these containers,
+ * set the <code>layout</code> property to <code>"absolute"</code>
+ * and create ConstraintColumn and ConstraintRow instances.
+ *
+ * @see mx.containers.Canvas
+ * @see mx.containers.Panel
+ * @see mx.core.Application
+ * @see mx.containers.utilityClasses.ConstraintColumn
+ * @see mx.containers.utilityClasses.ConstraintRow
+ * @see mx.modules.Module
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public interface IConstraintLayout
+{
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // constraintColumns
+ //----------------------------------
+
+ /**
+ * An Array of ConstraintColumn instances that partition this container.
+ * The ConstraintColumn instance at index 0 is the left-most column;
+ * indices increase from left to right.
+ *
+ * @default []
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get constraintColumns():Array /* of ConstraintColumn */;
+
+ /**
+ * @private
+ */
+ function set constraintColumns(value:Array /* of ConstraintColumn */):void;
+
+ //----------------------------------
+ // constraintRows
+ //----------------------------------
+
+ /**
+ * An Array of ConstraintRow instances that partition this container.
+ * The ConstraintRow instance at index 0 is the top-most row;
+ * indices increase from top to bottom.
+ *
+ * @default []
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get constraintRows():Array /* of ConstraintRow */;
+
+ /**
+ * @private
+ */
+ function set constraintRows(value:Array /* of ConstraintRow */):void;
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/BaseListData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/BaseListData.as b/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/BaseListData.as
new file mode 100644
index 0000000..cdb1651
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/BaseListData.as
@@ -0,0 +1,233 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.controls.listClasses
+{
+
+import flash.events.EventDispatcher;
+
+import mx.core.IUIComponent;
+import mx.core.IUID;
+
+/**
+ * The BaseListData class defines the data type of the <code>listData</code>
+ * property implemented by drop-in item renderers or drop-in item editors.
+ * All drop-in item renderers and drop-in item editors must implement the
+ * IDropInListItemRenderer interface, which defines the <code>listData</code>
+ * property.
+ *
+ * <p>The <code>listData</code> property is of type BaseListData,
+ * where the BaseListData class has three subclasses:
+ * DataGridListData, ListData, and TreeListData.
+ * The actual data type of the value of the <code>listData</code> property
+ * depends on the control using the drop-in item renderer or item editor.
+ * For a DataGrid control, the value is of type DataGridListData,
+ * for a List control the value is of type ListData,
+ * and for a Tree control, the value is of type TreeListData.</p>
+ *
+ * <p>When used as a drop-in item renderer or drop-in item editor,
+ * Flex sets the <code>listData</code> property to a BaseListData-derived
+ * class containing information computed about the item in the data provider
+ * containing the data for the item.</p>
+ *
+ * <p>While the properties of this class are writable,
+ * you should consider them to be read only.
+ * They are initialized by the list class,
+ * and read by an item renderer or item editor.
+ * Changing these values can lead to unexpected results.</p>
+ *
+ * <p>The properties are marked bindable, but these properties
+ * do not actually do any change detection or send change events.
+ * The properties are changed as a whole by setting a new
+ * value for the <code>listData</code> property.
+ * The <code>change</code> event for the modification of
+ * the <code>listData</code> property updates all bindings.</p>
+ *
+ * @see mx.controls.listClasses.IDropInListItemRenderer
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+
+public class BaseListData extends EventDispatcher
+{
+
+ include "../../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param label The textual representation of the item data.
+ *
+ * @param uid A unique identifier.
+ *
+ * @param owner A reference to the list control.
+ *
+ * @param rowIndex The index of the row in the currently visible rows of the control.
+ *
+ * @param columnIndex The index of the column in the currently visible columns of the
+ * control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function BaseListData(label:String, uid:String,
+ owner:IUIComponent, rowIndex:int = 0,
+ columnIndex:int = 0)
+ {
+ super();
+
+ this.label = label;
+ this.uid = uid;
+ this.owner = owner;
+ this.rowIndex = rowIndex;
+ this.columnIndex = columnIndex;
+ }
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // columnIndex
+ //----------------------------------
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * The index of the column of the List-based control relative
+ * to the currently visible columns of the control, where the first column
+ * is at an index of 1.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var columnIndex:int;
+
+ //----------------------------------
+ // label
+ //----------------------------------
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * The textual representation of the item data, based on the list class's
+ * <code>itemToLabel()</code> method.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var label:String;
+
+ //----------------------------------
+ // owner
+ //----------------------------------
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * A reference to the list object that owns this item.
+ * This should be a ListBase-derived class.
+ * This property is typed as IUIComponent so that drop-ins
+ * like Label and TextInput don't have to have dependencies
+ * on List and all of its dependencies.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var owner:IUIComponent;
+
+ //----------------------------------
+ // rowIndex
+ //----------------------------------
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * The index of the row of the DataGrid, List, or Tree control relative
+ * to the currently visible rows of the control, where the first row
+ * is at an index of 1.
+ * For example, you click on an item in the control and <code>rowIndex</code>
+ * is set to 3.
+ * You then scroll the control to change the row's position in the visible rows
+ * of the control, and then click on the same row as before.
+ * The <code>rowIndex</code> now contains a different value corresponding to
+ * the new index of the row in the currently visible rows.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var rowIndex:int;
+
+ //----------------------------------
+ // uid
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the uid property.
+ */
+ private var _uid:String;
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * The unique identifier for this item.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get uid():String
+ {
+ return _uid;
+ }
+
+ /**
+ * @private
+ */
+ public function set uid(value:String):void
+ {
+ _uid = value;
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IDropInListItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IDropInListItemRenderer.as b/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IDropInListItemRenderer.as
new file mode 100644
index 0000000..97ce464
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IDropInListItemRenderer.as
@@ -0,0 +1,163 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.controls.listClasses
+{
+
+/**
+ * The interface for "drop-in" item renderers. Most IListItemRenderers
+ * are not "drop-ins". They are expecting to use a particular field of
+ * the data provider item. For example, they may assign the "lastName"
+ * property of the item to a Label's <code>text</code> property. This
+ * is easy to write using data-binding, but has the negative
+ * consequence that the renderer cannot be re-used in another column
+ * of a DataGrid or another List with different fields.
+ * IDropInListItemRenderer allows a renderer to be re-used. The list
+ * classes will pass more information to the renderer so that it
+ * can determine which field to use at run-time.
+ *
+ * <p>Components that you want to use as drop-in item renderers or drop-in
+ * item editors must implement the IDropInListItemRenderer interface.
+ * Many Flex component implement this interface, and therefore are usable
+ * as drop-in item renderers and drop-in item editors in any column or
+ * list.</p>
+ *
+ * <p>Drop-in item renderers or drop-in item editors also must implement
+ * the IDataRenderer interface to define the <code>data</code> property.</p>
+ *
+ * <p>When a component is used as a drop-in item renderer or drop-in
+ * item editor, Flex initializes the <code>listData</code> property
+ * of the component with the appropriate data from the list control.
+ * The component can then use the <code>listData</code> property
+ * to initialize the <code>data</code> property of the drop-in
+ * item renderer or drop-in item editor.</p>
+ *
+ * <p>The <code>listData</code> property is of type BaseListData,
+ * where the BaseListData class has four subclasses:
+ * DataGridListData, ListData, TreeListData, and MenuListData.
+ * The actual data type of the value of the <code>listData</code> property
+ * depends on the control using the drop-in item renderer or item editor.
+ * For a DataGrid control, the value is of type DataGridListData,
+ * for a List control the value is of type ListData,
+ * for a Tree control, the value is of type TreeListData,
+ * and for a Menu control, the value is of type MenuListData..</p>
+ *
+ * <p>The following example shows the setter method for the
+ * <code>data</code> property for the NumericStepper control
+ * that initializes NumericStepper's <code>value</code> property
+ * based on the value of the <code>listData</code> property:</p>
+ *
+ * <pre>
+ * public function set data(value:Object):void
+ * {
+ * _data = value;
+ *
+ * this.value = _listData ? parseFloat(_listData.label) : Number(_data);
+ *
+ * dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
+ * }
+ * </pre>
+ *
+ * <p>In the example above, the NumericStepper control ignores the
+ * <code>data</code> property when setting NumericStepper's
+ * <code>value</code> property, and uses the <code>listData</code>
+ * property instead.</p>
+ *
+ * <p>To implement the IDropInListItemRenderer interface,
+ * you define a setter and getter method to implement
+ * the <code>listData</code> property.
+ * Typically, the setter method writes the value of the
+ * <code>listData</code> property to an internal variable.
+ * The list class always assigns this property then sets
+ * the data provider item in the <code>data</code> property.</p>
+ *
+ * <p>Notice that the setter method for the <code>listData</code> property
+ * does not dispatch an event.
+ * This is because the list classes always set <code>listData</code>,
+ * then set the <code>data</code> property.
+ * Setting the <code>data</code> property also dispatches the <code>dataChange</code> event.
+ * You never set <code>listData</code> on its own,
+ * so it does not need to dispatch its own event. </p>
+ *
+ * <p>The <code>data</code> setter method could call the <code>invalidateProperties()</code> method
+ * if it did something that required the control to update itself.
+ * It would then be up to the component developer to write a <code>commitProperties()</code> method
+ * to determine that <code>listData</code> was modified, and handle it accordingly. </p>
+ *
+ * <p>The getter method returns the current value
+ * of the internal variable, as the following example shows:</p>
+ *
+ * <pre>
+ * // Internal variable for the property value.
+ * private var _listData:BaseListData;
+ *
+ * // Make the listData property bindable.
+ * [Bindable("dataChange")]
+ *
+ * // Define the getter method.
+ * public function get listData():BaseListData
+ * {
+ * return _listData;
+ * }
+ *
+ * // Define the setter method,
+ * public function set listData(value:BaseListData):void
+ * {
+ * _listData = value;
+ * }
+ * </pre>
+ *
+ * @see mx.controls.listClasses.BaseListData
+ * @see mx.core.IDataRenderer
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public interface IDropInListItemRenderer
+{
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // listData
+ //----------------------------------
+
+ /**
+ * Implements the <code>listData</code> property
+ * using setter and getter methods.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get listData():BaseListData;
+
+ /**
+ * @private
+ */
+ function set listData(value:BaseListData):void;
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IListItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IListItemRenderer.as b/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IListItemRenderer.as
new file mode 100644
index 0000000..86d2b92
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/controls/listClasses/IListItemRenderer.as
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.controls.listClasses
+{
+
+import flash.events.IEventDispatcher;
+import mx.core.IDataRenderer;
+import mx.core.IFlexDisplayObject;
+import mx.core.IUIComponent;
+import mx.managers.ILayoutManagerClient;
+import mx.styles.ISimpleStyleClient;
+
+/**
+ * Item renderers and item editors for list components must implement
+ * the IListItemRenderer interface.
+ * The IListItemRenderer interface is a set of several other interfaces.
+ * It does not define any new class methods or properties.
+ *
+ * <p>The set of interfaces includes the following:
+ * IDataRenderer, IFlexDisplayObject, ILayoutManagerClient,
+ * ISimpleStyleClient, IUIComponent.
+ * The UIComponent class implements all of these interfaces,
+ * except the IDataRenderer interface.
+ * Therefore, if you create a custom item renderer or item editor
+ * as a subclass of the UIComponent class, you only have to implement
+ * the IDataRenderer interface and then you can add to the class
+ * definition that the class implements IDataRenderer and IListItemRenderer.</p>
+ *
+ * <p>IListItemRenderers are generally dedicated to displaying a particular
+ * field from the data provider item and cannot be re-used in other
+ * DataGrid columns or in other lists with different fields. If you want
+ * to create a renderer that can be re-used you can also implement
+ * IDropInListItemRenderer, and the list will pass more data to
+ * the renderer that allows the renderer to be re-used with different
+ * data fields.</p>
+ *
+ * <p>Item renderers and item editors are passed data from a list class'
+ * data provider using the IDataRenderer interface.
+ * Renderers and editors that implement the IDropInListItemRenderer
+ * interface get other information from the list class.
+ * The item renderer or item editor uses one or both pieces of information
+ * to display the data.</p>
+ *
+ * <p>The renderers and editors are often recycled.
+ * Once they are created, they may be used again simply by being given
+ * a new data and optional <code>listData</code> property.
+ * Therefore in your implementation you must make sure that component
+ * properties are not assumed to contain their initial, or default values.</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public interface IListItemRenderer extends IDataRenderer, IEventDispatcher,
+ IFlexDisplayObject,
+ ILayoutManagerClient,
+ ISimpleStyleClient, IUIComponent
+{
+}
+
+}