Revert "[NUI] Fix sibling issue (#20)" 69/167269/1
authordongsug.song <dongsug.song@samsung.com>
Tue, 16 Jan 2018 12:26:02 +0000 (21:26 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Tue, 16 Jan 2018 12:26:13 +0000 (21:26 +0900)
This reverts commit da9ec169dab93abd132247eaad37eaf559e99edf.

Change-Id: I216df390cd178fcb398fc14916637af2452ca612

src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Layer.cs

index bd51f9b..78667e0 100755 (executable)
@@ -2222,50 +2222,13 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                var parentChildren = Parent?.Children;
-                int currentOrder = 0;
-                if (parentChildren != null)
-                {
-                    currentOrder = parentChildren.IndexOf(this);
-                    
-                    if (currentOrder < parentChildren.Count)
-                    {
-                        return currentOrder;
-                    }
-                }
-                
-                return currentOrder;
+                int temp = 0;
+                GetProperty(View.Property.SIBLING_ORDER).Get(out temp);
+                return temp;
             }
             set
             {
-                var siblings = Parent?.Children;
-                if (siblings != null)
-                {
-                    int currentOrder = siblings.IndexOf(this);
-
-                    if (value != currentOrder)
-                    {
-                        if (value == 0)
-                        {
-                            LowerToBottom();
-                        }
-                        else if (value < siblings.Count - 1)
-                        {
-                            if (value > currentOrder)
-                            {
-                                RaiseAbove(siblings[value]);
-                            }
-                            else
-                            {
-                                LowerBelow(siblings[value]);
-                            }
-                        }
-                        else
-                        {
-                            RaiseToTop();
-                        }
-                    }
-                }
+                SetProperty(View.Property.SIBLING_ORDER, new Tizen.NUI.PropertyValue(value));
             }
         }
 
index 3a4b84d..f4be7f4 100755 (executable)
@@ -259,8 +259,6 @@ namespace Tizen.NUI
                     parentChildren[currentIdx] = temp;
                 }
             }
-            NDalicPINVOKE.Layer_Raise(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
@@ -284,46 +282,16 @@ namespace Tizen.NUI
 
                 }
             }
-            NDalicPINVOKE.Layer_Lower(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         internal void RaiseAbove(Layer target)
         {
-            var parentChildren = Window.Instance.LayersChildren;
-            if (parentChildren != null)
-            {
-                int currentIndex = parentChildren.IndexOf(this);
-                int targetIndex = parentChildren.IndexOf(target);
-
-                // If the currentIndex is less than the target index and the target has the same parent.
-                if (currentIndex < targetIndex)
-                {
-                    parentChildren.Remove(this);
-                    parentChildren.Insert(targetIndex, this);
-                }
-            }
             NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         internal void LowerBelow(Layer target)
         {
-            var parentChildren = Window.Instance.LayersChildren;
-
-            if (parentChildren != null)
-            {
-                int currentIndex = parentChildren.IndexOf(this);
-                int targetIndex = parentChildren.IndexOf(target);
-
-                // If the currentIndex is not already the 0th index and the target has the same parent.
-                if ((currentIndex != 0) && (targetIndex != -1) &&
-                    (currentIndex > targetIndex))
-                {
-                    parentChildren.Remove(this);
-                    parentChildren.Insert(targetIndex, this);
-                }
-            }
             NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }