[Tizen.NUI]Fix bug about Children property. (#23)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Wed, 10 Jan 2018 12:16:30 +0000 (21:16 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 10 Jan 2018 12:16:30 +0000 (21:16 +0900)
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Layer.cs

index bd51f9b..d66053c 100755 (executable)
@@ -49,11 +49,18 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 4 </since_tizen>
         public override void Add(View child)
         {
-            NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
-            Children.Add(child);
+            Container oldParent = child.Parent;
+            if(oldParent != this)
+            {
+                if (oldParent != null)
+                {
+                    oldParent.Remove(child);
+                }
+                NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                Children.Add(child);
+            }
         }
 
         /// <summary>
@@ -3701,6 +3708,22 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+
+        /// <summary>
+        /// [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")]
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
+        [Obsolete("Please do not use! This will be deprecated! Please use Visibility instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Visible
+        {
+            get
+            {
+                return IsVisible();
+            }
+        }
+
+
         /// <summary>
         /// Gets the view's world color.
         /// </summary>
index 3a4b84d..ab65d84 100755 (executable)
@@ -49,11 +49,18 @@ namespace Tizen.NUI
         /// <since_tizen> 4 </since_tizen>
         public override void Add(View child)
         {
-            NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
-            Children.Add(child);
+            Container oldParent = child.GetParent();
+            if (oldParent != this)
+            {
+                if (oldParent != null)
+                {
+                    oldParent.Remove(child);
+                }
+                NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                Children.Add(child);
+            }
         }
 
         /// <summary>