示例#1
0
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        public static IMappedColumnItem DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IMappedColumnItem wdg = new MappedCellRendererSimpleColor();

            wdg.MappedTo = aArgs.PropertyName;
            return(wdg);
        }
		/// <summary>
		/// Registered factory creation method
		/// </summary>
		/// <param name="aArgs">
		/// Arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IMappedColumnItem"/>
		/// </returns>
		public static IMappedColumnItem DefaultFactoryCreate (FactoryInvocationArgs aArgs)
		{
			IMappedColumnItem wdg = new MappedCellRendererTime();
//			if (aArgs.State == PropertyDefinition.ReadOnly)
			wdg.MappedTo = aArgs.PropertyName;
			return (wdg);
		}
示例#3
0
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        public static IMappedColumnItem DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IMappedColumnItem wdg = new MappedCellRendererIp();

//			if (aArgs.State == PropertyDefinition.ReadOnly)
            wdg.MappedTo = aArgs.PropertyName;
            return(wdg);
        }
示例#4
0
        public static IAdaptableControl DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IAdaptableControl wdg = new DataTextView();

            (wdg as DataTextView).Editable = (aArgs.State != PropertyDefinition.ReadOnly);
            wdg.Mappings = aArgs.PropertyName;
            return(wdg);
        }
		/// <summary>
		/// Registered factory creation method
		/// </summary>
		/// <param name="aArgs">
		/// Arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		public static IAdaptableControl DefaultFactoryCreate (FactoryInvocationArgs aArgs)
		{
			IAdaptableControl wdg;
//			if (aArgs.State == PropertyDefinition.ReadOnly)
				wdg = new DataImage();
//			else
//				wdg = new DataEntry();
			wdg.Mappings = aArgs.PropertyName;
			return (wdg);
		}
		/// <summary>
		/// Registered factory creation method
		/// </summary>
		/// <param name="aArgs">
		/// Arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		public static IAdaptableControl DefaultFactoryCreate (FactoryInvocationArgs aArgs)
		{
			IAdaptableControl wdg;
			if (aArgs.State == PropertyDefinition.ReadOnly)
				wdg = new DataLabel();
			else
				wdg = new DataRadioGroup();
			wdg.Mappings = aArgs.PropertyName;
			return (wdg);
		}
		/// <summary>
		/// Registered factory creation method
		/// </summary>
		/// <param name="aArgs">
		/// Arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		public static IAdaptableControl DefaultFactoryCreate (FactoryInvocationArgs aArgs)
		{
			IAdaptableControl wdg;
			if (aArgs.State == PropertyDefinition.ReadOnly)
				wdg = new DataProgressBar();
			else
				wdg = new DataSpinButton(0, 100, 1);
			wdg.Mappings = aArgs.PropertyName;
			return (wdg);
		}
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        public static IMappedColumnItem DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            MappedCellRendererText wdg = new MappedCellRendererText();

            if (aArgs.State == PropertyDefinition.ReadWrite)
            {
                wdg.Editable = true;
            }
            wdg.MappedTo = aArgs.PropertyName;
            return(wdg);
        }
示例#9
0
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        public static IAdaptableControl DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IAdaptableControl wdg;

//			if (aArgs.State == PropertyDefinition.ReadOnly)
            wdg = new DataImage();
//			else
//				wdg = new DataEntry();
            wdg.Mappings = aArgs.PropertyName;
            return(wdg);
        }
示例#10
0
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        public static IMappedColumnItem DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            MappedCellRendererDate wdg = new MappedCellRendererDate();

            if (aArgs.InvokationHandler == "longdate")
            {
                wdg.LongDate = true;
            }
            wdg.Editable = (aArgs.State == PropertyDefinition.ReadOnly);
            wdg.MappedTo = aArgs.PropertyName;
            return(wdg);
        }
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        public static IMappedColumnItem DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            MappedCellRendererCurrency wdg = new MappedCellRendererCurrency();

            if (aArgs.InvokationHandler == "currency")
            {
                wdg.ShowCurrency = true;
            }
//			if (aArgs.State == PropertyDefinition.ReadOnly)
            wdg.MappedTo = aArgs.PropertyName;
            return(wdg);
        }
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        public static IAdaptableControl DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IAdaptableControl wdg;

            if (aArgs.State == PropertyDefinition.ReadOnly)
            {
                wdg = new DataProgressBar();
            }
            else
            {
                wdg = new DataSpinButton(0, 100, 1);
            }
            wdg.Mappings = aArgs.PropertyName;
            return(wdg);
        }
示例#13
0
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        public static IAdaptableControl DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IAdaptableControl wdg;

            if (aArgs.State == PropertyDefinition.ReadOnly)
            {
                wdg = new DataLabel();
            }
            else
            {
                wdg = new DataEntry();
            }
            wdg.Mappings = aArgs.PropertyName;
            return(wdg);
        }
示例#14
0
        /// <summary>
        /// Registered factory creation method
        /// </summary>
        /// <param name="aArgs">
        /// Arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        public static IAdaptableControl DefaultFactoryCreate(FactoryInvocationArgs aArgs)
        {
            IAdaptableControl wdg = new DataCheckButton();

            wdg.Mappings = aArgs.PropertyName;
            if (aArgs.State == PropertyDefinition.ReadOnly)
            {
                (wdg as DataCheckButton).Editable = false;
            }
            (wdg as DataCheckButton).AutomaticTitle = aArgs.ResolveTitle;
            if ((wdg as DataCheckButton).AutomaticTitle == false)
            {
                (wdg as DataCheckButton).Label = aArgs.Title;
            }
            return(wdg);
        }
		/// <summary>
		/// Factory widget creation
		/// </summary>
		/// <param name="aDefaultMethod">
		/// Default creation method fallback <see cref="CellCreationEvent"/>
		/// </param>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IMappedColumnItem"/>
		/// </returns>
		public static IMappedColumnItem CreateCell (CellCreationEvent aDefaultMethod, FactoryInvocationArgs aArgs)
		{
System.Console.WriteLine("CreateCell");
			if (aDefaultMethod == null)
				aDefaultMethod = new CellCreationEvent (CreateDefaultCellWidget);
			
			IMappedColumnItem 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 = CreateHandlerCell (aDefaultMethod, aArgs);
					break;
				}
			}
			else if ((aArgs.HandlerOverride != "") && (aArgs.HandlerOverride.ToLower().Trim() != "default"))
				wdg = CreateHandlerCell (aDefaultMethod, aArgs);
			else
				wdg = aDefaultMethod (aArgs);
			
			return (wdg);
		}
示例#16
0
 /// <summary>
 /// Factory widget creation
 /// </summary>
 /// <param name="aArgs">
 /// A <see cref="FactoryInvocationArgs"/>
 /// </param>
 /// <returns>
 /// A <see cref="IMappedColumnItem"/>
 /// </returns>
 public static IMappedColumnItem CreateCell(FactoryInvocationArgs aArgs)
 {
     return(WidgetFactory.CreateCell(gtkCellCreationMethod, aArgs));
 }
		/// <summary>
		/// Creates default widgets for properties which don't specify their property description
		/// </summary>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		/// <remarks>
		/// Throws exception
		/// </remarks>
		private static IAdaptableControl CreateDefaultWidget (FactoryInvocationArgs aArgs)
		{
			throw new NotSupportedException ("Default factory method must be specified");
		}
		/// <summary>
		/// Factory handler invokation
		/// </summary>
		/// <param name="aArgs">
		/// Handler name <see cref="System.String"/>
		/// </param>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IAdaptableControl"/>
		/// </returns>
		private static IAdaptableControl InvokeHandler (string aHandler, FactoryInvocationArgs aArgs)
		{
			foreach (string fn in aArgs.Filter)
				foreach (FactoryInvokerClass fi in AllByFilter(fn))
					if (fi.FactoryProvider.HandlerType == aHandler)
						return (fi.Invoke (aArgs));
			throw new NotImplementedException (string.Format ("Handler [{0}] in filter [{1}] is not registered", aHandler, aArgs.Filter));
		}
		/// <summary>
		/// Creates default widgets for properties which don't specify their property description
		/// </summary>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IMappedColumnItem"/>
		/// </returns>
		/// <remarks>
		/// Throws exception
		/// </remarks>
		private static IMappedColumnItem CreateDefaultCellWidget (FactoryInvocationArgs aArgs)
		{
			throw new NotSupportedException ("Default factory method must be specified");
		}
		/// <summary>
		/// Factory handler selector
		/// </summary>
		/// <param name="aDefaultMethod">
		/// Default creation method fallback <see cref="CellCreationEvent"/>
		/// </param>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IMappedColumnItem"/>
		/// </returns>
		private static IMappedColumnItem CreateHandlerCell (CellCreationEvent 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 (InvokeCellHandler (handler, aArgs));
		}
示例#21
0
        /// <summary>
        /// Creates default widgets for properties which don't specify their property description
        /// </summary>
        /// <param name="aArgs">
        /// Widget creation arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IMappedColumnItem"/>
        /// </returns>
        private static IMappedColumnItem CreateDefaultGtkCellWidget(FactoryInvocationArgs aArgs)
        {
            foreach (CellFactoryInvokerClass invoker in AllCellWidgetsForType(aArgs.PropertyInfo.PropertyType))
            {
                return(invoker.Invoke(aArgs));
            }

            // Silly fallback if registration is not done
            IMappedColumnItem wdg = null;

            switch (aArgs.State)
            {
            case PropertyDefinition.ReadOnly:
                if (aArgs.PropertyInfo.PropertyType == typeof(string))
                {
                    wdg = new MappedCellRendererText();
                    break;
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(bool))
                {
                    wdg = new MappedCellRendererToggle();
//					(wdg as DataCheckButton).Editable = false;
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(Gdk.Pixbuf))
                {
                    wdg = new MappedCellRendererPixbuf();
                }
                else
                {
                    wdg = new MappedCellRendererText();
                }
                break;

            case PropertyDefinition.ReadWrite:
                if (aArgs.PropertyInfo.PropertyType == typeof(string))
                {
                    wdg = new MappedCellRendererText();
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(bool))
                {
                    wdg = new MappedCellRendererToggle();
                }
                else if ((aArgs.PropertyInfo.PropertyType == typeof(int)) || (aArgs.PropertyInfo.PropertyType == typeof(float)) || (aArgs.PropertyInfo.PropertyType == typeof(double)))
                {
                    wdg = new MappedCellRendererSpin();
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(DateTime))
                {
                    wdg = new MappedCellRendererText();
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(Gdk.Pixbuf))
                {
                    wdg = new MappedCellRendererPixbuf();
                }
                else
                {
                    wdg = new MappedCellRendererText();
                }
                break;
            }
            wdg.MappedTo = aArgs.PropertyName;

            return(wdg);
        }
		/// <summary>
		/// Factory handler invokation
		/// </summary>
		/// <param name="aArgs">
		/// Handler name <see cref="System.String"/>
		/// </param>
		/// <param name="aArgs">
		/// Widget creation arguments <see cref="FactoryInvocationArgs"/>
		/// </param>
		/// <returns>
		/// Result widget <see cref="IMappedColumnItem"/>
		/// </returns>
		private static IMappedColumnItem InvokeCellHandler (string aHandler, FactoryInvocationArgs aArgs)
		{
			foreach (string fn in aArgs.Filter)
				foreach (CellFactoryInvokerClass fi in AllCellsByFilter(fn))
					if (fi.FactoryProvider.HandlerType == aHandler)
						return (fi.Invoke (aArgs));
			throw new NotImplementedException (string.Format ("Handler [{0}] in filter [{1}] is not registered", aHandler, aArgs.Filter));
		}
示例#23
0
 /// <summary>
 /// Factory widget creation
 /// </summary>
 /// <param name="aArgs">
 /// A <see cref="FactoryInvocationArgs"/>
 /// </param>
 /// <returns>
 /// A <see cref="IAdaptableControl"/>
 /// </returns>
 public static IAdaptableControl CreateWidget(FactoryInvocationArgs aArgs)
 {
     return(WidgetFactory.CreateWidget(gtkCreationMethod, aArgs));
 }
		public IMappedColumnItem Invoke (FactoryInvocationArgs aArgs)
		{
			if (FactoryMethod == null)
				throw new NullReferenceException ("Method can't be null");
			return ((IMappedColumnItem) FactoryMethod.Invoke (null, new object[1] { aArgs }));
		}
示例#25
0
        /// <summary>
        /// Creates default widgets for properties which don't specify their property description
        /// </summary>
        /// <param name="aArgs">
        /// Widget creation arguments <see cref="FactoryInvocationArgs"/>
        /// </param>
        /// <returns>
        /// Result widget <see cref="IAdaptableControl"/>
        /// </returns>
        private static IAdaptableControl CreateDefaultGtkWidget(FactoryInvocationArgs aArgs)
        {
            foreach (FactoryInvokerClass invoker in AllWidgetsForType(aArgs.PropertyInfo.PropertyType))
            {
                return(invoker.Invoke(aArgs));
            }

            // Silly fallback if registration is not done
            IAdaptableControl wdg = null;

            switch (aArgs.State)
            {
            case PropertyDefinition.ReadOnly:
                if (aArgs.PropertyInfo.PropertyType == typeof(string))
                {
                    wdg = new DataLabel(aArgs.PropertyName);
                    break;
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(bool))
                {
                    wdg = new DataCheckButton(aArgs.PropertyName);
                    (wdg as DataCheckButton).Editable = false;
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(Gdk.Pixbuf))
                {
                    wdg = new DataImage(aArgs.PropertyName);
                }
                else
                {
                    wdg = new DataLabel(aArgs.PropertyName);
                }
                break;

            case PropertyDefinition.ReadWrite:
                if (aArgs.PropertyInfo.PropertyType == typeof(string))
                {
                    wdg = new DataEntry(aArgs.PropertyName);
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(bool))
                {
                    wdg = new DataCheckButton(aArgs.PropertyName);
                }
                else if ((aArgs.PropertyInfo.PropertyType == typeof(int)) || (aArgs.PropertyInfo.PropertyType == typeof(float)) || (aArgs.PropertyInfo.PropertyType == typeof(double)))
                {
                    wdg = new DataSpinButton(-100000000, 100000000, 1, aArgs.PropertyName);
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(DateTime))
                {
                    wdg = new DataCalendar(aArgs.PropertyName);
                }
                else if (aArgs.PropertyInfo.PropertyType == typeof(Gdk.Pixbuf))
                {
                    wdg = new DataImage(aArgs.PropertyName);
                }
                else
                {
                    wdg = new DataLabel(aArgs.PropertyName);
                }
                break;
            }
            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);
		}