* AttributeCollection.cs : implemented FromExisting().
* Container.cs : implemented ValidateName() support.
* ContainerFilterService.cs : FilterComponents() does nothing.
* InstanceCreationEditor.cs : implemented get_Text().
* ContainerTest.cs : added test for ValidateName().
svn path=/trunk/mcs/; revision=88388
}
#if NET_2_0
- [MonoNotSupported("")]
public static AttributeCollection FromExisting (AttributeCollection existing, params Attribute [] newAttributes)
{
- throw new NotImplementedException ();
+ if (existing == null)
+ throw new ArgumentNullException ("existing");
+ AttributeCollection ret = new AttributeCollection ();
+ ret.attrList.AddRange (existing.attrList);
+ if (newAttributes != null)
+ ret.attrList.AddRange (newAttributes);
+ return ret;
}
#endif
+2007-10-29 Atsushi Enomoto <atsushi@ximian.com>
+
+ * AttributeCollection.cs : implemented FromExisting().
+ * Container.cs : implemented ValidateName() support.
+ * ContainerFilterService.cs : FilterComponents() does nothing.
+ * InstanceCreationEditor.cs : implemented get_Text().
+
2007-09-27 Atsushi Enomoto <atsushi@ximian.com>
* TypeDescriptor.cs : added missing ObsoleteAttribute.
if (component.Site != null) {
component.Site.Container.Remove (component);
}
-
+#if NET_2_0
+ ValidateName (component, name);
+#endif
component.Site = this.CreateSite (component, name);
c.Add (component);
}
}
#if NET_2_0
- [MonoNotSupported("")]
protected virtual void ValidateName (IComponent component, string name)
{
- throw new NotImplementedException ();
+ if (component == null)
+ throw new ArgumentNullException ("component");
+ if (name == null)
+ return;
+ foreach (IComponent ic in c)
+ if (ic.Site != null && ic.Site.Name == name)
+ throw new ArgumentException (String.Format ("There already is a named component '{0}' in this container", name));
}
#endif
{
public abstract class ContainerFilterService
{
- [MonoTODO]
public virtual ComponentCollection FilterComponents (ComponentCollection components)
{
- throw new NotImplementedException ();
+ // The default implementation returns the input as is.
+ return components;
}
}
}
{
public abstract class InstanceCreationEditor
{
- [MonoTODO]
public virtual string Text {
- get { throw new NotImplementedException (); }
+ get { return Locale.GetText ("(New ...)"); }
}
public abstract object CreateInstance (ITypeDescriptorContext context, Type type);
+2007-10-29 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ContainerTest.cs : added test for ValidateName().
+
2007-09-28 Jb Evain <jbevain@novell.com>
* TypeConverterTests.cs: test case for bug #329450.
{
_container.Add (new TestComponent ());
}
+
+#if NET_2_0
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ValidateName ()
+ {
+ TestContainer container = new TestContainer ();
+ TestComponent c1 = new TestComponent ();
+ container.Add (c1, "dup");
+ TestComponent c2 = new TestComponent ();
+ container.Add (c2, "dup");
+ }
+#endif
}
}