Author: gonzalo
Date: 2005-04-07 01:45:31 -0400 (Thu, 07 Apr 2005)
New Revision: 42621

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
Log:
2005-04-07 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * UnitConverter.cs:
        * FontUnitConverter.cs: fixed ConvertTo to work with target
        InstanceDescriptor and value as a string.

        * Unit.cs: culture might be null.

        Fixes bug #74431.



Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2005-04-07 02:01:25 UTC (rev 42620)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2005-04-07 05:45:31 UTC (rev 42621)
@@ -1,3 +1,13 @@
+2005-04-07 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * UnitConverter.cs:
+       * FontUnitConverter.cs: fixed ConvertTo to work with target
+       InstanceDescriptor and value as a string.
+
+       * Unit.cs: culture might be null.
+
+       Fixes bug #74431.
+
 2005-04-01  Lluis Sanchez Gual <[EMAIL PROTECTED]>
 
        * ButtonField.cs: Mostly implemented.

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs   
2005-04-07 02:01:25 UTC (rev 42620)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs   
2005-04-07 05:45:31 UTC (rev 42621)
@@ -86,7 +86,7 @@
 
                public override object ConvertTo(ITypeDescriptorContext 
context, CultureInfo culture, object value, Type destinationType)
                {
-                       if(value != null && value is FontUnit)
+                       if(destinationType == typeof (string) && value is 
FontUnit)
                        {
                                FontUnit val = (FontUnit)value;
                                if(val.Type == FontSize.NotSet)
@@ -96,11 +96,16 @@
                                return val.ToString(culture);
                        }
 #if NET_2_0
-                       if (destinationType == typeof (InstanceDescriptor) && 
value is Unit) {
+                       if (destinationType == typeof (InstanceDescriptor) && 
value is FontUnit) {
                                FontUnit s = (FontUnit) value;
                                MethodInfo met = typeof(FontUnit).GetMethod 
("Parse", new Type[] {typeof(string)});
                                return new InstanceDescriptor (met, new 
object[] {s.ToString ()});
                        }
+
+                       if (destinationType == typeof (InstanceDescriptor) && 
value is string) {
+                               MethodInfo met = typeof(FontUnit).GetMethod 
("Parse", new Type[] {typeof(string)});
+                               return new InstanceDescriptor (met, new 
object[] {value});
+                       }
 #endif
                        return base.ConvertTo(context, culture, value, 
destinationType);
                }

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs        
2005-04-07 02:01:25 UTC (rev 42620)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs        
2005-04-07 05:45:31 UTC (rev 42621)
@@ -285,7 +285,8 @@
                {
                        if(IsEmpty)
                                return String.Empty;
-                       return ( val.ToString(culture.NumberFormat) + 
GetStringFromPixel(type) );
+
+                       return (val.ToString(culture) + 
GetStringFromPixel(type));
                }
        }
 }

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs       
2005-04-07 02:01:25 UTC (rev 42620)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs       
2005-04-07 05:45:31 UTC (rev 42621)
@@ -102,6 +102,11 @@
                                MethodInfo met = typeof(Unit).GetMethod 
("Parse", new Type[] {typeof(string)});
                                return new InstanceDescriptor (met, new 
object[] {s.ToString ()});
                        }
+
+                       if (destinationType == typeof (InstanceDescriptor) && 
value is string) {
+                               MethodInfo met = typeof(Unit).GetMethod 
("Parse", new Type[] {typeof(string)});
+                               return new InstanceDescriptor (met, new 
object[] {value});
+                       }
 #endif
                        
                        return ConvertTo(context, culture, value, 
destinationType);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to