Browse Source

Remove some warnings

Change-Id: Ie3d3411ee23fb5d22f9594e36899bf00be8d64f7
Reviewed-on: http://gerrit.dmdirc.com/3166
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Greg Holmes 10 years ago
parent
commit
1b3a531059

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryLabel.java View File

@@ -45,7 +45,7 @@ public class CategoryLabel extends JLabel {
45 45
     /** Panel gap. */
46 46
     private final int padding = (int) (1.5 * PlatformDefaults.getUnitValueX("related").getValue());
47 47
     /** Parent list. */
48
-    private final JList parentList;
48
+    private final JList<? extends PreferencesCategory> parentList;
49 49
 
50 50
     /**
51 51
      * Creates a new category label.
@@ -57,7 +57,7 @@ public class CategoryLabel extends JLabel {
57 57
      * @param index       Index of this label
58 58
      */
59 59
     public CategoryLabel(final IconManager iconManager,
60
-            final JList parentList,
60
+            final JList<? extends PreferencesCategory> parentList,
61 61
             final PreferencesCategory category, final int numCats,
62 62
             final int index) {
63 63
         super();

+ 9
- 16
src/com/dmdirc/addons/ui_swing/dialogs/prefs/PreferencesListCellRenderer.java View File

@@ -36,16 +36,11 @@ import javax.swing.ListCellRenderer;
36 36
 
37 37
 /**
38 38
  * Prefs dialog list cell renderer.
39
- *
40
- * @since 0.6.3m1
41 39
  */
42
-public class PreferencesListCellRenderer extends JLabel implements ListCellRenderer {
40
+public class PreferencesListCellRenderer extends JLabel implements
41
+        ListCellRenderer<PreferencesCategory> {
43 42
 
44
-    /**
45
-     * A version number for this class. It should be changed whenever the class structure is changed
46
-     * (or anything else that would prevent serialized objects being unserialized with the new
47
-     * class).
48
-     */
43
+    /** A version number for this class. */
49 44
     private static final long serialVersionUID = 1;
50 45
     /** Number of categories shown. */
51 46
     private final int numCats;
@@ -67,17 +62,15 @@ public class PreferencesListCellRenderer extends JLabel implements ListCellRende
67 62
         this.iconManager = iconManager;
68 63
     }
69 64
 
70
-    /** {@inheritDoc} */
71 65
     @Override
72
-    public Component getListCellRendererComponent(final JList list,
73
-            final Object value, final int index, final boolean isSelected,
66
+    public Component getListCellRendererComponent(final JList<? extends PreferencesCategory> list,
67
+            final PreferencesCategory value, final int index, final boolean isSelected,
74 68
             final boolean cellHasFocus) {
75
-        final PreferencesCategory cat = (PreferencesCategory) value;
76
-        if (!labelMap.containsKey(cat)) {
77
-            labelMap.put(cat, new CategoryLabel(iconManager,
78
-                    list, cat, numCats, index));
69
+        if (!labelMap.containsKey(value)) {
70
+            labelMap.put(value, new CategoryLabel(iconManager,
71
+                    list, value, numCats, index));
79 72
         }
80
-        final JLabel label = labelMap.get(cat);
73
+        final JLabel label = labelMap.get(value);
81 74
 
82 75
         if (isSelected) {
83 76
             label.setFont(getFont().deriveFont(Font.BOLD));

+ 4
- 16
src/com/dmdirc/addons/ui_swing/dialogs/prefs/SwingPreferencesDialog.java View File

@@ -66,7 +66,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
66 66
     /** Serial version UID. */
67 67
     private static final long serialVersionUID = 9;
68 68
     /** Preferences tab list, used to switch option types. */
69
-    private JList tabList;
69
+    private JList<PreferencesCategory> tabList;
70 70
     /** Main panel. */
71 71
     private CategoryPanel mainPanel;
72 72
     /** Previously selected category. */
@@ -161,7 +161,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
161 161
     private void initComponents() {
162 162
         mainPanel = categoryPanelProvider.get();
163 163
 
164
-        tabList = new JList(new DefaultListModel());
164
+        tabList = new JList<>(new DefaultListModel<PreferencesCategory>());
165 165
         tabList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
166 166
         tabList.addListSelectionListener(this);
167 167
         ListScroller.register(tabList);
@@ -199,7 +199,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
199 199
                 tabList.removeListSelectionListener(SwingPreferencesDialog.this);
200 200
                 for (PreferencesCategory category : categories) {
201 201
                     if (!category.isInline()) {
202
-                        ((DefaultListModel) tabList.getModel()).addElement(
202
+                        ((DefaultListModel<PreferencesCategory>) tabList.getModel()).addElement(
203 203
                                 category);
204 204
                     }
205 205
                     addCategories(category.getSubcats());
@@ -233,11 +233,6 @@ public final class SwingPreferencesDialog extends StandardDialog implements
233 233
         return count;
234 234
     }
235 235
 
236
-    /**
237
-     * Handles the actions for the dialog.
238
-     *
239
-     * @param actionEvent Action event
240
-     */
241 236
     @Override
242 237
     public void actionPerformed(final ActionEvent actionEvent) {
243 238
         if (selected != null) {
@@ -262,19 +257,12 @@ public final class SwingPreferencesDialog extends StandardDialog implements
262 257
         dispose();
263 258
     }
264 259
 
265
-    /**
266
-     * {@inheritDoc}
267
-     *
268
-     * @param e List selection event
269
-     *
270
-     * @since 0.6.3m1
271
-     */
272 260
     @Override
273 261
     public void valueChanged(final ListSelectionEvent e) {
274 262
         if (!e.getValueIsAdjusting()) {
275 263
             PreferencesCategory node = null;
276 264
             try {
277
-                node = (PreferencesCategory) tabList.getSelectedValue();
265
+                node = tabList.getSelectedValue();
278 266
             } catch (ArrayIndexOutOfBoundsException ex) {
279 267
                 //I hate the JVM
280 268
             }

Loading…
Cancel
Save