<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>fbair/util/display/layout/FlowBoxLayout.as</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -64,7 +64,7 @@
     import mx.events.ScrollEvent;
     import mx.utils.ObjectUtil;
 
-    private static const PollingDelay:int = 10000;
+    private static const PollingDelay:int = 30000;
     private static const MinAnimationDelay:int = 500;
     private static const PageScrollSize:int = 512;
     private static const MouseWheelSize:int = 16;</diff>
      <filename>fbair/nile/NileContainer.mxml</filename>
    </modified>
    <modified>
      <diff>@@ -1,238 +1,19 @@
 package fbair.util.display {
+
   import mx.containers.Box;
-  import mx.collections.ArrayCollection;
-  import mx.containers.BoxDirection;
-  import flash.display.DisplayObject;
-  import mx.controls.Alert;
-  import flash.events.Event;
-  import mx.events.ResizeEvent;
-  import mx.core.IUIComponent;
+  import mx.core.mx_internal;
 
-  // The default property assigned to when
-  //   this component is used in mxml
-  [DefaultProperty(&quot;children&quot;)]
+  import fbair.util.display.layout.FlowBoxLayout;
 
-  public class FlowBox extends Box {
+  use namespace mx_internal;
 
-    private var _children:ArrayCollection = new ArrayCollection();
-    private var _childrenChanged:Boolean = false;
+  public class FlowBox extends Box {
 
     public function FlowBox() {
-      this.addEventListener(ResizeEvent.RESIZE, resizeHandler);
-    }
-
-    // If this component is resized, the child
-    //   components must be laid out again
-    private function resizeHandler(event:Event):void {
-      //invalidateSize();
-      //validateNow();
-      relayoutChildren();
-    }
-
-    // Layout all child components (if we need to) during
-    //   the commit properties phase of execution
-    protected override function commitProperties():void {
-      super.commitProperties();
-
-      if (_childrenChanged) {
-        _childrenChanged = false;
-        layoutChildren();
-      }
-    }
-
-    // Detect if any styles have been set which would
-    //   require the child components to be laid out again
-    override public function setStyle(styleProp:String, newValue:*):void {
-      super.setStyle(styleProp, newValue);
-
-      if (this.initialized &amp;&amp;
-          (styleProp == &quot;horizontalAlign&quot;
-          || styleProp == &quot;verticalAlign&quot;
-          || styleProp == &quot;horizontalGap&quot;
-          || styleProp == &quot;verticalGap&quot;
-          || styleProp == &quot;paddingLeft&quot;
-          || styleProp == &quot;paddingTop&quot;
-          || styleProp == &quot;paddingRight&quot;
-          || styleProp == &quot;paddingBottom&quot;))
-        relayoutChildren();
-    }
-
-    // Add all child components to ourself, creating
-    //   sub containers as required for the layout
-    private function layoutChildren():void {
-      clearContentsForRelayout();
-
-      var currentSubContainer:Box = createSubContainer();
-      super.addChildAt(currentSubContainer, super.numChildren);
-
-      for each (var child:DisplayObject in _children) {
-        if (!canFit(child, currentSubContainer)) {
-          currentSubContainer = createSubContainer();
-          super.addChildAt(currentSubContainer, super.numChildren);
-        }
-        currentSubContainer.addChild(child);
-      }
-    }
-
-    // Create a sub container (row or column) for
-    //   this component will the required configuration
-    private function createSubContainer():Box {
-      var subContainer:Box = new Box();
-      subContainer.direction = this.direction;
-
-      if (this.direction == BoxDirection.HORIZONTAL) {
-        subContainer.width = super.width - super.getStyle(&quot;paddingLeft&quot;)
-                             - super.getStyle(&quot;paddingRight&quot;);
-      } else {
-        subContainer.height = super.height - super.getStyle(&quot;paddingTop&quot;)
-                              - super.getStyle(&quot;paddingBottom&quot;);
-      }
-
-      subContainer.setStyle(&quot;paddingLeft&quot;, 0);
-      subContainer.setStyle(&quot;paddingTop&quot;, 0);
-      subContainer.setStyle(&quot;paddingBottom&quot;, 0);
-      subContainer.setStyle(&quot;paddingRight&quot;, 0);
-
-      subContainer.setStyle(&quot;horizontalAlign&quot;,
-                            this.getStyle(&quot;horizontalAlign&quot;));
-      subContainer.setStyle(&quot;verticalAlign&quot;,
-                            this.getStyle(&quot;verticalAlign&quot;));
-      subContainer.setStyle(&quot;horizontalGap&quot;, this.getStyle(&quot;horizontalGap&quot;));
-      subContainer.setStyle(&quot;verticalGap&quot;, this.getStyle(&quot;verticalGap&quot;));
-
-      subContainer.setStyle(&quot;backgroundAlpha&quot;, 0);
-
-      return subContainer;
-    }
-
-    // Removes all internal layout containers from this
-    //   container so that the children can be re-laid out
-    private function clearContentsForRelayout():void {
-      var kids:Array = super.getChildren();
-      for each (var child:DisplayObject in kids)
-        super.removeChild(child);
-    }
-
-    // Tests whether the specified component could fit within
-    //   the specfied container without any clipping or scrollbars
-    private function canFit(child:DisplayObject, parent:Box):Boolean {
-      var gap:Number;
-      var padding:Number;
-      var criticalDimension:String;
-
-      if (parent.direction == BoxDirection.HORIZONTAL) {
-        gap = parent.getStyle(&quot;horizontalGap&quot;);
-        padding = parent.getStyle(&quot;paddingLeft&quot;) +
-                  parent.getStyle(&quot;paddingRight&quot;);
-        criticalDimension = &quot;width&quot;;
-      } else {
-        gap = parent.getStyle(&quot;verticalGap&quot;);
-        padding = parent.getStyle(&quot;paddingTop&quot;) +
-                  parent.getStyle(&quot;paddingBottom&quot;);
-        criticalDimension = &quot;height&quot;;
-      }
-
-      var usedSpace:Number = padding;
-      var seperator:Number = 0;
-      var kids:Array = parent.getChildren();
-      for each (var existingChild:DisplayObject in kids) {
-        usedSpace += seperator + existingChild[criticalDimension];
-        seperator = gap;
-      }
-
-      var requiredSpace:Number = usedSpace + gap + child[criticalDimension];
-      return requiredSpace &lt; parent[criticalDimension];
-    }
-
-    // Flag that the children of this control have changed,
-    //   and should be redrawn at the next convenient time
-    public function relayoutChildren(event:Event = null):void {
-      _childrenChanged = true;
-      invalidateProperties();
-    }
-
-    // Need to invert the direction property of this control
-    //   so that the behaviour is logical
-    override public function set direction(value:String):void {
-      if (value == BoxDirection.HORIZONTAL)
-        super.direction = BoxDirection.VERTICAL;
-      else
-        super.direction = BoxDirection.HORIZONTAL;
-
-      relayoutChildren();
-    }
-
-    override public function get direction():String {
-      if (super.direction == BoxDirection.HORIZONTAL)
-        return BoxDirection.VERTICAL;
-      else
-        return BoxDirection.HORIZONTAL;
-    }
-
-    /**
-     * Override all of the child manipulation functions to mask
-     * the internal child layout functions of this container
-     */
-    public override function addChild(child:DisplayObject):DisplayObject {
-      _children.addItem(child);
-      relayoutChildren();
-      child.addEventListener(ResizeEvent.RESIZE, relayoutChildren);
-      return child;
-    }
-
-    override public function addChildAt(child:DisplayObject, index:int):DisplayObject {
-      _children.addItemAt(child, index);
-      relayoutChildren();
-      child.addEventListener(ResizeEvent.RESIZE, relayoutChildren);
-      return child;
-    }
-
-    override public function removeChild(child:DisplayObject):DisplayObject {
-      var tmp:DisplayObject = _children.removeItemAt(
-        _children.getItemIndex(child)) as DisplayObject;
-      tmp.removeEventListener(ResizeEvent.RESIZE, relayoutChildren);
-      relayoutChildren();
-      return tmp;
-    }
-
-    override public function removeChildAt(index:int):DisplayObject {
-      var tmp:DisplayObject = _children.removeItemAt(index) as DisplayObject;
-      tmp.removeEventListener(ResizeEvent.RESIZE, relayoutChildren);
-      relayoutChildren();
-      return tmp;
-    }
-
-    override public function removeAllChildren():void {
-      for each (var child:DisplayObject in _children)
-        child.removeEventListener(ResizeEvent.RESIZE, relayoutChildren);
-      _children.removeAll();
-      relayoutChildren();
-    }
-
-    override public function getChildren():Array {
-      return _children.toArray();
-    }
-
-    override public function getChildIndex(child:DisplayObject):int {
-      return _children.getItemIndex(child);
-    }
-
-    // This property recieves the child components
-    //   of this container when they are set in MXML
-    //   This is set as the default property of this component
-    public function set children(value:*):void {
-      if (value is DisplayObject) {
-        _children = new ArrayCollection([value]);
-      } else if( value is Array ) {
-        var tmp:Array = value as Array;
-        _children = new ArrayCollection();
+      super();
 
-        for each (var child:DisplayObject in tmp) {
-          _children.addItem(child);
-          child.addEventListener(ResizeEvent.RESIZE, relayoutChildren);
-        }
-      }
-      relayoutChildren();
+      mx_internal::layoutObject = new FlowBoxLayout();
+      mx_internal::layoutObject.target = this;
     }
   }
 }</diff>
      <filename>fbair/util/display/FlowBox.as</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>90e567898eac3245a946b5a3f0bec192c21fe47e</id>
    </parent>
  </parents>
  <author>
    <name>Lee Byron</name>
    <email>leebyron@lbyron.local</email>
  </author>
  <url>http://github.com/jubishop/Facebook-for-Adobe-AIR/commit/44ba9ffe8670eea9e08e1eb2ff9bdd4db0c4ae0a</url>
  <id>44ba9ffe8670eea9e08e1eb2ff9bdd4db0c4ae0a</id>
  <committed-date>2009-05-28T17:59:06-07:00</committed-date>
  <authored-date>2009-05-28T17:59:06-07:00</authored-date>
  <message>flowbox rewrite solves a lot of sticky slow issues</message>
  <tree>cdd21f143fa13efc3e837599e5e0a6b33879e8f9</tree>
  <committer>
    <name>Lee Byron</name>
    <email>leebyron@lbyron.local</email>
  </committer>
</commit>
