Browse Source

Remove warnings from renderers

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

+ 4
- 9
src/com/dmdirc/addons/ui_swing/components/expandingsettings/AddOptionPanel.java View File

@@ -43,16 +43,12 @@ import net.miginfocom.swing.MigLayout;
43 43
  */
44 44
 public class AddOptionPanel extends JPanel implements ActionListener {
45 45
 
46
-    /**
47
-     * A version number for this class. It should be changed whenever the class structure is changed
48
-     * (or anything else that would prevent serialized objects being unserialized with the new
49
-     * class).
50
-     */
46
+    /** A version number for this class. */
51 47
     private static final long serialVersionUID = 2;
52 48
     /** Parent settings panel. */
53 49
     private final SettingsPanel parent;
54 50
     /** Add options combobox. */
55
-    private JComboBox addOptionComboBox;
51
+    private JComboBox<Object> addOptionComboBox;
56 52
     /** Add option button. */
57 53
     private JButton addOptionButton;
58 54
     /** Current add option input. */
@@ -79,7 +75,7 @@ public class AddOptionPanel extends JPanel implements ActionListener {
79 75
 
80 76
     /** Initialises the components. */
81 77
     private void initComponents() {
82
-        addOptionComboBox = new JComboBox(new DefaultComboBoxModel());
78
+        addOptionComboBox = new JComboBox<>(new DefaultComboBoxModel<>());
83 79
         addOptionButton = new JButton("Add");
84 80
 
85 81
         addOptionComboBox.setRenderer(new AddOptionCellRenderer(parent,
@@ -120,8 +116,7 @@ public class AddOptionPanel extends JPanel implements ActionListener {
120 116
      * @param setting Setting to add
121 117
      */
122 118
     protected void addOption(final JComponent setting) {
123
-        ((DefaultComboBoxModel) addOptionComboBox.getModel())
124
-                .addElement(setting);
119
+        ((DefaultComboBoxModel<Object>) addOptionComboBox.getModel()).addElement(setting);
125 120
         addOptionButton.setEnabled(true);
126 121
         addOptionComboBox.setEnabled(true);
127 122
     }

+ 0
- 57
src/com/dmdirc/addons/ui_swing/components/renderers/ActionSubstititionRenderer.java View File

@@ -1,57 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2014 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.addons.ui_swing.components.renderers;
24
-
25
-import com.dmdirc.addons.ui_swing.components.substitutions.Substitution;
26
-
27
-import javax.swing.JLabel;
28
-import javax.swing.ListCellRenderer;
29
-
30
-/**
31
- * Displays actions using getName not toString.
32
- */
33
-public final class ActionSubstititionRenderer extends DMDircListCellRenderer {
34
-
35
-    /**
36
-     * A version number for this class.
37
-     */
38
-    private static final long serialVersionUID = 1;
39
-
40
-    /**
41
-     * Creates a new instance of this renderer.
42
-     *
43
-     * @param renderer RendereParent renderer
44
-     */
45
-    public ActionSubstititionRenderer(final ListCellRenderer renderer) {
46
-        super(renderer);
47
-    }
48
-
49
-    /** {@inheritDoc} */
50
-    @Override
51
-    protected void renderValue(final JLabel label, final Object value,
52
-            final int index, final boolean isSelected,
53
-            final boolean cellHasFocus) {
54
-        label.setText(((Substitution) value).getValue());
55
-    }
56
-
57
-}

+ 2
- 3
src/com/dmdirc/addons/ui_swing/components/renderers/AddOptionCellRenderer.java View File

@@ -32,7 +32,7 @@ import javax.swing.ListCellRenderer;
32 32
 /**
33 33
  * Add option combo box cell renderer.
34 34
  */
35
-public final class AddOptionCellRenderer extends DMDircListCellRenderer {
35
+public final class AddOptionCellRenderer extends DMDircListCellRenderer<Object> {
36 36
 
37 37
     /**
38 38
      * A version number for this class.
@@ -48,13 +48,12 @@ public final class AddOptionCellRenderer extends DMDircListCellRenderer {
48 48
      * @param renderer      Parent renderer
49 49
      */
50 50
     public AddOptionCellRenderer(final SettingsPanel settingsPanel,
51
-            final ListCellRenderer renderer) {
51
+            final ListCellRenderer<? super Object> renderer) {
52 52
         super(renderer);
53 53
 
54 54
         this.settingsPanel = settingsPanel;
55 55
     }
56 56
 
57
-    /** {@inheritDoc} */
58 57
     @Override
59 58
     protected void renderValue(final JLabel label, final Object value,
60 59
             final int index, final boolean isSelected,

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/renderers/AddonCellRenderer.java View File

@@ -36,7 +36,6 @@ import javax.swing.table.TableCellRenderer;
36 36
  */
37 37
 public class AddonCellRenderer implements TableCellRenderer {
38 38
 
39
-    /** {@inheritDoc} */
40 39
     @Override
41 40
     public Component getTableCellRendererComponent(final JTable table,
42 41
             final Object value, final boolean isSelected,

+ 2
- 6
src/com/dmdirc/addons/ui_swing/components/renderers/FontListCellRenderer.java View File

@@ -30,21 +30,17 @@ import javax.swing.ListCellRenderer;
30 30
 /**
31 31
  * Font list cell renderer.
32 32
  */
33
-public class FontListCellRenderer extends DMDircListCellRenderer {
33
+public class FontListCellRenderer extends DMDircListCellRenderer<Object> {
34 34
 
35 35
     /**
36
-     * A version number for this class.
37
-     *
38
-     * /**
39 36
      * Creates a new instance of this renderer.
40 37
      *
41 38
      * @param renderer RendereParent renderer
42 39
      */
43
-    public FontListCellRenderer(final ListCellRenderer renderer) {
40
+    public FontListCellRenderer(final ListCellRenderer<Object> renderer) {
44 41
         super(renderer);
45 42
     }
46 43
 
47
-    /** {@inheritDoc} */
48 44
     @Override
49 45
     protected void renderValue(final JLabel label, final Object value,
50 46
             final int index, final boolean isSelected,

+ 2
- 3
src/com/dmdirc/addons/ui_swing/components/renderers/MapEntryRenderer.java View File

@@ -30,7 +30,7 @@ import javax.swing.ListCellRenderer;
30 30
 /**
31 31
  * Renders a map entry as its value.
32 32
  */
33
-public final class MapEntryRenderer extends DMDircListCellRenderer {
33
+public final class MapEntryRenderer extends DMDircListCellRenderer<Object> {
34 34
 
35 35
     /**
36 36
      * A version number for this class.
@@ -42,11 +42,10 @@ public final class MapEntryRenderer extends DMDircListCellRenderer {
42 42
      *
43 43
      * @param renderer RendereParent renderer
44 44
      */
45
-    public MapEntryRenderer(final ListCellRenderer renderer) {
45
+    public MapEntryRenderer(final ListCellRenderer<Object> renderer) {
46 46
         super(renderer);
47 47
     }
48 48
 
49
-    /** {@inheritDoc} */
50 49
     @Override
51 50
     protected void renderValue(final JLabel label, final Object value,
52 51
             final int index, final boolean isSelected,

+ 12
- 19
src/com/dmdirc/addons/ui_swing/components/renderers/NicklistRenderer.java View File

@@ -41,11 +41,7 @@ import javax.swing.JList;
41 41
 public final class NicklistRenderer extends DefaultListCellRenderer implements
42 42
         ConfigChangeListener {
43 43
 
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
-     */
44
+    /** A version number for this class. */
49 45
     private static final long serialVersionUID = 5;
50 46
     /** Config manager. */
51 47
     private final AggregateConfigProvider config;
@@ -54,7 +50,7 @@ public final class NicklistRenderer extends DefaultListCellRenderer implements
54 50
     /** Show nick colours. */
55 51
     private boolean showColours;
56 52
     /** The list that we're using for the nicklist. */
57
-    private final JList nicklist;
53
+    private final JList<ChannelClientInfo> nicklist;
58 54
     /** Colour manager to use to resolve colours. */
59 55
     private final ColourManager colourManager;
60 56
 
@@ -67,10 +63,8 @@ public final class NicklistRenderer extends DefaultListCellRenderer implements
67 63
      */
68 64
     public NicklistRenderer(
69 65
             final AggregateConfigProvider config,
70
-            final JList nicklist,
66
+            final JList<ChannelClientInfo> nicklist,
71 67
             final ColourManager colourManager) {
72
-        super();
73
-
74 68
         this.config = config;
75 69
         this.nicklist = nicklist;
76 70
         this.colourManager = colourManager;
@@ -81,16 +75,15 @@ public final class NicklistRenderer extends DefaultListCellRenderer implements
81 75
         config.addChangeListener("ui", "nickListAltBackgroundColour", this);
82 76
         altBackgroundColour = UIUtilities.convertColour(
83 77
                 colourManager.getColourFromString(
84
-                config.getOptionString(
85
-                "ui", "nickListAltBackgroundColour",
86
-                "ui", "nicklistbackgroundcolour",
87
-                "ui", "backgroundcolour"), null));
78
+                        config.getOptionString(
79
+                                "ui", "nickListAltBackgroundColour",
80
+                                "ui", "nicklistbackgroundcolour",
81
+                                "ui", "backgroundcolour"), null));
88 82
         showColours = config.getOptionBool("ui", "shownickcoloursinnicklist");
89 83
     }
90 84
 
91
-    /** {@inheritDoc} */
92 85
     @Override
93
-    public Component getListCellRendererComponent(final JList list,
86
+    public Component getListCellRendererComponent(final JList<?> list,
94 87
             final Object value, final int index, final boolean isSelected,
95 88
             final boolean cellHasFocus) {
96 89
 
@@ -127,10 +120,10 @@ public final class NicklistRenderer extends DefaultListCellRenderer implements
127 120
         } else {
128 121
             altBackgroundColour = UIUtilities.convertColour(
129 122
                     colourManager.getColourFromString(
130
-                    config.getOptionString(
131
-                    "ui", "nickListAltBackgroundColour",
132
-                    "ui", "nicklistbackgroundcolour",
133
-                    "ui", "backgroundcolour"), null));
123
+                            config.getOptionString(
124
+                                    "ui", "nickListAltBackgroundColour",
125
+                                    "ui", "nicklistbackgroundcolour",
126
+                                    "ui", "backgroundcolour"), null));
134 127
         }
135 128
         nicklist.repaint();
136 129
     }

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/renderers/ServerGroupTreeRenderer.java View File

@@ -44,7 +44,6 @@ public class ServerGroupTreeRenderer extends DefaultTreeCellRenderer {
44 44
      */
45 45
     private static final long serialVersionUID = 1;
46 46
 
47
-    /** {@inheritDoc} */
48 47
     @Override
49 48
     public Component getTreeCellRendererComponent(final JTree tree,
50 49
             final Object value, final boolean sel, final boolean expanded,

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/renderers/UpdateComponentTableCellRenderer.java View File

@@ -41,7 +41,6 @@ public class UpdateComponentTableCellRenderer extends DefaultTableCellRenderer {
41 41
      */
42 42
     private static final long serialVersionUID = 1;
43 43
 
44
-    /** {@inheritDoc} */
45 44
     @Override
46 45
     public Component getTableCellRendererComponent(final JTable table,
47 46
             final Object value, final boolean isSelected,

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/renderers/UpdateStatusTableCellRenderer.java View File

@@ -41,7 +41,6 @@ public class UpdateStatusTableCellRenderer extends DefaultTableCellRenderer {
41 41
      */
42 42
     private static final long serialVersionUID = 1;
43 43
 
44
-    /** {@inheritDoc} */
45 44
     @Override
46 45
     public Component getTableCellRendererComponent(final JTable table,
47 46
             final Object value, final boolean isSelected,

Loading…
Cancel
Save