/// <summary>
        /// Fires a property change event to listeners
        /// that have been registered to track updates of
        /// all properties or a property with the specified name.
        /// <para>
        /// Any listener can throw a {@code PropertyVetoException} to veto the update.
        /// If one of the listeners vetoes the update, this method passes
        /// a new "undo" {@code PropertyChangeEvent} that reverts to the old value
        /// to all listeners that already confirmed this update
        /// and throws the {@code PropertyVetoException} again.
        /// </para>
        /// <para>
        /// No event is fired if the given event's old and new values are equal and non-null.
        ///
        /// </para>
        /// </summary>
        /// <param name="event">  the {@code PropertyChangeEvent} to be fired </param>
        /// <exception cref="PropertyVetoException"> if one of listeners vetoes the property update </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void fireVetoableChange(PropertyChangeEvent event) throws PropertyVetoException
        public virtual void FireVetoableChange(PropertyChangeEvent @event)
        {
            Object oldValue = @event.OldValue;
            Object newValue = @event.NewValue;

            if (oldValue == null || newValue == null || !oldValue.Equals(newValue))
            {
                String name = @event.PropertyName;

                VetoableChangeListener[] common = this.Map.Get(null);
                VetoableChangeListener[] named  = (name != null) ? this.Map.Get(name) : null;

                VetoableChangeListener[] listeners;
                if (common == null)
                {
                    listeners = named;
                }
                else if (named == null)
                {
                    listeners = common;
                }
                else
                {
                    listeners = new VetoableChangeListener[common.Length + named.Length];
                    System.Array.Copy(common, 0, listeners, 0, common.Length);
                    System.Array.Copy(named, 0, listeners, common.Length, named.Length);
                }
                if (listeners != null)
                {
                    int current = 0;
                    try
                    {
                        while (current < listeners.Length)
                        {
                            listeners[current].VetoableChange(@event);
                            current++;
                        }
                    }
                    catch (PropertyVetoException veto)
                    {
                        @event = new PropertyChangeEvent(this.Source, name, newValue, oldValue);
                        for (int i = 0; i < current; i++)
                        {
                            try
                            {
                                listeners[i].VetoableChange(@event);
                            }
                            catch (PropertyVetoException)
                            {
                                // ignore exceptions that occur during rolling back
                            }
                        }
                        throw veto;                         // rethrow the veto exception
                    }
                }
            }
        }
 /// <summary>
 /// Remove a VetoableChangeListener for a specific property.
 /// If <code>listener</code> was added more than once to the same event
 /// source for the specified property, it will be notified one less time
 /// after being removed.
 /// If <code>propertyName</code> is null, no exception is thrown and no
 /// action is taken.
 /// If <code>listener</code> is null, or was never added for the specified
 /// property, no exception is thrown and no action is taken.
 /// </summary>
 /// <param name="propertyName">  The name of the property that was listened on. </param>
 /// <param name="listener">  The VetoableChangeListener to be removed </param>
 public virtual void RemoveVetoableChangeListener(String propertyName, VetoableChangeListener listener)
 {
     if (listener == null || propertyName == null)
     {
         return;
     }
     listener = this.Map.Extract(listener);
     if (listener != null)
     {
         this.Map.Remove(propertyName, listener);
     }
 }
 /// <summary>
 /// Remove a VetoableChangeListener from the listener list.
 /// This removes a VetoableChangeListener that was registered
 /// for all properties.
 /// If <code>listener</code> was added more than once to the same event
 /// source, it will be notified one less time after being removed.
 /// If <code>listener</code> is null, or was never added, no exception is
 /// thrown and no action is taken.
 /// </summary>
 /// <param name="listener">  The VetoableChangeListener to be removed </param>
 public virtual void RemoveVetoableChangeListener(VetoableChangeListener listener)
 {
     if (listener == null)
     {
         return;
     }
     if (listener is VetoableChangeListenerProxy)
     {
         VetoableChangeListenerProxy proxy = (VetoableChangeListenerProxy)listener;
         // Call two argument remove method.
         RemoveVetoableChangeListener(proxy.PropertyName, proxy.Listener);
     }
     else
     {
         this.Map.Remove(null, listener);
     }
 }
 /// <summary>
 /// Removes a <code>VetoableChangeListener</code>.
 /// If <code>pcl</code> was added more than once to the same event
 /// source for the specified property, it will be notified one less time
 /// after being removed.
 /// If <code>name</code> is null, no exception is thrown
 /// and no action is taken.
 /// If <code>vcl</code> is null, or was never added for the specified
 /// property, no exception is thrown and no action is taken.
 /// </summary>
 /// <param name="name"> The name of the property that was listened on </param>
 /// <param name="vcl"> The <code>VetoableChangeListener</code> to be removed </param>
 public virtual void RemoveVetoableChangeListener(String name, VetoableChangeListener vcl)
 {
     VcSupport.RemoveVetoableChangeListener(name, vcl);
 }
예제 #5
0
		/// <summary>
		/// Removes a <code>VetoableChangeListener</code> from the listener list.
		/// </summary>
		public void removeVetoableChangeListener(VetoableChangeListener @listener)
		{
		}
예제 #6
0
		/// <summary>
		/// Adds a <code>VetoableChangeListener</code> to the listener list.
		/// </summary>
		public void addVetoableChangeListener(VetoableChangeListener @listener)
		{
		}
예제 #7
0
 /// <summary>
 /// Removes a <code>VetoableChangeListener</code> from the listener list.
 /// </summary>
 public void removeVetoableChangeListener(VetoableChangeListener @listener)
 {
 }
예제 #8
0
 /// <summary>
 /// Adds a <code>VetoableChangeListener</code> to the listener list.
 /// </summary>
 public void addVetoableChangeListener(VetoableChangeListener @listener)
 {
 }