Example usage for java.beans PropertyChangeEvent PropertyChangeEvent

List of usage examples for java.beans PropertyChangeEvent PropertyChangeEvent

Introduction

In this page you can find the example usage for java.beans PropertyChangeEvent PropertyChangeEvent.

Prototype

public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue) 

Source Link

Document

Constructs a new PropertyChangeEvent .

Usage

From source file:blue.Marker.java

public void setName(String name) {
    String oldName = name;//from   w  ww  .ja va 2  s.  c  o m

    this.name = name;

    PropertyChangeEvent pce = new PropertyChangeEvent(this, "name", oldName, name);

    firePropertyChangeEvent(pce);
}

From source file:blue.Marker.java

public void setTime(float time) {
    float oldVal = this.time;

    this.time = time;

    PropertyChangeEvent pce = new PropertyChangeEvent(this, "time", new Float(oldVal), new Float(time));

    firePropertyChangeEvent(pce);/*  w w  w  .  j  a  v a 2  s  .  co m*/
}

From source file:blue.soundObject.pianoRoll.PianoNote.java

public void setDuration(float duration) {
    PropertyChangeEvent pce = new PropertyChangeEvent(this, "duration", new Float(this.duration),
            new Float(duration));
    this.duration = duration;
    firePropertyChange(pce);//from  w  w w  .  j  a  v  a 2s . c o m
}

From source file:org.jbb.lib.properties.UpdateFilePropertyChangeListenerTest.java

@Test
public void shouldUpdateFileContent_whenPropertyChange() throws Exception {
    // given//from   w ww.j a  v a 2s. c  o  m
    // see setUp method

    // when
    listener.propertyChange(new PropertyChangeEvent(testPropertyFile, "foo", "test1", "new"));

    // then
    assertThat(FileUtils.contentEquals(testPropertyFile,
            new ClassPathResource("test1-after-change-event.properties").getFile())).isTrue();
}

From source file:blue.soundObject.pianoRoll.PianoNote.java

public void setOctave(int octave) {
    PropertyChangeEvent pce = new PropertyChangeEvent(this, "octave", new Integer(this.octave),
            new Integer(octave));
    this.octave = octave;
    firePropertyChange(pce);/*from w ww. ja v a 2s. c o m*/
}

From source file:org.polymap.model2.runtime.event.PropertyChangeSupport.java

protected void fireEvent(Object oldValue, Object newValue) {
    PropertyInfo info = delegate.info();
    Entity entity = context.getCompositePart(Entity.class);
    PropertyChangeEvent event = new PropertyChangeEvent(entity, info.getName(), oldValue, newValue);
    EventManager.instance().publish(event);
}

From source file:org.jbb.lib.properties.UpdateFilePropertyChangeListenerTest.java

@Test
public void shouldPropagateConfigurationException_whenPropertyFileSuddenlyLost() {
    // given//from   ww w . j a v a2  s. c  o m
    // see setUp method

    // when
    testPropertyFile.delete();

    try {
        listener.propertyChange(new PropertyChangeEvent(testPropertyFile, "foo", "test1", "new"));
    } catch (RuntimeException e) {
        // then
        assertThat(e).hasRootCauseInstanceOf(ConfigurationException.class);
    }
}

From source file:zlicense.de.schlichtherle.xml.GenericCertificate.java

public final synchronized void sign(Object paramObject, PrivateKey paramPrivateKey, Signature paramSignature)
        throws NullPointerException, GenericCertificateIsLockedException, PropertyVetoException,
        PersistenceServiceException, InvalidKeyException {
    if (paramPrivateKey == null) {
        throw new NullPointerException("signingKey");
    }/*  ww w  . j  av a  2  s.  co m*/
    if (paramSignature == null) {
        throw new NullPointerException("signingEngine");
    }
    PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(this, "locked",
            Boolean.valueOf(isLocked()), Boolean.TRUE);
    if (isLocked()) {
        throw new GenericCertificateIsLockedException(localPropertyChangeEvent);
    }
    fireVetoableChange(localPropertyChangeEvent);
    try {
        byte[] arrayOfByte1 = PersistenceService.store2ByteArray(paramObject);
        paramSignature.initSign(paramPrivateKey);
        paramSignature.update(arrayOfByte1);
        byte[] arrayOfByte2 = Base64.encodeBase64(paramSignature.sign());
        String str = new String(arrayOfByte2, 0, arrayOfByte2.length, "US-ASCII");
        setEncoded(new String(arrayOfByte1, "UTF-8"));
        setSignature(str);
        setSignatureAlgorithm(paramSignature.getAlgorithm());
        setSignatureEncoding("US-ASCII/Base64");
    } catch (UnsupportedEncodingException localUnsupportedEncodingException) {
        throw new AssertionError(localUnsupportedEncodingException);
    } catch (SignatureException localSignatureException) {
        throw new AssertionError(localSignatureException);
    }
    this.locked = true;
    firePropertyChange(localPropertyChangeEvent);
}

From source file:blue.soundObject.pianoRoll.PianoNote.java

public void setScaleDegree(int scaleDegree) {
    PropertyChangeEvent pce = new PropertyChangeEvent(this, "scaleDegree", new Integer(this.scaleDegree),
            new Integer(scaleDegree));
    this.scaleDegree = scaleDegree;
    firePropertyChange(pce);/*w  ww .ja  va2s  .c  o m*/
}

From source file:blue.soundObject.pianoRoll.PianoNote.java

public void setStart(float start) {
    PropertyChangeEvent pce = new PropertyChangeEvent(this, "start", new Float(this.start), new Float(start));
    this.start = start;
    firePropertyChange(pce);/*  w  w w.j a  v  a  2 s  . c om*/
}