1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin;
21
22 import org.xnap.gui.theme.Theme;
23 import org.xnap.gui.theme.ThemeManager;
24
25 /***
26 * Provides the default implementation for theme plugin classes.
27 */
28 public abstract class AbstractThemePlugin extends AbstractPlugin
29 {
30
31
32
33
34
35 private Theme theme;
36
37
38
39 public AbstractThemePlugin()
40 {
41 }
42
43
44
45 /***
46 * Creates and returns the theme.
47 */
48 protected abstract Theme createTheme();
49
50 public Theme getTheme()
51 {
52 return theme;
53 }
54
55 /***
56 * Registers the theme. We need to do this before the gui is
57 * started (except for the SplashWindow).
58 *
59 * @see Plugin#start()
60 */
61 public void start()
62 {
63 theme = createTheme();
64 ThemeManager.addTheme(theme);
65 }
66
67 /***
68 * Does nothing.
69 *
70 * @see Plugin#startGUI()
71 */
72 public void startGUI()
73 {
74 }
75
76 /***
77 * Unregisters the theme
78 *
79 * @see Plugin#stop()
80 */
81 public void stop()
82 {
83 ThemeManager.removeTheme(theme);
84 theme = null;
85 }
86
87 /***
88 * Does nothing.
89 *
90 * @see Plugin#stopGUI()
91 */
92 public void stopGUI()
93 {
94 }
95
96 }