Browse Source

Deprecated methods, new ListenerList usage

Change-Id: I58916a0dedd6c8e737f593279b4c91a01f1ba2f0
Reviewed-on: http://gerrit.dmdirc.com/1126
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4
Chris Smith 14 years ago
parent
commit
f31a2c4756

+ 3
- 6
src/com/dmdirc/addons/logging/HistoryWindow.java View File

@@ -39,9 +39,6 @@ public class HistoryWindow extends FrameContainer {
39 39
     /** The window we're using. */
40 40
     private Window window;
41 41
 
42
-    /** Our parent window. */
43
-    private Window parent;
44
-
45 42
     /**
46 43
      * Creates a new HistoryWindow.
47 44
      *
@@ -51,14 +48,14 @@ public class HistoryWindow extends FrameContainer {
51 48
      * @param numLines The number of lines to show
52 49
      */
53 50
     public HistoryWindow(final String title, final ReverseFileReader reader,
54
-                         final Window parent, final int numLines) {
51
+                         final FrameContainer parent, final int numLines) {
55 52
         super("raw", title, title, parent.getConfigManager());
56 53
 
57 54
         this.parent = parent;
58 55
 
59 56
         window = Main.getUI().getWindow(this);
60 57
 
61
-        WindowManager.addWindow(parent, window);
58
+        WindowManager.addWindow(parent, this);
62 59
         window.open();
63 60
         final int frameBufferSize = IdentityManager.getGlobalConfig().getOptionInt(
64 61
                 "ui", "frameBufferSize");
@@ -97,7 +94,7 @@ public class HistoryWindow extends FrameContainer {
97 94
     /** {@inheritDoc} */
98 95
     @Override
99 96
     public Server getServer() {
100
-        return parent == null ? null : parent.getContainer().getServer();
97
+        return parent == null ? null : parent.getServer();
101 98
     }
102 99
 
103 100
 }

+ 1
- 1
src/com/dmdirc/addons/logging/LoggingPlugin.java View File

@@ -838,7 +838,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
838 838
             return false;
839 839
         }
840 840
 
841
-        new HistoryWindow("History", reader, target, historyLines);
841
+        new HistoryWindow("History", reader, target.getContainer(), historyLines);
842 842
 
843 843
         return true;
844 844
     }

+ 3
- 2
src/com/dmdirc/addons/redirect/FakeInputWindow.java View File

@@ -28,10 +28,8 @@ import com.dmdirc.commandparser.parsers.CommandParser;
28 28
 import com.dmdirc.config.ConfigManager;
29 29
 import com.dmdirc.ui.input.InputHandler;
30 30
 import com.dmdirc.ui.interfaces.InputWindow;
31
-import com.dmdirc.ui.messages.Formatter;
32 31
 import com.dmdirc.util.StringTranscoder;
33 32
 
34
-import java.beans.PropertyVetoException;
35 33
 import java.nio.charset.Charset;
36 34
 
37 35
 /**
@@ -95,6 +93,7 @@ public class FakeInputWindow implements InputWindow {
95 93
 
96 94
     /** {@inheritDoc} */
97 95
     @Override
96
+    @Deprecated
98 97
     public void clear() {
99 98
         // Do nothing
100 99
     }
@@ -137,6 +136,7 @@ public class FakeInputWindow implements InputWindow {
137 136
 
138 137
     /** {@inheritDoc} */
139 138
     @Override
139
+    @Deprecated
140 140
     public void setTitle(final String title) {
141 141
         // Do nothing
142 142
     }
@@ -149,6 +149,7 @@ public class FakeInputWindow implements InputWindow {
149 149
 
150 150
     /** {@inheritDoc} */
151 151
     @Override
152
+    @Deprecated
152 153
     public StringTranscoder getTranscoder() {
153 154
         return new StringTranscoder(Charset.defaultCharset());
154 155
     }

+ 3
- 0
src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java View File

@@ -102,6 +102,7 @@ public class DummyInputWindow implements InputWindow {
102 102
     
103 103
     /** {@inheritDoc} */
104 104
     @Override
105
+    @Deprecated
105 106
     public void clear() {
106 107
         throw new UnsupportedOperationException("Not supported yet.");
107 108
     }
@@ -153,6 +154,7 @@ public class DummyInputWindow implements InputWindow {
153 154
     
154 155
     /** {@inheritDoc} */
155 156
     @Override
157
+    @Deprecated
156 158
     public void setTitle(final String title) {
157 159
         this.title = title;
158 160
     }
@@ -165,6 +167,7 @@ public class DummyInputWindow implements InputWindow {
165 167
     
166 168
     /** {@inheritDoc} */
167 169
     @Override
170
+    @Deprecated
168 171
     public StringTranscoder getTranscoder() {
169 172
         return new StringTranscoder(Charset.defaultCharset());
170 173
     }

+ 2
- 6
src/com/dmdirc/addons/ui_swing/components/OptionalJSpinner.java View File

@@ -176,9 +176,7 @@ public class OptionalJSpinner extends JPanel implements ActionListener,
176 176
      * @param listener Listener to add
177 177
      */
178 178
     public void addChangeListener(final ChangeListener listener) {
179
-        synchronized (listeners) {
180
-            listeners.add(ChangeListener.class, listener);
181
-        }
179
+        listeners.add(ChangeListener.class, listener);
182 180
     }
183 181
 
184 182
     /**
@@ -187,9 +185,7 @@ public class OptionalJSpinner extends JPanel implements ActionListener,
187 185
      * @param listener Listener to remove
188 186
      */
189 187
     public void removeChangeListener(final ChangeListener listener) {
190
-        synchronized (listeners) {
191
-            listeners.remove(ChangeListener.class, listener);
192
-        }
188
+        listeners.remove(ChangeListener.class, listener);
193 189
     }
194 190
 
195 191
     private void fireChangeListener() {

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/colours/OptionalColourChooser.java View File

@@ -37,7 +37,6 @@ import javax.swing.BorderFactory;
37 37
 import javax.swing.JButton;
38 38
 import javax.swing.JCheckBox;
39 39
 import javax.swing.JPanel;
40
-import javax.swing.UIManager;
41 40
 
42 41
 import net.miginfocom.swing.MigLayout;
43 42
 

+ 4
- 5
src/com/dmdirc/addons/ui_swing/components/durationeditor/DurationDisplay.java View File

@@ -182,12 +182,11 @@ public class DurationDisplay extends JPanel implements ActionListener,
182 182
      * @param listener Listener to add
183 183
      */
184 184
     public void addDurationListener(final DurationListener listener) {
185
-        synchronized (listeners) {
186
-            if (listener == null) {
187
-                return;
188
-            }
189
-            listeners.add(DurationListener.class, listener);
185
+        if (listener == null) {
186
+            return;
190 187
         }
188
+
189
+        listeners.add(DurationListener.class, listener);
191 190
     }
192 191
 
193 192
     /**

+ 4
- 5
src/com/dmdirc/addons/ui_swing/components/durationeditor/DurationEditor.java View File

@@ -195,12 +195,11 @@ public class DurationEditor extends StandardDialog implements ActionListener {
195 195
      * @param listener Listener to add
196 196
      */
197 197
     public void addDurationListener(final DurationListener listener) {
198
-        synchronized (listeners) {
199
-            if (listener == null) {
200
-                return;
201
-            }
202
-            listeners.add(DurationListener.class, listener);
198
+        if (listener == null) {
199
+            return;
203 200
         }
201
+
202
+        listeners.add(DurationListener.class, listener);
204 203
     }
205 204
 
206 205
     /**

+ 12
- 36
src/com/dmdirc/addons/ui_swing/wizard/WizardPanel.java View File

@@ -252,9 +252,7 @@ public class WizardPanel extends JPanel implements ActionListener {
252 252
      * @param listener
253 253
      */
254 254
     public void addStepListener(final StepListener listener) {
255
-        synchronized (stepListeners) {
256
-            stepListeners.add(StepListener.class, listener);
257
-        }
255
+        stepListeners.add(StepListener.class, listener);
258 256
     }
259 257
 
260 258
     /**
@@ -263,9 +261,7 @@ public class WizardPanel extends JPanel implements ActionListener {
263 261
      * @param listener
264 262
      */
265 263
     public void removeStepListener(final StepListener listener) {
266
-        synchronized (stepListeners) {
267
-            stepListeners.remove(StepListener.class, listener);
268
-        }
264
+        stepListeners.remove(StepListener.class, listener);
269 265
     }
270 266
 
271 267
     /**
@@ -274,9 +270,7 @@ public class WizardPanel extends JPanel implements ActionListener {
274 270
      * @param listener
275 271
      */
276 272
     public void addWizardListener(final WizardListener listener) {
277
-        synchronized (stepListeners) {
278
-            stepListeners.add(WizardListener.class, listener);
279
-        }
273
+        stepListeners.add(WizardListener.class, listener);
280 274
     }
281 275
 
282 276
     /**
@@ -285,9 +279,7 @@ public class WizardPanel extends JPanel implements ActionListener {
285 279
      * @param listener
286 280
      */
287 281
     public void removeWizardListener(final WizardListener listener) {
288
-        synchronized (stepListeners) {
289
-            stepListeners.remove(WizardListener.class, listener);
290
-        }
282
+        stepListeners.remove(WizardListener.class, listener);
291 283
     }
292 284
 
293 285
     /**
@@ -296,12 +288,8 @@ public class WizardPanel extends JPanel implements ActionListener {
296 288
      * @param step Step to be displayed
297 289
      */
298 290
     private void fireStepAboutToBeDisplayed(final Step step) {
299
-        synchronized (stepListeners) {
300
-            List<StepListener> listeners =
301
-                    stepListeners.get(StepListener.class);
302
-            for (StepListener listener : listeners) {
303
-                listener.stepAboutToDisplay(step);
304
-            }
291
+        for (StepListener listener : stepListeners.get(StepListener.class)) {
292
+            listener.stepAboutToDisplay(step);
305 293
         }
306 294
     }
307 295
 
@@ -311,12 +299,8 @@ public class WizardPanel extends JPanel implements ActionListener {
311 299
      * @param step step thats been hidden
312 300
      */
313 301
     private void fireStepHidden(final Step step) {
314
-        synchronized (stepListeners) {
315
-            List<StepListener> listeners =
316
-                    stepListeners.get(StepListener.class);
317
-            for (StepListener listener : listeners) {
318
-                listener.stepHidden(step);
319
-            }
302
+        for (StepListener listener : stepListeners.get(StepListener.class)) {
303
+            listener.stepHidden(step);
320 304
         }
321 305
     }
322 306
 
@@ -324,12 +308,8 @@ public class WizardPanel extends JPanel implements ActionListener {
324 308
      * Fires wizard finished events.
325 309
      */
326 310
     private void fireWizardFinished() {
327
-        synchronized (stepListeners) {
328
-            List<WizardListener> listeners =
329
-                    stepListeners.get(WizardListener.class);
330
-            for (WizardListener listener : listeners) {
331
-                listener.wizardFinished();
332
-            }
311
+        for (WizardListener listener : stepListeners.get(WizardListener.class)) {
312
+            listener.wizardFinished();
333 313
         }
334 314
     }
335 315
 
@@ -337,12 +317,8 @@ public class WizardPanel extends JPanel implements ActionListener {
337 317
      * Fires wizard cancelled events.
338 318
      */
339 319
     protected void fireWizardCancelled() {
340
-        synchronized (stepListeners) {
341
-            List<WizardListener> listeners =
342
-                    stepListeners.get(WizardListener.class);
343
-            for (WizardListener listener : listeners) {
344
-                listener.wizardCancelled();
345
-            }
320
+        for (WizardListener listener : stepListeners.get(WizardListener.class)) {
321
+            listener.wizardCancelled();
346 322
         }
347 323
     }
348 324
 }

Loading…
Cancel
Save