incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1389146 - in /incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts: AccordionLayout.as supportClasses/NavigatorLayoutBase.as
Date Sun, 23 Sep 2012 21:18:46 GMT
Author: tink
Date: Sun Sep 23 21:18:46 2012
New Revision: 1389146

URL: http://svn.apache.org/viewvc?rev=1389146&view=rev
Log:
Bug fix for some circumstances when an error is thrown when the dateProvider of a target for
an AccordionLayout is changed.

AccordionLayout - If the seletedIndex is bigger than the length of the number of elements
included in the layout, measures the item at index 0.

NavigatorLayoutBase - checks whether the selectedIndex is bigger than the number of items
in the layout. If so, sets the proposed selectedIndex to 0. Also makes use of the indicesInLayout
array to get the selectedElement.

Modified:
    incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/AccordionLayout.as
    incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/supportClasses/NavigatorLayoutBase.as

Modified: incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/AccordionLayout.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/AccordionLayout.as?rev=1389146&r1=1389145&r2=1389146&view=diff
==============================================================================
--- incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/AccordionLayout.as
(original)
+++ incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/AccordionLayout.as
Sun Sep 23 21:18:46 2012
@@ -632,8 +632,9 @@ package ws.tink.spark.layouts
 			}
 			else if( selectedIndex != -1 )
 			{
+				const index:int = selectedIndex >= numElementsInLayout ? numElementsInLayout - 1 :
0
 				// If we are using a virtual layout, cache the size of the selected item.
-				_measuredCache.cache( target.getElementAt( indicesInLayout[ selectedIndex ] ) );
+				_measuredCache.cache( target.getElementAt( indicesInLayout[ index ] ) );
 			}
 			
 			const prevButtonSize:Number = _buttonLayout._totalSize;
@@ -1291,6 +1292,8 @@ internal class MeasuredCache
 
 	public function cache( elt:ILayoutElement ):void
 	{
+		if( !elt ) return;
+		
 		var preferred:Number;
 		var min:Number;
 		

Modified: incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/supportClasses/NavigatorLayoutBase.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/supportClasses/NavigatorLayoutBase.as?rev=1389146&r1=1389145&r2=1389146&view=diff
==============================================================================
--- incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/supportClasses/NavigatorLayoutBase.as
(original)
+++ incubator/flex/whiteboard/tink/navigators/src/ws/tink/spark/layouts/supportClasses/NavigatorLayoutBase.as
Sun Sep 23 21:18:46 2012
@@ -711,7 +711,7 @@ package ws.tink.spark.layouts.supportCla
 			// Only really want to do this if...
 			// a) the number of elements have changed
 			// b) includeLayout has changed on an element
-			// updateElementsInLayout();
+			 updateElementsInLayout();
 			
 			// TODO This was move to measure, but if the target has an explicit size
 			// measure isn't invoked, so checking it here too.
@@ -741,6 +741,12 @@ package ws.tink.spark.layouts.supportCla
 				//				scrollPositionChanged();
 				scrollPositionInvalid = true;
 			}
+			else if( selectedIndex >= _numElementsInLayout )
+			{
+				_selectedIndexInvalid = true;
+				_proposedSelectedIndex = 0;
+				scrollPositionInvalid = true;
+			}
 			
 			if( _targetChanged )
 			{
@@ -785,11 +791,11 @@ package ws.tink.spark.layouts.supportCla
 			{
 				if( useVirtualLayout )
 				{
-					_selectedElement = target ? target.getVirtualElementAt( selectedIndex ) : null;
+					_selectedElement = target ? target.getVirtualElementAt( indicesInLayout[ selectedIndex
] ) : null;
 				}
 				else
 				{
-					_selectedElement = target ? target.getElementAt( selectedIndex ) : null;
+					_selectedElement = target ? target.getElementAt( indicesInLayout[ selectedIndex ] )
: null;
 				}
 			}
 			



Mime
View raw message