Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BuddiPreferencePlugin |
|
| 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 javax.swing.JPanel; | |
9 | ||
10 | import org.homeunix.thecave.buddi.plugin.api.exception.PluginException; | |
11 | ||
12 | import ca.digitalcave.moss.application.plugin.MossPlugin; | |
13 | import ca.digitalcave.moss.common.Version; | |
14 | ||
15 | /** | |
16 | * A Buddi plugin which will be loaded into the Preferences screen. If your plugin needs | |
17 | * user configuration, it is highly recommended to use this class to perform that. | |
18 | * | |
19 | * It is quite simple to do this; you need to create a JPanel of the component layout | |
20 | * in getPreferencesPanel(), and provide the logic to load and save these values in | |
21 | * the load() and save() methods. | |
22 | * | |
23 | * See the documentation for BuddiPluginPreference to see how to access the preferences file. | |
24 | * | |
25 | * @author wyatt | |
26 | * | |
27 | */ | |
28 | 3475 | public abstract class BuddiPreferencePlugin extends PreferenceAccess implements MossPlugin { |
29 | ||
30 | /** | |
31 | * Saves the preferences which this panel is responsible for. If the changes nessecitate | |
32 | * a restart, return true; otherwise, return false. | |
33 | */ | |
34 | public abstract boolean save() throws PluginException; | |
35 | ||
36 | /** | |
37 | * Loads the preferences which this panel is responsible for. | |
38 | */ | |
39 | public abstract void load() throws PluginException; | |
40 | ||
41 | /** | |
42 | * If true, we put a JPanel wrapper around this JPanel, so that it keeps | |
43 | * all the components at the top of the window, even if there is extra | |
44 | * room. This is correct behaviour for most preference panes, especially | |
45 | * if they contain multiple small widgets (buttons, check boxes, etc). | |
46 | * | |
47 | * If the panel is to contain a large widget which is to take up the entire | |
48 | * frame (such as seen in the built in Plugins preference pane), override this | |
49 | * and set to false. | |
50 | * @return | |
51 | */ | |
52 | public boolean isUseWrapper(){ | |
53 | 2780 | return true; |
54 | } | |
55 | ||
56 | /** | |
57 | * Create the JPanel to show in the Preferences. | |
58 | * @return A JPanel object which can be put into the Preferences panel | |
59 | */ | |
60 | public abstract JPanel getPreferencesPanel(); | |
61 | ||
62 | /** | |
63 | * Not used in PreferencePlugin | |
64 | */ | |
65 | public boolean isPluginActive() { | |
66 | 0 | return true; |
67 | } | |
68 | ||
69 | /** | |
70 | * Not used in PreferencePlugin | |
71 | */ | |
72 | public String getDescription() { | |
73 | 0 | return null; |
74 | } | |
75 | ||
76 | public Version getMaximumVersion() { | |
77 | 0 | return null; |
78 | } | |
79 | ||
80 | public Version getMinimumVersion() { | |
81 | 0 | return null; |
82 | } | |
83 | } |