Ver código fonte

Remove warnings from ignore list

Change-Id: I97599c4c3f429310aead6403918b59b38bc2d251
Reviewed-on: http://gerrit.dmdirc.com/3140
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes 10 anos atrás
pai
commit
f7d54d1edd

+ 4
- 11
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/IgnoreListModel.java Ver arquivo

@@ -27,16 +27,11 @@ import com.dmdirc.parser.common.IgnoreList;
27 27
 import javax.swing.AbstractListModel;
28 28
 
29 29
 /**
30
- *
31
- * @author chris
30
+ * Shows the list of ignores in string form.
32 31
  */
33
-public class IgnoreListModel extends AbstractListModel {
32
+public class IgnoreListModel extends AbstractListModel<String> {
34 33
 
35
-    /**
36
-     * A version number for this class. It should be changed whenever the class structure is changed
37
-     * (or anything else that would prevent serialized objects being unserialized with the new
38
-     * class).
39
-     */
34
+    /** A version number for this class. */
40 35
     private static final long serialVersionUID = 1;
41 36
     /** Ignore list backing this model. */
42 37
     private final IgnoreList ignoreList;
@@ -55,15 +50,13 @@ public class IgnoreListModel extends AbstractListModel {
55 50
         isSimple = ignoreList.canConvert();
56 51
     }
57 52
 
58
-    /** {@inheritDoc} */
59 53
     @Override
60 54
     public int getSize() {
61 55
         return ignoreList.count();
62 56
     }
63 57
 
64
-    /** {@inheritDoc} */
65 58
     @Override
66
-    public Object getElementAt(final int index) {
59
+    public String getElementAt(final int index) {
67 60
         if (isSimple) {
68 61
             return ignoreList.getSimpleList().get(index);
69 62
         } else {

+ 14
- 23
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/IgnoreListPanel.java Ver arquivo

@@ -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} */

+ 21
- 19
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/ServerSettingsDialog.java Ver arquivo

@@ -93,7 +93,8 @@ public class ServerSettingsDialog extends StandardDialog implements ActionListen
93 93
         setTitle("Server settings");
94 94
         setResizable(false);
95 95
 
96
-        initComponents(controller, iconManager, server.getConfigManager(), compFactory);
96
+        initComponents(controller, parentWindow, iconManager, server.getConfigManager(),
97
+                compFactory);
97 98
         initListeners();
98 99
     }
99 100
 
@@ -106,15 +107,16 @@ public class ServerSettingsDialog extends StandardDialog implements ActionListen
106 107
      * @config Config to read from
107 108
      * @param compFactory Preferences setting component factory
108 109
      */
109
-    private void initComponents(final SwingController controller, final IconManager iconManager,
110
-            final AggregateConfigProvider config, final PrefsComponentFactory compFactory) {
110
+    private void initComponents(final SwingController controller, final MainFrame parentWindow,
111
+            final IconManager iconManager, final AggregateConfigProvider config,
112
+            final PrefsComponentFactory compFactory) {
111 113
         orderButtons(new JButton(), new JButton());
112 114
 
113 115
         tabbedPane = new JTabbedPane();
114 116
 
115 117
         modesPanel = new UserModesPane(controller, server);
116 118
 
117
-        ignoreList = new IgnoreListPanel(controller, server, controller.getMainFrame());
119
+        ignoreList = new IgnoreListPanel(iconManager, server, parentWindow);
118 120
 
119 121
         performPanel = new PerformTab(iconManager, config, performWrapper, server);
120 122
 
@@ -167,21 +169,21 @@ public class ServerSettingsDialog extends StandardDialog implements ActionListen
167 169
                     ModalityType.MODELESS,
168 170
                     "Server has been disconnected.", "Any changes you have "
169 171
                     + "made will be lost, are you sure you want to close this " + "dialog?") {
170
-                private static final long serialVersionUID = 1;
171
-
172
-                /** {@inheritDoc} */
173
-                @Override
174
-                public boolean save() {
175
-                    ServerSettingsDialog.this.dispose();
176
-                    return true;
177
-                }
178
-
179
-                /** {@inheritDoc} */
180
-                @Override
181
-                public void cancelled() {
182
-                    //Ignore
183
-                }
184
-            }.display(getOwner());
172
+                        private static final long serialVersionUID = 1;
173
+
174
+                        /** {@inheritDoc} */
175
+                        @Override
176
+                        public boolean save() {
177
+                            ServerSettingsDialog.this.dispose();
178
+                            return true;
179
+                        }
180
+
181
+                        /** {@inheritDoc} */
182
+                        @Override
183
+                        public void cancelled() {
184
+                            //Ignore
185
+                        }
186
+                    }.display(getOwner());
185 187
         } else {
186 188
             closeAndSave();
187 189
         }

Carregando…
Cancelar
Salvar