[NUI] Refine codes to reduce code duplicaton (#1119)
authorXianbing Teng <xb.teng@samsung.com>
Mon, 18 Nov 2019 06:19:57 +0000 (14:19 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 18 Nov 2019 06:19:57 +0000 (15:19 +0900)
src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs
src/Tizen.NUI/src/public/InputMethodContext.cs
src/Tizen.NUI/src/public/NUIConstants.cs
src/Tizen.NUI/src/public/UIComponents/ScrollViewEvent.cs
src/Tizen.NUI/src/public/VisualConstants.cs
src/Tizen.NUI/src/public/Window.cs

index b082642..c05183b 100755 (executable)
@@ -130,17 +130,7 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("HorizontalAlignment get error!");
             }
 
-            switch (temp)
-            {
-                case "BEGIN":
-                    return HorizontalAlignment.Begin;
-                case "CENTER":
-                    return HorizontalAlignment.Center;
-                case "END":
-                    return HorizontalAlignment.End;
-                default:
-                    return HorizontalAlignment.Begin;
-            }
+            return temp.GetValueByDescription<HorizontalAlignment>();
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
index 500167a..dd03804 100755 (executable)
@@ -181,13 +181,7 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("HorizontalAlignment get error!");
             }
 
-            switch (temp)
-            {
-                case "BEGIN": return HorizontalAlignment.Begin;
-                case "CENTER": return HorizontalAlignment.Center;
-                case "END": return HorizontalAlignment.End;
-                default: return HorizontalAlignment.Begin;
-            }
+            return temp.GetValueByDescription<HorizontalAlignment>();
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -208,13 +202,7 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("VerticalAlignment get error!");
             }
 
-            switch (temp)
-            {
-                case "TOP": return VerticalAlignment.Top;
-                case "CENTER": return VerticalAlignment.Center;
-                case "BOTTOM": return VerticalAlignment.Bottom;
-                default: return VerticalAlignment.Bottom;
-            }
+            return temp.GetValueByDescription<VerticalAlignment>();
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
index dc5b3a6..f49134f 100755 (executable)
@@ -125,13 +125,7 @@ namespace Tizen.NUI.BaseComponents
             string valueToString = "";
             if (newValue != null)
             {
-                switch ((HorizontalAlignment)newValue)
-                {
-                    case HorizontalAlignment.Begin: { valueToString = "BEGIN"; break; }
-                    case HorizontalAlignment.Center: { valueToString = "CENTER"; break; }
-                    case HorizontalAlignment.End: { valueToString = "END"; break; }
-                    default: { valueToString = "BEGIN"; break; }
-                }
+                valueToString = ((HorizontalAlignment)newValue).GetDescription<HorizontalAlignment>();
                 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
             }
         },
@@ -143,13 +137,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("HorizontalAlignment get error!");
             }
-            switch (temp)
-            {
-                case "BEGIN": return HorizontalAlignment.Begin;
-                case "CENTER": return HorizontalAlignment.Center;
-                case "END": return HorizontalAlignment.End;
-                default: return HorizontalAlignment.Begin;
-            }
+            return temp.GetValueByDescription<HorizontalAlignment>();
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -159,13 +147,7 @@ namespace Tizen.NUI.BaseComponents
             string valueToString = "";
             if (newValue != null)
             {
-                switch ((VerticalAlignment)newValue)
-                {
-                    case VerticalAlignment.Top: { valueToString = "TOP"; break; }
-                    case VerticalAlignment.Center: { valueToString = "CENTER"; break; }
-                    case VerticalAlignment.Bottom: { valueToString = "BOTTOM"; break; }
-                    default: { valueToString = "BOTTOM"; break; }
-                }
+                valueToString = ((VerticalAlignment)newValue).GetDescription<VerticalAlignment>();
                 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
             }
         },
@@ -178,13 +160,7 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("VerticalAlignment get error!");
             }
 
-            switch (temp)
-            {
-                case "TOP": return VerticalAlignment.Top;
-                case "CENTER": return VerticalAlignment.Center;
-                case "BOTTOM": return VerticalAlignment.Bottom;
-                default: return VerticalAlignment.Bottom;
-            }
+            return temp.GetValueByDescription<VerticalAlignment>();
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -443,12 +419,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("AutoScrollStopMode get error!");
             }
-            switch (temp)
-            {
-                case "FINISH_LOOP": return AutoScrollStopMode.FinishLoop;
-                case "IMMEDIATE": return AutoScrollStopMode.Immediate;
-                default: return AutoScrollStopMode.FinishLoop;
-            }
+            return temp.GetValueByDescription<AutoScrollStopMode>();
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
index 303eca7..377c1cb 100755 (executable)
@@ -162,13 +162,7 @@ namespace Tizen.NUI.BaseComponents
             string valueToString = "";
             if (newValue != null)
             {
-                switch ((States)newValue)
-                {
-                    case States.Normal: { valueToString = "NORMAL"; break; }
-                    case States.Focused: { valueToString = "FOCUSED"; break; }
-                    case States.Disabled: { valueToString = "DISABLED"; break; }
-                    default: { valueToString = "NORMAL"; break; }
-                }
+                valueToString = ((States)newValue).GetDescription<States>();
                 Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.SUB_STATE, new Tizen.NUI.PropertyValue(valueToString));
             }
         },
@@ -180,13 +174,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("subState get error!");
             }
-            switch (temp)
-            {
-                case "NORMAL": return States.Normal;
-                case "FOCUSED": return States.Focused;
-                case "DISABLED": return States.Disabled;
-                default: return States.Normal;
-            }
+            return temp.GetValueByDescription<States>();
         });
 
         /// <summary>
@@ -340,13 +328,7 @@ namespace Tizen.NUI.BaseComponents
 
             if (newValue != null)
             {
-                switch ((HorizontalAlignmentType)newValue)
-                {
-                    case Tizen.NUI.HorizontalAlignmentType.Left: { valueToString = "left"; break; }
-                    case Tizen.NUI.HorizontalAlignmentType.Center: { valueToString = "center"; break; }
-                    case Tizen.NUI.HorizontalAlignmentType.Right: { valueToString = "right"; break; }
-                    default: { valueToString = "left"; break; }
-                }
+                valueToString = ((HorizontalAlignmentType)newValue).GetDescription<HorizontalAlignmentType>();
                 Tizen.NUI.Object.SetProperty(view.swigCPtr, TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
             }
         },
@@ -359,13 +341,7 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("CellHorizontalAlignment get error!");
             }
 
-            switch (temp)
-            {
-                case "left": return Tizen.NUI.HorizontalAlignmentType.Left;
-                case "center": return Tizen.NUI.HorizontalAlignmentType.Center;
-                case "right": return Tizen.NUI.HorizontalAlignmentType.Right;
-                default: return Tizen.NUI.HorizontalAlignmentType.Left;
-            }
+            return temp.GetValueByDescription<HorizontalAlignmentType>();
         });
 
         /// <summary>
@@ -379,13 +355,7 @@ namespace Tizen.NUI.BaseComponents
 
             if (newValue != null)
             {
-                switch ((VerticalAlignmentType)newValue)
-                {
-                    case Tizen.NUI.VerticalAlignmentType.Top: { valueToString = "top"; break; }
-                    case Tizen.NUI.VerticalAlignmentType.Center: { valueToString = "center"; break; }
-                    case Tizen.NUI.VerticalAlignmentType.Bottom: { valueToString = "bottom"; break; }
-                    default: { valueToString = "top"; break; }
-                }
+                valueToString = ((VerticalAlignmentType)newValue).GetDescription<VerticalAlignmentType>();
                 Tizen.NUI.Object.SetProperty(view.swigCPtr, TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
             }
         },
@@ -398,13 +368,7 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Error("CellVerticalAlignment get error!");
             }
 
-            switch (temp)
-            {
-                case "top": return Tizen.NUI.VerticalAlignmentType.Top;
-                case "center": return Tizen.NUI.VerticalAlignmentType.Center;
-                case "bottom": return Tizen.NUI.VerticalAlignmentType.Bottom;
-                default: return Tizen.NUI.VerticalAlignmentType.Top;
-            }
+            return temp.GetValueByDescription<VerticalAlignmentType>();
         });
 
         /// <summary>
@@ -1021,15 +985,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("DrawMode get error!");
             }
-            switch (temp)
-            {
-                case "NORMAL": return DrawModeType.Normal;
-                case "OVERLAY_2D": return DrawModeType.Overlay2D;
-#pragma warning disable CS0618 // Disable deprecated warning as we do need to use the deprecated API here.
-                case "STENCIL": return DrawModeType.Stencil;
-#pragma warning restore CS0618
-                default: return DrawModeType.Normal;
-            }
+            return temp.GetValueByDescription<DrawModeType>();
         });
 
         /// <summary>
@@ -1072,18 +1028,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("WidthResizePolicy get error!");
             }
-            switch (temp)
-            {
-                case "FIXED": return ResizePolicyType.Fixed;
-                case "USE_NATURAL_SIZE": return ResizePolicyType.UseNaturalSize;
-                case "FILL_TO_PARENT": return ResizePolicyType.FillToParent;
-                case "SIZE_RELATIVE_TO_PARENT": return ResizePolicyType.SizeRelativeToParent;
-                case "SIZE_FIXED_OFFSET_FROM_PARENT": return ResizePolicyType.SizeFixedOffsetFromParent;
-                case "FIT_TO_CHILDREN": return ResizePolicyType.FitToChildren;
-                case "DIMENSION_DEPENDENCY": return ResizePolicyType.DimensionDependency;
-                case "USE_ASSIGNED_SIZE": return ResizePolicyType.UseAssignedSize;
-                default: return ResizePolicyType.Fixed;
-            }
+            return temp.GetValueByDescription<ResizePolicyType>();
         });
 
         /// <summary>
@@ -1106,18 +1051,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("HeightResizePolicy get error!");
             }
-            switch (temp)
-            {
-                case "FIXED": return ResizePolicyType.Fixed;
-                case "USE_NATURAL_SIZE": return ResizePolicyType.UseNaturalSize;
-                case "FILL_TO_PARENT": return ResizePolicyType.FillToParent;
-                case "SIZE_RELATIVE_TO_PARENT": return ResizePolicyType.SizeRelativeToParent;
-                case "SIZE_FIXED_OFFSET_FROM_PARENT": return ResizePolicyType.SizeFixedOffsetFromParent;
-                case "FIT_TO_CHILDREN": return ResizePolicyType.FitToChildren;
-                case "DIMENSION_DEPENDENCY": return ResizePolicyType.DimensionDependency;
-                case "USE_ASSIGNED_SIZE": return ResizePolicyType.UseAssignedSize;
-                default: return ResizePolicyType.Fixed;
-            }
+            return temp.GetValueByDescription<ResizePolicyType>();
         });
 
         /// <summary>
@@ -1130,13 +1064,7 @@ namespace Tizen.NUI.BaseComponents
             string valueToString = "";
             if (newValue != null)
             {
-                switch ((SizeScalePolicyType)newValue)
-                {
-                    case SizeScalePolicyType.UseSizeSet: { valueToString = "USE_SIZE_SET"; break; }
-                    case SizeScalePolicyType.FitWithAspectRatio: { valueToString = "FIT_WITH_ASPECT_RATIO"; break; }
-                    case SizeScalePolicyType.FillWithAspectRatio: { valueToString = "FILL_WITH_ASPECT_RATIO"; break; }
-                    default: { valueToString = "USE_SIZE_SET"; break; }
-                }
+                valueToString = ((SizeScalePolicyType)newValue).GetDescription<SizeScalePolicyType>();
                 Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.SIZE_SCALE_POLICY, new Tizen.NUI.PropertyValue(valueToString));
             }
         },
@@ -1148,13 +1076,7 @@ namespace Tizen.NUI.BaseComponents
             {
                 NUILog.Error("SizeScalePolicy get error!");
             }
-            switch (temp)
-            {
-                case "USE_SIZE_SET": return SizeScalePolicyType.UseSizeSet;
-                case "FIT_WITH_ASPECT_RATIO": return SizeScalePolicyType.FitWithAspectRatio;
-                case "FILL_WITH_ASPECT_RATIO": return SizeScalePolicyType.FillWithAspectRatio;
-                default: return SizeScalePolicyType.UseSizeSet;
-            }
+            return temp.GetValueByDescription<SizeScalePolicyType>();
         });
 
         /// <summary>
index 4e076a3..90c996f 100755 (executable)
@@ -81,14 +81,17 @@ namespace Tizen.NUI.BaseComponents
             /// <summary>
             /// The normal state.
             /// </summary>
+            [Description("NORMAL")]
             Normal,
             /// <summary>
             /// The focused state.
             /// </summary>
+            [Description("FOCUSED")]
             Focused,
             /// <summary>
             /// The disabled state.
             /// </summary>
+            [Description("DISABLED")]
             Disabled
         }
 
index c480517..f3bda4c 100755 (executable)
@@ -903,25 +903,15 @@ namespace Tizen.NUI
         /// This structure is used to pass on data from the IMF regarding predictive text.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        public class EventData : global::System.IDisposable
+        public class EventData : Disposable
         {
             /// <summary>
             /// The state if it owns memory
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
             protected bool swigCMemOwn;
-
-            /// <summary>
-            /// A flag to check if it is already disposed.
-            /// </summary>
-            /// <since_tizen> 5 </since_tizen>
-            protected bool disposed = false;
-
             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
-            //A flag to check who called Dispose(). (By User or DisposeQueue)
-            private bool isDisposeQueued = false;
-
             /// <summary>
             /// The default constructor.
             /// </summary>
@@ -951,19 +941,6 @@ namespace Tizen.NUI
             }
 
             /// <summary>
-            /// Releases the resource.
-            /// </summary>
-            /// <since_tizen> 5 </since_tizen>
-            ~EventData()
-            {
-                if (!isDisposeQueued)
-                {
-                    isDisposeQueued = true;
-                    DisposeQueue.Instance.Add(this);
-                }
-            }
-
-            /// <summary>
             /// The pre-edit or the commit string.
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
@@ -1039,29 +1016,6 @@ namespace Tizen.NUI
                 }
             }
 
-            /// <summary>
-            /// The dispose pattern.
-            /// </summary>
-            /// <since_tizen> 5 </since_tizen>
-            public void Dispose()
-            {
-                //Throw excpetion if Dispose() is called in separate thread.
-                if (!Window.IsInstalled())
-                {
-                    throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
-                }
-
-                if (isDisposeQueued)
-                {
-                    Dispose(DisposeTypes.Implicit);
-                }
-                else
-                {
-                    Dispose(DisposeTypes.Explicit);
-                    System.GC.SuppressFinalize(this);
-                }
-            }
-
             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventData obj)
             {
                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
@@ -1078,21 +1032,13 @@ namespace Tizen.NUI
             /// You can override it to clean-up your own resources.
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
-            protected virtual void Dispose(DisposeTypes type)
+            protected override void Dispose(DisposeTypes type)
             {
                 if (disposed)
                 {
                     return;
                 }
 
-                if (type == DisposeTypes.Explicit)
-                {
-                    //Called by User.
-                    //Release your own managed resources here.
-                    //You should release all of your own disposable objects here.
-
-                }
-
                 //Release your own unmanaged resources here.
                 //You should not access any managed member here except static instance.
                 //because the execution order of Finalizes is non-deterministic.
@@ -1107,7 +1053,7 @@ namespace Tizen.NUI
                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
                 }
 
-                disposed = true;
+                base.Dispose(type);
             }
         }
 
@@ -1115,25 +1061,15 @@ namespace Tizen.NUI
         /// Data required by the IMF from the callback.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        public class CallbackData : global::System.IDisposable
+        public class CallbackData : Disposable
         {
             /// <summary>
             /// The state if it owns memory
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
             protected bool swigCMemOwn;
-
-            /// <summary>
-            /// A Flag to check if it is already disposed.
-            /// </summary>
-            /// <since_tizen> 5 </since_tizen>
-            protected bool disposed = false;
-
             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
-            //A flag to check who called Dispose(). (By User or DisposeQueue)
-            private bool isDisposeQueued = false;
-
             /// <summary>
             /// The default constructor.
             /// </summary>
@@ -1157,19 +1093,6 @@ namespace Tizen.NUI
             }
 
             /// <summary>
-            /// Releases the resource.
-            /// </summary>
-            /// <since_tizen> 5 </since_tizen>
-            ~CallbackData()
-            {
-                if (!isDisposeQueued)
-                {
-                    isDisposeQueued = true;
-                    DisposeQueue.Instance.Add(this);
-                }
-            }
-
-            /// <summary>
             /// The current text string.
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
@@ -1245,29 +1168,6 @@ namespace Tizen.NUI
                 }
             }
 
-            /// <summary>
-            /// The dispose pattern.
-            /// </summary>
-            /// <since_tizen> 5 </since_tizen>
-            public void Dispose()
-            {
-                //Throw excpetion if Dispose() is called in separate thread.
-                if (!Window.IsInstalled())
-                {
-                    throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
-                }
-
-                if (isDisposeQueued)
-                {
-                    Dispose(DisposeTypes.Implicit);
-                }
-                else
-                {
-                    Dispose(DisposeTypes.Explicit);
-                    System.GC.SuppressFinalize(this);
-                }
-            }
-
             internal IntPtr GetCallbackDataPtr()
             {
                 return (IntPtr)swigCPtr;
@@ -1295,21 +1195,13 @@ namespace Tizen.NUI
             /// You can override it to clean-up your own resources.
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
-            protected virtual void Dispose(DisposeTypes type)
+            protected override void Dispose(DisposeTypes type)
             {
                 if (disposed)
                 {
                     return;
                 }
 
-                if (type == DisposeTypes.Explicit)
-                {
-                    //Called by User.
-                    //Release your own managed resources here.
-                    //You should release all of your own disposable objects here.
-
-                }
-
                 //Release your own unmanaged resources here.
                 //You should not access any managed member here except static instance.
                 //Because the execution order of Finalizes is non-deterministic.
@@ -1324,7 +1216,7 @@ namespace Tizen.NUI
                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
                 }
 
-                disposed = true;
+                base.Dispose(type);
             }
         }
 
index 3678baa..93fbcdd 100755 (executable)
@@ -112,10 +112,12 @@ namespace Tizen.NUI
         /// <summary>
         /// The default draw-mode.
         /// </summary>
+        [Description("NORMAL")]
         Normal = 0,
         /// <summary>
         /// Draw the actor and its children as an overlay.
         /// </summary>
+        [Description("OVERLAY_2D")]
         Overlay2D = 1,
 
         /// <summary>
@@ -125,6 +127,7 @@ namespace Tizen.NUI
         /// Deprecated.(API Level 6) Not used.
         /// </remarks>
         [Obsolete("Please do not use this DrawModeType.Stencil(Deprecated). This is replaced by ClippingModeType")]
+        [Description("STENCIL")]
         Stencil = 3
     }
 
@@ -137,35 +140,43 @@ namespace Tizen.NUI
         /// <summary>
         /// Size is fixed as set by SetSize.
         /// </summary>
+        [Description("FIXED")]
         Fixed,
         /// <summary>
         /// Size is to use the actor's natural size.
         /// </summary>
         /// <see cref="ViewImpl.GetNaturalSize"/>
+        [Description("USE_NATURAL_SIZE")]
         UseNaturalSize,
         /// <summary>
         /// Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained.
         /// </summary>
+        [Description("FILL_TO_PARENT")]
         FillToParent,
         /// <summary>
         /// The actors size will be ( ParentSize * SizeRelativeToParentFactor ).
         /// </summary>
+        [Description("SIZE_RELATIVE_TO_PARENT")]
         SizeRelativeToParent,
         /// <summary>
         /// The actors size will be ( ParentSize + SizeRelativeToParentFactor ).
         /// </summary>
+        [Description("SIZE_FIXED_OFFSET_FROM_PARENT")]
         SizeFixedOffsetFromParent,
         /// <summary>
         /// The size will adjust to wrap around all children.
         /// </summary>
+        [Description("FIT_TO_CHILDREN")]
         FitToChildren,
         /// <summary>
         /// One dimension is dependent on the other.
         /// </summary>
+        [Description("DIMENSION_DEPENDENCY")]
         DimensionDependency,
         /// <summary>
         /// The size will be assigned to the actor.
         /// </summary>
+        [Description("USE_ASSIGNED_SIZE")]
         UseAssignedSize
     }
 
@@ -178,14 +189,17 @@ namespace Tizen.NUI
         /// <summary>
         /// Use the size that was set.
         /// </summary>
+        [Description("USE_SIZE_SET")]
         UseSizeSet,
         /// <summary>
         /// Fit within the size set maintaining natural size aspect ratio.
         /// </summary>
+        [Description("FIT_WITH_ASPECT_RATIO")]
         FitWithAspectRatio,
         /// <summary>
         /// Fit within the size set maintaining natural size aspect ratio.
         /// </summary>
+        [Description("FILL_WITH_ASPECT_RATIO")]
         FillWithAspectRatio
     }
 
@@ -539,14 +553,17 @@ namespace Tizen.NUI
         /// <summary>
         /// Align horizontally left.
         /// </summary>
+        [Description("left")]
         Left,
         /// <summary>
         /// Align horizontally center.
         /// </summary>
+        [Description("center")]
         Center,
         /// <summary>
         /// Align horizontally right.
         /// </summary>
+        [Description("right")]
         Right
     }
 
@@ -559,14 +576,17 @@ namespace Tizen.NUI
         /// <summary>
         /// Align vertically top.
         /// </summary>
+        [Description("top")]
         Top,
         /// <summary>
         /// Align vertically center.
         /// </summary>
+        [Description("center")]
         Center,
         /// <summary>
         /// Align vertically bottom.
         /// </summary>
+        [Description("bottom")]
         Bottom
     }
 
@@ -648,10 +668,12 @@ namespace Tizen.NUI
         /// <summary>
         /// Stop animation after current loop finished.
         /// </summary>
+        [Description("FINISH_LOOP")]
         FinishLoop,
         /// <summary>
         /// Stop animation immediately and reset position.
         /// </summary>
+        [Description("IMMEDIATE")]
         Immediate
     }
 
index eed8a46..aba21ef 100755 (executable)
@@ -102,7 +102,7 @@ namespace Tizen.NUI
         /// This will be deprecated
         [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public class SnapEvent : global::System.IDisposable
+        public class SnapEvent : Disposable
         {
             /// <summary>
             /// swigCMemOwn
@@ -112,22 +112,8 @@ namespace Tizen.NUI
             [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
             [EditorBrowsable(EditorBrowsableState.Never)]
             protected bool swigCMemOwn;
-
-            /// <summary>
-            /// A Flat to check if it is already disposed.
-            /// </summary>
-            /// swigCMemOwn
-            /// <since_tizen> 3 </since_tizen>
-            /// This will be deprecated
-            [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
-            [EditorBrowsable(EditorBrowsableState.Never)]
-            protected bool disposed = false;
-
             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
-            //A Flag to check who called Dispose(). (By User or DisposeQueue)
-            private bool isDisposeQueued = false;
-
             /// <summary>
             /// Create an instance of SnapEvent.
             /// </summary>
@@ -147,19 +133,6 @@ namespace Tizen.NUI
             }
 
             /// <summary>
-            /// Dispose
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            ~SnapEvent()
-            {
-                if (!isDisposeQueued)
-                {
-                    isDisposeQueued = true;
-                    DisposeQueue.Instance.Add(this);
-                }
-            }
-
-            /// <summary>
             /// Scroll position.
             /// </summary>
             /// <since_tizen> 3 </since_tizen>
@@ -235,32 +208,6 @@ namespace Tizen.NUI
                 return ret;
             }
 
-            /// <summary>
-            /// Dispose.
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            /// This will be deprecated
-            [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
-            [EditorBrowsable(EditorBrowsableState.Never)]
-            public void Dispose()
-            {
-                //Throw excpetion if Dispose() is called in separate thread.
-                if (!Window.IsInstalled())
-                {
-                    throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
-                }
-
-                if (isDisposeQueued)
-                {
-                    Dispose(DisposeTypes.Implicit);
-                }
-                else
-                {
-                    Dispose(DisposeTypes.Explicit);
-                    System.GC.SuppressFinalize(this);
-                }
-            }
-
             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SnapEvent obj)
             {
                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
@@ -274,21 +221,13 @@ namespace Tizen.NUI
             /// This will be deprecated
             [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
             [EditorBrowsable(EditorBrowsableState.Never)]
-            protected virtual void Dispose(DisposeTypes type)
+            protected override void Dispose(DisposeTypes type)
             {
                 if (disposed)
                 {
                     return;
                 }
 
-                if (type == DisposeTypes.Explicit)
-                {
-                    //Called by User
-                    //Release your own managed resources here.
-                    //You should release all of your own disposable objects here.
-
-                }
-
                 //Release your own unmanaged resources here.
                 //You should not access any managed member here except static instance.
                 //because the execution order of Finalizes is non-deterministic.
@@ -303,7 +242,7 @@ namespace Tizen.NUI
                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
                 }
 
-                disposed = true;
+                base.Dispose(type);
             }
 
         }
index aa31fe1..eb9dd18 100755 (executable)
@@ -63,14 +63,17 @@ namespace Tizen.NUI
         /// <summary>
         /// Texts place at the begin of horizontal direction.
         /// </summary>
+        [Description("BEGIN")]
         Begin,
         /// <summary>
         /// Texts place at the center of horizontal direction.
         /// </summary>
+        [Description("CENTER")]
         Center,
         /// <summary>
         /// Texts place at the end of horizontal direction.
         /// </summary>
+        [Description("END")]
         End
     }
 
@@ -83,14 +86,17 @@ namespace Tizen.NUI
         /// <summary>
         /// Texts place at the top of vertical direction.
         /// </summary>
+        [Description("TOP")]
         Top,
         /// <summary>
         /// Texts place at the center of vertical direction.
         /// </summary>
+        [Description("CENTER")]
         Center,
         /// <summary>
         /// Texts place at the bottom of vertical direction.
         /// </summary>
+        [Description("BOTTOM")]
         Bottom
     }
 
index 2e7d4b6..a9400f9 100755 (executable)
@@ -896,11 +896,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void AddLayer(Layer layer)
         {
-            Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
-            LayersChildren?.Add(layer);
-            layer.SetWindow(this);
+            Add(layer);
         }
 
         /// <summary>
@@ -910,11 +906,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void RemoveLayer(Layer layer)
         {
-            Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
-            LayersChildren?.Remove(layer);
-            layer.SetWindow(null);
+            Remove(layer);
         }
 
         /// <summary>