org.homeunix.thecave.buddi.plugin.api
Class BuddiReportPlugin

java.lang.Object
  extended by org.homeunix.thecave.buddi.plugin.api.PreferenceAccess
      extended by org.homeunix.thecave.buddi.plugin.api.BuddiReportPlugin
All Implemented Interfaces:
MossPlugin
Direct Known Subclasses:
AverageIncomeExpenseByCategory, ExpensesPieGraph, IncomeExpenseReportByCategory, IncomePieGraph, NetWorthOverTime

public abstract class BuddiReportPlugin
extends PreferenceAccess
implements MossPlugin

This class is the defintion of a Buddi report, which writes out HTML to disk and opens it with a browser. The main method which needs to be implemented is the getReport() method. This method gives you the document object, the frame which called this plugin, and the date range on which to report.

Author:
wyatt

Constructor Summary
BuddiReportPlugin()
           
 
Method Summary
abstract  PluginReportDateRangeChoices getDateRangeChoice()
          The type of plugin this should be.
 Version getMaximumVersion()
          Returns the maximum program version needed to run this plugin.
 Version getMinimumVersion()
          Returns the minimum program version needed to run this plugin.
abstract  HtmlPage getReport(ImmutableDocument model, MossDocumentFrame callingFrame, java.util.Date startDate, java.util.Date endDate)
          Returns an in-memory version of the printed page, as an HTML file.
 boolean getReportGUI(ImmutableDocument model, MossDocumentFrame callingFrame, java.util.Date startDate, java.util.Date endDate)
          This method will be called on the EventDispatch thread, before the getReport() method is run.
 
Methods inherited from class org.homeunix.thecave.buddi.plugin.api.PreferenceAccess
getListPreference, getPreference, getSecurePreference, putListPreference, putPreference, putSecurePreference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.homeunix.thecave.moss.plugin.MossPlugin
getDescription, getName, isPluginActive
 

Constructor Detail

BuddiReportPlugin

public BuddiReportPlugin()
Method Detail

getReport

public abstract HtmlPage getReport(ImmutableDocument model,
                                   MossDocumentFrame callingFrame,
                                   java.util.Date startDate,
                                   java.util.Date endDate)
                            throws PluginException
Returns an in-memory version of the printed page, as an HTML file. An HtmlPage object is just a small class containing a string with the HTML text in it, and a map of String to BufferedImage containing all the images referenced in the HTML, by name. See HtmlPage for more information on what is needed.

Parameters:
startDate - Start of report period
endDate - End of report period
Returns:
Throws:
PluginException

getReportGUI

public boolean getReportGUI(ImmutableDocument model,
                            MossDocumentFrame callingFrame,
                            java.util.Date startDate,
                            java.util.Date endDate)
This method will be called on the EventDispatch thread, before the getReport() method is run. Since this method is run on the EventDispatch thread, and is the place to put any graphical forms or other prompts for the user. For instance, if you wish to show a window in which the user can pick options, put it here. This method should return true if the plugin is to continue; false if the user has canceled the plugin exection. The default instance of the plugin returns true, without showing anything.

Returns:

getDateRangeChoice

public abstract PluginReportDateRangeChoices getDateRangeChoice()
The type of plugin this should be. Can choose between one of the following enum values: INTERVAL, START_ONLY, END_ONLY

Returns:
A constant enum value which determines how the plugin loader should display this plugin.

getMaximumVersion

public Version getMaximumVersion()
Description copied from interface: MossPlugin
Returns the maximum program version needed to run this plugin. If this is null, there is no limitation on the program (not recommended unless you can guarantee that the plugin uses no API calls within the program).

Specified by:
getMaximumVersion in interface MossPlugin
Returns:
The Version object containing the maximum version number.

getMinimumVersion

public Version getMinimumVersion()
Description copied from interface: MossPlugin
Returns the minimum program version needed to run this plugin. If this is null, there is no limitation on the program (not recommended unless you can guarantee that the plugin uses no API calls within the program).

Specified by:
getMinimumVersion in interface MossPlugin
Returns:
The Version object containing the minimum version number.