Browse Source

Stop using redundant windowfacotry calls

Change-Id: I96c7fb7ba00a5d5fd3472806c9915ecdb9bc444f
Reviewed-on: http://gerrit.dmdirc.com/3291
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
changes/91/3291/2
Greg Holmes 10 years ago
parent
commit
175097f62a
1 changed files with 6 additions and 59 deletions
  1. 6
    59
      src/com/dmdirc/addons/ui_swing/components/TopicBar.java

+ 6
- 59
src/com/dmdirc/addons/ui_swing/components/TopicBar.java View File

@@ -27,7 +27,6 @@ import com.dmdirc.ClientModule.GlobalConfig;
27 27
 import com.dmdirc.Topic;
28 28
 import com.dmdirc.addons.ui_swing.MainFrame;
29 29
 import com.dmdirc.addons.ui_swing.SwingController;
30
-import com.dmdirc.addons.ui_swing.SwingWindowFactory;
31 30
 import com.dmdirc.addons.ui_swing.UIUtilities;
32 31
 import com.dmdirc.addons.ui_swing.actions.ReplacePasteAction;
33 32
 import com.dmdirc.addons.ui_swing.components.frames.ChannelFrame;
@@ -37,7 +36,6 @@ import com.dmdirc.addons.ui_swing.components.text.WrapEditorKit;
37 36
 import com.dmdirc.interfaces.TopicChangeListener;
38 37
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
39 38
 import com.dmdirc.interfaces.config.ConfigChangeListener;
40
-import com.dmdirc.interfaces.ui.Window;
41 39
 import com.dmdirc.plugins.PluginDomain;
42 40
 import com.dmdirc.plugins.PluginManager;
43 41
 import com.dmdirc.ui.IconManager;
@@ -83,12 +81,10 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
83 81
     private final JButton topicEdit;
84 82
     /** Cancel button. */
85 83
     private final JButton topicCancel;
86
-    /** The factory to use to retrieve windows. */
87
-    private final SwingWindowFactory windowFactory;
88 84
     /** Manager to use to resolve colours. */
89 85
     private final ColourManager colourManager;
90 86
     /** The window this topic bar is for. */
91
-    private final Window window;
87
+    private final ChannelFrame window;
92 88
     /** Associated channel. */
93 89
     private final Channel channel;
94 90
     /** the maximum length allowed for a topic. */
@@ -118,9 +114,6 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
118 114
      * @param domain          The domain that settings are stored in.
119 115
      * @param colourManager   The colour manager to use for colour input.
120 116
      * @param pluginManager   The plugin manager to use for plugin information.
121
-     * @param windowFactory   The factory to use to find and create windows.
122
-     * @param urlHandler      The URL handler to use to open URLs.
123
-     * @param swingController The controller to use to manage window focus.
124 117
      * @param channel         The channel that this topic bar is for.
125 118
      * @param window          The window this topic bar is for.
126 119
      * @param iconManager     The icon manager to use for this bar's icons.
@@ -131,13 +124,11 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
131 124
             @SuppressWarnings("qualifiers") @PluginDomain(SwingController.class) final String domain,
132 125
             final ColourManager colourManager,
133 126
             final PluginManager pluginManager,
134
-            final SwingWindowFactory windowFactory,
135 127
             @Unbound final Channel channel,
136
-            @Unbound final Window window,
128
+            @Unbound final ChannelFrame window,
137 129
             @Unbound final IconManager iconManager) {
138 130
         this.channel = channel;
139 131
         this.domain = domain;
140
-        this.windowFactory = windowFactory;
141 132
         this.colourManager = colourManager;
142 133
         this.window = window;
143 134
         topicText = new TextPaneInputField(parentWindow, globalConfig, colourManager, iconManager);
@@ -258,11 +249,6 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
258 249
         super.setVisible(true);
259 250
     }
260 251
 
261
-    /**
262
-     * {@inheritDoc}
263
-     *
264
-     * @param e Action event
265
-     */
266 252
     @Override
267 253
     public void actionPerformed(final ActionEvent e) {
268 254
         if (!channel.isOnChannel()) {
@@ -290,8 +276,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
290 276
                 .equals(topicText.getText()))) {
291 277
             channel.setTopic(topicText.getText());
292 278
         }
293
-        ((ChannelFrame) windowFactory.getSwingWindow(channel))
294
-                .getInputField().requestFocusInWindow();
279
+        window.getInputField().requestFocusInWindow();
295 280
         if (channel.getCurrentTopic() == null) {
296 281
             topicText.setText("");
297 282
         } else {
@@ -327,10 +312,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
327 312
         topicText.setFocusable(false);
328 313
         topicText.setEditable(false);
329 314
         topicCancel.setVisible(false);
330
-        final ChannelFrame channelFrame = (ChannelFrame) windowFactory.getSwingWindow(channel);
331
-        if (channelFrame != null) {
332
-            channelFrame.getInputField().requestFocusInWindow();
333
-        }
315
+        window.getInputField().requestFocusInWindow();
334 316
         topicChanged(channel, null);
335 317
     }
336 318
 
@@ -394,7 +376,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
394 376
     }
395 377
 
396 378
     /**
397
-     * Sets the caret colour to the specified coloour.
379
+     * Sets the caret colour to the specified colour.
398 380
      *
399 381
      * @param optionColour Colour for the caret
400 382
      */
@@ -408,11 +390,6 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
408 390
         });
409 391
     }
410 392
 
411
-    /**
412
-     * Sets the foreground colour to the specified coloour.
413
-     *
414
-     * @param optionColour Colour for the foreground
415
-     */
416 393
     @Override
417 394
     public void setForeground(final Color optionColour) {
418 395
         UIUtilities.invokeLater(new Runnable() {
@@ -425,7 +402,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
425 402
     }
426 403
 
427 404
     /**
428
-     * Sets the disabled text colour to the specified coloour.
405
+     * Sets the disabled text colour to the specified colour.
429 406
      *
430 407
      * @param optionColour Colour for the disabled text
431 408
      */
@@ -439,11 +416,6 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
439 416
         });
440 417
     }
441 418
 
442
-    /**
443
-     * Sets the background colour to the specified coloour.
444
-     *
445
-     * @param optionColour Colour for the caret
446
-     */
447 419
     @Override
448 420
     public void setBackground(final Color optionColour) {
449 421
         UIUtilities.invokeLater(new Runnable() {
@@ -508,11 +480,6 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
508 480
         });
509 481
     }
510 482
 
511
-    /**
512
-     * {@inheritDoc}
513
-     *
514
-     * @param e Mouse event
515
-     */
516 483
     @Override
517 484
     public void mouseClicked(final MouseEvent e) {
518 485
         if (e.getClickCount() == 2 && !topicText.isEditable()) {
@@ -520,41 +487,21 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
520 487
         }
521 488
     }
522 489
 
523
-    /**
524
-     * {@inheritDoc}
525
-     *
526
-     * @param e Mouse event
527
-     */
528 490
     @Override
529 491
     public void mousePressed(final MouseEvent e) {
530 492
         //Ignore
531 493
     }
532 494
 
533
-    /**
534
-     * {@inheritDoc}
535
-     *
536
-     * @param e Mouse event
537
-     */
538 495
     @Override
539 496
     public void mouseReleased(final MouseEvent e) {
540 497
         //Ignore
541 498
     }
542 499
 
543
-    /**
544
-     * {@inheritDoc}
545
-     *
546
-     * @param e Mouse event
547
-     */
548 500
     @Override
549 501
     public void mouseEntered(final MouseEvent e) {
550 502
         //Ignore
551 503
     }
552 504
 
553
-    /**
554
-     * {@inheritDoc}
555
-     *
556
-     * @param e Mouse event
557
-     */
558 505
     @Override
559 506
     public void mouseExited(final MouseEvent e) {
560 507
         //Ignore

Loading…
Cancel
Save