Example usage for java.beans PropertyChangeSupport firePropertyChange

List of usage examples for java.beans PropertyChangeSupport firePropertyChange

Introduction

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

Prototype

public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) 

Source Link

Document

Reports a boolean bound property update to listeners that have been registered to track updates of all properties or a property with the specified name.

Usage

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashWritableObjectHelper.java

/**
 * @param gnucashObject The gnucashObject to set.
 * @see ${@link #gnucashObject}/*from w  w w .ja va  2 s  . co  m*/
 */
public void setGnucashObject(final GnucashObjectImpl gnucashObject) {
    if (gnucashObject == null) {
        throw new IllegalArgumentException("null 'gnucashObject' given!");
    }

    Object old = this.gnucashObject;
    if (old == gnucashObject) {
        return; // nothing has changed
    }
    this.gnucashObject = gnucashObject;
    // <<insert code to react further to this change here
    PropertyChangeSupport propertyChangeFirer = getPropertyChangeSupport();
    if (propertyChangeFirer != null) {
        propertyChangeFirer.firePropertyChange("gnucashObject", old, gnucashObject);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashObjectImpl.java

/**
 * @param slots The slots to set.//from ww w .ja va2 s.c om
 * @see ${@link #mySlots}
 */
@SuppressWarnings("unchecked")
public void setSlots(final SlotsType slots) {
    if (slots == null) {
        throw new IllegalArgumentException("null 'slots' given!");
    }

    Object old = mySlots;
    if (old == slots) {
        return; // nothing has changed
    }
    mySlots = slots;

    // we have an xsd-problem saving empty slots so we add a dummy-value
    if (slots.getSlot().isEmpty()) {
        try {
            ObjectFactory objectFactory = new ObjectFactory();
            Slot slot = objectFactory.createSlot();
            slot.setSlotKey("dummy");
            SlotValueType value = objectFactory.createSlotValueType();
            value.setType("string");
            value.getContent().add("dummy");
            slot.setSlotValue(value);
            slots.getSlot().add(slot);
        } catch (JAXBException e) {
            LOGGER.error("[JAXBException] Problem in " + getClass().getName(), e);
        }
    }

    // <<insert code to react further to this change here
    PropertyChangeSupport propertyChangeFirer = getPropertyChangeSupport();
    if (propertyChangeFirer != null) {
        propertyChangeFirer.firePropertyChange("slots", old, slots);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashCustomerWritingImpl.java

/**
 *
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableCustomer#setCustomerNumber(java.lang.String)
 *///from  www  .j  ava  2  s .  c om
public void setCustomerNumber(final String number) {
    Object old = getCustomerNumber();
    getJwsdpPeer().setCustId(number);
    getGnucashFile().setModified(true);

    PropertyChangeSupport propertyChangeSupport = getPropertyChangeSupport();
    if (propertyChangeSupport != null) {
        propertyChangeSupport.firePropertyChange("customerNumber", old, number);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashCustomerWritingImpl.java

/**
 *
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableCustomer#setDiscount(java.lang.String)
 *//*from w w  w .  j  av  a 2  s.co  m*/
public void setDiscount(final String discount) {
    Object old = getDiscount();
    getJwsdpPeer().setCustDiscount(discount);
    getGnucashFile().setModified(true);

    PropertyChangeSupport propertyChangeSupport = getPropertyChangeSupport();
    if (propertyChangeSupport != null) {
        propertyChangeSupport.firePropertyChange("discount", old, discount);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashCustomerWritingImpl.java

/**
 * @param notes user-defined notes about the customer (may be null)
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableCustomer#setNotes(String)
 *//*  w  w  w .  j  ava2 s  .com*/
public void setNotes(final String notes) {
    Object old = getNotes();
    getJwsdpPeer().setCustNotes(notes);
    getGnucashFile().setModified(true);

    PropertyChangeSupport propertyChangeSupport = getPropertyChangeSupport();
    if (propertyChangeSupport != null) {
        propertyChangeSupport.firePropertyChange("notes", old, notes);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashCustomerWritingImpl.java

/**
 *
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableCustomer#setName(java.lang.String)
 *//*from ww w .  jav a2s . co m*/
public void setName(final String name) {
    Object old = getName();
    getJwsdpPeer().setCustName(name);
    getGnucashFile().setModified(true);

    PropertyChangeSupport propertyChangeSupport = getPropertyChangeSupport();
    if (propertyChangeSupport != null) {
        propertyChangeSupport.firePropertyChange("name", old, name);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashAccountWritingImpl.java

/**
 * @see biz.wolschon.fileformats.gnucash.GnucashAccount#addTransactionSplit(biz.wolschon.fileformats.gnucash.GnucashTransactionSplit)
 *//* ww  w .  ja  va 2s  .  c  o m*/
@Override
public void addTransactionSplit(final GnucashTransactionSplit split) {
    super.addTransactionSplit(split);

    setIsModified();
    // <<insert code to react further to this change here
    PropertyChangeSupport propertyChangeFirer = getPropertyChangeSupport();
    if (propertyChangeFirer != null) {
        propertyChangeFirer.firePropertyChange("transactionSplits", null, getTransactionSplits());
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashAccountWritingImpl.java

/**
 * @param impl the split to remove/*from   www  . ja va2s  . c o  m*/
 */
protected void removeTransactionSplit(final GnucashWritableTransactionSplit impl) {
    List transactionSplits = getTransactionSplits();
    transactionSplits.remove(impl);

    setIsModified();
    // <<insert code to react further to this change here
    PropertyChangeSupport propertyChangeFirer = getPropertyChangeSupport();
    if (propertyChangeFirer != null) {
        propertyChangeFirer.firePropertyChange("transactionSplits", null, transactionSplits);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashAccountWritingImpl.java

/**
 *
 *
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableAccount#setName(java.lang.String)
 *///from  w  w  w .  ja  va2s  .  c om
public void setName(final String name) {
    if (name == null || name.trim().length() == 0) {
        throw new IllegalArgumentException("null or empty name given!");
    }

    Object old = getJwsdpPeer().getActName();
    if (old == name) {
        return; // nothing has changed
    }
    this.getJwsdpPeer().setActName(name);
    setIsModified();
    // <<insert code to react further to this change here
    PropertyChangeSupport propertyChangeFirer = getPropertyChangeSupport();
    if (propertyChangeFirer != null) {
        propertyChangeFirer.firePropertyChange("name", old, name);
    }
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashAccountWritingImpl.java

/**
*
*
* @see biz.wolschon.fileformats.gnucash.GnucashWritableAccount#setAccountCode(java.lang.String)
*///from   ww w  .  ja  v a 2  s .c om
public void setAccountCode(final String code) {
    if (code == null || code.trim().length() == 0) {
        throw new IllegalArgumentException("null or empty code given!");
    }

    Object old = getJwsdpPeer().getActCode();
    if (old == code) {
        return; // nothing has changed
    }
    this.getJwsdpPeer().setActCode(code);
    setIsModified();
    // <<insert code to react further to this change here
    PropertyChangeSupport propertyChangeFirer = getPropertyChangeSupport();
    if (propertyChangeFirer != null) {
        propertyChangeFirer.firePropertyChange("code", old, code);
    }
}