|
@@ -22,10 +22,11 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.addons.ui_swing.components.statusbar;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.addons.ui_swing.SwingController;
|
|
25
|
+import com.dmdirc.ClientModule.GlobalConfig;
|
26
|
26
|
import com.dmdirc.addons.ui_swing.dialogs.FeedbackDialog;
|
27
|
27
|
import com.dmdirc.addons.ui_swing.injection.DialogProvider;
|
28
|
28
|
import com.dmdirc.interfaces.ui.StatusBarComponent;
|
|
29
|
+import com.dmdirc.ui.IconManager;
|
29
|
30
|
|
30
|
31
|
import java.awt.event.ActionEvent;
|
31
|
32
|
import java.awt.event.ActionListener;
|
|
@@ -54,30 +55,34 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
|
54
|
55
|
private final JPopupMenu menu;
|
55
|
56
|
/** Show menu item. */
|
56
|
57
|
private final JMenuItem show;
|
57
|
|
- /** Swing Controller. */
|
58
|
|
- private final SwingController controller;
|
|
58
|
+ /** Status bar we're displayed in. */
|
|
59
|
+ // TODO: There should be some other class which adds the nag to the status bar, and manages it.
|
|
60
|
+ private final SwingStatusBar statusBar;
|
59
|
61
|
/** Provider of feedback dialogs. */
|
60
|
62
|
private final DialogProvider<FeedbackDialog> feedbackDialogProvider;
|
61
|
63
|
|
62
|
64
|
/**
|
63
|
65
|
* Creates a new feedback nag.
|
64
|
66
|
*
|
65
|
|
- * @param controller Swing controller
|
|
67
|
+ * @param statusBar Status bar the nag will be displayed in.
|
|
68
|
+ * @param iconManager The icon manager to use to find the feedback nag icon.
|
66
|
69
|
* @param feedbackDialogProvider Provider of feedback dialogs.
|
67
|
70
|
*/
|
68
|
71
|
@Inject
|
69
|
72
|
public FeedbackNag(
|
70
|
|
- final SwingController controller,
|
|
73
|
+ final SwingStatusBar statusBar,
|
|
74
|
+ @GlobalConfig final IconManager iconManager,
|
71
|
75
|
final DialogProvider<FeedbackDialog> feedbackDialogProvider) {
|
72
|
76
|
super();
|
73
|
|
- this.controller = controller;
|
|
77
|
+
|
|
78
|
+ this.statusBar = statusBar;
|
74
|
79
|
this.feedbackDialogProvider = feedbackDialogProvider;
|
75
|
80
|
|
76
|
81
|
menu = new JPopupMenu();
|
77
|
82
|
show = new JMenuItem("Open");
|
78
|
83
|
final JMenuItem dismiss = new JMenuItem("Dismiss");
|
79
|
84
|
|
80
|
|
- setIcon(controller.getIconManager().getIcon("feedback"));
|
|
85
|
+ setIcon(iconManager.getIcon("feedback"));
|
81
|
86
|
setBorder(BorderFactory.createEtchedBorder());
|
82
|
87
|
setToolTipText("We would appreciate any feedback you may have about "
|
83
|
88
|
+ "DMDirc.");
|
|
@@ -88,7 +93,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
|
88
|
93
|
show.addActionListener(this);
|
89
|
94
|
dismiss.addActionListener(this);
|
90
|
95
|
addMouseListener(this);
|
91
|
|
- controller.getSwingStatusBar().addComponent(this);
|
|
96
|
+ statusBar.addComponent(this);
|
92
|
97
|
}
|
93
|
98
|
|
94
|
99
|
/**
|
|
@@ -120,7 +125,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
|
120
|
125
|
public void mouseReleased(final MouseEvent e) {
|
121
|
126
|
if (e.getButton() == 1) {
|
122
|
127
|
feedbackDialogProvider.displayOrRequestFocus();
|
123
|
|
- controller.getSwingStatusBar().removeComponent(this);
|
|
128
|
+ statusBar.removeComponent(this);
|
124
|
129
|
}
|
125
|
130
|
checkMouseEvent(e);
|
126
|
131
|
}
|
|
@@ -166,6 +171,6 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
|
166
|
171
|
if (e.getSource() == show) {
|
167
|
172
|
feedbackDialogProvider.displayOrRequestFocus();
|
168
|
173
|
}
|
169
|
|
- controller.getSwingStatusBar().removeComponent(this);
|
|
174
|
+ statusBar.removeComponent(this);
|
170
|
175
|
}
|
171
|
176
|
}
|