Browse Source

Removes some uses of deprecated methods

Change-Id: I22de49ab4ce11af7647d2cdaadb894ac7a0291ef
Reviewed-on: http://gerrit.dmdirc.com/1196
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4
Greboid 14 years ago
parent
commit
75f2a661e2

+ 1
- 1
src/com/dmdirc/addons/tabcompletion_bash/BashStyle.java View File

@@ -92,7 +92,7 @@ public class BashStyle implements TabCompletionStyle {
92 92
             
93 93
             final String sub = res.getBestSubstring();
94 94
             if (sub.equalsIgnoreCase(word) && tabCount >= 2) {
95
-                window.addLine("tabCompletion", res.toString());
95
+                window.getContainer().addLine("tabCompletion", res.toString());
96 96
                 
97 97
                 return null;
98 98
             } else {

+ 35
- 10
src/com/dmdirc/addons/ui_dummy/DummyController.java View File

@@ -72,32 +72,57 @@ public final class DummyController extends Plugin implements UIController {
72 72
         return new DummyStatusBar();
73 73
     }
74 74
        
75
-    /** {@inheritDoc} */
76
-    @Override
75
+    /**
76
+     * {@inheritDoc}
77
+     *
78
+     * @deprecated Controllers should listen for window events using a
79
+     * {@link FrameListener} and create windows as needed.
80
+     */
81
+    @Override  @Deprecated
77 82
     public ChannelWindow getChannel(final Channel channel) {
78 83
         return new DummyChannelWindow(channel);
79 84
     }
80 85
     
81
-    /** {@inheritDoc} */
82
-    @Override
86
+    /**
87
+     * {@inheritDoc}
88
+     *
89
+     * @deprecated Controllers should listen for window events using a
90
+     * {@link FrameListener} and create windows as needed.
91
+     */
92
+    @Override  @Deprecated
83 93
     public ServerWindow getServer(final Server server) {
84 94
         return new DummyServerWindow(server);
85 95
     }
86 96
     
87
-    /** {@inheritDoc} */
88
-    @Override
97
+    /**
98
+     * {@inheritDoc}
99
+     *
100
+     * @deprecated Controllers should listen for window events using a
101
+     * {@link FrameListener} and create windows as needed.
102
+     */
103
+    @Override  @Deprecated
89 104
     public QueryWindow getQuery(final Query query) {
90 105
         return new DummyQueryWindow(query);
91 106
     }
92 107
     
93
-    /** {@inheritDoc} */
94
-    @Override
108
+    /**
109
+     * {@inheritDoc}
110
+     *
111
+     * @deprecated Controllers should listen for window events using a
112
+     * {@link FrameListener} and create windows as needed.
113
+     */
114
+    @Override  @Deprecated
95 115
     public Window getWindow(final FrameContainer<?> owner) {
96 116
         throw new UnsupportedOperationException("Not supported yet.");
97 117
     }
98 118
     
99
-    /** {@inheritDoc} */
100
-    @Override
119
+    /**
120
+     * {@inheritDoc}
121
+     *
122
+     * @deprecated Controllers should listen for window events using a
123
+     * {@link FrameListener} and create windows as needed.
124
+     */
125
+    @Override  @Deprecated
101 126
     public InputWindow getInputWindow(final WritableFrameContainer<?> owner) {
102 127
         return new DummyInputWindow(owner, owner.getCommandParser());
103 128
     }

+ 15
- 12
src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java View File

@@ -207,6 +207,7 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
207 207
      * @return This frame's container.
208 208
      */
209 209
     @Override
210
+    @SuppressWarnings("unchecked")
210 211
     public WritableFrameContainer<? extends InputWindow> getContainer() {
211 212
         return (WritableFrameContainer<? extends InputWindow>) super.getContainer();
212 213
     }
@@ -263,6 +264,8 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
263 264
      * Sets the away indicator on or off.
264 265
      *
265 266
      * @param awayState away state
267
+     *
268
+     * @deprecated Use {@link AwayStateListener}s to listen for changes instead
266 269
      */
267 270
     @Override
268 271
     @Deprecated
@@ -400,8 +403,8 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
400 403
             final String text = inputFieldText.substring(0, caretPosition)
401 404
                     + clipboard + inputFieldText.substring(caretPosition);
402 405
             //check the limit
403
-            final Integer pasteTrigger = getConfigManager().getOptionInt("ui",
404
-                    "pasteProtectionLimit");
406
+            final Integer pasteTrigger = getContainer().getConfigManager()
407
+                    .getOptionInt("ui", "pasteProtectionLimit");
405 408
             //check whether the number of lines is over the limit
406 409
             if (pasteTrigger != null && getContainer().getNumLines(text)
407 410
                     > pasteTrigger) {
@@ -436,29 +439,29 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
436 439
     public void configChanged(final String domain, final String key) {
437 440
         super.configChanged(domain, key);
438 441
 
439
-        if ("ui".equals(domain) && getConfigManager() != null) {
442
+        if ("ui".equals(domain) && getContainer().getConfigManager() != null) {
440 443
             if (getInputField() != null) {
441 444
                 if ("inputbackgroundcolour".equals(key) || "backgroundcolour".
442 445
                         equals(key)) {
443
-                    getInputField().setBackground(getConfigManager().
444
-                            getOptionColour(
446
+                    getInputField().setBackground(getContainer()
447
+                            .getConfigManager().getOptionColour(
445 448
                             "ui", "inputbackgroundcolour",
446 449
                             "ui", "backgroundcolour"));
447 450
                 } else if ("inputforegroundcolour".equals(key) || "foregroundcolour".
448 451
                         equals(key)) {
449
-                    getInputField().setForeground(getConfigManager().
450
-                            getOptionColour(
452
+                    getInputField().setForeground(getContainer()
453
+                            .getConfigManager().getOptionColour(
451 454
                             "ui", "inputforegroundcolour",
452 455
                             "ui", "foregroundcolour"));
453
-                    getInputField().setCaretColor(getConfigManager().
454
-                            getOptionColour(
456
+                    getInputField().setCaretColor(getContainer()
457
+                            .getConfigManager().getOptionColour(
455 458
                             "ui", "inputforegroundcolour",
456 459
                             "ui", "foregroundcolour"));
457 460
                 }
458 461
             }
459 462
             if ("awayindicator".equals(key)) {
460
-                useAwayIndicator = getConfigManager().getOptionBool("ui",
461
-                        "awayindicator");
463
+                useAwayIndicator = getContainer().getConfigManager()
464
+                        .getOptionBool("ui", "awayindicator");
462 465
             }
463 466
         }
464 467
     }
@@ -470,7 +473,7 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
470 473
      */
471 474
     protected final void popuplateNicklistPopup(final String nickname) {
472 475
         final PopupMenu popups = PopupManager.getMenu(PopupType.CHAN_NICK,
473
-                getConfigManager());
476
+                getContainer().getConfigManager());
474 477
 
475 478
         nickPopup = (JPopupMenu) populatePopupMenu(new JPopupMenu(), popups,
476 479
                 nickname);

+ 25
- 22
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java View File

@@ -146,7 +146,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
146 146
         final ConfigManager config = owner.getConfigManager();
147 147
 
148 148
         setFrameIcon(IconManager.getIconManager().getIcon(owner.getIcon()));
149
-        setTitle(frameParent.getTitle());
149
+        getContainer().setTitle(frameParent.getTitle());
150 150
 
151 151
         owner.addFrameInfoListener(this);
152 152
 
@@ -164,7 +164,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
164 164
         inputWindow = this;
165 165
         while (!(inputWindow instanceof InputWindow) && inputWindow != null
166 166
                 && inputWindow.getContainer().getParent() != null) {
167
-            inputWindow = inputWindow.getContainer().getParent().getFrame();
167
+            inputWindow = controller.getWindowFactory().getSwingWindow(
168
+                    inputWindow.getContainer().getParent());
168 169
         }
169 170
 
170 171
         initComponents();
@@ -202,7 +203,11 @@ public abstract class TextFrame extends JInternalFrame implements Window,
202 203
         return panel;
203 204
     }
204 205
 
205
-    /** {@inheritDoc} */
206
+    /**
207
+     * {@inheritDoc}
208
+     * 
209
+     * @deprecated Should use {@link FrameContainer#setTitle(java.lang.String)}
210
+     */
206 211
     @Override
207 212
     @Deprecated
208 213
     public void setTitle(final String title) {
@@ -216,6 +221,17 @@ public abstract class TextFrame extends JInternalFrame implements Window,
216 221
         });
217 222
     }
218 223
 
224
+    /**
225
+     * {@inheritDoc}
226
+     * 
227
+     * @deprecated Use {@link FrameContainer#getTitle()} instead
228
+     */
229
+    @Override
230
+    @Deprecated
231
+    public String getTitle() {
232
+        return super.getTitle();
233
+    }
234
+
219 235
     /** {@inheritDoc} */
220 236
     @Override
221 237
     public void setVisible(final boolean isVisible) {
@@ -617,15 +633,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
617 633
      */
618 634
     @Override
619 635
     public void internalFrameOpened(final InternalFrameEvent event) {
620
-        new LoggingSwingWorker() {
621
-
622
-            /** {@inheritDoc} */
623
-            @Override
624
-            protected Object doInBackground() throws Exception {
625
-                frameParent.windowOpened();
626
-                return null;
627
-            }
628
-        }.execute();
636
+        //Ignore
629 637
     }
630 638
 
631 639
     /**
@@ -717,15 +725,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
717 725
         if (maximiseRestoreInProgress.get()) {
718 726
             return;
719 727
         }
720
-        new LoggingSwingWorker() {
721
-
722
-            /** {@inheritDoc} */
723
-            @Override
724
-            protected Object doInBackground() throws Exception {
725
-                frameParent.windowDeactivated();
726
-                return null;
727
-            }
728
-        }.execute();
729 728
     }
730 729
 
731 730
     /** {@inheritDoc} */
@@ -734,7 +733,11 @@ public abstract class TextFrame extends JInternalFrame implements Window,
734 733
         return frameParent;
735 734
     }
736 735
 
737
-    /** {@inheritDoc} */
736
+    /**
737
+     * {@inheritDoc}
738
+     * 
739
+     * @deprecated Use {@link FrameContainer#getConfigManager()}
740
+     */
738 741
     @Deprecated
739 742
     @Override
740 743
     public ConfigManager getConfigManager() {

+ 6
- 0
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonPanel.java View File

@@ -38,6 +38,12 @@ import net.miginfocom.swing.MigLayout;
38 38
  */
39 39
 public class ButtonPanel extends JPanel implements Scrollable {
40 40
 
41
+    /**
42
+     * A version number for this class. It should be changed whenever the class
43
+     * structure is changed (or anything else that would prevent serialized
44
+     * objects being unserialized with the new class).
45
+     */
46
+    private static final long serialVersionUID = 1;
41 47
     /** The ButtonBar that created this Panel. */
42 48
     private ButtonBar buttonBar;
43 49
 

+ 6
- 0
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/FrameToggleButton.java View File

@@ -35,6 +35,12 @@ import javax.swing.JToggleButton;
35 35
  */
36 36
 public class FrameToggleButton extends JToggleButton {
37 37
 
38
+    /**
39
+     * A version number for this class. It should be changed whenever the class
40
+     * structure is changed (or anything else that would prevent serialized
41
+     * objects being unserialized with the new class).
42
+     */
43
+    private static final long serialVersionUID = 1;
38 44
     /** Contains the window associated with this button. */
39 45
     private final Window window;
40 46
 

+ 3
- 2
src/com/dmdirc/addons/ui_web/DynamicRequestHandler.java View File

@@ -273,8 +273,9 @@ public class DynamicRequestHandler extends AbstractHandler {
273 273
 
274 274
         nickEvents.add(new Event("clearnicklist", false));
275 275
 
276
-        for (ChannelClientInfo cci : ((WebChannelWindow) WebInterfaceUI.active)
277
-                .getChannel().getChannelInfo().getChannelClients()) {
276
+        for (ChannelClientInfo cci : ((Channel) ((WebChannelWindow)
277
+                WebInterfaceUI.active).getContainer()).getChannelInfo()
278
+                .getChannelClients()) {
278 279
             nickEvents.add(new Event("addnicklist",
279 280
                     cci.getClient().getNickname()));
280 281
         }

+ 45
- 12
src/com/dmdirc/addons/ui_web/WebInterfaceUI.java View File

@@ -134,32 +134,57 @@ public class WebInterfaceUI implements UIController {
134 134
         return new WebStatusBar();
135 135
     }
136 136
 
137
-    /** {@inheritDoc} */
138
-    @Override
137
+    /**
138
+     * {@inheritDoc}
139
+     *
140
+     * @deprecated Controllers should listen for window events using a
141
+     * {@link FrameListener} and create windows as needed.
142
+     */
143
+    @Override @Deprecated
139 144
     public ChannelWindow getChannel(final Channel channel) {
140 145
         return new WebChannelWindow(channel);
141 146
     }
142 147
 
143
-    /** {@inheritDoc} */
144
-    @Override
148
+    /**
149
+     * {@inheritDoc}
150
+     *
151
+     * @deprecated Controllers should listen for window events using a
152
+     * {@link FrameListener} and create windows as needed.
153
+     */
154
+    @Override @Deprecated
145 155
     public ServerWindow getServer(final Server server) {
146 156
         return new WebServerWindow(server);
147 157
     }
148 158
 
149
-    /** {@inheritDoc} */
150
-    @Override
159
+    /**
160
+     * {@inheritDoc}
161
+     *
162
+     * @deprecated Controllers should listen for window events using a
163
+     * {@link FrameListener} and create windows as needed.
164
+     */
165
+    @Override @Deprecated
151 166
     public QueryWindow getQuery(final Query query) {
152 167
         return new WebQueryWindow(query);
153 168
     }
154 169
 
155
-    /** {@inheritDoc} */
156
-    @Override
170
+    /**
171
+     * {@inheritDoc}
172
+     *
173
+     * @deprecated Controllers should listen for window events using a
174
+     * {@link FrameListener} and create windows as needed.
175
+     */
176
+    @Override @Deprecated
157 177
     public Window getWindow(final FrameContainer<?> owner) {
158 178
         return new WebWindow(owner);
159 179
     }
160 180
 
161
-    /** {@inheritDoc} */
162
-    @Override
181
+    /**
182
+     * {@inheritDoc}
183
+     *
184
+     * @deprecated Controllers should listen for window events using a
185
+     * {@link FrameListener} and create windows as needed.
186
+     */
187
+    @Override @Deprecated
163 188
     public InputWindow getInputWindow(final WritableFrameContainer<?> owner) {
164 189
         return new WebInputWindow(owner, owner.getCommandParser());
165 190
     }
@@ -205,13 +230,21 @@ public class WebInterfaceUI implements UIController {
205 230
         // Do nothing
206 231
     }
207 232
 
208
-    /** {@inheritDoc} */
233
+    /**
234
+     * {@inheritDoc}
235
+     * 
236
+     * @deprecated Use {@link WindowManager#getActiveWindow()} instead
237
+     */
209 238
     @Override @Deprecated
210 239
     public Window getActiveWindow() {
211 240
         return active;
212 241
     }
213 242
 
214
-    /** {@inheritDoc} */
243
+    /**
244
+     * {@inheritDoc}
245
+     * 
246
+     * @deprecated Use {@link WindowManager#getActiveWindow()} instead
247
+     */
215 248
     @Override @Deprecated
216 249
     public Server getActiveServer() {
217 250
         //TODO FIXME

+ 6
- 1
src/com/dmdirc/addons/ui_web/uicomponents/WebChannelWindow.java View File

@@ -70,8 +70,13 @@ public class WebChannelWindow extends WebInputWindow implements ChannelWindow {
70 70
         }
71 71
     }
72 72
 
73
-    /** {@inheritDoc} */
73
+    /**
74
+     * {@inheritDoc}
75
+     *
76
+     * @deprecated Use {@link #getContainer()}
77
+     */
74 78
     @Override
79
+    @Deprecated
75 80
     public Channel getChannel() {
76 81
         return channel;
77 82
     }

Loading…
Cancel
Save