public void addPropertyChangeListener(String propertyName,
                                              PropertyChangeListener listener)
        {
            lock (this){
                if ((listener != null) && (propertyName != null))
                {
                    PropertyChangeSupport listeners = children.get(propertyName);

                    if (listeners == null)
                    {
                        listeners = new PropertyChangeSupport(source);
                        children.put(propertyName, listeners);
                    }

                    // RI compatibility
                    if (listener is PropertyChangeListenerProxy)
                    {
                        PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy)listener;

                        listeners
                        .addPropertyChangeListener(new PropertyChangeListenerProxy(
                                                       proxy.getPropertyName(),
                                                       (PropertyChangeListener)proxy.getListener()));
                    }
                    else
                    {
                        listeners.addPropertyChangeListener(listener);
                    }
                }
            }
        }
        private void doFirePropertyChange(PropertyChangeEvent eventJ)
        {
            Object oldValue = eventJ.getOldValue();
            Object newValue = eventJ.getNewValue();

            if (oldValue != null && newValue != null && oldValue.equals(newValue))
            {
                return;
            }

            // Collect up the global listeners
            PropertyChangeListener[] gListeners;
            lock (this) {
                gListeners = globalListeners.toArray(new PropertyChangeListener[0]);
            }

            // Fire the events for global listeners
            for (int i = 0; i < gListeners.Length; i++)
            {
                gListeners[i].propertyChange(eventJ);
            }

            // Fire the events for the property specific listeners if any
            if (eventJ.getPropertyName() != null)
            {
                PropertyChangeSupport namedListener = children
                                                      .get(eventJ.getPropertyName());
                if (namedListener != null)
                {
                    namedListener.firePropertyChange(eventJ);
                }
            }
        }
        public void removePropertyChangeListener(String propertyName,
                                                 PropertyChangeListener listener)
        {
            lock (this){
                if ((propertyName != null) && (listener != null))
                {
                    PropertyChangeSupport listeners = children.get(propertyName);

                    if (listeners != null)
                    {
                        listeners.removePropertyChangeListener(listener);
                    }
                }
            }
        }
        public PropertyChangeListener[] getPropertyChangeListeners(
            String propertyName)
        {
            lock (this){
                PropertyChangeSupport listeners = null;

                if (propertyName != null)
                {
                    listeners = children.get(propertyName);
                }

                return((listeners == null) ? new PropertyChangeListener[0]
                : listeners.getPropertyChangeListeners());
            }
        }
 public bool hasListeners(String propertyName)
 {
     lock (this){
         if (globalListeners.size() > 0)
         {
             return(true);
         }
         bool result = false;
         if (propertyName != null)
         {
             PropertyChangeSupport listeners = children.get(propertyName);
             result = (listeners != null && listeners.hasListeners(propertyName));
         }
         return(result);
     }
 }
 public PropertyChangeListener[] getPropertyChangeListeners()
 {
     lock (this){}
     java.util.ArrayList <PropertyChangeListener> result = new java.util.ArrayList <PropertyChangeListener>(
         globalListeners);
     java.util.Iterator <String> it = children.keySet().iterator();
     while (it.hasNext())
     {
         String propertyName = it.next();
         PropertyChangeSupport namedListener = children
                                               .get(propertyName);
         PropertyChangeListener[] listeners = namedListener
                                              .getPropertyChangeListeners();
         for (int i = 0; i < listeners.Length; i++)
         {
             result.add(new PropertyChangeListenerProxy(propertyName,
                                                        listeners[i]));
         }
     }
     return(result.toArray(new PropertyChangeListener[0]));
 }