| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BuddiReportPlugin |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Created on Sep 14, 2006 by wyatt | |
| 3 | * | |
| 4 | * The interface which can be extended to create custom reports. | |
| 5 | */ | |
| 6 | package org.homeunix.thecave.buddi.plugin.api; | |
| 7 | ||
| 8 | import java.util.Date; | |
| 9 | ||
| 10 | import org.homeunix.thecave.buddi.i18n.keys.PluginReportDateRangeChoices; | |
| 11 | import org.homeunix.thecave.buddi.plugin.api.exception.PluginException; | |
| 12 | import org.homeunix.thecave.buddi.plugin.api.model.ImmutableDocument; | |
| 13 | import org.homeunix.thecave.buddi.plugin.api.util.HtmlPage; | |
| 14 | ||
| 15 | import ca.digitalcave.moss.application.plugin.MossPlugin; | |
| 16 | import ca.digitalcave.moss.common.Version; | |
| 17 | import ca.digitalcave.moss.swing.MossDocumentFrame; | |
| 18 | ||
| 19 | ||
| 20 | /** | |
| 21 | * This class is the defintion of a Buddi report, which writes out HTML to disk and opens | |
| 22 | * it with a browser. The main method which needs to be implemented is the getReport() | |
| 23 | * method. This method gives you the document object, the frame which called this plugin, | |
| 24 | * and the date range on which to report. | |
| 25 | * | |
| 26 | * @author wyatt | |
| 27 | * | |
| 28 | */ | |
| 29 | 14885 | public abstract class BuddiReportPlugin extends PreferenceAccess implements MossPlugin { |
| 30 | /** | |
| 31 | * Returns an in-memory version of the printed page, as an HTML | |
| 32 | * file. An HtmlPage object is just a small class containing a string | |
| 33 | * with the HTML text in it, and a map of String to BufferedImage | |
| 34 | * containing all the images referenced in the HTML, by name. | |
| 35 | * | |
| 36 | * See HtmlPage for more information on what is needed. | |
| 37 | * @param startDate Start of report period | |
| 38 | * @param endDate End of report period | |
| 39 | * @return | |
| 40 | */ | |
| 41 | public abstract HtmlPage getReport(ImmutableDocument model, MossDocumentFrame callingFrame, Date startDate, Date endDate) throws PluginException; | |
| 42 | ||
| 43 | /** | |
| 44 | * This method will be called on the EventDispatch thread, before the | |
| 45 | * getReport() method is run. Since this method is run on the | |
| 46 | * EventDispatch thread, and is the place to put any graphical forms or | |
| 47 | * other prompts for the user. For instance, if you wish to show a | |
| 48 | * window in which the user can pick options, put it here. | |
| 49 | * | |
| 50 | * This method should return true if the plugin is to continue; false | |
| 51 | * if the user has canceled the plugin exection. | |
| 52 | * | |
| 53 | * The default instance of the plugin returns true, without showing anything. | |
| 54 | * | |
| 55 | * @return | |
| 56 | */ | |
| 57 | public boolean getReportGUI(ImmutableDocument model, MossDocumentFrame callingFrame, Date startDate, Date endDate){ | |
| 58 | 0 | return true; |
| 59 | } | |
| 60 | ||
| 61 | /** | |
| 62 | * The type of plugin this should be. Can choose between one of the following enum | |
| 63 | * values: | |
| 64 | * | |
| 65 | * INTERVAL, | |
| 66 | * START_ONLY, | |
| 67 | * END_ONLY | |
| 68 | * | |
| 69 | * @return A constant enum value which determines how the plugin loader should display this plugin. | |
| 70 | */ | |
| 71 | public abstract PluginReportDateRangeChoices getDateRangeChoice(); | |
| 72 | ||
| 73 | public Version getMaximumVersion() { | |
| 74 | 0 | return null; |
| 75 | } | |
| 76 | ||
| 77 | public Version getMinimumVersion() { | |
| 78 | 0 | return null; |
| 79 | } | |
| 80 | } |