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.GnucashAccountWritingImpl.java

/**
 * @param currencyID the new currency/*from w  w w  . j a v a 2 s . c  o m*/
 * @see #setCurrencyNameSpace(String)
 * @see ${@link GnucashAccount#getCurrencyID()}
 */
public void setCurrencyID(final String currencyID) {
    if (currencyID == null) {
        throw new IllegalArgumentException("null or empty currencyID given!");
    }

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

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

/**
 * @param currencyNameSpace the new namespace
 * @see ${@link GnucashAccount#getCurrencyNameSpace()}
 *///w w  w . j av a 2  s .c  o m
public void setCurrencyNameSpace(final String currencyNameSpace) {
    if (currencyNameSpace == null) {
        throw new IllegalArgumentException("null or empty currencyNameSpace given!");
    }

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

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

/**
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableAccount#setDescription(java.lang.String)
 *//* www.j  av a2s  . co m*/
public void setDescription(final String description) {
    if (description == null) {
        throw new IllegalArgumentException("null or empty description given!");
    }

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

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

/**
 *
 *
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableAccount#setType(java.lang.String)
 *///w  w w .jav  a 2 s  . com
public void setType(final String type) {
    if (type == null) {
        throw new IllegalArgumentException("null type given!");
    }

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

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

/**
 * @see biz.wolschon.fileformats.gnucash.GnucashWritableAccount#setParentAccount(biz.wolschon.fileformats.gnucash.GnucashAccount)
 *//*  w ww  . j av a  2 s  .  co  m*/
public void setParentAccount(final GnucashAccount parentAccount) throws JAXBException {

    if (parentAccount == null) {
        this.getJwsdpPeer().setActParent(null);
        return;
    }

    if (parentAccount == this) {
        throw new IllegalArgumentException("I cannot be my own parent!");
    }

    // check if newparent is a child-account recusively
    if (isChildAccountRecursive(parentAccount)) {
        throw new IllegalArgumentException("I cannot be my own (grand-)parent!");
    }

    Object old = null;
    biz.wolschon.fileformats.gnucash.jwsdpimpl.generated.GncAccountType.ActParentType parent = getJwsdpPeer()
            .getActParent();
    if (parent == null) {
        parent = ((GnucashFileWritingImpl) getWritableGnucashFile()).getObjectFactory()
                .createGncAccountTypeActParentType();
        parent.setType("guid");
        parent.setValue(parentAccount.getId());
        getJwsdpPeer().setActParent(parent);

    } else {
        old = getParentAccount();
        parent.setValue(parentAccount.getId());
    }
    setIsModified();

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

From source file:biz.wolschon.finance.jgnucash.widgets.TransactionSum.java

/**
 * @param aBooks The books to set.//from   w w w  .j a  va 2  s . com
 * @throws JAXBException if we have issues with the XML-backend
 * @see #myBooks
 */
public void setBooks(final GnucashFile aBooks) throws JAXBException {
    if (aBooks == null) {
        throw new IllegalArgumentException("null 'aBooks' given!");
    }

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

From source file:biz.wolschon.finance.jgnucash.widgets.TransactionSum.java

/**
 * @param aSourceAccounts The sourceAccounts to set.
 * @throws JAXBException if we have issues with the XML-backend
 * @see #mySourceAccounts/*ww w. j  a va2 s. co  m*/
 */
public void setSourceAccounts(final Set<GnucashAccount> aSourceAccounts) throws JAXBException {
    if (aSourceAccounts == null) {
        throw new IllegalArgumentException("null 'aSourceAccounts' given!");
    }

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

From source file:biz.wolschon.finance.jgnucash.widgets.TransactionSum.java

/**
 * @param aSummationType The summationType to set.
 * @throws JAXBException if we have issues with the XML-backend
 * @see #mySummationType/*from w w w. ja va  2 s .  com*/
 */
public void setSummationType(final SUMMATIONTYPE aSummationType) throws JAXBException {
    if (aSummationType == null) {
        throw new IllegalArgumentException("null 'aSummationType' given!");
    }

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

From source file:biz.wolschon.finance.jgnucash.widgets.TransactionSum.java

/**
 * @param aTargetAccounts The targetAccounts to set.
 * @throws JAXBException if we have issues with the XML-backend
 * @see #myTargetAccounts/*  w ww.  ja va  2  s  .  com*/
 */
public void setTargetAccounts(final Set<GnucashAccount> aTargetAccounts) throws JAXBException {
    if (aTargetAccounts == null) {
        throw new IllegalArgumentException("null 'aTargetAccounts' given!");
    }

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

From source file:biz.wolschon.finance.jgnucash.widgets.TransactionSum.java

/**
 * @param aMinDate The minDate to set./*from   w ww.j a v a 2s . c om*/
 * @throws JAXBException if we have issues with the XML-backend
 * @see #myMinDate
 */
public void setMinDate(final Date aMinDate) throws JAXBException {
    //        if (aMinDate == null) {
    //            throw new IllegalArgumentException("null 'aMinDate' given!");
    //        }

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