|
@@ -22,12 +22,12 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.addons.ui_swing.dialogs.serversetting;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.addons.ui_swing.SwingController;
|
26
|
25
|
import com.dmdirc.addons.ui_swing.UIUtilities;
|
27
|
26
|
import com.dmdirc.addons.ui_swing.dialogs.StandardInputDialog;
|
28
|
27
|
import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
|
29
|
28
|
import com.dmdirc.interfaces.Connection;
|
30
|
29
|
import com.dmdirc.parser.common.IgnoreList;
|
|
30
|
+import com.dmdirc.ui.IconManager;
|
31
|
31
|
import com.dmdirc.util.validators.NotEmptyValidator;
|
32
|
32
|
import com.dmdirc.util.validators.RegexValidator;
|
33
|
33
|
import com.dmdirc.util.validators.ValidatorChain;
|
|
@@ -52,8 +52,7 @@ import net.miginfocom.swing.MigLayout;
|
52
|
52
|
/**
|
53
|
53
|
* Ignore list panel.
|
54
|
54
|
*/
|
55
|
|
-public final class IgnoreListPanel extends JPanel implements ActionListener,
|
56
|
|
- ListSelectionListener {
|
|
55
|
+public final class IgnoreListPanel extends JPanel implements ActionListener, ListSelectionListener {
|
57
|
56
|
|
58
|
57
|
/** Serial version UID. */
|
59
|
58
|
private static final long serialVersionUID = 2;
|
|
@@ -61,8 +60,8 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
61
|
60
|
private final Connection connection;
|
62
|
61
|
/** Parent window. */
|
63
|
62
|
private final Window parentWindow;
|
64
|
|
- /** Swing controller. */
|
65
|
|
- private final SwingController controller;
|
|
63
|
+ /** Icon manager. */
|
|
64
|
+ private final IconManager iconManager;
|
66
|
65
|
/** Add button. */
|
67
|
66
|
private JButton addButton;
|
68
|
67
|
/** Remove button. */
|
|
@@ -72,7 +71,7 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
72
|
71
|
/** Size label. */
|
73
|
72
|
private JLabel sizeLabel;
|
74
|
73
|
/** Ignore list. */
|
75
|
|
- private JList list;
|
|
74
|
+ private JList<String> list;
|
76
|
75
|
/** Cached ignore list. */
|
77
|
76
|
private IgnoreList cachedIgnoreList;
|
78
|
77
|
/** Ignore list model . */
|
|
@@ -81,15 +80,15 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
81
|
80
|
/**
|
82
|
81
|
* Creates a new instance of IgnoreList.
|
83
|
82
|
*
|
84
|
|
- * @param controller Swing controller
|
|
83
|
+ * @param iconManager Icon manager
|
85
|
84
|
* @param connection The connection whose ignore list should be displayed.
|
86
|
85
|
* @param parentWindow Parent window
|
87
|
86
|
*/
|
88
|
|
- public IgnoreListPanel(final SwingController controller,
|
|
87
|
+ public IgnoreListPanel(final IconManager iconManager,
|
89
|
88
|
final Connection connection, final Window parentWindow) {
|
90
|
89
|
super();
|
91
|
90
|
|
92
|
|
- this.controller = controller;
|
|
91
|
+ this.iconManager = iconManager;
|
93
|
92
|
this.connection = connection;
|
94
|
93
|
this.parentWindow = parentWindow;
|
95
|
94
|
|
|
@@ -104,7 +103,7 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
104
|
103
|
cachedIgnoreList = new IgnoreList(connection.getIgnoreList().getRegexList());
|
105
|
104
|
|
106
|
105
|
listModel = new IgnoreListModel(cachedIgnoreList);
|
107
|
|
- list = new JList(listModel);
|
|
106
|
+ list = new JList<>(listModel);
|
108
|
107
|
|
109
|
108
|
final JScrollPane scrollPane = new JScrollPane(list);
|
110
|
109
|
|
|
@@ -129,8 +128,8 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
129
|
128
|
|
130
|
129
|
/** Updates the size label. */
|
131
|
130
|
private void updateSizeLabel() {
|
132
|
|
- sizeLabel.setText(cachedIgnoreList.count() + " entr" + (cachedIgnoreList.
|
133
|
|
- count() == 1 ? "y" : "ies"));
|
|
131
|
+ sizeLabel.setText(cachedIgnoreList.count() + " entr" + (cachedIgnoreList.count()
|
|
132
|
+ == 1 ? "y" : "ies"));
|
134
|
133
|
}
|
135
|
134
|
|
136
|
135
|
/** Adds listeners to the components. */
|
|
@@ -179,16 +178,12 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
179
|
178
|
public void actionPerformed(final ActionEvent e) {
|
180
|
179
|
if (e.getSource() == addButton) {
|
181
|
180
|
new StandardInputDialog(parentWindow,
|
182
|
|
- ModalityType.MODELESS, controller.getIconManager(), "New ignore list entry",
|
|
181
|
+ ModalityType.MODELESS, iconManager, "New ignore list entry",
|
183
|
182
|
"Please enter the new ignore list entry",
|
184
|
183
|
viewToggle.isSelected() ? new ValidatorChain<>(
|
185
|
184
|
new NotEmptyValidator(), new RegexValidator())
|
186
|
185
|
: new NotEmptyValidator()) {
|
187
|
|
- /**
|
188
|
|
- * A version number for this class. It should be changed whenever the class
|
189
|
|
- * structure is changed (or anything else that would prevent serialized objects
|
190
|
|
- * being unserialized with the new class).
|
191
|
|
- */
|
|
186
|
+ /** A version number for this class. */
|
192
|
187
|
private static final long serialVersionUID = 2;
|
193
|
188
|
|
194
|
189
|
/** {@inheritDoc} */
|
|
@@ -216,11 +211,7 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
|
216
|
211
|
ModalityType.APPLICATION_MODAL,
|
217
|
212
|
"Confirm deletion",
|
218
|
213
|
"Are you sure you want to delete this item?") {
|
219
|
|
- /**
|
220
|
|
- * A version number for this class. It should be changed whenever the class
|
221
|
|
- * structure is changed (or anything else that would prevent serialized objects
|
222
|
|
- * being unserialized with the new class).
|
223
|
|
- */
|
|
214
|
+ /** A version number for this class. */
|
224
|
215
|
private static final long serialVersionUID = 1;
|
225
|
216
|
|
226
|
217
|
/** {@inheritDoc} */
|