/// <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 } } } }
private static void Fire(PropertyChangeListener[] listeners, PropertyChangeEvent @event) { if (listeners != null) { foreach (PropertyChangeListener listener in listeners) { listener.PropertyChange(@event); } } }
public void propertyChange(PropertyChangeEvent pcEvent) { String name = pcEvent.getPropertyName(); if (name.Equals("mol")) { currentMol = (Molecule) pcEvent.getNewValue(); textBoxFormula.Text = currentMol.getFormula(); textBoxSmiles.Text = currentMol.toFormat("smiles"); textBoxWeight.Text = Convert.ToString(currentMol.getMass()); } }
/// <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> /// 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> public virtual void FirePropertyChange(PropertyChangeEvent @event) { Object oldValue = @event.OldValue; Object newValue = @event.NewValue; if (oldValue == null || newValue == null || !oldValue.Equals(newValue)) { String name = @event.PropertyName; PropertyChangeListener[] common = this.Map.Get(null); PropertyChangeListener[] named = (name != null) ? this.Map.Get(name) : null; Fire(common, @event); Fire(named, @event); } }
/// <summary> /// Report that we have been modified to any interested listeners. /// </summary> public virtual void FirePropertyChange() { List <PropertyChangeListener> targets; lock (this) { if (Listeners == null) { return; } targets = UnsafeClone(Listeners); } // Tell our listeners that "everything" has changed. PropertyChangeEvent evt = new PropertyChangeEvent(Source_Renamed, null, null, null); for (int i = 0; i < targets.Count; i++) { PropertyChangeListener target = targets[i]; target.PropertyChange(evt); } }
public void propertyChange(PropertyChangeEvent pcEvent) { lock (propertyChangeListeners) { for (int ix = 0; ix < propertyChangeListeners.Count; ix++) { PropertyChangeListener listener = (PropertyChangeListener)propertyChangeListeners[ix]; listener.propertyChange(pcEvent); } } }
public PropertyVetoExceptionThatNetBeansLikes(string mess, PropertyChangeEvent evt) { base.\u002Ector(mess, evt); }
protected internal void notifyListener(string field, System.Object oldValue, System.Object newValue) { if (listeners == null || listeners.Count == 0) { return ; } else { PropertyChangeEvent event_Renamed = new PropertyChangeEvent(this, field, oldValue, newValue); for (int i = 0; i < listeners.Count; i++) { ((java.beans.PropertyChangeListener) listeners[i]).propertyChange(event_Renamed); } } }
public virtual void setDeviceNumber(Integer deviceNumber) { if (deviceNumber != null) { try { if (this.frameGrabber != null) { try { Class @class = this.frameGrabber; Class[] classArray = new Class[1]; int index = 0; // ISSUE: variable of the null type __Null local = Integer.TYPE; classArray[index] = (Class) local; CallerID callerId = CameraDevice.SettingsImplementation.__\u003CGetCallerID\u003E(); @class.getConstructor(classArray, callerId); goto label_10; } catch (NoSuchMethodException ex) { } } else goto label_10; } catch (NoSuchMethodException ex) { goto label_6; } try { Class @class = this.frameGrabber; Class[] classArray = new Class[1]; int index = 0; // ISSUE: variable of the null type __Null local = ClassLiteral<Integer>.Value; classArray[index] = (Class) local; CallerID callerId = CameraDevice.SettingsImplementation.__\u003CGetCallerID\u003E(); @class.getConstructor(classArray, callerId); goto label_10; } catch (NoSuchMethodException ex) { } // ISSUE: variable of the null type __Null local1 = null; goto label_13; label_6: local1 = null; goto label_13; label_10: try { this.setDevicePath((string) null); this.setDeviceFile((File) null); goto label_14; } catch (NoSuchMethodException ex) { } local1 = null; label_13: string mess = new StringBuilder().append(this.frameGrabber.getSimpleName()).append(" does not accept a deviceNumber.").toString(); string str = "deviceNumber"; Integer integer = this.deviceNumber; CameraDevice.SettingsImplementation settingsImplementation = this; // ISSUE: variable of the null type __Null local2 = null; this.deviceNumber = (Integer) null; PropertyChangeEvent evt = new PropertyChangeEvent((object) this, str, (object) integer, (object) local2); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new BaseChildSettings.PropertyVetoExceptionThatNetBeansLikes(mess, evt); } label_14: string description = this.getDescription(); string str1 = "deviceNumber"; Integer integer1 = this.deviceNumber; CameraDevice.SettingsImplementation settingsImplementation1 = this; Integer integer2 = deviceNumber; Integer integer3 = integer2; this.deviceNumber = integer2; this.firePropertyChange(str1, (object) integer1, (object) integer3); this.firePropertyChange("description", (object) description, (object) this.getDescription()); }
public virtual void setDevicePath(string devicePath) { if (devicePath != null) { try { if (this.frameGrabber != null) { Class @class = this.frameGrabber; Class[] classArray = new Class[1]; int index = 0; // ISSUE: variable of the null type __Null local = ClassLiteral<String>.Value; classArray[index] = (Class) local; CallerID callerId = CameraDevice.SettingsImplementation.__\u003CGetCallerID\u003E(); @class.getConstructor(classArray, callerId); } this.setDeviceNumber((Integer) null); this.setDeviceFile((File) null); goto label_6; } catch (NoSuchMethodException ex) { } string mess = new StringBuilder().append(this.frameGrabber.getSimpleName()).append(" does not accept a devicePath.").toString(); string str1 = "devicePath"; string str2 = this.devicePath; CameraDevice.SettingsImplementation settingsImplementation = this; // ISSUE: variable of the null type __Null local1 = null; this.devicePath = (string) null; PropertyChangeEvent evt = new PropertyChangeEvent((object) this, str1, (object) str2, (object) local1); Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new BaseChildSettings.PropertyVetoExceptionThatNetBeansLikes(mess, evt); } label_6: string description = this.getDescription(); string str3 = "devicePath"; string str4 = this.devicePath; CameraDevice.SettingsImplementation settingsImplementation1 = this; string str5 = devicePath; string str6 = str5; this.devicePath = str5; this.firePropertyChange(str3, (object) str4, (object) str6); this.firePropertyChange("description", (object) description, (object) this.getDescription()); }
public void propertyChange(PropertyChangeEvent pcEvent) { String name = pcEvent.getPropertyName(); if (name.Equals("mol")) { currentMol = (Molecule) pcEvent.getNewValue(); updateMolProperties(); } }
/// <summary> /// Constructs a <code>PropertyVetoException</code> with a /// detailed message. /// </summary> /// <param name="mess"> Descriptive message </param> /// <param name="evt"> A PropertyChangeEvent describing the vetoed change. </param> public PropertyVetoException(String mess, PropertyChangeEvent evt) : base(mess) { this.Evt = evt; }
internal void firePropertyChange(PropertyChangeEvent propertyChangeEvent) { throw new NotImplementedException(); }