/// <summary>
        /// Factory widget creation
        /// </summary>
        /// <param name="aDefaultMethod">
        /// Default creation method fallback <see cref="WidgetCreationEvent"/>
        /// </param>
        /// <param name="aArgs">
        /// Widget creation arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        public static IAdaptableControl CreateWidget(WidgetCreationEvent aDefaultMethod, FactoryInvocationArgs aArgs)
        {
            if (aDefaultMethod == null)
            {
                aDefaultMethod = new WidgetCreationEvent(CreateDefaultWidget);
            }

            IAdaptableControl wdg = null;

            if (aArgs.PropertyInfo == null)
            {
                return(null);
            }
            if (aArgs.Description != null)
            {
                switch (aArgs.Description.HandlerType)
                {
                case PropertyHandlerType.Default:
                    wdg = aDefaultMethod(aArgs);
                    break;

                case PropertyHandlerType.Custom:
                    wdg = CreateHandlerWidget(aDefaultMethod, aArgs);
                    break;
                }
            }
            else if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
            {
                wdg = CreateHandlerWidget(aDefaultMethod, aArgs);
            }
            else
            {
                wdg = aDefaultMethod(aArgs);
            }

            if (wdg != null)
            {
                wdg.InheritedDataSource = true;
            }
            return(wdg);
        }
		/// <summary>
		/// Factory widget creation
		/// </summary>
		/// <param name="aDefaultMethod">
		/// Default creation method fallback <see cref="WidgetCreationEvent"/>
		/// </param>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		public static IAdaptableControl CreateWidget (WidgetCreationEvent aDefaultMethod, FactoryInvocationArgs aArgs)
		{
			if (aDefaultMethod == null)
				aDefaultMethod = new WidgetCreationEvent (CreateDefaultWidget);
			
			IAdaptableControl wdg = null;
			if (aArgs.PropertyInfo == null)
				return (null);
			if (aArgs.Description != null) {
				switch (aArgs.Description.HandlerType) {
				case PropertyHandlerType.Default:
					wdg = aDefaultMethod (aArgs);
					break;
				case PropertyHandlerType.Custom:
					wdg = CreateHandlerWidget (aDefaultMethod, aArgs);
					break;
				}
			}
			else if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
				wdg = CreateHandlerWidget (aDefaultMethod, aArgs);
			else
				wdg = aDefaultMethod (aArgs);
			
			if (wdg != null)
				wdg.InheritedDataSource = true;
			return (wdg);
		}
        /// <summary>
        /// Factory handler selector
        /// </summary>
        /// <param name="aDefaultMethod">
        /// Default creation method fallback <see cref="WidgetCreationEvent"/>
        /// </param>
        /// <param name="aArgs">
        /// Widget creation arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        private static IAdaptableControl CreateHandlerWidget(WidgetCreationEvent aDefaultMethod, FactoryInvocationArgs aArgs)
        {
            if ((aArgs.HandlerOverride == "") && (aArgs.HandlerOverride.ToLower().Trim() == "default"))
            {
                if (aArgs.Description == null)
                {
                    return(aDefaultMethod(aArgs));
                }

                if (aArgs.Description.HandlerType == PropertyHandlerType.Default)
                {
                    return(aDefaultMethod(aArgs));
                }
            }

            if ((aArgs.Filter == null) || (aArgs.Filter.Length == 0))
            {
                throw new NotSupportedException("Widget created by Handler has to define filter");
            }

            string handler = "default";

            if (aArgs.State == PropertyDefinition.ReadOnly)
            {
                if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
                {
                    handler = aArgs.HandlerOverride;
                }
                else if ((aArgs.Description.ReadOnlyDataTypeHandler != "default") && (aArgs.Description.ReadOnlyDataTypeHandler != ""))
                {
                    handler = aArgs.Description.ReadOnlyDataTypeHandler;
                }
                else if ((aArgs.Description.DataTypeHandler != "default") && (aArgs.Description.DataTypeHandler != ""))
                {
                    handler = aArgs.Description.DataTypeHandler;
                }
                else
                {
                    return(aDefaultMethod(aArgs));
                }
            }
            else
            {
                if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
                {
                    handler = aArgs.HandlerOverride;
                }
                else if ((aArgs.Description.DataTypeHandler != "default") && (aArgs.Description.DataTypeHandler != ""))
                {
                    handler = aArgs.Description.DataTypeHandler;
                }
                else
                {
                    return(aDefaultMethod(aArgs));
                }
            }
            System.Console.WriteLine("Invoking handler [{0}]", handler);
            if (handler == "default")
            {
                return(aDefaultMethod(aArgs));
            }
            return(InvokeHandler(handler, aArgs));
        }
		/// <summary>
		/// Factory handler selector
		/// </summary>
		/// <param name="aDefaultMethod">
		/// Default creation method fallback <see cref="WidgetCreationEvent"/>
		/// </param>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		private static IAdaptableControl CreateHandlerWidget (WidgetCreationEvent aDefaultMethod, FactoryInvocationArgs aArgs)
		{
			if ((aArgs.HandlerOverride == "") && (aArgs.HandlerOverride.ToLower().Trim() == "default")) {
				if (aArgs.Description == null)
					return (aDefaultMethod (aArgs));
			
				if (aArgs.Description.HandlerType == PropertyHandlerType.Default)
					return (aDefaultMethod (aArgs));
			}

			if ((aArgs.Filter == null) || (aArgs.Filter.Length == 0))
				throw new NotSupportedException ("Widget created by Handler has to define filter");
			
			string handler = "default";
			if (aArgs.State == PropertyDefinition.ReadOnly) {
				if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
					handler = aArgs.HandlerOverride;
				else if ((aArgs.Description.ReadOnlyDataTypeHandler != "default") && (aArgs.Description.ReadOnlyDataTypeHandler != ""))
					handler = aArgs.Description.ReadOnlyDataTypeHandler;
				else if ((aArgs.Description.DataTypeHandler != "default") && (aArgs.Description.DataTypeHandler != ""))
					handler = aArgs.Description.DataTypeHandler;
				else
					return (aDefaultMethod (aArgs));
			}
			else {
				if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
					handler = aArgs.HandlerOverride;
				else if ((aArgs.Description.DataTypeHandler != "default") && (aArgs.Description.DataTypeHandler != ""))
					handler = aArgs.Description.DataTypeHandler;
				else
					return (aDefaultMethod (aArgs));
			}
System.Console.WriteLine("Invoking handler [{0}]", handler);
			if (handler == "default")
				return (aDefaultMethod (aArgs));
			return (InvokeHandler (handler, aArgs));
		}