-/* java.beans.beancontext.BeanContextSupport
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* BeanContextSupport.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
okToUseGui = visible;
initialize ();
-
- throw new Error ("Not implemented");
}
public boolean add (Object targetChild)
{
- throw new Error ("Not implemented");
+ if (targetChild == null)
+ throw new IllegalArgumentException();
+
+ if (children.containsKey(targetChild))
+ return false;
+
+ // FIXME: The second argument is surely wrong.
+ children.put(targetChild, targetChild);
+ return true;
}
public boolean addAll (Collection c)
{
- throw new Error ("Not implemented");
+ throw new UnsupportedOperationException();
}
- public void addBeanContextMembershipListener (BeanContextMembershipListener bcml)
+ public void addBeanContextMembershipListener
+ (BeanContextMembershipListener listener)
{
- throw new Error ("Not implemented");
+ if (! bcmListeners.contains(listener))
+ bcmListeners.add(listener);
}
public boolean avoidingGui ()
public void clear ()
{
- throw new Error ("Not implemented");
+ throw new UnsupportedOperationException();
}
public boolean contains (Object o)
public Locale getLocale ()
{
- throw new Error ("Not implemented");
+ return locale;
}
public URL getResource (String name, BeanContextChild bcc)
protected void initialize ()
{
- throw new Error ("Not implemented");
+ bcmListeners = new ArrayList();
+ children = new HashMap();
}
public Object instantiateChild (String beanName)
public Iterator iterator ()
{
- throw new Error ("Not implemented");
+ return children.keySet().iterator();
}
public boolean needsGui ()
public boolean remove (Object targetChild)
{
- throw new Error ("Not implemented");
+ return remove(targetChild, true);
}
protected boolean remove (Object targetChild, boolean callChildSetBC)
{
+ if (targetChild == null)
+ throw new IllegalArgumentException();
+
throw new Error ("Not implemented");
}
public boolean removeAll (Collection c)
{
- throw new Error ("Not implemented");
+ throw new UnsupportedOperationException();
}
public void removeBeanContextMembershipListener (BeanContextMembershipListener bcml)
public boolean retainAll (Collection c)
{
- throw new Error ("Not implemented");
+ throw new UnsupportedOperationException();
}
protected final void serialize (ObjectOutputStream oos, Collection coll)
public Object[] toArray ()
{
- throw new Error ("Not implemented");
+ return children.keySet().toArray();
}
- public Object[] toArray (Object[] arry)
+ public Object[] toArray(Object[] array)
{
- throw new Error ("Not implemented");
+ return children.keySet().toArray(array);
}
protected boolean validatePendingAdd (Object targetChild)