[NUI] Move ChangeLayoutSiblingOrder from LayoutGroup to LayoutItem
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 5 Nov 2021 09:03:39 +0000 (18:03 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 9 Nov 2021 05:57:53 +0000 (14:57 +0900)
Previously, ChangeLayoutSiblingOrder was provided by LayoutGroup.
So, any layout class inherited from LayoutItem could not use it.

Now, ChangeLayoutSiblingOrder is moved from LayoutGroup to LayoutItem.
So, all layout classes inherited from LayoutItem can use it.

This PR has been made to resolve the following issue.
https://github.sec.samsung.net/dotnet/NUIBackend/issues/87

src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs

index 78ab3da..f3f4a18 100755 (executable)
@@ -1220,8 +1220,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetValue(SiblingOrderProperty, value);
 
-                LayoutGroup layout = Layout as LayoutGroup;
-                layout?.ChangeLayoutSiblingOrder(value);
+                Layout?.ChangeLayoutSiblingOrder(value);
 
                 NotifyPropertyChanged();
             }
index adc9d2d..b449569 100755 (executable)
@@ -138,33 +138,6 @@ namespace Tizen.NUI
             RequestLayout();
         }
 
-
-        /// <summary>
-        /// Sets the sibling order of the layout item so the layout can be defined within the same parent.
-        /// </summary>
-        /// <param name="order">the sibling order of the layout item</param>
-        /// <since_tizen> 6 </since_tizen>
-        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public void ChangeLayoutSiblingOrder(int order)
-        {
-            if (Owner != null)
-            {
-                var ownerParent = Owner.GetParent() as View;
-                if (ownerParent != null)
-                {
-                    var parent = ownerParent.Layout as LayoutGroup;
-
-                    if (parent != null && parent.LayoutChildren.Count > order)
-                    {
-                        parent.LayoutChildren.Remove(this);
-                        parent.LayoutChildren.Insert(order, this);
-                    }
-                }
-            }
-            RequestLayout();
-        }
-
         /// <summary>
         /// Sets the order of the child layout in the layout group.
         /// </summary>
index 7e19d57..3b074c5 100755 (executable)
@@ -628,5 +628,24 @@ namespace Tizen.NUI
             Dispose(true);
             global::System.GC.SuppressFinalize(this);
         }
+
+        /// <summary>
+        /// Sets the sibling order of the layout item so the layout can be defined within the same parent.
+        /// </summary>
+        /// <param name="order">the sibling order of the layout item</param>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void ChangeLayoutSiblingOrder(int order)
+        {
+            if (Owner != null)
+            {
+                var ownerParent = Owner.GetParent() as View;
+                if (ownerParent != null)
+                {
+                    var parent = ownerParent.Layout as LayoutGroup;
+                    parent?.ChangeLayoutChildOrder(this, order);
+                }
+            }
+        }
     }
 }