org.jbudget.io
Class EventDispatcher

java.lang.Object
  extended by org.jbudget.io.EventDispatcher
Direct Known Subclasses:
DataManager

public class EventDispatcher
extends java.lang.Object

A class that contains methods for delivering data related events to registered listeners.

Author:
petrov

Nested Class Summary
static interface EventDispatcher.AccountListener
           
static interface EventDispatcher.AllocationListener
           
static interface EventDispatcher.BudgetListener
           
static interface EventDispatcher.DataSourceListener
          Interface that is used by the components that want to receive updates notifying them that the data directory has been changed.
static interface EventDispatcher.MonthListener
           
static interface EventDispatcher.TransactionListener
           
static interface EventDispatcher.UserListener
           
 
Field Summary
private  java.util.List<EventDispatcher.AccountListener> accountListeners
          A list of listeners that receive account updates
private  java.util.List<EventDispatcher.AllocationListener> allocationListeners
          A list of listeners that receive allocation updates
private  java.util.List<EventDispatcher.BudgetListener> budgetListeners
          A list of listeners that receive budget updates
private  java.util.List<EventDispatcher.DataSourceListener> dataSourceListeners
          A list of listeners that receive data directory updates
private  java.util.List<EventDispatcher.MonthListener> monthListeners
          A list of listeners that receive month updates
private  java.util.List<EventDispatcher.TransactionListener> transactionListeners
          A list of listeners that receive transaction updates
private  java.util.List<EventDispatcher.UserListener> userListeners
          A list of listeners that receive account updates
 
Constructor Summary
EventDispatcher()
          Creates a new instance of EventDispatcher
 
Method Summary
 void addAccountListener(EventDispatcher.AccountListener listener)
           
 void addAllocationListener(EventDispatcher.AllocationListener listener)
           
 void addBudgetListener(EventDispatcher.BudgetListener listener)
           
 void addDataSourceListener(EventDispatcher.DataSourceListener listener)
           
 void addMonthListener(EventDispatcher.MonthListener listener)
           
 void addTransactionListener(EventDispatcher.TransactionListener listener)
           
 void addUserListener(EventDispatcher.UserListener listener)
           
 void fireAccountAdded(org.jbudget.Core.Account account)
          Notifies all listeners that have registered to receive account updates events that an account was added
 void fireAccountRemoved(int accountId)
          Notifies all listeners that have registered to receive account updates events that an account was removed
 void fireAccountUpdated(org.jbudget.Core.Account account)
          Notifies all listeners that have registered to receive account updates events that an account was added
 void fireAllocationAdded(org.jbudget.Core.Transaction allocation)
          Notifies all listeners that have registered to receive allocation update events that an allocation was added
 void fireAllocationRemoved(java.util.List<org.jbudget.Core.Transaction.Transfer> transfers, int cDay, int cMonth, int cYear)
          Notifies all listeners that have registered to receive allocation update events that an allocation that occurred on a specific date was removed
 void fireBudgetAdded(org.jbudget.Core.Budget budget)
          Notifies all listeners that have registered to receive budget update events that a budget was added
 void fireBudgetRemoved(int budgetId)
          Notifies all listeners that have registered to receive budget update events that a budget was removed
 void fireDataDirChanged()
          Notifies all registered listeners that the data directory has changed.
 void fireMonthAdded(org.jbudget.Core.Month month)
          Notifies all listeners that have registered to receive month update events that a month was added
 void fireMonthRemoved(int cMonth, int cYear)
          Notifies all listeners that have registered to receive month update events that a month was removed
 void fireMonthUpdated(org.jbudget.Core.Month month)
          Notifies all listeners that have registered to receive month update events that a month was updated
 void fireTransactionAdded(org.jbudget.Core.Transaction transaction)
          Notifies all listeners that have registered to receive transaction update events that a transaction was added
 void fireTransactionRemoved(java.util.List<org.jbudget.Core.Transaction.Transfer> transfers, int cDay, int cMonth, int cYear)
          Notifies all listeners that have registered to receive transaction update events that a transaction that occured on a specific date was removed
 void fireUserAdded(org.jbudget.Core.User user)
          Notifies all listeners that have registered to receive user updates events that a user was added
 void fireUserChanged(org.jbudget.Core.User user)
          Notifies all listeners that have registered to receive user updates events that the current user has changed.
 void fireUserRemoved(int uid)
          Notifies all listeners that have registered to receive user updates events that a user was removed
 void removeAccountListener(EventDispatcher.AccountListener listener)
           
 void removeAllocationListener(EventDispatcher.AllocationListener listener)
           
 void removeBudgetListener(EventDispatcher.BudgetListener listener)
           
 void removeDataSourceListener(EventDispatcher.DataSourceListener listener)
           
 void removeMonthListener(EventDispatcher.MonthListener listener)
           
 void removeTransactionListener(EventDispatcher.TransactionListener listener)
           
 void removeUserListener(EventDispatcher.UserListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

budgetListeners

private final java.util.List<EventDispatcher.BudgetListener> budgetListeners
A list of listeners that receive budget updates


monthListeners

private final java.util.List<EventDispatcher.MonthListener> monthListeners
A list of listeners that receive month updates


accountListeners

private final java.util.List<EventDispatcher.AccountListener> accountListeners
A list of listeners that receive account updates


userListeners

private final java.util.List<EventDispatcher.UserListener> userListeners
A list of listeners that receive account updates


transactionListeners

private final java.util.List<EventDispatcher.TransactionListener> transactionListeners
A list of listeners that receive transaction updates


allocationListeners

private final java.util.List<EventDispatcher.AllocationListener> allocationListeners
A list of listeners that receive allocation updates


dataSourceListeners

private final java.util.List<EventDispatcher.DataSourceListener> dataSourceListeners
A list of listeners that receive data directory updates

Constructor Detail

EventDispatcher

public EventDispatcher()
Creates a new instance of EventDispatcher

Method Detail

addBudgetListener

public void addBudgetListener(EventDispatcher.BudgetListener listener)

removeBudgetListener

public void removeBudgetListener(EventDispatcher.BudgetListener listener)

addUserListener

public void addUserListener(EventDispatcher.UserListener listener)

removeUserListener

public void removeUserListener(EventDispatcher.UserListener listener)

addAccountListener

public void addAccountListener(EventDispatcher.AccountListener listener)

removeAccountListener

public void removeAccountListener(EventDispatcher.AccountListener listener)

addMonthListener

public void addMonthListener(EventDispatcher.MonthListener listener)

removeMonthListener

public void removeMonthListener(EventDispatcher.MonthListener listener)

addTransactionListener

public void addTransactionListener(EventDispatcher.TransactionListener listener)

removeTransactionListener

public void removeTransactionListener(EventDispatcher.TransactionListener listener)

removeAllocationListener

public void removeAllocationListener(EventDispatcher.AllocationListener listener)

addAllocationListener

public void addAllocationListener(EventDispatcher.AllocationListener listener)

removeDataSourceListener

public void removeDataSourceListener(EventDispatcher.DataSourceListener listener)

addDataSourceListener

public void addDataSourceListener(EventDispatcher.DataSourceListener listener)

fireBudgetAdded

public void fireBudgetAdded(org.jbudget.Core.Budget budget)
Notifies all listeners that have registered to receive budget update events that a budget was added


fireBudgetRemoved

public void fireBudgetRemoved(int budgetId)
Notifies all listeners that have registered to receive budget update events that a budget was removed


fireAccountAdded

public void fireAccountAdded(org.jbudget.Core.Account account)
Notifies all listeners that have registered to receive account updates events that an account was added


fireAccountUpdated

public void fireAccountUpdated(org.jbudget.Core.Account account)
Notifies all listeners that have registered to receive account updates events that an account was added


fireAccountRemoved

public void fireAccountRemoved(int accountId)
Notifies all listeners that have registered to receive account updates events that an account was removed


fireUserAdded

public void fireUserAdded(org.jbudget.Core.User user)
Notifies all listeners that have registered to receive user updates events that a user was added


fireUserRemoved

public void fireUserRemoved(int uid)
Notifies all listeners that have registered to receive user updates events that a user was removed


fireUserChanged

public void fireUserChanged(org.jbudget.Core.User user)
Notifies all listeners that have registered to receive user updates events that the current user has changed.


fireMonthAdded

public void fireMonthAdded(org.jbudget.Core.Month month)
Notifies all listeners that have registered to receive month update events that a month was added


fireMonthRemoved

public void fireMonthRemoved(int cMonth,
                             int cYear)
Notifies all listeners that have registered to receive month update events that a month was removed


fireMonthUpdated

public void fireMonthUpdated(org.jbudget.Core.Month month)
Notifies all listeners that have registered to receive month update events that a month was updated


fireTransactionAdded

public void fireTransactionAdded(org.jbudget.Core.Transaction transaction)
Notifies all listeners that have registered to receive transaction update events that a transaction was added


fireTransactionRemoved

public void fireTransactionRemoved(java.util.List<org.jbudget.Core.Transaction.Transfer> transfers,
                                   int cDay,
                                   int cMonth,
                                   int cYear)
Notifies all listeners that have registered to receive transaction update events that a transaction that occured on a specific date was removed


fireAllocationAdded

public void fireAllocationAdded(org.jbudget.Core.Transaction allocation)
Notifies all listeners that have registered to receive allocation update events that an allocation was added


fireAllocationRemoved

public void fireAllocationRemoved(java.util.List<org.jbudget.Core.Transaction.Transfer> transfers,
                                  int cDay,
                                  int cMonth,
                                  int cYear)
Notifies all listeners that have registered to receive allocation update events that an allocation that occurred on a specific date was removed


fireDataDirChanged

public void fireDataDirChanged()
Notifies all registered listeners that the data directory has changed.