01: package vicazh.hyperpool.themes;
02:
03: import java.awt.*;
04: import java.awt.event.*;
05: import java.util.List;
06: import java.util.logging.*;
07: import javax.swing.*;
08: import vicazh.hyperpool.*;
09:
10: /**
11: * The view menu item listener
12: *
13: * @author Victor Zhigunov
14: * @version 0.4.0
15: */
16: public class IView implements ActionListener {
17:
18: private Reader reader;
19: private String theme;
20: private List<Component> components;
21:
22: /**
23: * @param reader
24: * theme reader
25: * @param theme
26: * theme source
27: * @param components
28: * UI components for update
29: * @param now
30: * set theme now
31: */
32: public IView(Reader reader, String theme,
33: List<Component> components, boolean now) throws Exception {
34: this .reader = reader;
35: this .theme = theme;
36: this .components = components;
37: if (now)
38: setTheme();
39: }
40:
41: private void setTheme() throws Exception {
42: reader.getObject(theme);
43: }
44:
45: public void actionPerformed(ActionEvent e) {
46: try {
47: setTheme();
48: } catch (Exception ex) {
49: Start.logger.log(Level.SEVERE, ex.getMessage(), ex);
50: }
51: for (Component c : components)
52: SwingUtilities.updateComponentTreeUI(c);
53: }
54: }
|