com.moneydance.apps.md.model
Class BudgetList

java.lang.Object
  extended by com.moneydance.apps.md.model.BudgetList

public class BudgetList
extends java.lang.Object

Container for the budgets in a data file


Method Summary
 void addBudget(Budget budget)
          Create a new budget, add it to the list, and return it
 void addListener(BudgetListener listener)
          Add a listener for events that affect the budget list or the budgets in the list.
 Budget findCurrentBudget()
          Return the most recent budget found that contains today's date.
 Budget getBudget(int i)
          Get the budget at the given position in the list
 int getBudgetCount()
          Get the number of budgets in the list
 Budget getBudgetWithKey(java.lang.String key)
          Get the budget with the given key, if any
 int indexOf(Budget b)
          Return the index of the given budget in the list or -1 if it is not in the list.
 boolean removeBudget(Budget budget)
          Remove the given budget from the list.
 void removeListener(BudgetListener listener)
          Removeo a listener for events that affect the budget list or the budgets in the list.
 void sortBudgets()
          Sort the list of budgets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addListener

public void addListener(BudgetListener listener)
Add a listener for events that affect the budget list or the budgets in the list.


removeListener

public void removeListener(BudgetListener listener)
Removeo a listener for events that affect the budget list or the budgets in the list.


sortBudgets

public final void sortBudgets()
Sort the list of budgets


getBudgetCount

public int getBudgetCount()
Get the number of budgets in the list


getBudget

public Budget getBudget(int i)
Get the budget at the given position in the list


getBudgetWithKey

public Budget getBudgetWithKey(java.lang.String key)
Get the budget with the given key, if any


findCurrentBudget

public Budget findCurrentBudget()
Return the most recent budget found that contains today's date. If none of the budgets contain today's date, then it returns the last budget in the list (sorted alphabetically).

Returns:
The current budget, or the default one, or null if there are none.

indexOf

public int indexOf(Budget b)
Return the index of the given budget in the list or -1 if it is not in the list.


removeBudget

public boolean removeBudget(Budget budget)
Remove the given budget from the list. Returns true if the budget was in the list.


addBudget

public void addBudget(Budget budget)
Create a new budget, add it to the list, and return it