瀏覽代碼

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 年之前
父節點
當前提交
f31a2c4756

+ 3
- 6
src/com/dmdirc/addons/logging/HistoryWindow.java 查看文件

39
     /** The window we're using. */
39
     /** The window we're using. */
40
     private Window window;
40
     private Window window;
41
 
41
 
42
-    /** Our parent window. */
43
-    private Window parent;
44
-
45
     /**
42
     /**
46
      * Creates a new HistoryWindow.
43
      * Creates a new HistoryWindow.
47
      *
44
      *
51
      * @param numLines The number of lines to show
48
      * @param numLines The number of lines to show
52
      */
49
      */
53
     public HistoryWindow(final String title, final ReverseFileReader reader,
50
     public HistoryWindow(final String title, final ReverseFileReader reader,
54
-                         final Window parent, final int numLines) {
51
+                         final FrameContainer parent, final int numLines) {
55
         super("raw", title, title, parent.getConfigManager());
52
         super("raw", title, title, parent.getConfigManager());
56
 
53
 
57
         this.parent = parent;
54
         this.parent = parent;
58
 
55
 
59
         window = Main.getUI().getWindow(this);
56
         window = Main.getUI().getWindow(this);
60
 
57
 
61
-        WindowManager.addWindow(parent, window);
58
+        WindowManager.addWindow(parent, this);
62
         window.open();
59
         window.open();
63
         final int frameBufferSize = IdentityManager.getGlobalConfig().getOptionInt(
60
         final int frameBufferSize = IdentityManager.getGlobalConfig().getOptionInt(
64
                 "ui", "frameBufferSize");
61
                 "ui", "frameBufferSize");
97
     /** {@inheritDoc} */
94
     /** {@inheritDoc} */
98
     @Override
95
     @Override
99
     public Server getServer() {
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 查看文件

838
             return false;
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
         return true;
843
         return true;
844
     }
844
     }

+ 3
- 2
src/com/dmdirc/addons/redirect/FakeInputWindow.java 查看文件

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

+ 3
- 0
src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java 查看文件

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

+ 2
- 6
src/com/dmdirc/addons/ui_swing/components/OptionalJSpinner.java 查看文件

176
      * @param listener Listener to add
176
      * @param listener Listener to add
177
      */
177
      */
178
     public void addChangeListener(final ChangeListener listener) {
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
      * @param listener Listener to remove
185
      * @param listener Listener to remove
188
      */
186
      */
189
     public void removeChangeListener(final ChangeListener listener) {
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
     private void fireChangeListener() {
191
     private void fireChangeListener() {

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/colours/OptionalColourChooser.java 查看文件

37
 import javax.swing.JButton;
37
 import javax.swing.JButton;
38
 import javax.swing.JCheckBox;
38
 import javax.swing.JCheckBox;
39
 import javax.swing.JPanel;
39
 import javax.swing.JPanel;
40
-import javax.swing.UIManager;
41
 
40
 
42
 import net.miginfocom.swing.MigLayout;
41
 import net.miginfocom.swing.MigLayout;
43
 
42
 

+ 4
- 5
src/com/dmdirc/addons/ui_swing/components/durationeditor/DurationDisplay.java 查看文件

182
      * @param listener Listener to add
182
      * @param listener Listener to add
183
      */
183
      */
184
     public void addDurationListener(final DurationListener listener) {
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 查看文件

195
      * @param listener Listener to add
195
      * @param listener Listener to add
196
      */
196
      */
197
     public void addDurationListener(final DurationListener listener) {
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 查看文件

252
      * @param listener
252
      * @param listener
253
      */
253
      */
254
     public void addStepListener(final StepListener listener) {
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
      * @param listener
261
      * @param listener
264
      */
262
      */
265
     public void removeStepListener(final StepListener listener) {
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
      * @param listener
270
      * @param listener
275
      */
271
      */
276
     public void addWizardListener(final WizardListener listener) {
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
      * @param listener
279
      * @param listener
286
      */
280
      */
287
     public void removeWizardListener(final WizardListener listener) {
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
      * @param step Step to be displayed
288
      * @param step Step to be displayed
297
      */
289
      */
298
     private void fireStepAboutToBeDisplayed(final Step step) {
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
      * @param step step thats been hidden
299
      * @param step step thats been hidden
312
      */
300
      */
313
     private void fireStepHidden(final Step step) {
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
      * Fires wizard finished events.
308
      * Fires wizard finished events.
325
      */
309
      */
326
     private void fireWizardFinished() {
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
      * Fires wizard cancelled events.
317
      * Fires wizard cancelled events.
338
      */
318
      */
339
     protected void fireWizardCancelled() {
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…
取消
儲存