You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2013/03/25 00:07:01 UTC

[3/4] git commit: implement removeItem method from IList in the rest of classes implementing the interface in the flex-sdk

implement removeItem method from IList in the rest of classes implementing the interface in the flex-sdk


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/461281f5
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/461281f5
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/461281f5

Branch: refs/heads/develop
Commit: 461281f5818f25319391c6188805512cebc4d977
Parents: 77f94e1
Author: Carlos Rovira <ca...@gmail.com>
Authored: Mon Mar 25 00:04:16 2013 +0100
Committer: Carlos Rovira <ca...@gmail.com>
Committed: Mon Mar 25 00:04:16 2013 +0100

----------------------------------------------------------------------
 .../src/spark/components/DataNavigator.as          |   13 +++++++++
 .../src/spark/components/DataNavigatorGroup.as     |   17 ++++++++++++
 .../experimental/src/spark/containers/Navigator.as |   13 +++++++++
 .../src/spark/containers/NavigatorGroup.as         |   18 +++++++++++++
 .../framework/src/mx/collections/AsyncListView.as  |   18 +++++++++++++
 .../framework/src/mx/collections/XMLListAdapter.as |   20 ++++++++++++++-
 .../src/spark/components/TabbedViewNavigator.as    |   18 +++++++++++++
 .../projects/mx/src/mx/containers/ViewStack.as     |   10 +++++++
 .../src/spark/collections/NumericDataProvider.as   |   16 ++++++++++++
 .../src/spark/collections/OnDemandDataProvider.as  |   16 ++++++++++++
 .../spark/src/spark/collections/SubListView.as     |    5 +++
 11 files changed, 163 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/experimental/src/spark/components/DataNavigator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental/src/spark/components/DataNavigator.as b/frameworks/projects/experimental/src/spark/components/DataNavigator.as
index c939851..78987fb 100644
--- a/frameworks/projects/experimental/src/spark/components/DataNavigator.as
+++ b/frameworks/projects/experimental/src/spark/components/DataNavigator.as
@@ -1015,6 +1015,19 @@ package spark.components
 		}
 		
 		/**
+		 *  @copy spark.components.DataNavigatorGroup#removeItem
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.10
+		 */
+		public function removeItem( item:Object ):Boolean
+		{
+			return dataProvider.removeItem( item );
+		}
+		
+		/**
 		 *  @copy spark.components.DataNavigatorGroup#removeItemAt
 		 *  
 		 *  @langversion 3.0

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/experimental/src/spark/components/DataNavigatorGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental/src/spark/components/DataNavigatorGroup.as b/frameworks/projects/experimental/src/spark/components/DataNavigatorGroup.as
index aa74554..03172f8 100644
--- a/frameworks/projects/experimental/src/spark/components/DataNavigatorGroup.as
+++ b/frameworks/projects/experimental/src/spark/components/DataNavigatorGroup.as
@@ -469,6 +469,23 @@ package spark.components
 		}
 		
 		/**
+		 *  Removes the specified item from the list.
+		 *
+		 *  @param the item to remove.
+		 *
+		 *  @return boolean true if the item was removed
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.10
+		 */
+		public function removeItem( item:Object ):Boolean
+		{
+			return dataProvider.removeItem(item);
+		}
+		
+		/**
 		 *  Removes the item at the specified index and returns it.  
 		 *  Any items that were after this index are now one index earlier.
 		 *

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/experimental/src/spark/containers/Navigator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental/src/spark/containers/Navigator.as b/frameworks/projects/experimental/src/spark/containers/Navigator.as
index 9e0274b..6743bb3 100644
--- a/frameworks/projects/experimental/src/spark/containers/Navigator.as
+++ b/frameworks/projects/experimental/src/spark/containers/Navigator.as
@@ -940,6 +940,19 @@ package spark.containers
 		}
 		
 		/**
+		 *  @copy spark.containers.NavigatorGroup#removeItem
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.10
+		 */
+		public function removeItem( item:Object ):Boolean
+		{
+			return currentContentGroup.removeItem( item );
+		}
+	
+		/**
 		 *  @copy spark.containers.NavigatorGroup#removeItemAt
 		 *  
 		 *  @langversion 3.0

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/experimental/src/spark/containers/NavigatorGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/experimental/src/spark/containers/NavigatorGroup.as b/frameworks/projects/experimental/src/spark/containers/NavigatorGroup.as
index 35eb4c7..3a4cb9f 100644
--- a/frameworks/projects/experimental/src/spark/containers/NavigatorGroup.as
+++ b/frameworks/projects/experimental/src/spark/containers/NavigatorGroup.as
@@ -467,6 +467,24 @@ package spark.containers
 		}
 		
 		/**
+		 *  Removes the specified item from the list.
+		 *
+		 *  @param the item to remove.
+		 *
+		 *  @return boolean true if the item was removed
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10
+		 *  @playerversion AIR 1.5
+		 *  @productversion Flex 4.10
+		 */
+		public function removeItem( item:Object ):Boolean
+		{
+			var element:IVisualElement = removeElement(item as IVisualElement);
+			return element != null;
+		}
+		
+		/**
 		 *  Removes the item at the specified index and returns it.  
 		 *  Any items that were after this index are now one index earlier.
 		 *

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/framework/src/mx/collections/AsyncListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/collections/AsyncListView.as b/frameworks/projects/framework/src/mx/collections/AsyncListView.as
index b002c19..336fe8e 100644
--- a/frameworks/projects/framework/src/mx/collections/AsyncListView.as
+++ b/frameworks/projects/framework/src/mx/collections/AsyncListView.as
@@ -821,6 +821,24 @@ public class AsyncListView extends OnDemandEventDispatcher implements IList
         if (list)
             list.removeAll();
     }
+	
+	/**
+	 *  Removes the specified item from this list, should it exist.
+	 *  Relies on ArrayList implementation
+	 *
+	 *  @param  item Object reference to the item that should be removed.
+	 *  @return Boolean indicating if the item was removed.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Apache Flex 4.10
+	 */
+	public function removeItem( item:Object ):Boolean
+	{
+		var item:Object = removeItemAt(getItemIndex(item));
+		return item != null;
+	}
     
     /**
      *  Removes the actual or pending item at the specified index and returns it.

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
index 3d1a962..9123a38 100644
--- a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
+++ b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
@@ -401,7 +401,25 @@ public class XMLListAdapter extends EventDispatcher implements IList, IXMLNotifi
             }
         }
     }
-
+	
+	/**
+	 *  Removes the specified item from this list, should it exist.
+	 *  Relies on ArrayList implementation
+	 *
+	 *  @param  item Object reference to the item that should be removed.
+	 *  @return Boolean indicating if the item was removed.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Apache Flex 4.10
+	 */
+	public function removeItem( item:Object ):Boolean
+	{
+		var item:Object = removeItemAt[getItemIndex(item)];
+		return item != null;
+	}
+	
     /**
      *  Remove the item at the specified index and return it.  Any items
      *  that were after this index are now one index earlier.

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigator.as b/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigator.as
index 99c7a7a..108bd36 100644
--- a/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigator.as
+++ b/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigator.as
@@ -1531,6 +1531,24 @@ public class TabbedViewNavigator extends ViewNavigatorBase implements ISelectabl
         navigators = null;
     }
     
+	/**
+	 *  Removes the specified item from this list, should it exist.
+	 *  Relies on ArrayList implementation
+	 *
+	 *  @param  item Object reference to the item that should be removed.
+	 *  @return Boolean indicating if the item was removed.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Apache Flex 4.10
+	 */
+	public function removeItem( item:Object ):Boolean
+	{
+		var element:IVisualElement = removeElement(item as ViewNavigatorBase);
+		return element != null;
+	}
+	
     /**
      *  Remove the view navigator at the specified index and return it.  
      *  The index of any items that were after this index are decreased by one.

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/mx/src/mx/containers/ViewStack.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/containers/ViewStack.as b/frameworks/projects/mx/src/mx/containers/ViewStack.as
index 1f1b9fb..e2b97d5 100644
--- a/frameworks/projects/mx/src/mx/containers/ViewStack.as
+++ b/frameworks/projects/mx/src/mx/containers/ViewStack.as
@@ -1594,6 +1594,16 @@ public class ViewStack extends Container implements IHistoryManagerClient, ISele
     {
         removeAllChildren();
     }
+	
+	/**
+	 *  @private
+	 *  IList implementation of removeItem calls removeChild
+	 */
+	public function removeItem(item:Object):Boolean
+	{
+		var displayObject:DisplayObject = removeChild(item as DisplayObject);
+		return displayObject != null;
+	}
 
     /**
      *  @private

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/spark/src/spark/collections/NumericDataProvider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/collections/NumericDataProvider.as b/frameworks/projects/spark/src/spark/collections/NumericDataProvider.as
index e02b6b0..96b6f35 100644
--- a/frameworks/projects/spark/src/spark/collections/NumericDataProvider.as
+++ b/frameworks/projects/spark/src/spark/collections/NumericDataProvider.as
@@ -351,6 +351,22 @@ public class NumericDataProvider extends OnDemandEventDispatcher implements ILis
             "collections", "removeAllError");
         throw new Error(message);
     }
+	
+	/**
+	 *  This function is not supported.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 11
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.10
+	 */
+	public function removeItem(item:Object):Boolean
+	{
+		var message:String = resourceManager.getString(
+			"collections", "removeItemError");
+		throw new Error(message);
+		return null;
+	}
     
     /**
      *  This function is not supported.

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/spark/src/spark/collections/OnDemandDataProvider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/collections/OnDemandDataProvider.as b/frameworks/projects/spark/src/spark/collections/OnDemandDataProvider.as
index b54942d..bf241d4 100644
--- a/frameworks/projects/spark/src/spark/collections/OnDemandDataProvider.as
+++ b/frameworks/projects/spark/src/spark/collections/OnDemandDataProvider.as
@@ -195,6 +195,22 @@ public class OnDemandDataProvider extends OnDemandEventDispatcher implements ILi
         throw new Error(message);
     }
     
+	/**
+	 *  This function is not supported.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 11
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.10
+	 */
+	public function removeItem(item:Object):Boolean
+	{
+		var message:String = resourceManager.getString(
+			"collections", "removeItemError");
+		throw new Error(message);
+		return null;
+	}
+	
     /**
      *  This function is not supported
      * 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/461281f5/frameworks/projects/spark/src/spark/collections/SubListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/collections/SubListView.as b/frameworks/projects/spark/src/spark/collections/SubListView.as
index 4f1eeb9..f76e87e 100644
--- a/frameworks/projects/spark/src/spark/collections/SubListView.as
+++ b/frameworks/projects/spark/src/spark/collections/SubListView.as
@@ -379,6 +379,11 @@ public class SubListView extends EventDispatcher implements IList
             list.removeAll();
     }
     
+	public function removeItem(item:Object):Boolean
+	{
+		return (list) ? list.removeItem( item ) : false;
+	}
+	
     public function removeItemAt(index:int):Object
     {
         return (list) ? list.removeItemAt(startIndex + index) : null;