[NUI] replace NUI.ISelectorItem with System.ICloneable (#1965)
authorYeongJong Lee <cleanlyj@naver.com>
Tue, 1 Sep 2020 10:26:15 +0000 (19:26 +0900)
committerGitHub <noreply@github.com>
Tue, 1 Sep 2020 10:26:15 +0000 (19:26 +0900)
`Tizen.NUI.ISelectorItem` and `System.ICloneable` are exactly same
interface.

16 files changed:
src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ISelectorItem.cs [deleted file]
src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs
src/Tizen.NUI/src/public/Color.cs
src/Tizen.NUI/src/public/Extents.cs
src/Tizen.NUI/src/public/Position.cs
src/Tizen.NUI/src/public/Position2D.cs
src/Tizen.NUI/src/public/Rectangle.cs
src/Tizen.NUI/src/public/Size.cs
src/Tizen.NUI/src/public/Size2D.cs
src/Tizen.NUI/src/public/Vector2.cs
src/Tizen.NUI/src/public/Vector3.cs
src/Tizen.NUI/src/public/Vector4.cs
src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs
src/Tizen.NUI/src/public/ViewProperty/Shadow.cs
src/Tizen.NUI/src/public/ViewProperty/TextShadow.cs

index 1a8dd10..82aabb3 100755 (executable)
@@ -835,7 +835,7 @@ namespace Tizen.NUI.BaseComponents
     /// A class containing frame informations for a LottieAnimationView.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class LottieFrameInfo : ISelectorItem
+    public class LottieFrameInfo : ICloneable
     {
         /// <summary>
         /// Creates a new instance with a playing range.
diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/ISelectorItem.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/ISelectorItem.cs
deleted file mode 100644 (file)
index 1ec5e37..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System.ComponentModel;
-
-namespace Tizen.NUI
-{
-    /// <summary>
-    /// An interface for the Selector and the Selector item.
-    /// Selector item class should implement this.
-    /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    public interface ISelectorItem
-    {
-        /// <summary>
-        /// Deep copy.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        object Clone();
-    }
-}
index 6c05400..6c9e8a7 100755 (executable)
@@ -24,13 +24,13 @@ namespace Tizen.NUI.BaseComponents
     /// <summary>
     /// Selector class, which is related by Control State, it is base class for other Selector.
     /// </summary>
+    /// <typeparam name="T">The property type of the selector. if it's reference type, it should be of type <see cref="ICloneable"/> that implement deep copy in <see cref="ICloneable.Clone"/>.</typeparam>
     /// <since_tizen> 6 </since_tizen>
     /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class Selector<T> : StateValueCollection<T>
     {
-        private readonly bool isSelectorItem = typeof(ISelectorItem).IsAssignableFrom(typeof(T));
-
+        private readonly bool isCloneable = typeof(ICloneable).IsAssignableFrom(typeof(T));
         /// <since_tizen> 6 </since_tizen>
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         public static implicit operator Selector<T>(T value)
@@ -48,7 +48,7 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Selector(T value) : this()
         {
-            All = isSelectorItem ? (T)((ISelectorItem)value)?.Clone() : value;
+            All = isCloneable ? (T)((ICloneable)value)?.Clone() : value;
         }
 
         /// Copy constructor
@@ -338,12 +338,12 @@ namespace Tizen.NUI.BaseComponents
         {
             Clear();
 
-            if (isSelectorItem)
+            if (isCloneable)
             {
-                All = (T)((ISelectorItem)other.All)?.Clone();
+                All = (T)((ICloneable)other.All)?.Clone();
                 foreach (var item in other.StateValueList)
                 {
-                    AddWithoutCheck(new StateValuePair<T>(item.State, (T)((ISelectorItem)item.Value)?.Clone()));
+                    AddWithoutCheck(new StateValuePair<T>(item.State, (T)((ICloneable)item.Value)?.Clone()));
                 }
             }
             else
index e5c8ec6..3778d54 100755 (executable)
@@ -26,7 +26,7 @@ namespace Tizen.NUI
     /// The Color class.
     /// </summary>
     [Tizen.NUI.Binding.TypeConverter(typeof(ColorTypeConverter))]
-    public class Color : Disposable, ISelectorItem
+    public class Color : Disposable, ICloneable
     {
         /// <summary>
         /// Gets the black colored Color class.
index b77d984..2652b30 100755 (executable)
@@ -14,6 +14,7 @@
 * limitations under the License.
 *
 */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
 
@@ -24,7 +25,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 4 </since_tizen>
     [Binding.TypeConverter(typeof(ExtentsTypeConverter))]
-    public class Extents : Disposable, ISelectorItem
+    public class Extents : Disposable, ICloneable
     {
 
 
index fb92ad6..f0060d6 100755 (executable)
@@ -27,7 +27,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Tizen.NUI.Binding.TypeConverter(typeof(PositionTypeConverter))]
-    public class Position : Disposable, ISelectorItem
+    public class Position : Disposable, ICloneable
     {
 
         /// <summary>
index da844d6..11204a8 100755 (executable)
@@ -26,7 +26,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Tizen.NUI.Binding.TypeConverter(typeof(Position2DTypeConverter))]
-    public class Position2D : Disposable, ISelectorItem
+    public class Position2D : Disposable, ICloneable
     {
         private Position2DChangedCallback callback = null;
 
index 1d849ec..63241af 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
 
@@ -24,7 +25,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Binding.TypeConverter(typeof(RectangleTypeConverter))]
-    public class Rectangle : Disposable, ISelectorItem
+    public class Rectangle : Disposable, ICloneable
     {
         /// <summary>
         /// The constructor.
index 44a2a0d..72a1014 100755 (executable)
@@ -26,7 +26,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 5 </since_tizen>
     [Tizen.NUI.Binding.TypeConverter(typeof(SizeTypeConverter))]
-    public class Size : Disposable, ISelectorItem
+    public class Size : Disposable, ICloneable
     {
 
         /// <summary>
index ee365bf..4da1854 100755 (executable)
@@ -14,9 +14,9 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
-using System.ComponentModel;
 
 namespace Tizen.NUI
 {
@@ -25,7 +25,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Tizen.NUI.Binding.TypeConverter(typeof(Size2DTypeConverter))]
-    public class Size2D : Disposable, ISelectorItem
+    public class Size2D : Disposable, ICloneable
     {
 
         private Size2DChangedCallback callback = null;
index d26cfac..f25465a 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
 
@@ -25,7 +26,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Binding.TypeConverter(typeof(Vector2TypeConverter))]
-    public class Vector2 : Disposable, ISelectorItem
+    public class Vector2 : Disposable, ICloneable
     {
 
         /// <summary>
index 0f4285e..92f4817 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
 
@@ -25,7 +26,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Binding.TypeConverter(typeof(Vector3TypeConverter))]
-    public class Vector3 : Disposable, ISelectorItem
+    public class Vector3 : Disposable, ICloneable
     {
         /// <summary>
         /// The constructor.
index 31d8e8d..bf060c1 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
 
@@ -25,7 +26,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Binding.TypeConverter(typeof(Vector4TypeConverter))]
-    public class Vector4 : Disposable, ISelectorItem
+    public class Vector4 : Disposable, ICloneable
     {
 
         /// <summary>
index 4e45424..891351b 100644 (file)
@@ -25,7 +25,7 @@ namespace Tizen.NUI
     /// The Shadow composed of image for View
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class ImageShadow : ShadowBase, ISelectorItem
+    public class ImageShadow : ShadowBase, ICloneable
     {
         private static readonly Rectangle noBorder = new Rectangle();
 
index ac92045..680b010 100644 (file)
@@ -25,7 +25,7 @@ namespace Tizen.NUI
     /// Represents a shadow with color and blur radius for a View.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class Shadow : ShadowBase, ISelectorItem
+    public class Shadow : ShadowBase, ICloneable
     {
         private static readonly Color noColor = new Color(0, 0, 0, 0);
 
index bddc297..af116f8 100755 (executable)
@@ -24,7 +24,7 @@ namespace Tizen.NUI
     /// The Text Shadow for TextLabel.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class TextShadow : ISelectorItem
+    public class TextShadow : ICloneable
     {
         private readonly PropertyMap propertyMap = null;