Browse Source

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 years ago
parent
commit
fe7fc88dd8

+ 1
- 23
src/com/dmdirc/addons/ui_swing/SwingController.java View File

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

@@ -24,7 +24,6 @@ package com.dmdirc.addons.ui_swing;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.Server;
27
-import com.dmdirc.addons.ui_swing.components.addonbrowser.DataLoaderWorkerFactory;
28 27
 import com.dmdirc.addons.ui_swing.components.menubar.MenuBar;
29 28
 import com.dmdirc.addons.ui_swing.components.statusbar.FeedbackNag;
30 29
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
@@ -40,7 +39,6 @@ import com.dmdirc.addons.ui_swing.wizard.firstrun.FirstRunWizardExecutor;
40 39
 import com.dmdirc.ui.WindowManager;
41 40
 import com.dmdirc.ui.core.components.StatusBarManager;
42 41
 import com.dmdirc.ui.core.util.URLHandler;
43
-import com.dmdirc.updater.manager.CachingUpdateManager;
44 42
 
45 43
 import java.awt.KeyboardFocusManager;
46 44
 import java.awt.Toolkit;
@@ -79,12 +77,6 @@ public class SwingManager {
79 77
     /** The key listener that supports dialogs. */
80 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 80
     /** Provider of first run executors. */
89 81
     private final Provider<FirstRunWizardExecutor> firstRunExecutor;
90 82
 
@@ -117,8 +109,6 @@ public class SwingManager {
117 109
      * @param ctrlTabManager The window manager that handles ctrl+tab behaviour.
118 110
      * @param urlHandler The URL handler to use.
119 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 112
      * @param firstRunExecutor A provider of first run executors.
123 113
      * @param prefsComponentFactory The factory to use to create prefs components.
124 114
      * @param prefsDialogProvider Provider of prefs dialogs.
@@ -139,8 +129,6 @@ public class SwingManager {
139 129
             final CtrlTabWindowManager ctrlTabManager,
140 130
             final URLHandler urlHandler,
141 131
             final DialogKeyListener dialogKeyListener,
142
-            final DataLoaderWorkerFactory dataLoaderWorkerFactory,
143
-            final CachingUpdateManager cachingUpdateManager,
144 132
             final Provider<FirstRunWizardExecutor> firstRunExecutor,
145 133
             final PrefsComponentFactory prefsComponentFactory,
146 134
             final DialogProvider<SwingPreferencesDialog> prefsDialogProvider,
@@ -155,8 +143,6 @@ public class SwingManager {
155 143
         this.statusBarManager = statusBarManager;
156 144
         this.urlHandler = urlHandler;
157 145
         this.dialogKeyListener = dialogKeyListener;
158
-        this.dataLoaderWorkerFactory = dataLoaderWorkerFactory;
159
-        this.cachingUpdateManager = cachingUpdateManager;
160 146
         this.firstRunExecutor = firstRunExecutor;
161 147
         this.prefsComponentFactory = prefsComponentFactory;
162 148
         this.prefsDialogProvider = prefsDialogProvider;
@@ -205,16 +191,6 @@ public class SwingManager {
205 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 194
     @Deprecated
219 195
     public PrefsComponentFactory getPrefsComponentFactory() {
220 196
         return prefsComponentFactory;

+ 6
- 5
src/com/dmdirc/addons/ui_swing/dialogs/error/ErrorListDialog.java View File

@@ -22,7 +22,7 @@
22 22
 
23 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 26
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
27 27
 import com.dmdirc.logger.ErrorManager;
28 28
 import com.dmdirc.logger.ErrorReportStatus;
@@ -76,17 +76,18 @@ public final class ErrorListDialog extends StandardDialog implements
76 76
     /**
77 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 85
         setTitle("Error list");
85 86
         setMinimumSize(new Dimension(600, 550));
86 87
 
87 88
         tableModel = new ErrorTableModel();
88 89
 
89
-        initComponents(controller.getIconManager());
90
+        initComponents(iconManager);
90 91
         layoutComponents();
91 92
         initListeners();
92 93
 

+ 38
- 31
src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateConfigPanel.java View File

@@ -22,16 +22,19 @@
22 22
 
23 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 27
 import com.dmdirc.addons.ui_swing.components.PackingTable;
27 28
 import com.dmdirc.config.prefs.PreferencesInterface;
28 29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29 30
 import com.dmdirc.interfaces.config.ConfigChangeListener;
30 31
 import com.dmdirc.interfaces.config.ConfigProvider;
32
+import com.dmdirc.interfaces.config.IdentityController;
31 33
 import com.dmdirc.logger.ErrorLevel;
32 34
 import com.dmdirc.logger.Logger;
33 35
 import com.dmdirc.updater.UpdateChannel;
34 36
 import com.dmdirc.updater.UpdateChecker;
37
+import com.dmdirc.updater.manager.CachingUpdateManager;
35 38
 
36 39
 import java.awt.event.ActionEvent;
37 40
 import java.awt.event.ActionListener;
@@ -71,23 +74,38 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
71 74
     private JButton checkNow;
72 75
     /** Update channel. */
73 76
     private JComboBox updateChannel;
74
-    /** Swing controller. */
75
-    private final SwingController controller;
76 77
     /** The prefs dialog that will be hosting the panel. */
77 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 89
      * Instantiates a new update config panel.
81 90
      *
82
-     * @param controller Swing controller
83 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 97
     @Inject
86 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 104
         this.prefsDialog = prefsDialog;
105
+        this.userConfig = userConfig;
106
+        this.globalConfig = globalConfig;
107
+        this.updateManager = updateManager;
108
+        this.identityController = identityController;
91 109
 
92 110
         initComponents();
93 111
         addListeners();
@@ -97,18 +115,16 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
97 115
     /** {@inheritDoc} */
98 116
     @Override
99 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 120
                 .getSelectedItem().toString());
105 121
 
106 122
         for (int i = 0; i < tableModel.getRowCount(); i++) {
107 123
             final String componentName = tableModel.getComponent(i).getName();
108 124
             if ((Boolean) tableModel.getValueAt(i, 1)) {
109
-                identity.unsetOption("updater", "enable-" + componentName);
125
+                userConfig.unsetOption("updater", "enable-" + componentName);
110 126
             } else {
111
-                identity.setOption("updater", "enable-" + componentName, false);
127
+                userConfig.setOption("updater", "enable-" + componentName, false);
112 128
             }
113 129
         }
114 130
     }
@@ -117,23 +133,18 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
117 133
      * Initialises the components.
118 134
      */
119 135
     private void initComponents() {
120
-        final AggregateConfigProvider config = controller.getGlobalConfig();
121 136
         enable = new JCheckBox();
122 137
         scrollPane = new JScrollPane();
123
-        tableModel = new UpdateTableModel(
124
-                controller.getCachingUpdateManager(),
125
-                controller.getCachingUpdateManager().getComponents());
138
+        tableModel = new UpdateTableModel(updateManager, updateManager.getComponents());
126 139
         table = new PackingTable(tableModel, scrollPane);
127 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 145
         UpdateChannel channel = UpdateChannel.NONE;
134 146
         try {
135
-            channel = UpdateChannel.valueOf(
136
-                    config.getOption("updater", "channel"));
147
+            channel = UpdateChannel.valueOf(globalConfig.getOption("updater", "channel"));
137 148
         } catch (IllegalArgumentException e) {
138 149
             Logger.userError(ErrorLevel.LOW, "Invalid setting for update "
139 150
                     + "channel, defaulting to none.");
@@ -147,8 +158,7 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
147 158
      */
148 159
     private void addListeners() {
149 160
         checkNow.addActionListener(this);
150
-        controller.getGlobalConfig().addChangeListener("updater",
151
-                "enable", this);
161
+        globalConfig.addChangeListener("updater", "enable", this);
152 162
         enable.addActionListener(this);
153 163
     }
154 164
 
@@ -175,16 +185,13 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
175 185
         if (enable == e.getSource()) {
176 186
             checkNow.setEnabled(enable.isSelected());
177 187
         } else {
178
-            UpdateChecker.checkNow(
179
-                    controller.getCachingUpdateManager(),
180
-                    controller.getIdentityManager());
188
+            UpdateChecker.checkNow(updateManager, identityController);
181 189
         }
182 190
     }
183 191
 
184 192
     /** {@inheritDoc} */
185 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
 }

Loading…
Cancel
Save