ソースを参照

Fix the status bar.

This needs to be fixed properly by removed the statusbar
manager and all uses.
pull/80/head
Greg Holmes 9年前
コミット
43cf4c58b7

+ 12
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/components/statusbar/SwingStatusBar.java ファイルの表示

@@ -22,8 +22,11 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components.statusbar;
24 24
 
25
+import com.dmdirc.DMDircMBassador;
25 26
 import com.dmdirc.events.StatusBarComponentAddedEvent;
26 27
 import com.dmdirc.events.StatusBarComponentRemovedEvent;
28
+import com.dmdirc.events.StatusBarMessageClearEvent;
29
+import com.dmdirc.events.StatusBarMessageEvent;
27 30
 import com.dmdirc.interfaces.ui.StatusBar;
28 31
 import com.dmdirc.interfaces.ui.StatusBarComponent;
29 32
 import com.dmdirc.ui.StatusMessage;
@@ -49,6 +52,8 @@ public class SwingStatusBar extends JPanel implements StatusBar {
49 52
 
50 53
     /** A version number for this class. */
51 54
     private static final long serialVersionUID = 5;
55
+    /** Event bus to post events to. */
56
+    private final DMDircMBassador eventBus;
52 57
     /** Mig layout component restraints. */
53 58
     private final String componentConstraints;
54 59
     /** error panel. */
@@ -61,12 +66,14 @@ public class SwingStatusBar extends JPanel implements StatusBar {
61 66
     /**
62 67
      * Creates a new instance of SwingStatusBar.
63 68
      *
69
+     * @param eventBus     The event bus to post events to (should be removed soon)
64 70
      * @param inviteLabel  The invite label to add to the status bar.
65 71
      * @param updaterLabel The updater label to add to the status bar.
66 72
      * @param errorLabel   The error label to add to the status bar.
67 73
      * @param messageLabel The message label to add to the status bar.
68 74
      */
69 75
     public SwingStatusBar(
76
+            final DMDircMBassador eventBus,
70 77
             final InviteLabel inviteLabel,
71 78
             final UpdaterLabel updaterLabel,
72 79
             final ErrorPanel errorLabel,
@@ -79,6 +86,7 @@ public class SwingStatusBar extends JPanel implements StatusBar {
79 86
         componentConstraints = "sgy components, hmax " + height + ", hmin " + height
80 87
                 + ", wmin 20, shrink 0";
81 88
 
89
+        this.eventBus = eventBus;
82 90
         this.errorLabel = errorLabel;
83 91
         this.updaterLabel = updaterLabel;
84 92
         this.inviteLabel = inviteLabel;
@@ -132,21 +140,21 @@ public class SwingStatusBar extends JPanel implements StatusBar {
132 140
 
133 141
     @Override
134 142
     public void setMessage(final StatusMessage message) {
135
-        //Do nothing
143
+        eventBus.publish(new StatusBarMessageEvent(message));
136 144
     }
137 145
 
138 146
     @Override
139 147
     public void clearMessage() {
140
-        //Do nothing
148
+        eventBus.publish(new StatusBarMessageClearEvent());
141 149
     }
142 150
 
143 151
     @Override
144 152
     public void addComponent(final StatusBarComponent component) {
145
-        //Do nothing
153
+        eventBus.publish(new StatusBarComponentAddedEvent(component));
146 154
     }
147 155
 
148 156
     @Override
149 157
     public void removeComponent(final StatusBarComponent component) {
150
-        //Do nothing
158
+        eventBus.publish(new StatusBarComponentRemovedEvent(component));
151 159
     }
152 160
 }

+ 2
- 1
ui_swing/src/com/dmdirc/addons/ui_swing/injection/SwingModule.java ファイルの表示

@@ -188,7 +188,8 @@ public class SwingModule {
188 188
         final SwingStatusBar sb = UIUtilities.invokeAndWait(new Callable<SwingStatusBar>() {
189 189
             @Override
190 190
             public SwingStatusBar call() {
191
-                return new SwingStatusBar(inviteLabel, updaterLabel, errorLabel, messageLabel);
191
+                return new SwingStatusBar(eventBus, inviteLabel, updaterLabel, errorLabel,
192
+                        messageLabel);
192 193
             }
193 194
         });
194 195
         eventBus.subscribe(messageLabel);

読み込み中…
キャンセル
保存