public final class Budget extends MoneydanceSyncableItem
Modifier and Type | Class and Description |
---|---|
static class |
Budget.CalculationResults
Holds the results of a budget calculation, including totals for income and expenses separately,
and for multiple date ranges.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SYNCABLE_TYPE_VALUE |
book, info
Constructor and Description |
---|
Budget(AccountBook book)
Construct a new budget in the context of the given account.
|
Budget(AccountBook book,
java.lang.String key,
StreamTable infoTable) |
Modifier and Type | Method and Description |
---|---|
void |
addBudgetListener(BudgetListener listener) |
static Budget.CalculationResults |
calculate(DateRange[] dateRanges,
AccountBook book,
java.util.List<BudgetItem> items,
boolean showAllCategories,
boolean showZeroes)
Compute budgeted and actual amounts, store them in an object that can be used by various
clients including the report, dashboard, and budget bars.
|
Budget.CalculationResults |
calculate(DateRange[] intervals,
boolean showAllCategories,
boolean showZeroes)
Compute budgeted and actual values based upon a series of graph intervals, for this budget.
|
Budget.CalculationResults |
calculate(int startDate,
int endDate,
boolean showAllCategories,
boolean showZeroes)
Compute budgeted and actual values based upon a single date range, for this budget.
|
boolean |
containsDate(int dateInt)
Determine if this budget contains any items that span the date given.
|
BudgetItem |
createItem()
Create a new item, add it to the list, and return it
|
Budget |
duplicateAsNew(java.lang.String newBudgetName)
Make a new budget with the same items as this one and the given name
|
java.util.List<BudgetItem> |
getAllItems() |
BudgetList |
getBudgetList()
Return the list that contains this budget
|
static int |
getIntervalIdx(DateRange[] intervals,
int date)
Given a date range list and a date, find the index of the date range in which the date belongs.
|
BudgetItemList |
getItemList() |
java.lang.String |
getKey()
Return the unique key needed to identify this budget for storage
|
java.lang.String |
getName()
Get the name of this budget
|
PeriodType |
getPeriodType() |
java.lang.String |
getSyncItemType()
Subclasses should override this to return a static string identifying their type of object
|
boolean |
isModified() |
boolean |
isNewStyle() |
protected void |
itemWasUpdated()
Load the list of budget items from the underlying table.
|
void |
removeBudgetListener(BudgetListener listener) |
void |
setBudgetInfo(Budget budget)
Copies the information from the given budget into this budget.
|
void |
setModified() |
void |
setName(java.lang.String newName)
Set the name for this budget
|
void |
setPeriodType(PeriodType periodType) |
java.lang.String |
toString()
Return the string representation of this budget
|
addParameters, addTags, autoSyncsChanges, decodeKeywordList, deleteItem, doesParameterExist, duplicate, encodeKeywordList, equals, getAccountParameter, getAddress, getAddressParameter, getBook, getBooleanParameter, getCurrencyParameter, getDoubleParameter, getIntParameter, getKeywords, getLongParameter, getParameter, getParameter, getParameterCount, getParameterKeys, getPreference, getPreferenceBoolean, getPreferenceDouble, getPreferenceInt, getPreferenceIntArray, getPreferenceLong, getPreferenceStringList, getPreferenceSublist, getPreferenceSubset, getSyncInfo, getSyncTimestamp, getUUID, hashCode, hasKeywordSubstring, initialize, isInEditingMode, isSyncable, itemWasUpdated, itemWillSync, itemWillSync, makeSyncableItem, removeParameter, setAccountParameter, setAddress, setAddressParameter, setCurrencyParameter, setDirty, setEditingMode, setKeywords, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterNoNotify, setPreference, setPreference, setPreference, syncItem
public static final java.lang.String SYNCABLE_TYPE_VALUE
public Budget(AccountBook book)
public Budget(AccountBook book, java.lang.String key, StreamTable infoTable)
public final java.lang.String getSyncItemType()
MoneydanceSyncableItem
getSyncItemType
in interface com.infinitekind.tiksync.SyncableItem
getSyncItemType
in class MoneydanceSyncableItem
protected void itemWasUpdated()
itemWasUpdated
in class MoneydanceSyncableItem
public Budget duplicateAsNew(java.lang.String newBudgetName)
public void setModified()
public boolean isModified()
public void addBudgetListener(BudgetListener listener)
public void removeBudgetListener(BudgetListener listener)
public void setBudgetInfo(Budget budget)
public java.util.List<BudgetItem> getAllItems()
public boolean containsDate(int dateInt)
dateInt
- The date to test.public final java.lang.String getKey()
public final BudgetList getBudgetList()
public java.lang.String getName()
public void setName(java.lang.String newName)
public BudgetItem createItem()
public BudgetItemList getItemList()
public java.lang.String toString()
toString
in class java.lang.Object
public Budget.CalculationResults calculate(DateRange[] intervals, boolean showAllCategories, boolean showZeroes)
intervals
- Graphing/reporting intervals representing a series of date ranges.showAllCategories
- True if all categories, including unbudgeted ones, are to be shown.showZeroes
- True if budget items with no spending and no budgeted amount are
to be included.public Budget.CalculationResults calculate(int startDate, int endDate, boolean showAllCategories, boolean showZeroes)
startDate
- Starting date to include.endDate
- Ending date to include.showAllCategories
- True if all categories, including unbudgeted ones, are to be shown.showZeroes
- True if budget items with no spending and no budgeted amount are to
be included.public static Budget.CalculationResults calculate(DateRange[] dateRanges, AccountBook book, java.util.List<BudgetItem> items, boolean showAllCategories, boolean showZeroes)
dateRanges
- List of date ranges to compute actual and budgeted for.book
- AccountBook containing the main dadtaset.items
- List of budget items to compute with.showAllCategories
- True if all categories, including unbudgeted ones, are to be shown.showZeroes
- True if budget items with no spending and no budgeted amount are
to be included.public static int getIntervalIdx(DateRange[] intervals, int date)
intervals
- A list of date intervals.date
- The date to find.public boolean isNewStyle()
public void setPeriodType(PeriodType periodType)
public PeriodType getPeriodType()