Bläddra i källkod

More tidying/dependencies/etc.

Change-Id: I828f2ea9980123409a7d33efc787cb3b6d64d441
Reviewed-on: http://gerrit.dmdirc.com/3060
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8
Chris Smith 10 år sedan
förälder
incheckning
fe7fc88dd8

+ 1
- 23
src/com/dmdirc/addons/ui_swing/SwingController.java Visa fil

30
 import com.dmdirc.addons.ui_swing.commands.PopInCommand;
30
 import com.dmdirc.addons.ui_swing.commands.PopInCommand;
31
 import com.dmdirc.addons.ui_swing.commands.PopOutCommand;
31
 import com.dmdirc.addons.ui_swing.commands.PopOutCommand;
32
 import com.dmdirc.addons.ui_swing.commands.ServerSettings;
32
 import com.dmdirc.addons.ui_swing.commands.ServerSettings;
33
-import com.dmdirc.addons.ui_swing.components.addonbrowser.DataLoaderWorkerFactory;
34
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
33
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
35
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
34
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
36
 import com.dmdirc.addons.ui_swing.dialogs.error.ErrorListDialog;
35
 import com.dmdirc.addons.ui_swing.dialogs.error.ErrorListDialog;
57
 import com.dmdirc.ui.IconManager;
56
 import com.dmdirc.ui.IconManager;
58
 import com.dmdirc.ui.core.util.URLHandler;
57
 import com.dmdirc.ui.core.util.URLHandler;
59
 import com.dmdirc.ui.messages.ColourManager;
58
 import com.dmdirc.ui.messages.ColourManager;
60
-import com.dmdirc.ui.themes.ThemeManager;
61
 import com.dmdirc.updater.Version;
59
 import com.dmdirc.updater.Version;
62
-import com.dmdirc.updater.manager.CachingUpdateManager;
63
 import com.dmdirc.util.URLBuilder;
60
 import com.dmdirc.util.URLBuilder;
64
 import com.dmdirc.util.validators.NumericalValidator;
61
 import com.dmdirc.util.validators.NumericalValidator;
65
 import com.dmdirc.util.validators.OptionalValidator;
62
 import com.dmdirc.util.validators.OptionalValidator;
110
     private final IconManager iconManager;
107
     private final IconManager iconManager;
111
     /** Plugin manager. */
108
     /** Plugin manager. */
112
     private final PluginManager pluginManager;
109
     private final PluginManager pluginManager;
113
-    /** Theme manager to use. */
114
-    private final ThemeManager themeManager;
115
     /** Apple handler, deals with Mac specific code. */
110
     /** Apple handler, deals with Mac specific code. */
116
     private final Apple apple;
111
     private final Apple apple;
117
     /** The colour manager to use to parse colours. */
112
     /** The colour manager to use to parse colours. */
141
             final IdentityFactory identityFactory,
136
             final IdentityFactory identityFactory,
142
             final PluginManager pluginManager,
137
             final PluginManager pluginManager,
143
             final ServerManager serverManager,
138
             final ServerManager serverManager,
144
-            final ThemeManager themeManager,
145
             final URLBuilder urlBuilder,
139
             final URLBuilder urlBuilder,
146
             final ColourManager colourManager,
140
             final ColourManager colourManager,
147
             final EventBus eventBus) {
141
             final EventBus eventBus) {
149
         this.identityManager = identityManager;
143
         this.identityManager = identityManager;
150
         this.identityFactory = identityFactory;
144
         this.identityFactory = identityFactory;
151
         this.pluginManager = pluginManager;
145
         this.pluginManager = pluginManager;
152
-        this.themeManager = themeManager;
153
         this.colourManager = colourManager;
146
         this.colourManager = colourManager;
154
         this.urlBuilder = urlBuilder;
147
         this.urlBuilder = urlBuilder;
155
 
148
 
197
         return pluginManager;
190
         return pluginManager;
198
     }
191
     }
199
 
192
 
200
-    @Deprecated
201
-    public ThemeManager getThemeManager() {
202
-        return themeManager;
203
-    }
204
-
205
     @Deprecated
193
     @Deprecated
206
     public Apple getApple() {
194
     public Apple getApple() {
207
         return apple;
195
         return apple;
463
             @Override
451
             @Override
464
             public void run() {
452
             public void run() {
465
                 getMainFrame().setVisible(true);
453
                 getMainFrame().setVisible(true);
466
-                errorDialog = new ErrorListDialog(SwingController.this);
454
+                errorDialog = new ErrorListDialog(getMainFrame(), getIconManager());
467
             }
455
             }
468
         });
456
         });
469
 
457
 
852
         return swingManager.getUrlHandler();
840
         return swingManager.getUrlHandler();
853
     }
841
     }
854
 
842
 
855
-    @Deprecated
856
-    public DataLoaderWorkerFactory getDataLoaderWorkerFactory() {
857
-        return swingManager.getDataLoaderWorkerFactory();
858
-    }
859
-
860
-    @Deprecated
861
-    public CachingUpdateManager getCachingUpdateManager() {
862
-        return swingManager.getCachingUpdateManager();
863
-    }
864
-
865
 }
843
 }

+ 0
- 24
src/com/dmdirc/addons/ui_swing/SwingManager.java Visa fil

24
 
24
 
25
 import com.dmdirc.Channel;
25
 import com.dmdirc.Channel;
26
 import com.dmdirc.Server;
26
 import com.dmdirc.Server;
27
-import com.dmdirc.addons.ui_swing.components.addonbrowser.DataLoaderWorkerFactory;
28
 import com.dmdirc.addons.ui_swing.components.menubar.MenuBar;
27
 import com.dmdirc.addons.ui_swing.components.menubar.MenuBar;
29
 import com.dmdirc.addons.ui_swing.components.statusbar.FeedbackNag;
28
 import com.dmdirc.addons.ui_swing.components.statusbar.FeedbackNag;
30
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
29
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
40
 import com.dmdirc.ui.WindowManager;
39
 import com.dmdirc.ui.WindowManager;
41
 import com.dmdirc.ui.core.components.StatusBarManager;
40
 import com.dmdirc.ui.core.components.StatusBarManager;
42
 import com.dmdirc.ui.core.util.URLHandler;
41
 import com.dmdirc.ui.core.util.URLHandler;
43
-import com.dmdirc.updater.manager.CachingUpdateManager;
44
 
42
 
45
 import java.awt.KeyboardFocusManager;
43
 import java.awt.KeyboardFocusManager;
46
 import java.awt.Toolkit;
44
 import java.awt.Toolkit;
79
     /** The key listener that supports dialogs. */
77
     /** The key listener that supports dialogs. */
80
     private final DialogKeyListener dialogKeyListener;
78
     private final DialogKeyListener dialogKeyListener;
81
 
79
 
82
-    /** Factory used to create data loader workers. */
83
-    private final DataLoaderWorkerFactory dataLoaderWorkerFactory;
84
-
85
-    /** The update manager to use. */
86
-    private final CachingUpdateManager cachingUpdateManager;
87
-
88
     /** Provider of first run executors. */
80
     /** Provider of first run executors. */
89
     private final Provider<FirstRunWizardExecutor> firstRunExecutor;
81
     private final Provider<FirstRunWizardExecutor> firstRunExecutor;
90
 
82
 
117
      * @param ctrlTabManager The window manager that handles ctrl+tab behaviour.
109
      * @param ctrlTabManager The window manager that handles ctrl+tab behaviour.
118
      * @param urlHandler The URL handler to use.
110
      * @param urlHandler The URL handler to use.
119
      * @param dialogKeyListener The key listener that supports dialogs.
111
      * @param dialogKeyListener The key listener that supports dialogs.
120
-     * @param dataLoaderWorkerFactory Factory used to create data loader workers.
121
-     * @param cachingUpdateManager Update manager to use.
122
      * @param firstRunExecutor A provider of first run executors.
112
      * @param firstRunExecutor A provider of first run executors.
123
      * @param prefsComponentFactory The factory to use to create prefs components.
113
      * @param prefsComponentFactory The factory to use to create prefs components.
124
      * @param prefsDialogProvider Provider of prefs dialogs.
114
      * @param prefsDialogProvider Provider of prefs dialogs.
139
             final CtrlTabWindowManager ctrlTabManager,
129
             final CtrlTabWindowManager ctrlTabManager,
140
             final URLHandler urlHandler,
130
             final URLHandler urlHandler,
141
             final DialogKeyListener dialogKeyListener,
131
             final DialogKeyListener dialogKeyListener,
142
-            final DataLoaderWorkerFactory dataLoaderWorkerFactory,
143
-            final CachingUpdateManager cachingUpdateManager,
144
             final Provider<FirstRunWizardExecutor> firstRunExecutor,
132
             final Provider<FirstRunWizardExecutor> firstRunExecutor,
145
             final PrefsComponentFactory prefsComponentFactory,
133
             final PrefsComponentFactory prefsComponentFactory,
146
             final DialogProvider<SwingPreferencesDialog> prefsDialogProvider,
134
             final DialogProvider<SwingPreferencesDialog> prefsDialogProvider,
155
         this.statusBarManager = statusBarManager;
143
         this.statusBarManager = statusBarManager;
156
         this.urlHandler = urlHandler;
144
         this.urlHandler = urlHandler;
157
         this.dialogKeyListener = dialogKeyListener;
145
         this.dialogKeyListener = dialogKeyListener;
158
-        this.dataLoaderWorkerFactory = dataLoaderWorkerFactory;
159
-        this.cachingUpdateManager = cachingUpdateManager;
160
         this.firstRunExecutor = firstRunExecutor;
146
         this.firstRunExecutor = firstRunExecutor;
161
         this.prefsComponentFactory = prefsComponentFactory;
147
         this.prefsComponentFactory = prefsComponentFactory;
162
         this.prefsDialogProvider = prefsDialogProvider;
148
         this.prefsDialogProvider = prefsDialogProvider;
205
         return firstRunExecutor.get();
191
         return firstRunExecutor.get();
206
     }
192
     }
207
 
193
 
208
-    @Deprecated
209
-    public DataLoaderWorkerFactory getDataLoaderWorkerFactory() {
210
-        return dataLoaderWorkerFactory;
211
-    }
212
-
213
-    @Deprecated
214
-    public CachingUpdateManager getCachingUpdateManager() {
215
-        return cachingUpdateManager;
216
-    }
217
-
218
     @Deprecated
194
     @Deprecated
219
     public PrefsComponentFactory getPrefsComponentFactory() {
195
     public PrefsComponentFactory getPrefsComponentFactory() {
220
         return prefsComponentFactory;
196
         return prefsComponentFactory;

+ 6
- 5
src/com/dmdirc/addons/ui_swing/dialogs/error/ErrorListDialog.java Visa fil

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.dialogs.error;
23
 package com.dmdirc.addons.ui_swing.dialogs.error;
24
 
24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
26
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
27
 import com.dmdirc.logger.ErrorManager;
27
 import com.dmdirc.logger.ErrorManager;
28
 import com.dmdirc.logger.ErrorReportStatus;
28
 import com.dmdirc.logger.ErrorReportStatus;
76
     /**
76
     /**
77
      * Creates a new instance of ErrorListDialog.
77
      * Creates a new instance of ErrorListDialog.
78
      *
78
      *
79
-     * @param controller Swing controller
79
+     * @param mainFrame The parent window.
80
+     * @param iconManager The manager to use to load icons.
80
      */
81
      */
81
-    public ErrorListDialog(final SwingController controller) {
82
-        super(controller.getMainFrame(), ModalityType.MODELESS);
82
+    public ErrorListDialog(final MainFrame mainFrame, final IconManager iconManager) {
83
+        super(mainFrame, ModalityType.MODELESS);
83
 
84
 
84
         setTitle("Error list");
85
         setTitle("Error list");
85
         setMinimumSize(new Dimension(600, 550));
86
         setMinimumSize(new Dimension(600, 550));
86
 
87
 
87
         tableModel = new ErrorTableModel();
88
         tableModel = new ErrorTableModel();
88
 
89
 
89
-        initComponents(controller.getIconManager());
90
+        initComponents(iconManager);
90
         layoutComponents();
91
         layoutComponents();
91
         initListeners();
92
         initListeners();
92
 
93
 

+ 38
- 31
src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateConfigPanel.java Visa fil

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24
 
24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.ClientModule.GlobalConfig;
26
+import com.dmdirc.ClientModule.UserConfig;
26
 import com.dmdirc.addons.ui_swing.components.PackingTable;
27
 import com.dmdirc.addons.ui_swing.components.PackingTable;
27
 import com.dmdirc.config.prefs.PreferencesInterface;
28
 import com.dmdirc.config.prefs.PreferencesInterface;
28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29
 import com.dmdirc.interfaces.config.ConfigChangeListener;
30
 import com.dmdirc.interfaces.config.ConfigChangeListener;
30
 import com.dmdirc.interfaces.config.ConfigProvider;
31
 import com.dmdirc.interfaces.config.ConfigProvider;
32
+import com.dmdirc.interfaces.config.IdentityController;
31
 import com.dmdirc.logger.ErrorLevel;
33
 import com.dmdirc.logger.ErrorLevel;
32
 import com.dmdirc.logger.Logger;
34
 import com.dmdirc.logger.Logger;
33
 import com.dmdirc.updater.UpdateChannel;
35
 import com.dmdirc.updater.UpdateChannel;
34
 import com.dmdirc.updater.UpdateChecker;
36
 import com.dmdirc.updater.UpdateChecker;
37
+import com.dmdirc.updater.manager.CachingUpdateManager;
35
 
38
 
36
 import java.awt.event.ActionEvent;
39
 import java.awt.event.ActionEvent;
37
 import java.awt.event.ActionListener;
40
 import java.awt.event.ActionListener;
71
     private JButton checkNow;
74
     private JButton checkNow;
72
     /** Update channel. */
75
     /** Update channel. */
73
     private JComboBox updateChannel;
76
     private JComboBox updateChannel;
74
-    /** Swing controller. */
75
-    private final SwingController controller;
76
     /** The prefs dialog that will be hosting the panel. */
77
     /** The prefs dialog that will be hosting the panel. */
77
     private final SwingPreferencesDialog prefsDialog;
78
     private final SwingPreferencesDialog prefsDialog;
79
+    /** The configuration to write settings changes to. */
80
+    private final ConfigProvider userConfig;
81
+    /** The configuration to read global settings from. */
82
+    private final AggregateConfigProvider globalConfig;
83
+    /** The manager to read update information from. */
84
+    private final CachingUpdateManager updateManager;
85
+    /** Controller to pass to the update checker. */
86
+    private final IdentityController identityController;
78
 
87
 
79
     /**
88
     /**
80
      * Instantiates a new update config panel.
89
      * Instantiates a new update config panel.
81
      *
90
      *
82
-     * @param controller Swing controller
83
      * @param prefsDialog The prefs dialog that will be hosting the panel.
91
      * @param prefsDialog The prefs dialog that will be hosting the panel.
92
+     * @param userConfig The configuration to write settings changes to.
93
+     * @param globalConfig The configuration to read global settings from.
94
+     * @param updateManager The manager to read update information from.
95
+     * @param identityController Controller to pass to the update checker.
84
      */
96
      */
85
     @Inject
97
     @Inject
86
     public UpdateConfigPanel(
98
     public UpdateConfigPanel(
87
-            final SwingController controller,
88
-            final SwingPreferencesDialog prefsDialog) {
89
-        this.controller = controller;
99
+            final SwingPreferencesDialog prefsDialog,
100
+            @UserConfig final ConfigProvider userConfig,
101
+            @GlobalConfig final AggregateConfigProvider globalConfig,
102
+            final CachingUpdateManager updateManager,
103
+            final IdentityController identityController) {
90
         this.prefsDialog = prefsDialog;
104
         this.prefsDialog = prefsDialog;
105
+        this.userConfig = userConfig;
106
+        this.globalConfig = globalConfig;
107
+        this.updateManager = updateManager;
108
+        this.identityController = identityController;
91
 
109
 
92
         initComponents();
110
         initComponents();
93
         addListeners();
111
         addListeners();
97
     /** {@inheritDoc} */
115
     /** {@inheritDoc} */
98
     @Override
116
     @Override
99
     public void save() {
117
     public void save() {
100
-        final ConfigProvider identity = controller.getGlobalIdentity();
101
-        identity.setOption("updater", "enable", enable.isSelected());
102
-
103
-        identity.setOption("updater", "channel", updateChannel
118
+        userConfig.setOption("updater", "enable", enable.isSelected());
119
+        userConfig.setOption("updater", "channel", updateChannel
104
                 .getSelectedItem().toString());
120
                 .getSelectedItem().toString());
105
 
121
 
106
         for (int i = 0; i < tableModel.getRowCount(); i++) {
122
         for (int i = 0; i < tableModel.getRowCount(); i++) {
107
             final String componentName = tableModel.getComponent(i).getName();
123
             final String componentName = tableModel.getComponent(i).getName();
108
             if ((Boolean) tableModel.getValueAt(i, 1)) {
124
             if ((Boolean) tableModel.getValueAt(i, 1)) {
109
-                identity.unsetOption("updater", "enable-" + componentName);
125
+                userConfig.unsetOption("updater", "enable-" + componentName);
110
             } else {
126
             } else {
111
-                identity.setOption("updater", "enable-" + componentName, false);
127
+                userConfig.setOption("updater", "enable-" + componentName, false);
112
             }
128
             }
113
         }
129
         }
114
     }
130
     }
117
      * Initialises the components.
133
      * Initialises the components.
118
      */
134
      */
119
     private void initComponents() {
135
     private void initComponents() {
120
-        final AggregateConfigProvider config = controller.getGlobalConfig();
121
         enable = new JCheckBox();
136
         enable = new JCheckBox();
122
         scrollPane = new JScrollPane();
137
         scrollPane = new JScrollPane();
123
-        tableModel = new UpdateTableModel(
124
-                controller.getCachingUpdateManager(),
125
-                controller.getCachingUpdateManager().getComponents());
138
+        tableModel = new UpdateTableModel(updateManager, updateManager.getComponents());
126
         table = new PackingTable(tableModel, scrollPane);
139
         table = new PackingTable(tableModel, scrollPane);
127
         checkNow = new JButton("Check now");
140
         checkNow = new JButton("Check now");
128
-        checkNow.setEnabled(config.getOptionBool("updater", "enable"));
129
-        updateChannel = new JComboBox(new DefaultComboBoxModel(UpdateChannel.
130
-                values()));
141
+        checkNow.setEnabled(globalConfig.getOptionBool("updater", "enable"));
142
+        updateChannel = new JComboBox(new DefaultComboBoxModel(UpdateChannel.values()));
131
 
143
 
132
-        enable.setSelected(config.getOptionBool("updater", "enable"));
144
+        enable.setSelected(globalConfig.getOptionBool("updater", "enable"));
133
         UpdateChannel channel = UpdateChannel.NONE;
145
         UpdateChannel channel = UpdateChannel.NONE;
134
         try {
146
         try {
135
-            channel = UpdateChannel.valueOf(
136
-                    config.getOption("updater", "channel"));
147
+            channel = UpdateChannel.valueOf(globalConfig.getOption("updater", "channel"));
137
         } catch (IllegalArgumentException e) {
148
         } catch (IllegalArgumentException e) {
138
             Logger.userError(ErrorLevel.LOW, "Invalid setting for update "
149
             Logger.userError(ErrorLevel.LOW, "Invalid setting for update "
139
                     + "channel, defaulting to none.");
150
                     + "channel, defaulting to none.");
147
      */
158
      */
148
     private void addListeners() {
159
     private void addListeners() {
149
         checkNow.addActionListener(this);
160
         checkNow.addActionListener(this);
150
-        controller.getGlobalConfig().addChangeListener("updater",
151
-                "enable", this);
161
+        globalConfig.addChangeListener("updater", "enable", this);
152
         enable.addActionListener(this);
162
         enable.addActionListener(this);
153
     }
163
     }
154
 
164
 
175
         if (enable == e.getSource()) {
185
         if (enable == e.getSource()) {
176
             checkNow.setEnabled(enable.isSelected());
186
             checkNow.setEnabled(enable.isSelected());
177
         } else {
187
         } else {
178
-            UpdateChecker.checkNow(
179
-                    controller.getCachingUpdateManager(),
180
-                    controller.getIdentityManager());
188
+            UpdateChecker.checkNow(updateManager, identityController);
181
         }
189
         }
182
     }
190
     }
183
 
191
 
184
     /** {@inheritDoc} */
192
     /** {@inheritDoc} */
185
     @Override
193
     @Override
186
-    public void configChanged(final String domain, final    String key) {
187
-        checkNow.setEnabled(controller.getGlobalConfig().getOptionBool(
188
-                "updater", "enable"));
194
+    public void configChanged(final String domain, final String key) {
195
+        checkNow.setEnabled(globalConfig.getOptionBool("updater", "enable"));
189
     }
196
     }
190
 }
197
 }

Laddar…
Avbryt
Spara