java.beans.PropertyChangeEvent.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中java.beans.PropertyChangeEvent.<init>()方法的一些代码示例,展示了PropertyChangeEvent.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PropertyChangeEvent.<init>()方法的具体详情如下:
包路径:java.beans.PropertyChangeEvent
类名称:PropertyChangeEvent
方法名:<init>

PropertyChangeEvent.<init>介绍

[英]The constructor used to create a new PropertyChangeEvent.
[中]用于创建新PropertyChangeEvent的构造函数。

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

protected void fireSizeChangedEvent(int oldValue, int newValue) {
  pcs.firePropertyChange(new PropertyChangeEvent(this, SIZE_PROPERTY, oldValue, newValue));
}

代码示例来源:origin: org.codehaus.groovy/groovy

protected void fireSizeChangedEvent(int oldValue, int newValue) {
  pcs.firePropertyChange(new PropertyChangeEvent(this, SIZE_PROPERTY, oldValue, newValue));
}

代码示例来源:origin: org.codehaus.groovy/groovy

protected void fireSizeChangedEvent(int oldValue, int newValue) {
  pcs.firePropertyChange(new PropertyChangeEvent(this, SIZE_PROPERTY, oldValue, newValue));
}

代码示例来源:origin: robovm/robovm

/**
 * Fires a {@link PropertyChangeEvent} with the given name, old value and
 * new value. As source the bean used to initialize this instance is used.
 * If the old value and the new value are not null and equal the event will
 * not be fired.
 *
 * @param propertyName
 *            the name of the property
 * @param oldValue
 *            the old value of the property
 * @param newValue
 *            the new value of the property
 */
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
  firePropertyChange(new PropertyChangeEvent(sourceBean, propertyName, oldValue, newValue));
}

代码示例来源:origin: spring-projects/spring-framework

@Nullable
private Object convertIfNecessary(@Nullable String propertyName, @Nullable Object oldValue,
    @Nullable Object newValue, @Nullable Class<?> requiredType, @Nullable TypeDescriptor td)
    throws TypeMismatchException {
  Assert.state(this.typeConverterDelegate != null, "No TypeConverterDelegate");
  try {
    return this.typeConverterDelegate.convertIfNecessary(propertyName, oldValue, newValue, requiredType, td);
  }
  catch (ConverterNotFoundException | IllegalStateException ex) {
    PropertyChangeEvent pce =
        new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue);
    throw new ConversionNotSupportedException(pce, requiredType, ex);
  }
  catch (ConversionException | IllegalArgumentException ex) {
    PropertyChangeEvent pce =
        new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue);
    throw new TypeMismatchException(pce, requiredType, ex);
  }
}

代码示例来源:origin: groovy/groovy-core

public void updateTargetValue(Object value) {
    listener.propertyChange(new PropertyChangeEvent(proxyObject, propertyName,
        InvokerHelper.getProperty(proxyObject, propertyName), value));
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

final void firePropertyChange(String name, Object o, Object n, Object propagationId) {
  if (changeSupport == null) {
    return;
  }
  if ((o != null) && (n != null) && o.equals(n)) {
    return;
  }
  PropertyChangeEvent e = new PropertyChangeEvent(this, name, o, n);
  e.setPropagationId(propagationId);
  changeSupport.firePropertyChange(e);
}

代码示例来源:origin: org.springframework/spring-beans

@Nullable
private Object convertIfNecessary(@Nullable String propertyName, @Nullable Object oldValue,
    @Nullable Object newValue, @Nullable Class<?> requiredType, @Nullable TypeDescriptor td)
    throws TypeMismatchException {
  Assert.state(this.typeConverterDelegate != null, "No TypeConverterDelegate");
  try {
    return this.typeConverterDelegate.convertIfNecessary(propertyName, oldValue, newValue, requiredType, td);
  }
  catch (ConverterNotFoundException | IllegalStateException ex) {
    PropertyChangeEvent pce =
        new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue);
    throw new ConversionNotSupportedException(pce, requiredType, ex);
  }
  catch (ConversionException | IllegalArgumentException ex) {
    PropertyChangeEvent pce =
        new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue);
    throw new TypeMismatchException(pce, requiredType, ex);
  }
}

代码示例来源:origin: org.apache.commons/commons-lang3

public void setProperty(final String property) {
  final String oldValue = this.property;
  this.property = property;
  listeners.fire().propertyChange(new PropertyChangeEvent(this, "property", oldValue, property));
}

代码示例来源:origin: apache/geode

/**
 * Test setting the session expiration via a property change as would happen under normal
 * deployment conditions.
 */
@Test
public void testSessionExpiration2() throws Exception {
 // TestSessions only live for a minute
 sessionManager.propertyChange(new PropertyChangeEvent(server.getRootContext(), "sessionTimeout",
   new Integer(30), new Integer(1)));
 // Check that the value has been set to 60 seconds
 assertEquals(60, sessionManager.getMaxInactiveInterval());
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

/** Fires property vetoable event.
* @param name name of the property
* @param o old value of the property
* @param n new value of the property
* @exception PropertyVetoException if an listener vetoed the change
*/
protected final void fireVetoableChange(String name, Object o, Object n)
throws PropertyVetoException {
  if (vetoableChangeList == null) {
    return;
  }
  PropertyChangeEvent e = null;
  for (VetoableChangeListener l : vetoableChangeList.getAllListeners()) {
    if (e == null) {
      e = new PropertyChangeEvent(this, name, o, n);
    }
    l.vetoableChange(e);
  }
}

代码示例来源:origin: MovingBlocks/Terasology

/**
 * {@inheritDoc}
 */
@Override
public boolean setValue(T newValue) {
  Preconditions.checkNotNull(newValue, formatWarning("The value of a setting cannot be null."));
  if (!validate(newValue)) {
    return false;
  }
  PropertyChangeEvent event = new PropertyChangeEvent(this, id.toString(), this.value, newValue);
  this.value = newValue;
  dispatchChangedEvent(event);
  return true;
}

代码示例来源:origin: internetarchive/heritrix3

TypeMismatchException tme2 = 
  new TypeMismatchException(
      new PropertyChangeEvent(
          hkp,
          fullpath,

代码示例来源:origin: spring-projects/spring-framework

PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(
    getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue());
if (ex.getTargetException() instanceof ClassCastException) {
PropertyChangeEvent pce = new PropertyChangeEvent(
    getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue());
throw new MethodInvocationException(pce, ex);

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testBindFilteredEventsToMethod() {
  final MultipleEventSource src = new MultipleEventSource();
  final EventCounter counter = new EventCounter();
  EventUtils.bindEventsToMethod(counter, "eventOccurred", src, MultipleEventListener.class, "event1");
  assertEquals(0, counter.getCount());
  src.listeners.fire().event1(new PropertyChangeEvent(new Date(), "Day", Integer.valueOf(0), Integer.valueOf(1)));
  assertEquals(1, counter.getCount());
  src.listeners.fire().event2(new PropertyChangeEvent(new Date(), "Day", Integer.valueOf(1), Integer.valueOf(2)));
  assertEquals(1, counter.getCount());
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testEventDispatchOrder() throws PropertyVetoException {
  final EventListenerSupport<VetoableChangeListener> listenerSupport = EventListenerSupport.create(VetoableChangeListener.class);
  final List<VetoableChangeListener> calledListeners = new ArrayList<>();
  final VetoableChangeListener listener1 = createListener(calledListeners);
  final VetoableChangeListener listener2 = createListener(calledListeners);
  listenerSupport.addListener(listener1);
  listenerSupport.addListener(listener2);
  listenerSupport.fire().vetoableChange(new PropertyChangeEvent(new Date(), "Day", 4, 5));
  assertEquals(calledListeners.size(), 2);
  assertSame(calledListeners.get(0), listener1);
  assertSame(calledListeners.get(1), listener2);
}

代码示例来源:origin: org.apache.commons/commons-lang3

final PropertyChangeEvent evt = new PropertyChangeEvent(new Date(), "Day", 7, 9);
listener.vetoableChange(evt);
EasyMock.replay(listener);

代码示例来源:origin: org.springframework/spring-beans

PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(
    getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue());
if (ex.getTargetException() instanceof ClassCastException) {
PropertyChangeEvent pce = new PropertyChangeEvent(
    getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue());
throw new MethodInvocationException(pce, ex);

代码示例来源:origin: org.apache.commons/commons-lang3

eventListenerSupport.addListener(listener);
final Object source = new Date();
final PropertyChangeEvent ignore = new PropertyChangeEvent(source, "Hour", 5, 6);
final PropertyChangeEvent respond = new PropertyChangeEvent(source, "Day", 6, 7);
listener.vetoableChange(respond);
EasyMock.replay(listener);

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testRemoveListenerDuringEvent() throws PropertyVetoException {
  final EventListenerSupport<VetoableChangeListener> listenerSupport = EventListenerSupport.create(VetoableChangeListener.class);
  for (int i = 0; i < 10; ++i) {
    addDeregisterListener(listenerSupport);
  }
  assertEquals(listenerSupport.getListenerCount(), 10);
  listenerSupport.fire().vetoableChange(new PropertyChangeEvent(new Date(), "Day", 4, 5));
  assertEquals(listenerSupport.getListenerCount(), 0);
}

相关文章