flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject [1/2] git commit: [flex-asjs] [refs/heads/develop] - Accordion added.
Date Tue, 15 Nov 2016 08:24:34 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop c9d3c3de0 -> 9834f8e3c


Accordion added.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/52a2147a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/52a2147a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/52a2147a

Branch: refs/heads/develop
Commit: 52a2147a7db66442355bb24f3d2c0ddb1bccd3f9
Parents: 4d6fa02
Author: yishayw <yishayjobs@hotmail.com>
Authored: Tue Nov 15 10:23:07 2016 +0200
Committer: yishayw <yishayjobs@hotmail.com>
Committed: Tue Nov 15 10:23:07 2016 +0200

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/html/Accordion.as |  79 ++++++++++++
 .../flex/html/beads/AccordionCollapseBead.as    |  50 +++++++
 .../org/apache/flex/html/beads/AccordionView.as |  47 +++++++
 .../flex/html/beads/IAccordionCollapseBead.as   |  27 ++++
 .../AccordionItemRendererMouseController.as     |  43 +++++++
 .../beads/layouts/IOneFlexibleChildLayout.as    |  38 ++++++
 .../layouts/OneFlexibleChildHorizontalLayout.as |  38 ++++--
 .../layouts/OneFlexibleChildVerticalLayout.as   |  59 +++++++--
 .../supportClasses/AccordionItemRenderer.as     | 129 +++++++++++++++++++
 .../flex/html/supportClasses/ICollapsible.as    |   8 ++
 .../HTML/src/main/resources/basic-manifest.xml  |   2 +
 .../HTML/src/main/resources/defaults.css        |  38 ++++--
 12 files changed, 522 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Accordion.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Accordion.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Accordion.as
new file mode 100644
index 0000000..20e3f96
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Accordion.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 org.apache.flex.html
+{
+	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.html.beads.IAccordionCollapseBead;
+	
+
+    /**
+     *  The Accordion class used to display a list of collapsible components
+	 *  All but the selected item are expected to be collapsed.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */    
+	public class Accordion extends List
+	{
+		private var _collapseBead:IAccordionCollapseBead;
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function Accordion()
+		{
+			super();
+			accordionCollapseBead; // make sure it's initialized
+		}
+		
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+			if (selectedIndex < 0)
+			{
+				selectedIndex = 0;
+			}
+		}
+		
+		public function get accordionCollapseBead():IAccordionCollapseBead
+		{
+			if (_collapseBead == null)
+			{
+				var c:Class = ValuesManager.valuesImpl.getValue(this, "iAccordionCollapseBead") as Class;
+				if (c)
+				{
+					if (c)
+					{
+						_collapseBead = (new c()) as IAccordionCollapseBead;
+						addBead(_collapseBead);
+					}
+				}
+			}
+			return _collapseBead;
+		}
+
+				
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
new file mode 100644
index 0000000..07ec267
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
@@ -0,0 +1,50 @@
+package org.apache.flex.html.beads
+{
+	import org.apache.flex.core.ILayoutChild;
+	import org.apache.flex.core.ISelectionModel;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.html.Accordion;
+	import org.apache.flex.html.beads.layouts.IOneFlexibleChildLayout;
+	import org.apache.flex.html.supportClasses.ICollapsible;
+	
+	public class AccordionCollapseBead implements IAccordionCollapseBead
+	{
+		private var _strand:IStrand;
+		private var lastSelectedIndex:int = -1;
+		public function AccordionCollapseBead()
+		{
+		}
+		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			host.model.addEventListener("selectedIndexChanged", selectedIndexChangedHandler);
+		}
+		
+		private function get host():Accordion
+		{
+			return _strand as Accordion;
+		}
+		
+		protected function selectedIndexChangedHandler(event:Event):void
+		{
+			var view:IListView = host.view as IListView;
+			var newChild:UIBase = view.dataGroup.getElementAt(host.selectedIndex) as UIBase;
+			if (!newChild)
+			{
+				return;
+			}
+			var layout:IOneFlexibleChildLayout = host.getBeadByType(IOneFlexibleChildLayout) as IOneFlexibleChildLayout;
+			if (lastSelectedIndex > -1)
+			{
+				var lastElement:ICollapsible = view.dataGroup.getItemRendererForIndex(lastSelectedIndex)
as ICollapsible;
+				(lastElement as ILayoutChild).height = lastElement.collapsedHeight;
+			}
+			lastSelectedIndex = host.selectedIndex;
+			layout.flexibleChild = newChild.id;
+			layout.layout();
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionView.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionView.as
new file mode 100644
index 0000000..656ca72
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionView.as
@@ -0,0 +1,47 @@
+package org.apache.flex.html.beads
+{
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.html.beads.layouts.IOneFlexibleChildLayout;
+
+	public class AccordionView extends ListView
+	{
+		private var _layout:IOneFlexibleChildLayout;
+		public function AccordionView()
+		{
+			super();
+		}
+		
+		override protected function selectionChangeHandler(event:Event):void
+		{
+			super.selectionChangeHandler(event);
+			var renderer:UIBase = dataGroup.getItemRendererForIndex(listModel.selectedIndex) as UIBase;
+			layout.flexibleChild = renderer.id;
+		}
+		
+		public function get layout():IOneFlexibleChildLayout
+		{
+			if (!_layout)
+			{
+				_layout = _strand.getBeadByType(IOneFlexibleChildLayout) as IOneFlexibleChildLayout;
+				if (!_layout) {
+					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
+					if (c) {
+						_layout = new c() as IOneFlexibleChildLayout;
+						_strand.addBead(_layout);
+					}
+				}
+			}
+			return _layout;
+		}
+		
+		override protected function performLayout(event:Event):void
+		{
+			if (layout && layout.flexibleChild)
+			{
+				super.performLayout(event);
+			}
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/IAccordionCollapseBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/IAccordionCollapseBead.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/IAccordionCollapseBead.as
new file mode 100644
index 0000000..ff0c740
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/IAccordionCollapseBead.as
@@ -0,0 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+	import org.apache.flex.core.IBead;
+
+	public interface IAccordionCollapseBead extends IBead
+	{
+		
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/controllers/AccordionItemRendererMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/controllers/AccordionItemRendererMouseController.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/controllers/AccordionItemRendererMouseController.as
new file mode 100644
index 0000000..fc771a3
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/controllers/AccordionItemRendererMouseController.as
@@ -0,0 +1,43 @@
+package org.apache.flex.html.beads.controllers
+{
+	import org.apache.flex.core.IBeadController;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.events.ItemClickedEvent;
+	import org.apache.flex.events.MouseEvent;
+	import org.apache.flex.html.supportClasses.AccordionItemRenderer;
+	
+	public class AccordionItemRendererMouseController implements IBeadController
+	{
+		private var _strand:IStrand;
+		
+		public function AccordionItemRendererMouseController()
+		{
+		}
+		
+		private function get accordionItemRenderer():AccordionItemRenderer
+		{
+			return _strand as AccordionItemRenderer;		
+		}
+		
+		public function get strand():IStrand
+		{
+			return _strand;
+		}
+
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			accordionItemRenderer.titleBar.addEventListener(MouseEvent.CLICK, titleBarClickHandler);
+		}
+		
+		protected function titleBarClickHandler(event:MouseEvent):void
+		{
+			var newEvent:ItemClickedEvent = new ItemClickedEvent("itemClicked");
+			newEvent.data = accordionItemRenderer.data;
+			newEvent.multipleSelection = event.shiftKey;
+			newEvent.index = accordionItemRenderer.index;
+			
+			accordionItemRenderer.dispatchEvent(newEvent);
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/IOneFlexibleChildLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/IOneFlexibleChildLayout.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/IOneFlexibleChildLayout.as
new file mode 100644
index 0000000..0cfe527
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/IOneFlexibleChildLayout.as
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core.IBeadLayout;
+	
+	/**
+	 * IOneFlexibleChildLayout will flex one of the children to take up
+	 * the space remaining in a container after the rest of the elements
+	 * have been laid out according to CSS layout rules.  
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public interface IOneFlexibleChildLayout extends IBeadLayout
+	{
+		function get flexibleChild():String;
+		function set flexibleChild(value:String):void;
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
index aedc3dc..ff09b9c 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
@@ -18,7 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads.layouts
 {
-	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IDocument;
 	import org.apache.flex.core.ILayoutChild;
 	import org.apache.flex.core.ILayoutHost;
@@ -26,13 +25,11 @@ package org.apache.flex.html.beads.layouts
 	import org.apache.flex.core.IParentIUIBase;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
-	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
-	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.geom.Rectangle;
+	import org.apache.flex.utils.CSSContainerUtils;
 	import org.apache.flex.utils.CSSUtils;
-    import org.apache.flex.utils.CSSContainerUtils;
 
     /**
      *  The OneFlexibleChildHorizontalLayout class is a simple layout
@@ -47,7 +44,7 @@ package org.apache.flex.html.beads.layouts
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-	public class OneFlexibleChildHorizontalLayout implements IBeadLayout, IDocument
+	public class OneFlexibleChildHorizontalLayout implements IOneFlexibleChildLayout, IDocument
 	{
         /**
          *  Constructor.
@@ -62,15 +59,7 @@ package org.apache.flex.html.beads.layouts
 		}
 		
         
-        /**
-         *  The id of the flexible child
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public var flexibleChild:String;
+        private var _flexibleChild:String;
         
         private var actualChild:ILayoutChild;
         
@@ -85,6 +74,27 @@ package org.apache.flex.html.beads.layouts
          */
         private var document:Object;
         
+		/**
+		 *  The id of the flexible child
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get flexibleChild():String
+		{
+			return _flexibleChild;
+		}
+
+		/**
+		 * @private
+		 */
+		public function set flexibleChild(value:String):void
+		{
+			_flexibleChild = value;
+		}
+
         /**
          *  @copy org.apache.flex.core.IBead#strand
          *  

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
index 3e964d2..2688eee 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
@@ -18,7 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads.layouts
 {
-	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IDocument;
 	import org.apache.flex.core.ILayoutChild;
 	import org.apache.flex.core.ILayoutHost;
@@ -29,9 +28,8 @@ package org.apache.flex.html.beads.layouts
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
-	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.geom.Rectangle;
-    import org.apache.flex.utils.CSSContainerUtils;
+	import org.apache.flex.utils.CSSContainerUtils;
 
     /**
      *  The OneFlexibleChildVerticalLayout class is a simple layout
@@ -46,7 +44,7 @@ package org.apache.flex.html.beads.layouts
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-	public class OneFlexibleChildVerticalLayout implements IBeadLayout, IDocument
+	public class OneFlexibleChildVerticalLayout implements IOneFlexibleChildLayout, IDocument
 	{
         /**
          *  Constructor.
@@ -61,15 +59,7 @@ package org.apache.flex.html.beads.layouts
 		}
 		
         
-        /**
-         *  The id of the flexible child
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public var flexibleChild:String;
+        private var _flexibleChild:String;
         
         private var actualChild:ILayoutChild;
         
@@ -84,6 +74,27 @@ package org.apache.flex.html.beads.layouts
          */
         private var document:Object;
         
+		/**
+		 *  The id of the flexible child
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get flexibleChild():String
+		{
+			return _flexibleChild;
+		}
+
+		/**
+		 * @private
+		 */
+		public function set flexibleChild(value:String):void
+		{
+			_flexibleChild = value;
+		}
+
         /**
          *  @copy org.apache.flex.core.IBead#strand
          *  
@@ -143,6 +154,20 @@ package org.apache.flex.html.beads.layouts
             _maxHeight = value;
         }
         
+		// TODO get rid of this
+		private function getActualChildById(contentView:IParentIUIBase, id:String):ILayoutChild
+		{
+			var result:ILayoutChild;
+			for (var i:int = 0; i < contentView.numElements; i++)
+			{
+				var child:UIBase = contentView.getElementAt(i) as UIBase;
+				if (child.id == id)
+				{
+					return child;
+				}
+			}
+			return null;
+		}
         /**
          * @copy org.apache.flex.core.IBeadLayout#layout
          */
@@ -151,7 +176,13 @@ package org.apache.flex.html.beads.layouts
             var layoutParent:ILayoutHost = (host as ILayoutParent).getLayoutHost();
             var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
             var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
-			actualChild = document[flexibleChild];
+			if (document && document.hasOwnProperty(flexibleChild))
+			{
+				actualChild = document[flexibleChild];
+			} else
+			{
+				actualChild = getActualChildById(contentView, flexibleChild);
+			}
             
             var ilc:ILayoutChild;
 			var n:int = contentView.numElements;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/AccordionItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/AccordionItemRenderer.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/AccordionItemRenderer.as
new file mode 100644
index 0000000..dab8efb
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/AccordionItemRenderer.as
@@ -0,0 +1,129 @@
+package org.apache.flex.html.supportClasses
+{
+	import org.apache.flex.core.IChild;
+	import org.apache.flex.core.ISelectableItemRenderer;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.ITitleBarModel;
+	import org.apache.flex.html.Panel;
+	import org.apache.flex.html.TitleBar;
+	import org.apache.flex.html.beads.PanelView;
+	
+	public class AccordionItemRenderer extends Panel implements ISelectableItemRenderer, ICollapsible
+	{
+		private var _index:int;
+		private var _selected:Boolean;
+		
+		public function AccordionItemRenderer()
+		{
+			super();
+			percentWidth = 100;
+			addBead(new ClippingViewport());
+		}
+		
+		public function get selected():Boolean
+		{
+			return _selected;
+		}
+
+		public function set selected(value:Boolean):void
+		{
+			_selected = value;
+		}
+
+		public function get index():int
+		{
+			return _index;
+		}
+
+		public function set index(value:int):void
+		{
+			_index = value;
+			id = "item" + index;
+		}
+
+		public function get labelField():String
+		{
+			return null;
+		}
+		
+		public function set labelField(value:String):void
+		{
+		}
+				
+		public function get hovered():Boolean
+		{
+			return false;
+		}
+		
+		public function set hovered(value:Boolean):void
+		{
+		}
+		
+		public function get down():Boolean
+		{
+			return false;
+		}
+		
+		public function set down(value:Boolean):void
+		{
+		}
+		
+		public function get data():Object
+		{
+			return numElements > 0 ? getElementAt(0) : null;
+		}
+		
+		public function set data(value:Object):void
+		{
+			while (numElements > 0)
+			{
+				removeElement(getElementAt(0));
+			}
+			addElement(value as IChild);
+			var dataAsStrand:IStrand = value as IStrand;
+			if (dataAsStrand)
+			{
+				var dataTitleModel:ITitleBarModel = dataAsStrand.getBeadByType(ITitleBarModel) as ITitleBarModel;
+				if (dataTitleModel)
+				{
+					titleBar.model = dataTitleModel;
+				}
+			}
+		}
+		
+		public function get listData():Object
+		{
+			return null;
+		}
+		
+		public function set listData(value:Object):void
+		{
+		}
+		
+		public function get itemRendererParent():Object
+		{
+			return null;
+		}
+		
+		public function set itemRendererParent(value:Object):void
+		{
+		}
+		
+		public function get titleBar():TitleBar
+		{
+			return (getBeadByType(PanelView) as PanelView).titleBar;
+		}
+		
+		public function get collapsedHeight():Number
+		{
+			return titleBar ? titleBar.height : NaN;
+		}
+		
+		public function get collapsedWidth():Number
+		{
+			// TODO Auto Generated method stub
+			return 0;
+		}
+		
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ICollapsible.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ICollapsible.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ICollapsible.as
new file mode 100644
index 0000000..b53d112
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ICollapsible.as
@@ -0,0 +1,8 @@
+package org.apache.flex.html.supportClasses
+{
+	public interface ICollapsible
+	{
+		function get collapsedHeight():Number;
+		function get collapsedWidth():Number;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
index 7919e14..6efa895 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -43,6 +43,7 @@
     <component id="RadioButton" class="org.apache.flex.html.RadioButton"/>
     <component id="ComboBox" class="org.apache.flex.html.ComboBox"/>
     <component id="Container" class="org.apache.flex.html.Container"/>
+    <component id="Accordion" class="org.apache.flex.html.Accordion"/>
     <component id="Form" class="org.apache.flex.html.Form"/>
     <component id="HContainer" class="org.apache.flex.html.HContainer"/>
     <component id="VContainer" class="org.apache.flex.html.VContainer"/>
@@ -70,6 +71,7 @@
     <component id="Slider" class="org.apache.flex.html.Slider"/>
     <component id="NumericStepper" class="org.apache.flex.html.NumericStepper" />
     <component id="StringItemRenderer" class="org.apache.flex.html.supportClasses.StringItemRenderer"/>
+    <component id="AccordionItemRenderer" class="org.apache.flex.html.supportClasses.AccordionItemRenderer"/>
     <component id="TreeItemRenderer" class="org.apache.flex.html.supportClasses.TreeItemRenderer"/>
     <component id="DataItemRenderer" class="org.apache.flex.html.supportClasses.DataItemRenderer"/>
     <component id="MXMLItemRenderer" class="org.apache.flex.html.supportClasses.MXMLItemRenderer"/>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/52a2147a/frameworks/projects/HTML/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/defaults.css b/frameworks/projects/HTML/src/main/resources/defaults.css
index 6c20cc0..1a40bac 100644
--- a/frameworks/projects/HTML/src/main/resources/defaults.css
+++ b/frameworks/projects/HTML/src/main/resources/defaults.css
@@ -226,20 +226,37 @@ VContainer
 
 List
 {
-    IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
-    IBeadView:  ClassReference("org.apache.flex.html.beads.ListView");			
-    IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
-    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
-    IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
-    IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
-    IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
-    IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+	IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+	IBeadView:  ClassReference("org.apache.flex.html.beads.ListView");			
+	IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+	IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+	IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
+	IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+	IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
 	IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
 	IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
 	border-style: solid;
 	border-color: #222222;
 }
 
+Accordion
+{
+	IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+	IBeadView:  ClassReference("org.apache.flex.html.beads.AccordionView");			
+	IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout");
+	IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+	IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
+	IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+	IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.AccordionItemRenderer");
+	IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
+	IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+	IAccordionCollapseBead: ClassReference("org.apache.flex.html.beads.AccordionCollapseBead");
+	border-style: solid;
+	border-color: #222222;
+}
+
 Tree
 {
 	IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
@@ -317,6 +334,11 @@ StringItemRenderer
     height: 16;
 }
 
+AccordionItemRenderer
+{
+	IBeadController: ClassReference("org.apache.flex.html.beads.controllers.AccordionItemRendererMouseController");
+}
+
 TreeItemRenderer
 {
 	IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");


Mime
View raw message