incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ftho...@apache.org
Subject svn commit: r1422462 [2/3] - in /incubator/flex/sdk/branches/develop/frameworks/projects/experimental: ./ assets/ assets/dividers/ bundles/en_US/ src/ src/org/apache/flex/components/ src/org/apache/flex/components/sparkAlert/ src/org/apache/flex/compon...
Date Sun, 16 Dec 2012 04:39:00 GMT
Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/skin/ColorPickerSkin.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/skin/ColorPickerSkin.mxml?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/skin/ColorPickerSkin.mxml (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/skin/ColorPickerSkin.mxml Sun Dec 16 04:38:49 2012
@@ -0,0 +1,221 @@
+<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" 
+			 xmlns:fb="http://ns.adobe.com/flashbuilder/2009" xmlns:local="*" alpha.disabled=".5" minWidth="24"
+			 currentStateChange="onStateChange(event)" 
+			 xmlns:focusgroup="org.apache.flex.components.spark.components.colorpicker.*" > 
+	<!--
+	////////////////////////////////////////////////////////////////////////////////
+	//
+	//  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.
+	//
+	////////////////////////////////////////////////////////////////////////////////
+	@author Bogdan Dinu (http://www.badu.ro)
+	-->
+	<fx:Metadata>
+		<![CDATA[ 
+		[HostComponent("org.apache.flex.components.sparkColorPicker.ColorPicker")]
+		]]>
+	</fx:Metadata> 
+	<fx:Declarations>		
+		<fx:Component id="colorItemRenderer">
+			<s:ItemRenderer rollOver="onRolledOver(event)">
+				<fx:Script>
+					<![CDATA[										
+						import org.apache.flex.components.sparkColorPicker.events.ColorChangeEvent;
+						import org.apache.flex.components.sparkColorPicker.util.ColorPickerUtil;
+						
+						protected function onRolledOver(event:MouseEvent):void
+						{
+							outerDocument.previewColor.color = uint(data); 
+							outerDocument.previewTextInput.text = ColorPickerUtil.uint2hex(uint(data)); 
+							outerDocument.hostComponent.dispatchEvent(new ColorChangeEvent(ColorChangeEvent.HOVER, uint(data)));							
+						}						
+					]]>
+				</fx:Script>
+				<s:states>
+					<s:State name="normal" />
+					<s:State name="hovered" />
+					<s:State name="selected" />
+				</s:states>
+				<s:Rect width="10" height="10">
+					<s:fill>
+						<s:SolidColor color="{data}" />
+					</s:fill>
+					<s:stroke>
+						<s:SolidColorStroke color="0xFFFF00" alpha.hovered="1" alpha="0" />
+					</s:stroke>
+				</s:Rect>
+			</s:ItemRenderer>
+		</fx:Component>
+	</fx:Declarations>
+	<fx:Script fb:purpose="styling">
+		<![CDATA[
+			import spark.events.TextOperationEvent;
+			import mx.events.StateChangeEvent;
+			import mx.events.FlexEvent;
+			
+			import spark.components.ComboBox;
+			import org.apache.flex.components.sparkColorPicker.events.ColorChangeEvent;
+			import org.apache.flex.components.sparkColorPicker.util.ColorPickerUtil;
+			
+			static private const contentFill:Array = ["bgFill"];
+			
+			/**
+			 * @private
+			 */
+			override public function get contentItems():Array {return contentFill};
+			/**
+			 * @private
+			 */
+			override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+			{
+				if (getStyle("borderVisible") == false)
+				{
+					if (border)
+					{
+						border.visible = false;
+					}
+					if (background)
+					{
+						background.left = background.top = background.right = background.bottom = 0;
+					}
+					if (swatchpanel)
+					{
+						swatchpanel.left = swatchpanel.top = swatchpanel.right = swatchpanel.bottom = 0;
+					}
+				}
+				else
+				{
+					if (border)
+					{
+						border.visible = true;
+					}
+					if (background)
+					{
+						background.left = background.top = background.right = background.bottom = 1;
+					}
+					if (swatchpanel)
+					{
+						swatchpanel.left = swatchpanel.top = swatchpanel.right = swatchpanel.bottom = 1;
+					}
+				}
+				
+				if (dropShadow)
+				{
+					dropShadow.visible = getStyle("dropShadowVisible");
+				}
+				
+				openButton.setStyle("cornerRadius", getStyle("cornerRadius"));
+				
+				if (borderStroke)
+				{
+					borderStroke.color = getStyle("borderColor");
+					borderStroke.alpha = getStyle("borderAlpha");
+				}
+				super.updateDisplayList(unscaledWidth, unscaledHeight);
+			}
+						
+			private function onEnterKey(e:FlexEvent):void
+			{
+				hostComponent.selectedItem = previewColor.color; 
+				hostComponent.closeDropDown(true); 
+				hostComponent.dispatchEvent(new ColorChangeEvent(ColorChangeEvent.CHOOSE, previewColor.color));
+			}
+			
+			protected function onStateChange(event:StateChangeEvent):void
+			{
+				if (currentState == 'open') 
+				{
+					if (preview) 
+					{
+						previewColor.color = hostComponent.selectedItem as uint;
+					}
+					previewTextInput.callLater(previewTextInput.setFocus);
+					previewTextInput.text = ColorPickerUtil.uint2hex(previewColor.color);
+				}				
+			}
+			
+			protected function onPreviewTextInputChange(event:TextOperationEvent):void
+			{
+				previewColor.color = uint('0x' + previewTextInput.text);
+			}
+			
+		]]>
+	</fx:Script>
+	
+	<s:states>
+		<s:State name="normal" />
+		<s:State name="open" />
+		<s:State name="disabled" />
+	</s:states>
+	
+	<s:PopUpAnchor id="popUp"  displayPopUp.normal="false" displayPopUp.open="true" includeIn="open"
+				   left="0" right="0" top="0" bottom="0" itemDestructionPolicy="auto"
+				   popUpPosition="below" popUpWidthMatchesAnchorWidth="false">
+		
+		<s:Group id="dropDown" >
+			<s:RectangularDropShadow id="dropShadow" blurX="20" blurY="20" alpha="0.45" distance="7" 
+									 angle="90" color="#000000" left="0" top="0" right="0" bottom="0"/>
+			<s:Rect id="border" left="0" right="0" top="0" bottom="0">
+				<s:stroke>
+					<s:SolidColorStroke id="borderStroke" weight="1"/>
+				</s:stroke>
+			</s:Rect>
+			
+			<s:Rect id="background" left="1" right="1" top="1" bottom="1" >
+				<s:fill>
+					<s:SolidColor id="bgFill" color="0x1F1F1F" />
+				</s:fill>
+			</s:Rect>
+			<s:VGroup id="swatchpanel" left="0" top="0" right="0" bottom="0" >
+				<s:HGroup>
+					<s:Rect id="preview" width="50" height="20" >
+						<s:fill>
+							<s:SolidColor id="previewColor" />
+						</s:fill>
+					</s:Rect>
+					<s:TextInput id="previewTextInput" restrict="0123456789abcdefABCDEF" 
+								 change="onPreviewTextInputChange(event)"
+								 enter="onEnterKey(event)"  />
+				</s:HGroup>
+				<s:Group>
+					<s:Rect left="0" top="0" right="0" bottom="0" width="220" height="132" >
+						<s:fill>
+							<s:SolidColor color="0x0" />
+						</s:fill>
+					</s:Rect>
+					<s:DataGroup id="dataGroup" left="0" top="0" right="0" bottom="0" width="220" height="132" 
+								 itemRenderer="{colorItemRenderer}">
+						<s:layout>
+							<s:TileLayout verticalGap="0" horizontalGap="0" 
+										  requestedColumnCount="20" 
+										  requestedRowCount="12" useVirtualLayout="false"/>
+						</s:layout>
+					</s:DataGroup>                           
+				</s:Group>
+			</s:VGroup>
+		</s:Group>
+	</s:PopUpAnchor>
+	
+	<s:Button id="openButton" left="0" right="0" top="0" bottom="0" focusEnabled="false"
+			  skinClass="org.apache.flex.components.sparkColorPicker.skin.ColorPickerButtonSkin" />  	 
+	
+	<s:Rect left="2" right="2" top="2" bottom="2" width="20" height="20" radiusX="2">
+		<s:fill>
+			<s:SolidColor id="solidColor" />
+		</s:fill>
+	</s:Rect>
+	
+</s:SparkSkin>
\ No newline at end of file

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/util/ColorPickerUtil.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/util/ColorPickerUtil.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/util/ColorPickerUtil.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkColorPicker/util/ColorPickerUtil.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,133 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkColorPicker.util
+{
+	import mx.collections.ArrayList;
+	import mx.collections.IList;
+	/**
+	 *  
+	 */
+	public class ColorPickerUtil
+	{
+		
+		//--------------------------------------------------------------------------
+		//
+		//  Constructor
+		//
+		//--------------------------------------------------------------------------
+		
+		/**
+		 *  Constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public function ColorPickerUtil()
+		{
+			super();
+		}
+		
+		//--------------------------------------------------------------------------
+		//
+		//  Methods
+		//
+		//--------------------------------------------------------------------------
+		
+		/**
+		 *  @private
+		 */
+		public function getColorsList():IList /* of Number */
+		{
+			// Dynamically generate the default websafe color palette.
+			var dp:IList = new ArrayList();
+			
+			var n:Number = 0;
+			
+			var spacer:Number = 0x000000;
+			
+			var c1:Array = [ 0x000000, 0x333333, 0x666666, 0x999999,
+				0xCCCCCC, 0xFFFFFF, 0xFF0000, 0x00FF00,
+				0x0000FF, 0xFFFF00, 0x00FFFF, 0xFF00FF ];
+			
+			var ra:Array = [ "00", "00", "00", "00", "00", "00",
+				"33", "33", "33", "33", "33", "33",
+				"66", "66", "66", "66", "66", "66" ];
+			
+			var rb:Array = [ "99", "99", "99", "99", "99", "99",
+				"CC", "CC", "CC", "CC", "CC", "CC",
+				"FF", "FF", "FF", "FF", "FF", "FF" ];
+			
+			var g:Array = [ "00", "33", "66", "99", "CC", "FF",
+				"00", "33", "66", "99", "CC", "FF",
+				"00", "33", "66", "99", "CC", "FF" ];
+			
+			var b:Array = [ "00", "33", "66", "99", "CC", "FF",
+				"00", "33", "66", "99", "CC", "FF" ];
+			
+			for (var x:int = 0; x < 12; x++)
+			{
+				for (var j:int = 0; j < 20; j++)
+				{
+					var item:Number;
+					
+					if (j == 0)
+					{
+						item = c1[x];
+						
+					}
+					else if (j == 1)
+					{
+						item = spacer;
+					}
+					else
+					{
+						var r:String;
+						if (x < 6)
+							r = ra[j - 2];
+						else
+							r = rb[j - 2];
+						item = Number("0x" + r + g[j - 2] + b[x]);
+					}
+					
+					dp.addItem(item);
+					n++;
+				}
+			}
+			
+			return dp;
+		}
+		
+		public static function uint2hex(dec:uint):String 
+		{	
+			var digits:String = "0123456789ABCDEF";
+			var hex:String = '';				
+			while (dec > 0) 
+			{					
+				var next:uint = dec & 0xF;
+				dec >>= 4;
+				hex = digits.charAt(next) + hex;					
+			}				
+			if (hex.length == 0) hex = '000000';				
+			return "0x"+hex;
+			
+		}
+	}	
+}

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,222 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkDividers
+{
+	import flash.events.Event;
+	import flash.events.MouseEvent;
+
+	import mx.core.IVisualElement;
+	import mx.events.SandboxMouseEvent;
+	import mx.managers.CursorManager;
+	import mx.managers.CursorManagerPriority;
+
+	import spark.components.Group;
+
+	[Exclude(name="layout", kind="property")]
+	[DefaultProperty("children")]
+	[ResourceBundle("dividers")]
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public class DividedGroup extends Group
+	{
+		public var dividers : Array;
+
+		protected function get cursorClass():Class
+		{
+			return null;
+		}
+
+		protected var _cursorID : int = CursorManager.NO_CURSOR;
+		protected var _currentActiveDivider : Divider;
+		protected var _typicalDividerWidth : Number;
+		protected var _typicalDividerHeight : Number;
+
+		private var _isCreatingChildren : Boolean = false;
+
+		protected var _showTooltipOnDividers : Boolean = false;
+		public function get showTooltipOnDividers():Boolean
+		{
+			return _showTooltipOnDividers;
+		}
+		public function set showTooltipOnDividers(value:Boolean):void
+		{
+			_showTooltipOnDividers = value;
+		}
+
+		public function DividedGroup()
+		{
+			super();
+		}
+
+		[ArrayElementType("mx.core.IVisualElement")]
+		protected var _children : Array;
+
+		[Inspectable(category="General", type="Array")]
+		public function get children():Array
+		{
+			return _children;
+		}
+
+		public function set children(value:Array):void
+		{
+			_children = value;
+		}
+
+		protected function createNewDivider(firstChild : IVisualElement , secondChild : IVisualElement, dividerClass : Class = null):Divider
+		{
+			var result : Divider = new dividerClass();
+			result.addEventListener(MouseEvent.MOUSE_OVER , onDividerMouseOver);
+			result.addEventListener(MouseEvent.MOUSE_OUT , onDividerMouseOut);
+			result.addEventListener(MouseEvent.MOUSE_DOWN , onDividerMouseDown);
+			if (isNaN(_typicalDividerWidth))
+			{
+				_typicalDividerWidth = result.width;
+			}
+			if(isNaN(_typicalDividerHeight))
+			{
+				_typicalDividerHeight = result.height;
+			}
+			result.upOrRightNeighbour = firstChild;
+			result.downOrLeftNeighbour = secondChild;
+			dividers.push(result);
+			return result;
+		}
+
+		protected function removeDivider(index : int):Boolean
+		{
+			var result : Boolean = false;
+			var divider : Divider = getElementAt(index) as Divider;
+			if (divider)
+			{
+				divider.removeEventListener(MouseEvent.MOUSE_OVER , onDividerMouseOver);
+				divider.removeEventListener(MouseEvent.MOUSE_OUT , onDividerMouseOut);
+				divider.removeEventListener(MouseEvent.MOUSE_DOWN , onDividerMouseDown);
+				super.removeElement( divider );
+				result = true;
+			}
+			return result;
+		}
+
+		protected function onDividerMouseOver(e:MouseEvent):void
+		{
+			_cursorID = cursorManager.setCursor(cursorClass , CursorManagerPriority.HIGH, 0, 0);
+		}
+
+		protected function onDividerMouseOut(e:MouseEvent = null):void
+		{
+			if (_cursorID != CursorManager.NO_CURSOR)
+			{
+				cursorManager.removeCursor(_cursorID);
+				_cursorID = CursorManager.NO_CURSOR;
+			}
+		}
+
+		protected function onDividerMouseDown(e:MouseEvent):void
+		{
+			_currentActiveDivider = e.currentTarget as Divider;
+			startDividerDrag(e);
+			systemManager.getSandboxRoot().addEventListener(MouseEvent.MOUSE_UP, onDividerMouseUp, true);
+			systemManager.getSandboxRoot().addEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE, onDividerMouseUp);
+		}
+
+		private function onDividerMouseUp(e:Event):void
+		{
+			onDividerMouseOut();
+			stopDividerDrag();
+			systemManager.getSandboxRoot().removeEventListener(MouseEvent.MOUSE_UP, onDividerMouseUp, true);
+			systemManager.getSandboxRoot().removeEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE, onDividerMouseUp);
+		}
+
+		protected function startDividerDrag(e:MouseEvent):void
+		{
+			systemManager.getSandboxRoot().addEventListener(MouseEvent.MOUSE_MOVE, onDividerMouseMove, true);
+			systemManager.deployMouseShields(true);
+		}
+
+		protected function stopDividerDrag():void
+		{
+			_currentActiveDivider = null;
+			systemManager.getSandboxRoot().removeEventListener(MouseEvent.MOUSE_MOVE, onDividerMouseMove, true);
+			systemManager.deployMouseShields(false);
+		}
+
+		protected function onDividerMouseMove(e:MouseEvent):void
+		{
+
+		}
+		/**
+		 * Not used, not properly tested yet.
+		 *
+		 * TODO :
+		 * make it work, so we can add and remove children at runtime
+		 */
+		/*
+		override public function addElement(element:IVisualElement):IVisualElement
+		{
+			var result : IVisualElement = super.addElement(element);
+			if (_isCreatingChildren) return result;
+			if (numElements > 1)
+			{
+				addElementAt(createNewDivider(numElements-1) , numElements-1);
+			}
+			return result;
+		}
+
+		override public function removeElement(element:IVisualElement):IVisualElement
+		{
+			var result : IVisualElement = super.removeElement(element);
+			if (numElements > 1)
+			{
+				if (!removeDivider(numElements-1))
+				{
+					throw new Error("Divider not found");
+				}
+			}
+			return result;
+		}
+		*/
+
+		protected function checkPercentsOnChildren():void
+		{
+
+		}
+
+		override protected function createChildren():void
+		{
+			super.createChildren();
+			_isCreatingChildren = true;
+			dividers = new Array();
+			if (!_children || _children.length <= 1)
+			{
+				throw new Error(resourceManager.getString('dividers', 'atLeastTwoChildrenRequiredError'));
+			}
+			checkPercentsOnChildren();
+			addElement(_children[0]);
+			for (var i : int = 1 ; i < _children.length ; i++)
+			{
+				addElement(createNewDivider(_children[i-1],_children[i]));
+				addElement(_children[i]);
+			}
+			_isCreatingChildren = false;
+			invalidateLayering();
+		}
+
+	}
+}

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/Divider.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/Divider.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/Divider.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/Divider.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,78 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkDividers
+{
+	import mx.core.IVisualElement;
+	
+	import spark.components.Group;
+	/**
+	*  @langversion 3.0
+	*  @playerversion Flash 10.1
+	*  @playerversion AIR 2.5
+	*  @productversion Flex 4.5
+	*/
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public class Divider extends Group
+	{	
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		private var _upOrRightNeighbour : IVisualElement;
+		public function get upOrRightNeighbour():IVisualElement
+		{
+			return _upOrRightNeighbour;
+		}
+
+		public function set upOrRightNeighbour(value:IVisualElement):void
+		{
+			_upOrRightNeighbour = value;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		private var _downOrLeftNeighbour : IVisualElement;
+		public function get downOrLeftNeighbour():IVisualElement
+		{
+			return _downOrLeftNeighbour;
+		}
+
+		public function set downOrLeftNeighbour(value:IVisualElement):void
+		{
+			_downOrLeftNeighbour = value;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		public function Divider()
+		{
+			super();
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDivider.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDivider.mxml?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDivider.mxml (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDivider.mxml Sun Dec 16 04:38:49 2012
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<sparkDividers:Divider
+			xmlns:fx="http://ns.adobe.com/mxml/2009"
+		  xmlns:s="library://ns.adobe.com/flex/spark"
+		  height="100%" xmlns:sparkDividers="org.apache.flex.components.sparkDividers.*">
+	<!--
+	////////////////////////////////////////////////////////////////////////////////
+	//
+	//  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.
+	//
+	////////////////////////////////////////////////////////////////////////////////
+	@author Bogdan Dinu (http://www.badu.ro)
+	-->
+	<sparkDividers:layout>
+		<s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
+	</sparkDividers:layout>
+	<s:Group>
+		<s:BitmapImage id="img" source="@Embed('../../../../../../assets/dividers/HDivider.png')" />
+		<s:Rect width="6" height="16">
+			<s:fill>
+				<s:SolidColor alpha="0" color="0x000000" />
+			</s:fill>
+		</s:Rect>
+	</s:Group>
+</sparkDividers:Divider>

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,452 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkDividers
+{
+	import flash.events.Event;
+	import flash.events.MouseEvent;
+
+	import mx.core.IVisualElement;
+
+	import spark.layouts.HorizontalLayout;
+	/**
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.1
+	 *  @playerversion AIR 2.5
+	 *  @productversion Flex 4.5
+	 */
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public class HDividerGroup extends DividedGroup
+	{
+		private var _onStartDragFirstNeighbourWidth : Number;
+		private var _onStartDragSecondNeighbourWidth : Number;
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		[Embed(source='../../../../../../assets/dividers/HDividerCursor.png')]
+		private var _cursorClass : Class ;
+		override protected function get cursorClass():Class
+		{
+			return _cursorClass;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		private var _minElementWidth : int = -1;
+		public function get minElementWidth():int
+		{
+			return _minElementWidth;
+		}
+		public function set minElementWidth(value:int):void
+		{
+			_minElementWidth = value;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		public function HDividerGroup()
+		{
+			super();
+			var hLayout : HorizontalLayout = new HorizontalLayout();
+			hLayout.gap = 0;
+			hLayout.useVirtualLayout = false;
+			super.layout = hLayout;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function createNewDivider(firstChild : IVisualElement , secondChild : IVisualElement, dividerClass : Class = null):Divider
+		{
+			return super.createNewDivider(firstChild, secondChild, HDivider);
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function startDividerDrag(e:MouseEvent):void
+		{
+			super.startDividerDrag(e);
+			_onStartDragFirstNeighbourWidth = _currentActiveDivider.upOrRightNeighbour.width - e.stageX;
+			_onStartDragSecondNeighbourWidth = _currentActiveDivider.downOrLeftNeighbour.width + e.stageX;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function onDividerMouseMove(e:MouseEvent):void
+		{
+			var newFirstNeighbourWidth : int = _onStartDragFirstNeighbourWidth + e.stageX;
+			var newSecondNeighbourWidth : int = _onStartDragSecondNeighbourWidth - e.stageX;
+			if (_showTooltipOnDividers) _currentActiveDivider.toolTip = newFirstNeighbourWidth+" px / "+newSecondNeighbourWidth+" px";
+			if (newFirstNeighbourWidth > minElementWidth && newSecondNeighbourWidth > minElementWidth)
+			{
+				_currentActiveDivider.downOrLeftNeighbour.width = newSecondNeighbourWidth;
+				_currentActiveDivider.upOrRightNeighbour.width = newFirstNeighbourWidth;
+			}
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function checkPercentsOnChildren():void
+		{
+			var totalPercents : Number = 0;
+			for (var j : int = 0 ; j < _children.length ; j++)
+			{
+				if (isNaN((_children[j] as IVisualElement).percentWidth))
+				{
+					throw new Error(resourceManager.getString('dividers','childDoesntHavePercentWidthError'));
+				}
+				else
+				{
+					totalPercents += (_children[j] as IVisualElement).percentWidth;
+				}
+			}
+			if (totalPercents > 100)
+			{
+				throw new Error(resourceManager.getString('dividers','totalPercentsGreaterThanOneHundredError'));
+			}
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		//----------------------------------
+		//  @private - internal
+		//----------------------------------
+		private function get horizontalLayout():HorizontalLayout
+		{
+			return HorizontalLayout(layout);
+		}
+
+		//--------------------------------------------------------------------------
+		//
+		//  Properties
+		//
+		//--------------------------------------------------------------------------
+
+		//----------------------------------
+		//  gap
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#gap
+		 *
+		 *  @default 6
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get gap():int
+		{
+			return horizontalLayout.gap;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set gap(value:int):void
+		{
+			horizontalLayout.gap = value;
+		}
+
+		//----------------------------------
+		//  horizontalAlign
+		//----------------------------------
+
+		[Inspectable(category="General", enumeration="left,right,center,justify,contentJustify", defaultValue="left")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#horizontalAlign
+		 *
+		 *  @default "left"
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get horizontalAlign():String
+		{
+			return horizontalLayout.horizontalAlign;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set horizontalAlign(value:String):void
+		{
+			horizontalLayout.horizontalAlign = value;
+		}
+
+		//----------------------------------
+		//  verticalAlign
+		//----------------------------------
+
+		[Inspectable(category="General", enumeration="top,bottom,middle", defaultValue="top")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#verticalAlign
+		 *
+		 *  @default "top"
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get verticalAlign():String
+		{
+			return horizontalLayout.verticalAlign;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set verticalAlign(value:String):void
+		{
+			horizontalLayout.verticalAlign = value;
+		}
+
+		//----------------------------------
+		//  paddingLeft
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingLeft
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingLeft():Number
+		{
+			return horizontalLayout.paddingLeft;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingLeft(value:Number):void
+		{
+			horizontalLayout.paddingLeft = value;
+		}
+
+		//----------------------------------
+		//  paddingRight
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingRight
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingRight():Number
+		{
+			return horizontalLayout.paddingRight;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingRight(value:Number):void
+		{
+			horizontalLayout.paddingRight = value;
+		}
+
+		//----------------------------------
+		//  paddingTop
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingTop
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingTop():Number
+		{
+			return horizontalLayout.paddingTop;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingTop(value:Number):void
+		{
+			horizontalLayout.paddingTop = value;
+		}
+
+		//----------------------------------
+		//  paddingBottom
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingBottom
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingBottom():Number
+		{
+			return horizontalLayout.paddingBottom;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingBottom(value:Number):void
+		{
+			horizontalLayout.paddingBottom = value;
+		}
+
+
+		//----------------------------------
+		//  firstIndexInView
+		//----------------------------------
+
+		[Bindable("indexInViewChanged")]
+		[Inspectable(category="General")]
+
+		/**
+		 * @copy spark.layouts.VerticalLayout#firstIndexInView
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get firstIndexInView():int
+		{
+			return horizontalLayout.firstIndexInView;
+		}
+
+		//----------------------------------
+		//  lastIndexInView
+		//----------------------------------
+
+		[Bindable("indexInViewChanged")]
+		[Inspectable(category="General")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#lastIndexInView
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get lastIndexInView():int
+		{
+			return horizontalLayout.lastIndexInView;
+		}
+
+		//--------------------------------------------------------------------------
+		//
+		//  Event Handlers
+		//
+		//--------------------------------------------------------------------------
+
+		/**
+		 * @private
+		 */
+		override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
+		{
+			switch(type)
+			{
+				case "indexInViewChanged":
+				case "propertyChange":
+					if (!hasEventListener(type))
+						horizontalLayout.addEventListener(type, redispatchHandler);
+					break;
+			}
+			super.addEventListener(type, listener, useCapture, priority, useWeakReference)
+		}
+
+		/**
+		 * @private
+		 */
+		override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
+		{
+			super.removeEventListener(type, listener, useCapture);
+			switch(type)
+			{
+				case "indexInViewChanged":
+				case "propertyChange":
+					if (!hasEventListener(type))
+						horizontalLayout.removeEventListener(type, redispatchHandler);
+					break;
+			}
+		}
+
+		private function redispatchHandler(event:Event):void
+		{
+			dispatchEvent(event);
+		}
+	}
+}

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDivider.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDivider.mxml?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDivider.mxml (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDivider.mxml Sun Dec 16 04:38:49 2012
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<sparkDividers:Divider xmlns:fx="http://ns.adobe.com/mxml/2009"
+				  xmlns:s="library://ns.adobe.com/flex/spark"
+				  width="100%" xmlns:sparkDividers="org.apache.flex.components.sparkDividers.*">
+	<!--
+	////////////////////////////////////////////////////////////////////////////////
+	//
+	//  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.
+	//
+	////////////////////////////////////////////////////////////////////////////////
+	@author Bogdan Dinu (http://www.badu.ro)
+	-->
+	<sparkDividers:layout>
+		<s:HorizontalLayout horizontalAlign="center" verticalAlign="middle" />
+	</sparkDividers:layout>
+
+	<s:Group>
+		<s:BitmapImage id="img" source="@Embed('../../../../../../assets/dividers/VDivider.png')" />
+		<s:Rect width="16" height="6">
+			<s:fill>
+				<s:SolidColor alpha="0" color="0x000000" />
+			</s:fill>
+		</s:Rect>
+	</s:Group>
+</sparkDividers:Divider>

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,453 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkDividers
+{
+	import flash.events.Event;
+	import flash.events.MouseEvent;
+
+	import mx.core.IVisualElement;
+
+	import spark.layouts.VerticalLayout;
+	/**
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.1
+	 *  @playerversion AIR 2.5
+	 *  @productversion Flex 4.5
+	 */
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public class VDividerGroup extends DividedGroup
+	{
+		private var _onStartDragFirstNeighbourHeight : Number;
+		private var _onStartDragSecondNeighbourHeight : Number;
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		[Embed(source='../../../../../../assets/dividers/VDividerCursor.png')]
+		private var _cursorClass : Class ;
+		override protected function get cursorClass():Class
+		{
+			return _cursorClass;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		private var _minElementHeight : int = -1;
+		public function get minElementHeight():int
+		{
+			return _minElementHeight;
+		}
+		public function set minElementHeight(value:int):void
+		{
+			_minElementHeight = value;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		public function VDividerGroup()
+		{
+			super();
+			var vLayout : VerticalLayout = new VerticalLayout();
+			vLayout.gap = 0;
+			vLayout.useVirtualLayout = false;
+			super.layout = vLayout;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function createNewDivider(firstChild : IVisualElement , secondChild : IVisualElement, dividerClass : Class = null):Divider
+		{
+			return super.createNewDivider(firstChild, secondChild, VDivider);
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function startDividerDrag(e:MouseEvent):void
+		{
+			super.startDividerDrag(e);
+			_onStartDragFirstNeighbourHeight = _currentActiveDivider.upOrRightNeighbour.height - e.stageY;
+			_onStartDragSecondNeighbourHeight = _currentActiveDivider.downOrLeftNeighbour.height + e.stageY;
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function onDividerMouseMove(e:MouseEvent):void
+		{
+			var newFirstNeighbourHeight : int = _onStartDragFirstNeighbourHeight + e.stageY
+			var newSecondNeighbourHeight : int = _onStartDragSecondNeighbourHeight - e.stageY;
+			if (_showTooltipOnDividers) _currentActiveDivider.toolTip = newFirstNeighbourHeight+" px\n--\n"+newSecondNeighbourHeight+" px";
+			if (newFirstNeighbourHeight > minElementHeight && newSecondNeighbourHeight > minElementHeight)
+			{
+				_currentActiveDivider.upOrRightNeighbour.height = newFirstNeighbourHeight;
+				_currentActiveDivider.downOrLeftNeighbour.height = newSecondNeighbourHeight;
+			}
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function checkPercentsOnChildren():void
+		{
+			var totalPercents : Number = 0;
+			for (var j : int = 0 ; j < _children.length ; j++)
+			{
+				if (isNaN((_children[j] as IVisualElement).percentHeight))
+				{
+					throw new Error(resourceManager.getString('dividers','childDoesntHavePercentHeightError'));
+				}
+				else
+				{
+					totalPercents += (_children[j] as IVisualElement).percentHeight;
+				}
+			}
+			if (totalPercents > 100)
+			{
+				throw new Error(resourceManager.getString('dividers','totalPercentsGreaterThanOneHundredError'));
+			}
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		//----------------------------------
+		//  @private - internal
+		//----------------------------------
+
+		private function get verticalLayout():VerticalLayout
+		{
+			return VerticalLayout(layout);
+		}
+
+		//--------------------------------------------------------------------------
+		//
+		//  Properties
+		//
+		//--------------------------------------------------------------------------
+
+		//----------------------------------
+		//  gap
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#gap
+		 *
+		 *  @default 6
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get gap():int
+		{
+			return verticalLayout.gap;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set gap(value:int):void
+		{
+			verticalLayout.gap = value;
+		}
+
+		//----------------------------------
+		//  horizontalAlign
+		//----------------------------------
+
+		[Inspectable(category="General", enumeration="left,right,center,justify,contentJustify", defaultValue="left")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#horizontalAlign
+		 *
+		 *  @default "left"
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get horizontalAlign():String
+		{
+			return verticalLayout.horizontalAlign;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set horizontalAlign(value:String):void
+		{
+			verticalLayout.horizontalAlign = value;
+		}
+
+		//----------------------------------
+		//  verticalAlign
+		//----------------------------------
+
+		[Inspectable(category="General", enumeration="top,bottom,middle", defaultValue="top")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#verticalAlign
+		 *
+		 *  @default "top"
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get verticalAlign():String
+		{
+			return verticalLayout.verticalAlign;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set verticalAlign(value:String):void
+		{
+			verticalLayout.verticalAlign = value;
+		}
+
+		//----------------------------------
+		//  paddingLeft
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingLeft
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingLeft():Number
+		{
+			return verticalLayout.paddingLeft;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingLeft(value:Number):void
+		{
+			verticalLayout.paddingLeft = value;
+		}
+
+		//----------------------------------
+		//  paddingRight
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingRight
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingRight():Number
+		{
+			return verticalLayout.paddingRight;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingRight(value:Number):void
+		{
+			verticalLayout.paddingRight = value;
+		}
+
+		//----------------------------------
+		//  paddingTop
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingTop
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingTop():Number
+		{
+			return verticalLayout.paddingTop;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingTop(value:Number):void
+		{
+			verticalLayout.paddingTop = value;
+		}
+
+		//----------------------------------
+		//  paddingBottom
+		//----------------------------------
+
+		[Inspectable(category="General", defaultValue="0.0")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#paddingBottom
+		 *
+		 *  @default 0
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get paddingBottom():Number
+		{
+			return verticalLayout.paddingBottom;
+		}
+
+		/**
+		 *  @private
+		 */
+		public function set paddingBottom(value:Number):void
+		{
+			verticalLayout.paddingBottom = value;
+		}
+
+
+		//----------------------------------
+		//  firstIndexInView
+		//----------------------------------
+
+		[Bindable("indexInViewChanged")]
+		[Inspectable(category="General")]
+
+		/**
+		 * @copy spark.layouts.VerticalLayout#firstIndexInView
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get firstIndexInView():int
+		{
+			return verticalLayout.firstIndexInView;
+		}
+
+		//----------------------------------
+		//  lastIndexInView
+		//----------------------------------
+
+		[Bindable("indexInViewChanged")]
+		[Inspectable(category="General")]
+
+		/**
+		 *  @copy spark.layouts.VerticalLayout#lastIndexInView
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4
+		 */
+		public function get lastIndexInView():int
+		{
+			return verticalLayout.lastIndexInView;
+		}
+
+		//--------------------------------------------------------------------------
+		//
+		//  Event Handlers
+		//
+		//--------------------------------------------------------------------------
+
+		/**
+		 * @private
+		 */
+		override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
+		{
+			switch(type)
+			{
+				case "indexInViewChanged":
+				case "propertyChange":
+					if (!hasEventListener(type))
+						verticalLayout.addEventListener(type, redispatchHandler);
+					break;
+			}
+			super.addEventListener(type, listener, useCapture, priority, useWeakReference)
+		}
+
+		/**
+		 * @private
+		 */
+		override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
+		{
+			super.removeEventListener(type, listener, useCapture);
+			switch(type)
+			{
+				case "indexInViewChanged":
+				case "propertyChange":
+					if (!hasEventListener(type))
+						verticalLayout.removeEventListener(type, redispatchHandler);
+					break;
+			}
+		}
+
+		private function redispatchHandler(event:Event):void
+		{
+			dispatchEvent(event);
+		}
+	}
+}

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/IListItemRenderer.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/IListItemRenderer.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/IListItemRenderer.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/IListItemRenderer.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkMenu
+{
+	import spark.components.IItemRenderer;
+	import spark.components.List;
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public interface IListItemRenderer extends IItemRenderer
+	{		
+		function set listOwner(value:List):void;
+		function get listOwner():List;
+	}
+}
\ No newline at end of file

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/Menu.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/Menu.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/Menu.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/Menu.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,393 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkMenu
+{
+	import flash.events.Event;
+	import flash.events.KeyboardEvent;
+	import flash.events.MouseEvent;
+	import flash.ui.Keyboard;
+	import flash.utils.getQualifiedClassName;
+	
+	import mx.core.IFlexModuleFactory;
+	import mx.core.IVisualElement;
+	import mx.events.FlexMouseEvent;
+	import mx.styles.CSSStyleDeclaration;
+	import mx.styles.IStyleManager2;
+	import mx.styles.StyleManager;
+	
+	import spark.components.IItemRenderer;
+	import spark.components.List;
+	import spark.events.IndexChangeEvent;
+	
+	import org.apache.flex.components.sparkMenu.events.MenuEvent;
+	import org.apache.flex.components.sparkMenu.skin.MenuSkin;
+	
+	/**
+	 * Plain simple Menu class, based upon list.
+	 * It is used as standalone and in combination with MenuBar 
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.1
+	 *  @playerversion AIR 2.5
+	 *  @productversion Flex 4.5
+	 */
+	[Event(name="selected", type="org.apache.flex.components.spark.events.MenuEvent")]
+	[Event(name="checked", type="org.apache.flex.components.spark.events.MenuEvent")]
+	/**
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.1
+	 *  @playerversion AIR 2.5
+	 *  @productversion Flex 4.5
+	 */
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public class Menu extends List
+	{		
+		protected var _storedSelectedIndex : int = -1;
+		protected var _ignoreFocus : Boolean;
+		protected var _openedItem : MenuCoreItemRenderer;
+		/**
+		 * Constructor
+		 * 
+		 * We never use virtual layout, since it's not needed
+		 * requireSelection is set to false in order to allow checkable items to be checked
+		 * If you remove requireSelection the checkable items will work, but
+		 * the menu will close immediately after clicking that item
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */		
+		public function Menu()
+		{
+			super();
+			useVirtualLayout = false;
+			requireSelection = false;
+		}		
+		/**
+		 
+		 **/
+		protected var _parentMenu : List;
+		public function get parentMenu():List
+		{
+			return _parentMenu;
+		}
+		public function set parentMenu(value:List):void
+		{
+			_parentMenu = value;				
+		}
+		/**
+		 * Sets for every item renderer the instance of this,
+		 * so we can dispatch events and access properties like labelField
+		 */
+		override public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void
+		{
+			super.updateRenderer(renderer, itemIndex, data);			
+			if (renderer is IListItemRenderer)
+			{
+				(renderer as IListItemRenderer).listOwner =  this;
+			}
+		}
+		/**
+		 * From keyboard navigation, called by a child to pass over focus and close popup on opened item
+		 */		
+		public function keyDownInChild(e:KeyboardEvent):void
+		{					
+			if (parentMenu is Menu) 
+			{
+				_openedItem.popup.displayPopUp = false;
+			}
+			closeSelectedItemRenderer();
+			_ignoreFocus = true;
+			setFocus();
+		}
+		/**
+		 * From keyboard navigation, checks if submenu is present
+		 */
+		protected function get selectedItemRendererShouldOpen():Boolean
+		{
+			if (selectedIndex < 0) return false;			
+			return (dataGroup.getElementAt(selectedIndex) as MenuCoreItemRenderer).dataProvider.length > 0;
+		}
+		/**
+		 * From keyboard navigation, when we need to close a submenu and cleanup
+		 */
+		protected function closeSelectedItemRenderer():void
+		{
+			_openedItem.selected = false;
+			_openedItem.setHovered ( false );
+			_openedItem = null;
+		}
+		/**
+		 * From keyboard navigation, when we are entitled to open a submenu
+		 */
+		protected function openAndFocusSelectedItemRenderer():void
+		{
+			var item : MenuCoreItemRenderer = dataGroup.getElementAt(selectedIndex) as MenuCoreItemRenderer;
+			if (item)
+			{				
+				_openedItem = item;
+				item.selected = false;
+				item.setHovered ( true );
+			}		
+		}
+		/**
+		 * From keyboard navigation, when submenu closes and parents need focus
+		 */
+		protected function closeAndFocusParent(e:KeyboardEvent):void
+		{		
+			parentMenu.setFocus();
+			if (parentMenu is MenuBar)
+			{
+				(parentMenu as MenuBar).keyDownInChild(e);
+			}
+			else if (parentMenu is Menu)
+			{
+				(parentMenu as Menu).keyDownInChild(e);
+			}
+		}
+		/**
+		 * From keyboard navigation, we check if it's necessary to open a submenu
+		 */
+		public function openIfNecessary():void
+		{
+			if (selectedItemRendererShouldOpen) 
+			{	
+				if (!_openedItem)						
+				{
+					openAndFocusSelectedItemRenderer();
+				}
+			}
+		}
+		/**
+		 * Handle navigation, up and down arrow keys and enter or space selects
+		 * Escape key, closes menu
+		 * 
+		 * Doesn't work very very well, probably the focus manager is sometimes
+		 * too slow for Spark components.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override protected function keyDownHandler(e:KeyboardEvent):void
+		{						
+			switch (e.keyCode)
+			{
+				case Keyboard.RIGHT:
+					selectedIndex = _storedSelectedIndex;
+					if (_openedItem)
+					{
+						_openedItem.subMenu.selectedIndex = 0;
+						_openedItem.subMenu.setFocus();
+						(_openedItem.subMenu as Menu).openIfNecessary();
+					}
+					else	if (selectedItemRendererShouldOpen) 
+					{
+						if (!_openedItem)						
+						{
+							openAndFocusSelectedItemRenderer();
+						}
+					}
+					else
+					{						
+						if (parentMenu is MenuBar)
+						{	
+							closeAndFocusParent(e);
+						}						
+					}
+					break;
+				case Keyboard.LEFT:
+					closeAndFocusParent(e);					
+					break;
+				case Keyboard.UP:
+					selectedIndex = _storedSelectedIndex;
+					if (_openedItem)
+					{
+						closeSelectedItemRenderer();
+					}
+					if (selectedIndex > 0)
+					{					
+						do 
+						{
+							selectedIndex--;
+						} while (dataProvider.getItemAt(selectedIndex).@separator.toString() == "true");						
+					}
+					_storedSelectedIndex = selectedIndex;
+					if (selectedItemRendererShouldOpen) 
+					{
+						if (!_openedItem)						
+						{							
+							openAndFocusSelectedItemRenderer();
+						}
+					}					
+					break;
+				case Keyboard.DOWN:
+					selectedIndex = _storedSelectedIndex;
+					if (_openedItem)
+					{
+						closeSelectedItemRenderer();
+					}					
+					if (selectedIndex < dataProvider.length - 1)
+					{					
+						do 
+						{
+							selectedIndex++;
+						} while (dataProvider.getItemAt(selectedIndex).@separator.toString() == "true");					
+					}
+					_storedSelectedIndex = selectedIndex;
+					if (selectedItemRendererShouldOpen) 
+					{
+						if (!_openedItem)						
+						{							
+							openAndFocusSelectedItemRenderer();
+						}
+					}					
+					break;				
+				case Keyboard.ESCAPE:
+					dispatchEvent(new FlexMouseEvent(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, false, false, 0, 0, null, false, false, false, false, 0));
+					break;
+				case Keyboard.ENTER:
+				case Keyboard.SPACE:
+					if (selectedItem.@isCheckable.toString() == 'true')
+					{
+						if (dataProvider.getItemAt(selectedIndex).@isChecked == 'true')
+						{
+							dataProvider.getItemAt(selectedIndex).@isChecked = 'false';
+						}
+						else
+						{
+							dataProvider.getItemAt(selectedIndex).@isChecked = 'true';
+						}	
+						dispatchEvent(new MenuEvent(MenuEvent.CHECKED, false, false, this, dataProvider.getItemAt(selectedIndex)));
+					}
+					else
+					{
+						dispatchEvent(new MenuEvent(MenuEvent.SELECTED, false, false,  this, selectedItem));
+					}
+					break;
+				default:
+					super.keyDownHandler(e);
+					break;
+			}		
+		}		
+		/**
+		 * Overriden to implement checkable behavior. 
+		 * If an item is checkable, we alter data and dispatch the event
+		 * If not, we just using the super method
+		 */
+		override protected function item_mouseDownHandler(event:MouseEvent):void
+		{
+			var canCallSuper : Boolean = true;			
+			if (event.currentTarget is IItemRenderer)
+			{
+				var itemRendererTarget : IItemRenderer = (event.currentTarget as IItemRenderer);
+				
+				if (itemRendererTarget.data.@isCheckable.toString() == 'true') 
+				{
+					canCallSuper = false;						
+					if (itemRendererTarget.data.@isChecked == 'true')
+					{
+						itemRendererTarget.data.@isChecked = 'false';
+					}
+					else
+					{
+						itemRendererTarget.data.@isChecked  = 'true';
+					}	
+					dispatchEvent(new MenuEvent(MenuEvent.CHECKED, false, false, this, itemRendererTarget.data));
+				}
+			}
+			if (canCallSuper)
+			{
+				super.item_mouseDownHandler(event);
+			}
+		}
+		/**
+		 * We are supposed to dispatch MenuEvent instead of IndexChangeEvent
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */
+		override public function dispatchEvent(e:Event):Boolean
+		{				
+			if (!(e is MenuEvent))
+			{
+				if (e is IndexChangeEvent)
+				{
+					if (selectedItem)
+					{
+						if (selectedItem.@separator.toString() == "true")
+						{
+							selectedIndex = -1;
+							return true;
+						}
+						if (selectedItem.children().length() > 0)
+						{
+							selectedIndex = -1;
+							return true;
+						}	
+						if (e.type == IndexChangeEvent.CHANGE)
+						{
+							return super.dispatchEvent(new MenuEvent(MenuEvent.SELECTED, e.bubbles, true, this, selectedItem));
+						}
+					}
+				}				
+			}
+			return super.dispatchEvent(e);
+		}
+		/**
+		 *  Skinning
+		 */		
+		private static var defaultStylesSet                : Boolean;
+		
+		override public function set moduleFactory(factory:IFlexModuleFactory):void
+		{
+			super.moduleFactory = factory;
+			prototype.constructor.setDefaultStyles( factory );
+		}
+		/**
+		 * Declares the default skinClass, in case it's not mentioned a custom skinning
+		 */
+		private static function setDefaultStyles( factory:IFlexModuleFactory ):void
+		{
+			if( defaultStylesSet ) return;			
+			defaultStylesSet = true;			
+			var defaultStyleName:String = getQualifiedClassName( prototype.constructor ).replace( /::/, "." );
+			var styleManager:IStyleManager2 = StyleManager.getStyleManager( factory );
+			var style:CSSStyleDeclaration = styleManager.getStyleDeclaration( defaultStyleName );			
+			if( !style )
+			{
+				style = new CSSStyleDeclaration();
+				styleManager.setStyleDeclaration( defaultStyleName, style, true );
+			}			
+			if( style.defaultFactory == null )
+			{
+				style.defaultFactory = function():void
+				{
+					this.skinClass = org.apache.flex.components.sparkMenu.skin.MenuSkin;
+				};
+			}
+		}
+	}
+}

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuBar.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuBar.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuBar.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuBar.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,165 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkMenu
+{
+    import flash.events.Event;
+    import flash.events.KeyboardEvent;
+    import flash.ui.Keyboard;
+    
+    import mx.core.IFlexModuleFactory;
+    import mx.core.IVisualElement;
+    import mx.events.FlexEvent;
+    import mx.styles.CSSStyleDeclaration;
+    import mx.styles.IStyleManager2;
+    import mx.styles.StyleManager;
+    
+    import spark.components.List;
+    import spark.events.IndexChangeEvent;
+    
+    import avmplus.getQualifiedClassName;
+    
+    import org.apache.flex.components.sparkMenu.events.MenuEvent;
+    import org.apache.flex.components.sparkMenu.skin.MenuBarSkin;
+        
+	/**
+	 * Plain simple MenuBar class, based upon list. 
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.1
+	 *  @playerversion AIR 2.5
+	 *  @productversion Flex 4.5
+	 */
+	[Event(name="selected", type="org.apache.flex.components.spark.events.MenuEvent")]
+	[Event(name="checked", type="org.apache.flex.components.spark.events.MenuEvent")]
+    /**
+	 * Note : works with both Horizontal and Vertical Layouts
+	 */
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+    public class MenuBar extends List
+    {		
+		/**
+		 * Constructor, we don't use virtual layout
+		 */
+		public function MenuBar()
+		{
+			super();
+			useVirtualLayout = false;
+		}		
+		/**
+		 * Overriden because we don't want to dispatch change event directly, but forward it to MenuEvent
+		 */
+        override public function dispatchEvent(e:Event):Boolean
+        {		
+            if (e.type == IndexChangeEvent.CHANGE && e is IndexChangeEvent && !(e is MenuEvent))
+            {
+                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));                
+                return true;          
+            }
+            return super.dispatchEvent(e);
+        }
+		/**
+		 * Sets for every item renderer the instance of this, 
+		 * so we can dispatch events and access properties like labelField
+		 */
+		override public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void
+		{
+			super.updateRenderer(renderer, itemIndex, data);
+			if (renderer is IListItemRenderer)
+			{
+				(renderer as IListItemRenderer).listOwner = this;				
+			}
+		}			
+		/**
+		 * this gets called by child to restore focus to us or to change the selected index 
+		 */
+		public function keyDownInChild(e:KeyboardEvent):void
+		{			
+			keyDownHandler(e);
+		}
+		/**
+		 * Key down handler for handling key navigation 
+		 */
+		override protected function keyDownHandler(e:KeyboardEvent):void
+		{			
+			if (e.keyCode == Keyboard.DOWN)
+			{
+				if (selectedIndex < 0)
+				{
+					selectedIndex = 0;					
+				}
+			}
+			else if (e.keyCode == Keyboard.UP)
+			{
+				if (selectedIndex >= 0)
+				{
+					selectedIndex = -1;
+					setFocus();
+				}
+			}			
+			else
+			{
+				super.keyDownHandler(e);
+			}
+			//we are passing the focus to our child
+			if (selectedIndex >= 0)
+			{
+				var item : MenuCoreItemRenderer = dataGroup.getElementAt(selectedIndex) as MenuCoreItemRenderer;
+				if (item)
+				{
+					item.setFocus();
+				}
+			}
+		}
+		/**
+		 *  Skinning
+		 */		
+		private static var defaultStylesSet                : Boolean;
+		
+		override public function set moduleFactory(factory:IFlexModuleFactory):void
+		{
+			super.moduleFactory = factory;
+			prototype.constructor.setDefaultStyles( factory );
+		}
+		/**
+		 * Declares the default skinClass, in case it's not mentioned a custom skinning
+		 */
+		private static function setDefaultStyles( factory:IFlexModuleFactory ):void
+		{
+			if( defaultStylesSet ) return;			
+			defaultStylesSet = true;			
+			var defaultStyleName:String = getQualifiedClassName( prototype.constructor ).replace( /::/, "." );
+			var styleManager:IStyleManager2 = StyleManager.getStyleManager( factory );
+			var style:CSSStyleDeclaration = styleManager.getStyleDeclaration( defaultStyleName );			
+			if( !style )
+			{
+				style = new CSSStyleDeclaration();
+				styleManager.setStyleDeclaration( defaultStyleName, style, true );
+			}			
+			if( style.defaultFactory == null )
+			{
+				style.defaultFactory = function():void
+				{
+					this.skinClass = org.apache.flex.components.sparkMenu.skin.MenuBarSkin;
+				};
+			}
+		}	
+    }
+}

Added: incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuCoreItemRenderer.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuCoreItemRenderer.as?rev=1422462&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuCoreItemRenderer.as (added)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkMenu/MenuCoreItemRenderer.as Sun Dec 16 04:38:49 2012
@@ -0,0 +1,429 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.components.sparkMenu
+{
+	import flash.events.MouseEvent;
+	
+	import mx.collections.XMLListCollection;
+	import mx.core.DeferredInstanceFromFunction;
+	import mx.events.FlexMouseEvent;
+	import mx.events.PropertyChangeEvent;
+	import mx.states.AddItems;
+	import mx.states.State;
+	
+	import spark.components.List;
+	import spark.components.PopUpAnchor;
+	import spark.components.supportClasses.ItemRenderer;
+	import spark.layouts.HorizontalLayout;
+	import spark.layouts.VerticalLayout;
+	
+	import org.apache.flex.components.sparkMenu.events.MenuEvent;
+
+	/**
+	 * 
+	 */
+	[States("normal", "hovered", "selected")]
+	/**
+	 * @author Bogdan Dinu (http://www.badu.ro)
+	 */
+	public class MenuCoreItemRenderer extends ItemRenderer implements org.apache.flex.components.sparkMenu.IListItemRenderer
+	{			
+		/**
+		 * getter of the subMenu, used in keyboard navigation
+		 */
+		protected var _subMenu : Menu;
+		public function get subMenu():Menu
+		{
+			return _subMenu;
+		}
+		/**
+		 * getter of the popup anchor, used in keyboard navigation
+		 */
+		protected var _popup : PopUpAnchor;
+		public function get popup():PopUpAnchor
+		{
+			return _popup;
+		}
+		/**
+		 * isSeparator property (bindable) - used by subclasses
+		 */
+		protected var _isSeparator : Boolean;
+		public function get isSeparator():Boolean
+		{
+			return _isSeparator;
+		}
+		[Bindable(event="propertyChange")]
+		public function set isSeparator(value:Boolean):void
+		{
+			if (_isSeparator !== value)
+			{
+				var oldValue : Boolean = _isSeparator; 
+				_isSeparator = value;	
+				if (hasEventListener("propertyChange"))
+				{
+					dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "isSeparator", oldValue, value));
+				}
+			}			
+		}
+		/**
+		 * hasIcon property (bindable) - used by subclasses		 
+		 **/
+		protected var _hasIcon : Boolean;
+		public function get hasIcon():Boolean
+		{
+			return _hasIcon;
+		}
+		[Bindable(event="propertyChange")]
+		public function set hasIcon(value:Boolean):void
+		{
+			if (_hasIcon !== value)
+			{
+				var oldValue : Boolean = _hasIcon; 
+				_hasIcon = value;	
+				if (hasEventListener("propertyChange"))
+				{
+					dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "hasIcon", oldValue, value));
+				}
+			}			
+		}
+		/**
+		 * iconSource property (bindable) - used by subclasses		 
+		 **/
+		protected var _iconSource : String;
+		public function get iconSource():String
+		{
+			return _iconSource;
+		}
+		[Bindable(event="propertyChange")]
+		public function set iconSource(value:String):void
+		{
+			if (_iconSource !== value)
+			{
+				var oldValue : String = _iconSource; 
+				_iconSource = value;	
+				if (hasEventListener("propertyChange"))
+				{
+					dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "iconSource", oldValue, value));
+				}
+			}			
+		}
+		/**
+		 * isChecked property (bindable) - used by subclasses	 
+		 **/
+		protected var _isChecked : Boolean;
+		public function get isChecked():Boolean
+		{
+			return _isChecked;
+		}
+		[Bindable(event="propertyChange")]
+		public function set isChecked(value:Boolean):void
+		{
+			if (_isChecked !== value)
+			{
+				var oldValue : Boolean = _isChecked; 
+				_isChecked = value;	
+				if (hasEventListener("propertyChange"))
+				{
+					dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "isChecked", oldValue, value));
+				}
+			}			
+		}
+		/**
+		 * isCheckable property  (bindable) - used by subclasses		 
+		 **/
+		protected var _isCheckable : Boolean;
+		public function get isCheckable():Boolean
+		{
+			return _isCheckable;
+		}
+		[Bindable(event="propertyChange")]
+		public function set isCheckable(value:Boolean):void
+		{
+			if (_isCheckable !== value)
+			{
+				var oldValue : Boolean = _isCheckable; 
+				_isCheckable = value;	
+				if (hasEventListener("propertyChange"))
+				{
+					dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "isCheckable", oldValue, value));
+				}
+			}			
+		}
+		/**
+		 * dataProvider property (bindable) - used by subclasses
+		 **/
+		protected var _dataProvider : XMLListCollection;
+		public function get dataProvider():XMLListCollection
+		{
+			return _dataProvider;
+		}
+		[Bindable(event="propertyChange")]
+		public function set dataProvider(value:XMLListCollection):void
+		{
+			if (_dataProvider !== value)
+			{
+				var oldValue : XMLListCollection = _dataProvider; 
+				_dataProvider = value;	
+				if (hasEventListener("propertyChange"))
+				{
+					dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "dataProvider", oldValue, value));
+				}
+			}			
+		}
+		/**
+		 * Holds the instance of the parent List (which is Menu or MenuBar)
+		 * if this instance is isSubMenuRenderer, and dataProvider has elements
+		 * we have to create popup anchor in order to display it when 
+		 * the item is hovered
+		 **/
+		protected var _ownerMenu : List;
+		public function get listOwner():List
+		{
+			return _ownerMenu;
+		}
+		public function set listOwner(value:List):void
+		{	 			
+			_ownerMenu = value;				
+			//optimisation : we are creating popup and menu only if dataProvider has what to show
+			if (isSubMenuRenderer && dataProvider.length > 0)
+			{
+				createPopupAnchor();
+				//_subMenu.id = _ownerMenu.id+"_"+itemIndex; //commented, used for debugging
+				_subMenu.parentMenu = _ownerMenu;//this is mandatory for keyboard navigation				
+				_subMenu.labelField = _ownerMenu.labelField;
+				_subMenu.dataProvider = dataProvider;
+			}			
+		}				
+		/**
+		 * this gets overriden and set to true when is a submenu item renderer
+		 */
+		public function get isSubMenuRenderer() : Boolean
+		{
+			return false;
+		}			
+		
+		/**
+		 * Sets data : checks if it's a separator, if it's checkable, it's default checked
+		 */
+		override public function set data(value:Object):void
+		{
+			super.data = XML(value);
+			dataProvider = new XMLListCollection(super.data.children());
+			isSeparator = super.data.@separator.toString() == 'true';
+			hasIcon = super.data.@icon.toString().length > 0;
+			if (hasIcon) iconSource = super.data.@icon.toString();
+			isCheckable = super.data.@isCheckable.toString() == 'true';
+			enabled = super.data.@enabled!='false';
+			if (_isCheckable)
+			{			
+				isChecked = super.data.@isChecked.toString() == 'true';
+			}
+		}
+		/**
+		 * since hovered is protected, we have to expose it somehow - it's accessed by keyboard navigation
+		 */
+		public function setHovered(value : Boolean):void
+		{
+			hovered = value;
+		}
+		/**
+		 * Handles hovering. If is a sub-menu item renderer, the popup should become
+		 * visible, thus displaying the sub-sub-menu
+		 */
+		override protected function set hovered(value:Boolean):void
+		{
+			if (super.hovered === value) return;
+			super.hovered = value;	
+			if (_isCheckable) return;
+			if (isSubMenuRenderer && _popup)
+			{
+				if (value && dataProvider.length > 0)
+				{
+					//only when set to true and it's a submenu item renderer and dataprovider has something, we display popup
+					_popup.displayPopUp = true;
+				}
+				else
+				{
+					_popup.displayPopUp = false;
+				}				
+			}
+			else
+			{
+				if (value)
+				{
+					if (_ownerMenu.selectedIndex != -1)
+					{
+						_ownerMenu.selectedIndex = _ownerMenu.dataProvider.getItemIndex(data);
+					}					
+				}				
+			}
+		}		
+		override public function set selected(value:Boolean):void
+		{
+			super.selected = value;
+			if (value && isSubMenuRenderer) 
+			{
+				callLater(setFocus);
+			}
+		}
+		/**
+		 * Constructor
+		 */
+		public function MenuCoreItemRenderer()
+		{
+			super();
+			createAndSetStates();		
+		}
+		/**
+		 * setup for states of this component 
+		 */
+		protected function createAndSetStates():void
+		{
+			currentState = "normal";
+			if (!isSubMenuRenderer)
+			{					
+				//there is nothing fancy here, but what the compiler would do by itself, but much more simplified
+				var 		overridesArray : Array= [
+					new AddItems().initializeFromObject({
+						destructionPolicy: "auto",
+						itemsFactory: new DeferredInstanceFromFunction(createPopupAnchor, destroyPopupAnchor),
+						destination: null,
+						propertyName: "mxmlContent",
+						position: "after",
+						relativeTo: ["labelDisplay"]
+					})							
+				];
+				states = [
+					new State ({ name: "normal"}),
+					new State ({ name: "hovered"}),
+					new State ({name: "selected", overrides : overridesArray})
+				];
+			}
+			else
+			{
+				states = [
+					new State ({ name: "normal"}),
+					new State ({ name: "hovered"}),
+					new State ({name: "selected"})
+				];
+			}
+		}		
+		/**
+		 * Destroys the popup anchor
+		 */
+		protected function destroyPopupAnchor():void
+		{
+			_popup = null;
+		}
+		/**
+		 * Creates the popup anchor which will hold the submenu
+		 */
+		protected function createPopupAnchor() : PopUpAnchor
+		{
+			_popup = new PopUpAnchor();
+			_popup.left = 0;
+			_popup.right = 0;
+			_popup.top = 0;
+			_popup.bottom = 0;
+			_popup.popUpWidthMatchesAnchorWidth = false;
+			_popup.popUp = createMenu();
+			if (_ownerMenu && _ownerMenu.layout is VerticalLayout) _popup.popUpPosition = "right";
+			if (_ownerMenu && _ownerMenu.layout is HorizontalLayout) _popup.popUpPosition = "below";
+			if (!_popup.popUpPosition) _popup.popUpPosition = "right";
+			if (!isSubMenuRenderer)
+			{	
+				if (_dataProvider.length > 0) _popup.displayPopUp = true;
+			}			
+			if (!_popup.document) _popup.document = this;
+			if (isSubMenuRenderer)
+			{
+				addElement(_popup);
+			}
+			return _popup;
+		}
+		/**
+		 * Creates the sub-menu
+		 */
+		protected function createMenu() : Menu
+		{
+			_subMenu = new Menu();
+			_subMenu.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, onMouseDownOutside);
+			_subMenu.addEventListener(MenuEvent.SELECTED, onMenuChange);
+			_subMenu.addEventListener(MenuEvent.CHECKED, onMenuChange);
+			_subMenu.addEventListener(MouseEvent.ROLL_OUT, onMenuRollOut);
+			_subMenu.addEventListener(MouseEvent.ROLL_OVER, onMenuRollOver);			
+			if (!isSubMenuRenderer)
+			{
+				//_subMenu.id = _ownerMenu.id+"_"+itemIndex;					//commented, used for debugging
+				_subMenu.dataProvider = dataProvider;
+				_subMenu.labelField = _ownerMenu.labelField;
+				_subMenu.parentMenu = _ownerMenu;//this is mandatory for keyboard navigation
+				_subMenu.setFocus();
+				_subMenu.selectedIndex = 0;
+			}
+			if (!_subMenu.document) _subMenu.document = this;
+			return _subMenu;
+		}
+		/**
+		 * Handler for sub-menu mouse event		 
+		 **/
+		protected function onMouseDownOutside(e:FlexMouseEvent):void
+		{
+			if (isSubMenuRenderer)
+			{
+				if (selected) 
+				{
+					hovered = true;
+					return;
+				}
+			}			
+			_ownerMenu.selectedIndex = -1;
+			hovered = false;
+			_ownerMenu.dispatchEvent(e);
+		}
+		/**
+		 * Handler for sub-menu mouse event
+		 **/
+		protected function onMenuChange(e:MenuEvent):void
+		{			
+			if (e.type == MenuEvent.SELECTED)
+			{
+				_ownerMenu.selectedIndex = -1;
+				hovered = false;			
+			}
+			_ownerMenu.dispatchEvent(e);
+			
+		}		
+		/**
+		 *when the parent is rolled out, we trigger that we are not hovered
+		 **/
+		protected function onMenuRollOut(e:MouseEvent):void
+		{
+			if (e.relatedObject == null || owner.contains(e.relatedObject)) hovered = false;		
+		}
+		/**
+		 * when the parent is rolled over, if isSubMenuRenderer true
+		 * we have to trigger hovered
+		 **/
+		protected function onMenuRollOver(e:MouseEvent):void
+		{
+			if (isSubMenuRenderer) hovered = true;
+		}
+	}
+}
\ No newline at end of file



Mime
View raw message