Quellcode durchsuchen

Fix PMD errors in plugins.

Change-Id: I7953fd2c0bbadb5a30188641a25352c10905416c
Reviewed-on: http://gerrit.dmdirc.com/1691
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.5
Greg Holmes vor 13 Jahren
Ursprung
Commit
4a4a169e27
59 geänderte Dateien mit 1054 neuen und 838 gelöschten Zeilen
  1. 8
    8
      src/com/dmdirc/addons/dcc/PlaceholderContainer.java
  2. 15
    15
      src/com/dmdirc/addons/identd/IdentdPlugin.java
  3. 6
    12
      src/com/dmdirc/addons/mediasource_dbus/DBusMediaSource.java
  4. 13
    8
      src/com/dmdirc/addons/nowplaying/ConfigPanel.java
  5. 11
    14
      src/com/dmdirc/addons/redirect/RedirectCommand.java
  6. 121
    62
      src/com/dmdirc/addons/relaybot/RelayChannelHandler.java
  7. 47
    26
      src/com/dmdirc/addons/scriptplugin/JavaScriptHelper.java
  8. 7
    9
      src/com/dmdirc/addons/time/TimerManager.java
  9. 1
    1
      src/com/dmdirc/addons/ui_dummy/DummyInputField.java
  10. 5
    4
      src/com/dmdirc/addons/ui_swing/components/addonbrowser/AddonInfoCellEditor.java
  11. 28
    20
      src/com/dmdirc/addons/ui_swing/components/addonbrowser/AddonInfoLabel.java
  12. 42
    24
      src/com/dmdirc/addons/ui_swing/components/inputfields/SwingInputHandler.java
  13. 15
    19
      src/com/dmdirc/addons/ui_swing/components/statusbar/FeedbackNag.java
  14. 8
    11
      src/com/dmdirc/addons/ui_swing/components/substitutions/SubstitutionLabel.java
  15. 1
    1
      src/com/dmdirc/addons/ui_swing/components/text/DMDircHTMLFactory.java
  16. 78
    62
      src/com/dmdirc/addons/ui_swing/dialogs/FeedbackDialog.java
  17. 16
    17
      src/com/dmdirc/addons/ui_swing/dialogs/StandardInputDialog.java
  18. 11
    11
      src/com/dmdirc/addons/ui_swing/dialogs/StandardMessageDialog.java
  19. 8
    8
      src/com/dmdirc/addons/ui_swing/dialogs/StandardQuestionDialog.java
  20. 8
    5
      src/com/dmdirc/addons/ui_swing/dialogs/about/AboutDialog.java
  21. 11
    9
      src/com/dmdirc/addons/ui_swing/dialogs/about/LicenceLoader.java
  22. 11
    11
      src/com/dmdirc/addons/ui_swing/dialogs/about/LicenceRenderer.java
  23. 4
    4
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionConditionEditorPanel.java
  24. 21
    23
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersListPanel.java
  25. 23
    22
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersPanel.java
  26. 21
    18
      src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionsGroupPanel.java
  27. 4
    5
      src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicTable.java
  28. 23
    55
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryLabel.java
  29. 74
    0
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/IconLoader.java
  30. 4
    30
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/NoRemovePanel.java
  31. 33
    25
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/URLHandlerTableModel.java
  32. 24
    20
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateTableModel.java
  33. 19
    4
      src/com/dmdirc/addons/ui_swing/dialogs/serversetting/IgnoreListModel.java
  34. 56
    46
      src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java
  35. 14
    12
      src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonPanel.java
  36. 10
    8
      src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java
  37. 5
    5
      src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNode.java
  38. 7
    8
      src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNodeMenuItem.java
  39. 16
    15
      src/com/dmdirc/addons/ui_swing/textpane/LineInfo.java
  40. 9
    9
      src/com/dmdirc/addons/ui_swing/textpane/TextPane.java
  41. 5
    3
      src/com/dmdirc/addons/ui_swing/textpane/TextPaneEndAction.java
  42. 5
    3
      src/com/dmdirc/addons/ui_swing/textpane/TextPaneHomeAction.java
  43. 5
    3
      src/com/dmdirc/addons/ui_swing/textpane/TextPanePageDownAction.java
  44. 5
    3
      src/com/dmdirc/addons/ui_swing/textpane/TextPanePageUpAction.java
  45. 5
    3
      src/com/dmdirc/addons/ui_web/Client.java
  46. 51
    39
      src/com/dmdirc/addons/ui_web/DynamicRequestHandler.java
  47. 5
    5
      src/com/dmdirc/addons/ui_web/Event.java
  48. 6
    6
      src/com/dmdirc/addons/ui_web/Message.java
  49. 5
    4
      src/com/dmdirc/addons/ui_web/WebPrincipal.java
  50. 17
    14
      src/com/dmdirc/addons/ui_web/WebUserRealm.java
  51. 12
    8
      src/com/dmdirc/addons/ui_web/uicomponents/WebChannelWindow.java
  52. 17
    15
      src/com/dmdirc/addons/ui_web/uicomponents/WebInputField.java
  53. 4
    4
      src/com/dmdirc/addons/ui_web/uicomponents/WebInputHandler.java
  54. 21
    19
      src/com/dmdirc/addons/ui_web/uicomponents/WebInputWindow.java
  55. 2
    2
      src/com/dmdirc/addons/ui_web/uicomponents/WebMainWindow.java
  56. 1
    1
      src/com/dmdirc/addons/ui_web/uicomponents/WebQueryWindow.java
  57. 4
    3
      src/com/dmdirc/addons/ui_web/uicomponents/WebServerWindow.java
  58. 11
    10
      src/com/dmdirc/addons/ui_web/uicomponents/WebStatusBar.java
  59. 35
    27
      src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java

+ 8
- 8
src/com/dmdirc/addons/dcc/PlaceholderContainer.java Datei anzeigen

@@ -29,8 +29,6 @@ import com.dmdirc.addons.ui_swing.SwingController;
29 29
 import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
30 30
 import com.dmdirc.config.IdentityManager;
31 31
 import com.dmdirc.plugins.PluginManager;
32
-import com.dmdirc.ui.WindowManager;
33
-import com.dmdirc.ui.interfaces.Window;
34 32
 
35 33
 import java.awt.Dialog.ModalityType;
36 34
 
@@ -48,7 +46,8 @@ public class PlaceholderContainer extends FrameContainer<PlaceholderWindow> {
48 46
      * @param plugin The plugin which owns this placeholder
49 47
      */
50 48
     public PlaceholderContainer(final DCCPlugin plugin) {
51
-        super("dcc", "DCCs", "DCCs", PlaceholderWindow.class, IdentityManager.getGlobalConfig());
49
+        super("dcc", "DCCs", "DCCs", PlaceholderWindow.class,
50
+                IdentityManager.getGlobalConfig());
52 51
 
53 52
         this.plugin = plugin;
54 53
     }
@@ -71,12 +70,13 @@ public class PlaceholderContainer extends FrameContainer<PlaceholderWindow> {
71 70
                     .getPluginManager().getPluginInfoByName("ui_swing")
72 71
                     .getPlugin()).getMainFrame(), ModalityType.MODELESS,
73 72
                     "Close confirmation",
74
-                    "Closing this window will cause all existing DCCs " +
75
-                    "to terminate, are you sure you want to do this?") {
73
+                    "Closing this window will cause all existing DCCs "
74
+                    + "to terminate, are you sure you want to do this?") {
76 75
                 /**
77
-                 * A version number for this class. It should be changed whenever the class
78
-                 * structure is changed (or anything else that would prevent serialized
79
-                 * objects being unserialized with the new class).
76
+                 * A version number for this class. It should be changed
77
+                 * whenever the class structure is changed (or anything else
78
+                 * that would prevent serialized objects being unserialized
79
+                 * with the new class).
80 80
                  */
81 81
                 private static final long serialVersionUID = 1;
82 82
 

+ 15
- 15
src/com/dmdirc/addons/identd/IdentdPlugin.java Datei anzeigen

@@ -41,8 +41,6 @@ import java.util.List;
41 41
 
42 42
 /**
43 43
  * The Identd plugin answers ident requests from IRC servers.
44
- *
45
- * @author Shane
46 44
  */
47 45
 public class IdentdPlugin extends Plugin implements ActionListener {
48 46
 
@@ -52,22 +50,19 @@ public class IdentdPlugin extends Plugin implements ActionListener {
52 50
     /** The IdentdServer that we use. */
53 51
     private IdentdServer myServer;
54 52
 
55
-    /**
56
-     * Creates a new instance of IdentdPlugin.
57
-     */
58
-    public IdentdPlugin() {
59
-    }
60
-
61 53
     /**
62 54
      * Called when the plugin is loaded.
63 55
      */
64 56
     @Override
65 57
     public void onLoad() {
66 58
         // Add action hooks
67
-        ActionManager.addListener(this, CoreActionType.SERVER_CONNECTED, CoreActionType.SERVER_CONNECTING, CoreActionType.SERVER_CONNECTERROR);
59
+        ActionManager.addListener(this, CoreActionType.SERVER_CONNECTED, 
60
+                CoreActionType.SERVER_CONNECTING,
61
+                CoreActionType.SERVER_CONNECTERROR);
68 62
 
69 63
         myServer = new IdentdServer(this);
70
-        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.alwaysOn")) {
64
+        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(),
65
+                "advanced.alwaysOn")) {
71 66
             myServer.startServer();
72 67
         }
73 68
     }
@@ -90,7 +85,8 @@ public class IdentdPlugin extends Plugin implements ActionListener {
90 85
      * @param arguments The arguments for the event
91 86
      */
92 87
     @Override
93
-    public void processEvent(final ActionType type, final StringBuffer format, final Object... arguments) {
88
+    public void processEvent(final ActionType type, final StringBuffer format,
89
+            final Object... arguments) {
94 90
         if (type == CoreActionType.SERVER_CONNECTING) {
95 91
             synchronized (servers) {
96 92
                 if (servers.isEmpty()) {
@@ -98,11 +94,13 @@ public class IdentdPlugin extends Plugin implements ActionListener {
98 94
                 }
99 95
                 servers.add((Server) arguments[0]);
100 96
             }
101
-        } else if (type == CoreActionType.SERVER_CONNECTED || type == CoreActionType.SERVER_CONNECTERROR) {
97
+        } else if (type == CoreActionType.SERVER_CONNECTED
98
+                || type == CoreActionType.SERVER_CONNECTERROR) {
102 99
             synchronized (servers) {
103 100
                 servers.remove(arguments[0]);
104 101
 
105
-                if (servers.isEmpty() && !IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.alwaysOn")) {
102
+                if (servers.isEmpty() && !IdentityManager.getGlobalConfig()
103
+                        .getOptionBool(getDomain(), "advanced.alwaysOn")) {
106 104
                     myServer.stopServer();
107 105
                 }
108 106
             }
@@ -112,10 +110,12 @@ public class IdentdPlugin extends Plugin implements ActionListener {
112 110
     /** {@inheritDoc} */
113 111
     @Override
114 112
     public void showConfig(final PreferencesDialogModel manager) {
115
-        final PreferencesCategory general = new PluginPreferencesCategory(getPluginInfo(), "Identd",
113
+        final PreferencesCategory general = new PluginPreferencesCategory(
114
+                getPluginInfo(), "Identd",
116 115
                 "General Identd Plugin config ('Lower' options take priority " +
117 116
                 "over those above them)");
118
-        final PreferencesCategory advanced = new PluginPreferencesCategory(getPluginInfo(), "Advanced",
117
+        final PreferencesCategory advanced = new PluginPreferencesCategory(
118
+                getPluginInfo(), "Advanced",
119 119
                 "Advanced Identd Plugin config - Only edit these if you need " +
120 120
                 "to/know what you are doing. Editing these could prevent " +
121 121
                 "access to some servers. ('Lower' options take priority over " +

+ 6
- 12
src/com/dmdirc/addons/mediasource_dbus/DBusMediaSource.java Datei anzeigen

@@ -44,17 +44,11 @@ public class DBusMediaSource extends Plugin implements MediaSourceManager {
44 44
     /** The sources used by this media source. */
45 45
     private List<MediaSource> sources;
46 46
     /** A map of discovered mpris sources. */
47
-    private final Map<String, MediaSource> mprisSources = new HashMap<String, MediaSource>();
47
+    private final Map<String, MediaSource> mprisSources
48
+            = new HashMap<String, MediaSource>();
48 49
     /** The path to qdbus. */
49 50
     private String qdbus;
50
-       
51
-    /**
52
-     * Creates a new instance of DBusMediaSource.
53
-     */
54
-    public DBusMediaSource() {
55
-        super();
56
-    }
57
-    
51
+
58 52
     /** {@inheritDoc} */
59 53
     @Override
60 54
     public void onLoad() {
@@ -68,7 +62,7 @@ public class DBusMediaSource extends Plugin implements MediaSourceManager {
68 62
             qdbus = "/bin/qdbus";
69 63
         }
70 64
     }
71
-    
65
+
72 66
     /** {@inheritDoc} */
73 67
     @Override
74 68
     public void onUnload() {
@@ -114,7 +108,7 @@ public class DBusMediaSource extends Plugin implements MediaSourceManager {
114 108
         exeArgs[3] = method;
115 109
 
116 110
         for (int i = 0; i < args.length; i++) {
117
-            exeArgs[4 + i] = args[i];
111
+            exeArgs[4 + i] = args[i]; //NOPMD
118 112
         }
119 113
 
120 114
         return getInfo(exeArgs);
@@ -170,7 +164,7 @@ public class DBusMediaSource extends Plugin implements MediaSourceManager {
170 164
             if (index == -1 || index >= line.length() - 2) {
171 165
                 continue;
172 166
             }
173
-            
167
+
174 168
             final String key = line.substring(0, index);
175 169
             final String value = line.substring(index + 2);
176 170
 

+ 13
- 8
src/com/dmdirc/addons/nowplaying/ConfigPanel.java Datei anzeigen

@@ -84,7 +84,8 @@ public class ConfigPanel extends JPanel implements PreferencesInterface,
84 84
      * @param plugin The plugin that owns this panel
85 85
      * @param sources A list of sources to be used in the panel
86 86
      */
87
-    public ConfigPanel(final NowPlayingPlugin plugin, final List<String> sources) {
87
+    public ConfigPanel(final NowPlayingPlugin plugin,
88
+            final List<String> sources) {
88 89
         super();
89 90
 
90 91
         if (sources == null) {
@@ -157,13 +158,14 @@ public class ConfigPanel extends JPanel implements PreferencesInterface,
157 158
         }
158 159
 
159 160
         final String text = plugin.doSubstitution(
160
-                        UIUtilities.invokeAndWait(new ReturnableThread<String>() {
161
+                UIUtilities.invokeAndWait(new ReturnableThread<String>() {
161 162
 
162
-                    @Override
163
-                    public void run() {
164
-                        setObject(textfield.getText());
165
-                    }
166
-                }), source);
163
+            /** {@inheritDoc} */
164
+            @Override
165
+            public void run() {
166
+                setObject(textfield.getText());
167
+            }
168
+        }), source);
167 169
         SwingUtilities.invokeLater(new Runnable() {
168 170
 
169 171
             /** {@inheritDoc} */
@@ -248,7 +250,10 @@ public class ConfigPanel extends JPanel implements PreferencesInterface,
248 250
             public void run() {
249 251
                 try {
250 252
                     updatePreview();
251
-                } catch (Throwable ex) {
253
+                } catch (LinkageError e) {
254
+                    Logger.appError(ErrorLevel.MEDIUM,
255
+                            "Error when updating nowplaying preview", e);
256
+                } catch (Exception ex) {
252 257
                     Logger.appError(ErrorLevel.MEDIUM,
253 258
                             "Error when updating nowplaying preview", ex);
254 259
                 }

+ 11
- 14
src/com/dmdirc/addons/redirect/RedirectCommand.java Datei anzeigen

@@ -38,30 +38,26 @@ import com.dmdirc.ui.input.TabCompleter;
38 38
  * The redirect command allows the user to redirect the output from another
39 39
  * command that would normally echo results locally to a query or channel
40 40
  * window instead.
41
- *
42
- * @author Chris
43 41
  */
44 42
 public class RedirectCommand extends Command implements IntelligentCommand,
45 43
         CommandInfo {
46
-    
47
-    public RedirectCommand() {
48
-    }
49
-    
44
+
50 45
     /** {@inheritDoc} */
51 46
     @Override
52 47
     public void execute(final FrameContainer<?> origin,
53 48
             final CommandArguments args, final CommandContext context) {
54
-        final MessageTarget<?> target = ((ChatCommandContext) context).getChat();
55
-        target.getCommandParser().parseCommand(new FakeWriteableFrameContainer(target),
56
-                context.getSource(), args.getArgumentsAsString());
49
+        final MessageTarget<?> target = ((ChatCommandContext) context)
50
+                .getChat();
51
+        target.getCommandParser().parseCommand(new FakeWriteableFrameContainer(
52
+                target), context.getSource(), args.getArgumentsAsString());
57 53
     }
58
-    
54
+
59 55
     /** {@inheritDoc} */
60 56
     @Override
61 57
     public String getName() {
62 58
         return "redirect";
63 59
     }
64
-    
60
+
65 61
     /** {@inheritDoc} */
66 62
     @Override
67 63
     public boolean showInHelp() {
@@ -73,11 +69,12 @@ public class RedirectCommand extends Command implements IntelligentCommand,
73 69
     public CommandType getType() {
74 70
         return CommandType.TYPE_CHAT;
75 71
     }
76
-    
72
+
77 73
     /** {@inheritDoc} */
78 74
     @Override
79 75
     public String getHelp() {
80
-        return "redirect <command> - sends the output of the command to a channel or query window";
76
+        return "redirect <command> - sends the output of the command to a "
77
+                + "channel or query window";
81 78
     }
82 79
 
83 80
     /** {@inheritDoc} */
@@ -86,5 +83,5 @@ public class RedirectCommand extends Command implements IntelligentCommand,
86 83
             final IntelligentCommandContext context) {
87 84
         return TabCompleter.getIntelligentResults(arg, context, 0);
88 85
     }
89
-    
86
+
90 87
 }

+ 121
- 62
src/com/dmdirc/addons/relaybot/RelayChannelHandler.java Datei anzeigen

@@ -46,7 +46,7 @@ import java.util.Map;
46 46
  * This class replaces the ChannelHandler in the core to allow intercepting
47 47
  * callbacks from the parser.
48 48
  *
49
- * This allows us to hide them from the core and send faked ones instead.
49
+ * This allows us to hide them from the core and send faked onullnes instead.
50 50
  *
51 51
  * @author shane
52 52
  */
@@ -60,40 +60,45 @@ public class RelayChannelHandler implements ChannelMessageListener {
60 60
     /** Plugin that owns this RelayChannelHandler. */
61 61
     private final RelayBotPlugin myPlugin;
62 62
 
63
-    /** Known ChannelClients */
64
-    private final Map<String, IRCChannelClientInfo> channelClients = new HashMap<String, IRCChannelClientInfo>();
63
+    /** Known ChannelClients. */
64
+    private final Map<String, IRCChannelClientInfo> channelClients
65
+            = new HashMap<String, IRCChannelClientInfo>();
65 66
 
66 67
     /**
67 68
      * Create a new RelayChannelHandler.
68 69
      *
69
-     * @param myPlugin 
70
+     * @param myPlugin Parent plugin
70 71
      * @param myChannel channel to hax!
71 72
      */
72
-    public RelayChannelHandler(final RelayBotPlugin myPlugin, final Channel myChannel) {
73
+    public RelayChannelHandler(final RelayBotPlugin myPlugin,
74
+            final Channel myChannel) {
73 75
         this.myChannel = myChannel;
74 76
         this.myPlugin = myPlugin;
75
-        ChannelEventHandler ceh = null;
77
+        ChannelEventHandler ceh;
76 78
         try {
77 79
             // Get the core Channel handler.
78
-            final Field field = myChannel.getClass().getDeclaredField("eventHandler");
80
+            final Field field = myChannel.getClass().getDeclaredField(
81
+                    "eventHandler");
79 82
             field.setAccessible(true);
80 83
             ceh = (ChannelEventHandler) field.get(myChannel);
81 84
         } catch (IllegalArgumentException ex) {
82
-            ex.printStackTrace();
85
+            ceh = null;
83 86
         } catch (IllegalAccessException ex) {
84
-            ex.printStackTrace();
87
+            ceh = null;
85 88
         } catch (NoSuchFieldException ex) {
86
-            ex.printStackTrace();
89
+            ceh = null;
87 90
         } catch (SecurityException ex) {
88
-            ex.printStackTrace();
91
+            ceh = null;
89 92
         }
90 93
 
91 94
         coreChannelHandler = ceh;
92 95
 
93 96
         if (coreChannelHandler != null) {
94
-            final IRCCallbackManager cbm = (IRCCallbackManager) myChannel.getServer().getParser().getCallbackManager();
97
+            final IRCCallbackManager cbm = (IRCCallbackManager) myChannel
98
+                    .getServer().getParser().getCallbackManager();
95 99
             cbm.delCallback(ChannelMessageListener.class, coreChannelHandler);
96
-            cbm.addCallback(ChannelMessageListener.class, this, myChannel.getName());
100
+            cbm.addCallback(ChannelMessageListener.class, this,
101
+                    myChannel.getName());
97 102
         }
98 103
     }
99 104
 
@@ -102,22 +107,28 @@ public class RelayChannelHandler implements ChannelMessageListener {
102 107
      * Get a ChannelClient object for the given nick@server.
103 108
      *
104 109
      * @param channel Channel
110
+     * @param date Date for event
105 111
      * @param nick Nickname to get channel client for.
106
-     * @param sendJoinIfNew
112
+     * @param sendJoinIfNew Send join if new client seen
107 113
      * @return Requested ChannelClient Info.
108 114
      */
109
-    private IRCChannelClientInfo getChannelClient(final ChannelInfo channel, final Date date, final String nick, final boolean sendJoinIfNew) {
115
+    private IRCChannelClientInfo getChannelClient(final ChannelInfo channel,
116
+            final Date date, final String nick, final boolean sendJoinIfNew) {
110 117
         final Parser parser = channel.getParser();
111 118
         final String storeName = parser.getStringConverter().toLowerCase(nick);
112 119
         synchronized (channelClients) {
113 120
             if (!channelClients.containsKey(storeName)) {
114
-                final RelayClientInfo client = new RelayClientInfo(channel.getParser(), nick);
115
-                final IRCChannelClientInfo newChannelClient = new IRCChannelClientInfo((IRCParser) channel.getParser(), client, channel);
121
+                final RelayClientInfo client = new RelayClientInfo(channel
122
+                        .getParser(), nick);
123
+                final IRCChannelClientInfo newChannelClient
124
+                        = new IRCChannelClientInfo((IRCParser) channel
125
+                        .getParser(), client, channel);
116 126
                 colourClient(newChannelClient);
117 127
 
118 128
                 channelClients.put(storeName, newChannelClient);
119 129
                 if (sendJoinIfNew && !client.isServer()) {
120
-                    coreChannelHandler.onChannelJoin(parser, date, channel, newChannelClient);
130
+                    coreChannelHandler.onChannelJoin(parser, date, channel,
131
+                            newChannelClient);
121 132
                     // The nickcolour plugin colours the nicknames on join
122 133
                     // and uses nickname@server when colouring rather than
123 134
                     // the setting the user wanted, we can recolour here to
@@ -131,12 +142,13 @@ public class RelayChannelHandler implements ChannelMessageListener {
131 142
     }
132 143
 
133 144
     /**
134
-     * Remove a stored ChannelClient
145
+     * Remove a stored ChannelClient.
135 146
      *
136 147
      * @param channel Channel
137 148
      * @param nick Nickname to get channel client for.
138 149
      */
139
-    private void removeChannelClient(final ChannelInfo channel, final String nick) {
150
+    private void removeChannelClient(final ChannelInfo channel,
151
+            final String nick) {
140 152
         final Parser parser = channel.getParser();
141 153
         final String storeName = parser.getStringConverter().toLowerCase(nick);
142 154
         synchronized (channelClients) {
@@ -145,18 +157,21 @@ public class RelayChannelHandler implements ChannelMessageListener {
145 157
     }
146 158
 
147 159
     /**
148
-     * Rename a stored ChannelClient
160
+     * Rename a stored ChannelClient.
149 161
      *
150 162
      * @param channelClient ChannelClient
151 163
      * @param newNick new Nickname
152 164
      */
153
-    private void renameChannelClient(final IRCChannelClientInfo channelClient, final String newNick) {
165
+    private void renameChannelClient(final IRCChannelClientInfo channelClient,
166
+            final String newNick) {
154 167
         final Parser parser = channelClient.getChannel().getParser();
155
-        final String storeName = parser.getStringConverter().toLowerCase(newNick);
168
+        final String storeName = parser.getStringConverter().toLowerCase(
169
+                newNick);
156 170
 
157 171
         synchronized (channelClients) {
158 172
             channelClients.remove(channelClient.getClient().toString());
159
-            ((RelayClientInfo) channelClient.getClient()).changeNickname(newNick);
173
+            ((RelayClientInfo) channelClient.getClient()).changeNickname(
174
+                    newNick);
160 175
             channelClients.put(storeName, channelClient);
161 176
         }
162 177
     }
@@ -166,13 +181,17 @@ public class RelayChannelHandler implements ChannelMessageListener {
166 181
      */
167 182
     public void restoreCoreChannelHandler() {
168 183
         if (coreChannelHandler != null) {
169
-            final IRCCallbackManager cbm = (IRCCallbackManager) myChannel.getServer().getParser().getCallbackManager();
184
+            final IRCCallbackManager cbm = (IRCCallbackManager) myChannel
185
+                    .getServer().getParser().getCallbackManager();
170 186
 
171 187
             // Force adding this callback to the CBM.
172 188
             if (cbm instanceof RelayCallbackManager) {
173
-                ((RelayCallbackManager) cbm).forceAddCallback(ChannelMessageListener.class, coreChannelHandler, myChannel.getName());
189
+                ((RelayCallbackManager) cbm).forceAddCallback(
190
+                        ChannelMessageListener.class, coreChannelHandler,
191
+                        myChannel.getName());
174 192
             } else {
175
-                cbm.addCallback(ChannelMessageListener.class, coreChannelHandler, myChannel.getName());
193
+                cbm.addCallback(ChannelMessageListener.class,
194
+                        coreChannelHandler, myChannel.getName());
176 195
             }
177 196
             unset();
178 197
             updateNames();
@@ -180,10 +199,11 @@ public class RelayChannelHandler implements ChannelMessageListener {
180 199
     }
181 200
 
182 201
     /**
183
-     * Remove channel message handling from this ChannelHandler
202
+     * Remove channel message handling from this ChannelHandler.
184 203
      */
185 204
     public void unset() {
186
-        myChannel.getServer().getParser().getCallbackManager().delCallback(ChannelMessageListener.class, this);
205
+        myChannel.getServer().getParser().getCallbackManager().delCallback(
206
+                ChannelMessageListener.class, this);
187 207
     }
188 208
 
189 209
     /**
@@ -193,25 +213,35 @@ public class RelayChannelHandler implements ChannelMessageListener {
193 213
     */
194 214
     private void colourClient(final ChannelClientInfo channelClient) {
195 215
         // Use nick colour plugin to colour the client if available.
196
-        final PluginInfo nickColour = PluginManager.getPluginManager().getPluginInfoByName("nickcolour");
216
+        final PluginInfo nickColour = PluginManager.getPluginManager()
217
+                .getPluginInfoByName("nickcolour");
197 218
 
198
-        final boolean fullColour = IdentityManager.getGlobalConfig().getOptionBool(myPlugin.getDomain(), "colourFullName");
199
-        final RelayClientInfo client = (RelayClientInfo) channelClient.getClient();
219
+        final boolean fullColour = IdentityManager.getGlobalConfig()
220
+                .getOptionBool(myPlugin.getDomain(), "colourFullName");
221
+        final RelayClientInfo client = (RelayClientInfo) channelClient
222
+                .getClient();
200 223
         final boolean oldValue = client.getShowFullNickname();
201 224
         client.setShowFullNickname(fullColour);
202 225
 
203 226
         if (nickColour != null && nickColour.isLoaded()) {
204 227
             try {
205
-                final Method gpcl = PluginInfo.class.getDeclaredMethod("getPluginClassLoader");
228
+                final Method gpcl = PluginInfo.class.getDeclaredMethod(
229
+                        "getPluginClassLoader");
206 230
                 gpcl.setAccessible(true);
207 231
 
208 232
                 final Class<?> nc = nickColour.getPlugin().getClass();
209
-                final Method colourClient = nc.getDeclaredMethod("colourClient", new Class<?>[]{String.class, ChannelClientInfo.class});
233
+                final Method colourClient = nc.getDeclaredMethod("colourClient",
234
+                        new Class<?>[]{String.class, ChannelClientInfo.class});
210 235
                 colourClient.setAccessible(true);
211
-                colourClient.invoke(nickColour.getPlugin(), myChannel.getServer().getNetwork(), channelClient);
212
-            } catch (Throwable t) { /* If it can't colour then oh well. */ }
236
+                colourClient.invoke(nickColour.getPlugin(), myChannel
237
+                        .getServer().getNetwork(), channelClient);
238
+            } catch (LinkageError e) {
239
+                // If it can't colour then oh well.
240
+            } catch (Exception t) {
241
+                // If it can't colour then oh well.
242
+            }
213 243
         }
214
-        
244
+
215 245
         client.setShowFullNickname(oldValue);
216 246
     }
217 247
 
@@ -220,41 +250,53 @@ public class RelayChannelHandler implements ChannelMessageListener {
220 250
      * Handle the IRCParsers incoming message.
221 251
      *
222 252
      * @param parser Parser that sent the message
253
+     * @param date Date for event
223 254
      * @param channel Channel the message went to
224 255
      * @param channelClient Client who send the message
225 256
      * @param message Message content
226 257
      * @param host Host of client
227 258
      */
228 259
     @Override
229
-    public void onChannelMessage(final Parser parser, final Date date, final ChannelInfo channel, final ChannelClientInfo channelClient, final String message, final String host) {
230
-        final String channelName = parser.getStringConverter().toLowerCase(channel.getName());
260
+    public void onChannelMessage(final Parser parser, final Date date,
261
+            final ChannelInfo channel, final ChannelClientInfo channelClient,
262
+            final String message, final String host) {
263
+        final String channelName = parser.getStringConverter().toLowerCase(
264
+                channel.getName());
231 265
         String botName;
232 266
         try {
233
-            botName = IdentityManager.getGlobalConfig().getOption(myPlugin.getDomain(), channelName);
267
+            botName = IdentityManager.getGlobalConfig().getOption(
268
+                    myPlugin.getDomain(), channelName);
234 269
         } catch (IllegalArgumentException iae) {
235 270
             botName = "";
236 271
         }
237
-        final boolean isBot = parser.getStringConverter().equalsIgnoreCase(botName, channelClient.getClient().getNickname());
272
+        final boolean isBot = parser.getStringConverter().equalsIgnoreCase(
273
+                botName, channelClient.getClient().getNickname());
238 274
 
239
-        final boolean joinNew = IdentityManager.getGlobalConfig().getOptionBool(myPlugin.getDomain(), "joinOnDiscover");
275
+        final boolean joinNew = IdentityManager.getGlobalConfig().getOptionBool(
276
+                myPlugin.getDomain(), "joinOnDiscover");
240 277
 
241 278
         // See if we need to modify this message
242
-        if (channelClient instanceof IRCChannelClientInfo && !botName.isEmpty() && isBot) {
279
+        if (channelClient instanceof IRCChannelClientInfo
280
+                && !botName.isEmpty() && isBot) {
243 281
             final String[] bits = message.split(" ", 2);
244 282
             final String initial = Styliser.stipControlCodes(bits[0]);
245 283
 
246 284
             if (initial.charAt(0) == '+') {
247 285
                 // Channel Message
248
-                final IRCChannelClientInfo newChannelClient = getChannelClient(channel, date, bits[0].substring(2, bits[0].length() - 1), joinNew);
286
+                final IRCChannelClientInfo newChannelClient = getChannelClient(
287
+                        channel, date, bits[0].substring(2, bits[0].length() - 1), joinNew);
249 288
 
250
-                coreChannelHandler.onChannelMessage(parser, date, channel, newChannelClient, bits[1], host);
289
+                coreChannelHandler.onChannelMessage(parser, date, channel,
290
+                        newChannelClient, bits[1], host);
251 291
                 return;
252 292
             } else if (initial.equalsIgnoreCase("***")) {
253 293
                 // Some kind of state-changing action
254 294
                 final String[] newBits = bits[1].split(" ");
255 295
 
256 296
                 if (newBits.length > 2) {
257
-                    final IRCChannelClientInfo newChannelClient = getChannelClient(channel, date, newBits[0], joinNew);
297
+                    final IRCChannelClientInfo newChannelClient
298
+                            = getChannelClient(channel, date, newBits[0],
299
+                            joinNew);
258 300
 
259 301
                     if (newBits[2].equalsIgnoreCase("joined")) {
260 302
                         // User joined a relayed channel.
@@ -262,7 +304,8 @@ public class RelayChannelHandler implements ChannelMessageListener {
262 304
                             // If auto join on discover isn't enabled, we will
263 305
                             // need to send this join, else it will already
264 306
                             // have been sent.
265
-                            coreChannelHandler.onChannelJoin(parser, date, channel, newChannelClient);
307
+                            coreChannelHandler.onChannelJoin(parser, date,
308
+                                    channel, newChannelClient);
266 309
                             // And recolour to combat the nickcolour plugin
267 310
                             // changing the colour on join.
268 311
                             colourClient(newChannelClient);
@@ -270,35 +313,46 @@ public class RelayChannelHandler implements ChannelMessageListener {
270 313
                         return;
271 314
                     } else if (newBits[2].equalsIgnoreCase("left")) {
272 315
                         // User left a relayed channel.
273
-                        String reason = (newBits.length > 4) ? mergeBits(newBits, 4, newBits.length - 1, " ") : "()";
316
+                        String reason = (newBits.length > 4) ? mergeBits(
317
+                                newBits, 4, newBits.length - 1, " ") : "()";
274 318
                         reason = reason.substring(1, reason.length() - 1);
275 319
 
276
-                        coreChannelHandler.onChannelPart(parser, date, channel, newChannelClient, reason);
320
+                        coreChannelHandler.onChannelPart(parser, date, channel,
321
+                                newChannelClient, reason);
277 322
                         removeChannelClient(channel, newBits[0]);
278 323
                         return;
279 324
                     } else if (newBits[2].equalsIgnoreCase("quit")) {
280 325
                         // User quit a relayed channel.
281
-                        String reason = (newBits.length > 4) ? mergeBits(newBits, 4, newBits.length - 1, " ") : "()";
326
+                        String reason = (newBits.length > 4) ? mergeBits(
327
+                                newBits, 4, newBits.length - 1, " ") : "()";
282 328
                         reason = reason.substring(1, reason.length() - 1);
283 329
 
284
-                        coreChannelHandler.onChannelQuit(parser, date, channel, newChannelClient, reason);
330
+                        coreChannelHandler.onChannelQuit(parser, date, channel,
331
+                                newChannelClient, reason);
285 332
                         removeChannelClient(channel, newBits[0]);
286 333
                         return;
287 334
                     } else if (newBits[2].equalsIgnoreCase("kicked")) {
288 335
                         // User was kicked from a relayed channel.
289
-                        String reason = (newBits.length > 7) ? mergeBits(newBits, 7, newBits.length - 1, " ") : "()";
336
+                        String reason = (newBits.length > 7) ? mergeBits(
337
+                                newBits, 7, newBits.length - 1, " ") : "()";
290 338
                         reason = reason.substring(1, reason.length() - 1);
291 339
 
292
-                        final IRCChannelClientInfo kickingChannelClient = (newBits.length > 6) ? getChannelClient(channel, date, newBits[6], joinNew) : null;
340
+                        final IRCChannelClientInfo kickingChannelClient
341
+                                = (newBits.length > 6) ? getChannelClient(
342
+                                channel, date, newBits[6], joinNew) : null;
293 343
 
294
-                        coreChannelHandler.onChannelKick(parser, date, channel, newChannelClient, kickingChannelClient, reason, "");
344
+                        coreChannelHandler.onChannelKick(parser, date, channel,
345
+                                newChannelClient, kickingChannelClient, reason,
346
+                                "");
295 347
                         removeChannelClient(channel, newBits[0]);
296 348
                         return;
297
-                    } else if (newBits[2].equalsIgnoreCase("now") && newBits.length > 3) {
349
+                    } else if (newBits[2].equalsIgnoreCase("now")
350
+                            && newBits.length > 3) {
298 351
                         // User changed their nickname in a relayed channel.
299 352
                         renameChannelClient(newChannelClient, newBits[3]);
300 353
 
301
-                        coreChannelHandler.onChannelNickChanged(parser, date, channel, newChannelClient, newBits[0]);
354
+                        coreChannelHandler.onChannelNickChanged(parser, date,
355
+                                channel, newChannelClient, newBits[0]);
302 356
                         return;
303 357
                     }
304 358
                 }
@@ -306,27 +360,31 @@ public class RelayChannelHandler implements ChannelMessageListener {
306 360
                 // Channel Action
307 361
                 final String[] newBits = bits[1].split(" ", 2);
308 362
 
309
-                final IRCChannelClientInfo newChannelClient = getChannelClient(channel, date, newBits[0], joinNew);
363
+                final IRCChannelClientInfo newChannelClient = getChannelClient(
364
+                        channel, date, newBits[0], joinNew);
310 365
 
311
-                coreChannelHandler.onChannelAction(parser, date, channel, newChannelClient, newBits[1], "");
366
+                coreChannelHandler.onChannelAction(parser, date, channel,
367
+                        newChannelClient, newBits[1], "");
312 368
                 return;
313 369
             }
314 370
         }
315 371
 
316 372
         // Pass it on unchanged.
317
-        coreChannelHandler.onChannelMessage(parser, date, channel, channelClient, message, host);
373
+        coreChannelHandler.onChannelMessage(parser, date, channel,
374
+                channelClient, message, host);
318 375
     }
319 376
 
320 377
     /**
321 378
      * Merge the given bits.
322
-     *and
379
+     *
323 380
      * @param bits Bits to merge
324 381
      * @param start Start
325 382
      * @param end end
326 383
      * @param joiner What to use to join them
327 384
      * @return Joined bits.
328 385
      */
329
-    private String mergeBits(final String[] bits, final int start, final int end, final String joiner) {
386
+    private String mergeBits(final String[] bits, final int start,
387
+            final int end, final String joiner) {
330 388
         final StringBuilder builder = new StringBuilder();
331 389
         for (int i = start; i <= end; i++) {
332 390
             if (bits.length < i) { break; }
@@ -342,6 +400,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
342 400
      * This will cause all remote clients to vanish from the nicklist.
343 401
      */
344 402
     public void updateNames() {
345
-        coreChannelHandler.onChannelGotNames(myChannel.getServer().getParser(), new Date(), myChannel.getChannelInfo());
403
+        coreChannelHandler.onChannelGotNames(myChannel.getServer().getParser(),
404
+                new Date(), myChannel.getChannelInfo());
346 405
     }
347 406
 }

+ 47
- 26
src/com/dmdirc/addons/scriptplugin/JavaScriptHelper.java Datei anzeigen

@@ -21,79 +21,100 @@
21 21
  */
22 22
 
23 23
 package com.dmdirc.addons.scriptplugin;
24
+
24 25
 import java.util.HashMap;
26
+import java.util.Locale;
25 27
 import java.util.Map;
26 28
 
27 29
 /**
28 30
  * Used to allow the rhino javascript to do stuff that it otherwise can't, such
29 31
  * as setting global variables, string triming and getting a char.
30
- *
31
- * @author Shane 'Dataforce' McCormack
32 32
  */
33 33
 public class JavaScriptHelper {
34 34
     /** Used to identify the JavaScriptHelper. */
35 35
     private static final String ID = "DMDIRC-JSH";
36
-    
37
-    /** Used to allow scripts to know if a specific function they need is available. */
36
+
37
+    /**
38
+     * Used to allow scripts to know if a specific function they need is
39
+     * available.
40
+     */
38 41
     private static final int VERSION = 2;
39 42
 
40 43
     /** Hashtable for storing stuff. */
41
-    private static final Map<String, Object> SETTINGS = new HashMap<String, Object>();
42
-    
44
+    private static final Map<String, Object> SETTINGS
45
+            = new HashMap<String, Object>();
46
+
43 47
     /**
44 48
      * Method to set Stuff.
45 49
      *
46 50
      * @param setting Name of setting
47 51
      * @param value Value of setting
48 52
      */
49
-    public void setGlobal(String setting, final Object value) {
50
-        if (setting.equals("")) { return; }
51
-        setting = setting.toLowerCase();
52
-        if (SETTINGS.containsKey(setting)) { SETTINGS.remove(setting); }
53
-        if (value != null) { SETTINGS.put(setting, value); }
53
+    public void setGlobal(final String setting, final Object value) {
54
+        if (setting.isEmpty()) {
55
+            return;
56
+        }
57
+        final String key = setting.toLowerCase(Locale.getDefault());
58
+        if (SETTINGS.containsKey(key)) {
59
+            SETTINGS.remove(key);
60
+        }
61
+        if (value != null) {
62
+            SETTINGS.put(key, value);
63
+        }
54 64
     }
55
-    
65
+
56 66
     /**
57 67
      * Method to get Stuff.
58 68
      *
59 69
      * @param setting Name of setting
70
+     *
60 71
      * @return Value of setting
61 72
      */
62
-    public Object getGlobal(String setting) {
63
-        if (setting.equals("")) { return ""; }
64
-        setting = setting.toLowerCase();
65
-        if (SETTINGS.containsKey(setting)) { return SETTINGS.get(setting); }
66
-        return null;
73
+    public Object getGlobal(final String setting) {
74
+        if (setting.isEmpty()) {
75
+            return "";
76
+        }
77
+        return SETTINGS.get(setting.toLowerCase(Locale.getDefault()));
67 78
     }
68
-    
79
+
69 80
     /**
70 81
      * Method to trim spaces from strings.
71 82
      *
72 83
      * @param str String to trim
84
+     *
73 85
      * @return String without spaces on the ends
74 86
      */
75
-    public String trim(String str) { return str.trim(); }
76
-    
87
+    public String trim(final String str) {
88
+        return str.trim();
89
+    }
90
+
77 91
     /**
78 92
      * Method to get a java Character object.
79 93
      *
80 94
      * @param str String to make object from
95
+     *
81 96
      * @return Character represending first char in the string
82 97
      */
83
-    public Character toChar(String str) { return str.charAt(0); }
84
-    
98
+    public Character toChar(final String str) {
99
+        return str.charAt(0);
100
+    }
101
+
85 102
     /**
86 103
      * Get the version of JavaScriptHelper in use.
87 104
      *
88 105
      * @return JavaScriptHelper version
89 106
      */
90
-    public int getVersion() { return VERSION; }
91
-    
107
+    public int getVersion() {
108
+        return VERSION;
109
+    }
110
+
92 111
     /**
93 112
      * Get the ID of this JavaScriptHelper.
94 113
      * If you extend or modify this, you should change the myIDString variable.
95 114
      *
96 115
      * @return JavaScriptHelper ID
97 116
      */
98
-    public String getID() { return ID; }
99
-}
117
+    public String getID() {
118
+        return ID;
119
+    }
120
+}

+ 7
- 9
src/com/dmdirc/addons/time/TimerManager.java Datei anzeigen

@@ -20,7 +20,6 @@
20 20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 21
  * SOFTWARE.
22 22
  */
23
-
24 23
 package com.dmdirc.addons.time;
25 24
 
26 25
 import com.dmdirc.FrameContainer;
@@ -34,7 +33,6 @@ import java.util.Set;
34 33
 /**
35 34
  * Class to manage Timers.
36 35
  *
37
- * @author Simon Mott
38 36
  * @since 0.6.5
39 37
  */
40 38
 public class TimerManager {
@@ -56,13 +54,14 @@ public class TimerManager {
56 54
      * @param origin The frame container to use for the execution
57 55
      * @param commandContext The window the command came from
58 56
      */
59
-    public void addTimer(final int repetitions, final int interval, String command,
60
-            final FrameContainer<?> origin, final Window commandContext) {
57
+    public void addTimer(final int repetitions, final int interval,
58
+            final String command, final FrameContainer<?> origin,
59
+            final Window commandContext) {
61 60
 
62 61
         synchronized (this) {
63 62
             final int timerKey = findFreeKey();
64
-            timerList.put(timerKey, new TimedCommand(this, timerKey, repetitions,
65
-                interval, command, origin, commandContext));
63
+            timerList.put(timerKey, new TimedCommand(this, timerKey,
64
+                    repetitions, interval, command, origin, commandContext));
66 65
         }
67 66
     }
68 67
 
@@ -124,10 +123,9 @@ public class TimerManager {
124 123
      *
125 124
      * @param id ID that we want to check if there is a timer for
126 125
      *
127
-     * @return Returns True of there is a timer with the ID. False if there isn't
126
+     * @return Returns True iif there is a timer with the ID
128 127
      */
129 128
     public boolean hasTimerWithID(final int id) {
130 129
         return timerList.containsKey(id);
131 130
     }
132
-
133
-}
131
+}

+ 1
- 1
src/com/dmdirc/addons/ui_dummy/DummyInputField.java Datei anzeigen

@@ -82,7 +82,7 @@ public class DummyInputField implements InputField {
82 82
 
83 83
     /** {@inheritDoc} */
84 84
     @Override
85
-    public void setText(String text) {
85
+    public void setText(final String text) {
86 86
         throw new UnsupportedOperationException("Not supported yet.");
87 87
     }
88 88
 

+ 5
- 4
src/com/dmdirc/addons/ui_swing/components/addonbrowser/AddonInfoCellEditor.java Datei anzeigen

@@ -45,10 +45,11 @@ public class AddonInfoCellEditor extends AbstractCellEditor implements
45 45
     /** Table to edit. */
46 46
     private Object value;
47 47
 
48
-    /** {@innheritDoc} */
48
+    /** {@inheritDoc} */
49 49
     @Override
50
-    public Component getTableCellEditorComponent(JTable table, Object value,
51
-            boolean isSelected, int row, int column) {
50
+    public Component getTableCellEditorComponent(final JTable table,
51
+            final Object value, final boolean isSelected, final int row,
52
+            final int column) {
52 53
         this.value = value;
53 54
         if (value instanceof AddonInfoLabel) {
54 55
             final AddonInfoLabel label = (AddonInfoLabel) value;
@@ -64,7 +65,7 @@ public class AddonInfoCellEditor extends AbstractCellEditor implements
64 65
         }
65 66
     }
66 67
 
67
-    /** {@innheritDoc} */
68
+    /** {@inheritDoc} */
68 69
     @Override
69 70
     public Object getCellEditorValue() {
70 71
         return value;

+ 28
- 20
src/com/dmdirc/addons/ui_swing/components/addonbrowser/AddonInfoLabel.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -50,7 +49,7 @@ public class AddonInfoLabel extends JPanel {
50 49
     /** Addon info to be represented. */
51 50
     private final AddonInfo addonInfo;
52 51
     /** Parent window. */
53
-    private BrowserWindow parentWindow;
52
+    private final BrowserWindow parentWindow;
54 53
 
55 54
     /**
56 55
      * Creates a new addon info label to describe the specified addon info.
@@ -58,14 +57,19 @@ public class AddonInfoLabel extends JPanel {
58 57
      * @param addonInfo Addon to describe
59 58
      * @param parentWindow Parent window
60 59
      */
61
-    public AddonInfoLabel(final AddonInfo addonInfo, 
60
+    public AddonInfoLabel(final AddonInfo addonInfo,
62 61
             final BrowserWindow parentWindow) {
62
+        super();
63
+
63 64
         this.addonInfo = addonInfo;
64 65
         this.parentWindow = parentWindow;
65 66
 
66 67
         init();
67 68
     }
68 69
 
70
+    /**
71
+     * Initialises the components used in this addon info label.
72
+     */
69 73
     private void init() {
70 74
         setLayout(new MigLayout("fillx, ins 0"));
71 75
 
@@ -75,15 +79,15 @@ public class AddonInfoLabel extends JPanel {
75 79
 
76 80
         title = new JLabel(addonInfo.getScreenshot());
77 81
         title.setBorder(BorderFactory.createLineBorder(Color.BLACK));
78
-        add(title, "wmin 150, wmax 150, hmin 150, hmax 150, wrap, spany 5, " +
79
-                "gapright 5, gaptop 5, gapbottom 5");
82
+        add(title, "wmin 150, wmax 150, hmin 150, hmax 150, wrap, spany 5, "
83
+                + "gapright 5, gaptop 5, gapbottom 5");
80 84
 
81
-        title = new JLabel(addonInfo.getType().toString() + ", rated " +
82
-                addonInfo.getRating() + "/10");
85
+        title = new JLabel(addonInfo.getType().toString() + ", rated "
86
+                + addonInfo.getRating() + "/10");
83 87
         add(title, "wrap, gapleft 5");
84 88
 
85
-        TextLabel label = new TextLabel(addonInfo.getDescription());
86
-        add(label, "wmax 100%-170, hmax 150, growy, wrap, pushy, gapleft 5");
89
+        add(new TextLabel(addonInfo.getDescription()),
90
+                "wmax 100%-170, hmax 150, growy, wrap, pushy, gapleft 5");
87 91
 
88 92
         final JButton button = new JButton("Install");
89 93
         button.addActionListener(new InstallListener(addonInfo, parentWindow));
@@ -92,8 +96,8 @@ public class AddonInfoLabel extends JPanel {
92 96
 
93 97
         if (installed || !addonInfo.isDownloadable()) {
94 98
             button.setEnabled(false);
95
-            title = new JLabel(
96
-                    installed ? "Already installed" : "No download available");
99
+            title = new JLabel(installed ? "Already installed"
100
+                    : "No download available");
97 101
             title.setForeground(Color.GRAY);
98 102
             add(title);
99 103
         }
@@ -113,23 +117,27 @@ public class AddonInfoLabel extends JPanel {
113 117
     /** {@inheritDoc} */
114 118
     @Override
115 119
     public void repaint() {
120
+        //NOOP for performance reasons
116 121
     }
117 122
 
118 123
     /** {@inheritDoc} */
119 124
     @Override
120
-    public void firePropertyChange(String propertyName, Object oldValue,
121
-            Object newValue) {
125
+    public void firePropertyChange(final String propertyName,
126
+            final Object oldValue, final Object newValue) {
127
+        //NOOP for performance reasons
122 128
     }
123 129
 
124 130
     /** {@inheritDoc} */
125 131
     @Override
126
-    public void firePropertyChange(String propertyName, boolean oldValue,
127
-            boolean newValue) {
132
+    public void firePropertyChange(final String propertyName,
133
+            final boolean oldValue, final boolean newValue) {
134
+        //NOOP for performance reasons
128 135
     }
129 136
 
130 137
     /** {@inheritDoc} */
131 138
     @Override
132
-    public void firePropertyChange(String propertyName, int oldValue,
133
-            int newValue) {
139
+    public void firePropertyChange(final String propertyName,
140
+            final int oldValue, final int newValue) {
141
+        //NOOP for performance reasons
134 142
     }
135 143
 }

+ 42
- 24
src/com/dmdirc/addons/ui_swing/components/inputfields/SwingInputHandler.java Datei anzeigen

@@ -69,20 +69,23 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
69 69
             localTarget = (JTextComponent) target;
70 70
         } else if (target instanceof SwingInputField) {
71 71
             localTarget = ((SwingInputField) target).getTextField();
72
+        } else {
73
+            throw new IllegalArgumentException("Unknown target");
72 74
         }
73 75
 
74 76
         localTarget.getActionMap().put("upArrow", new AbstractAction() {
75 77
 
76 78
             /**
77
-             * A version number for this class. It should be changed whenever the class
78
-             * structure is changed (or anything else that would prevent serialized
79
-             * objects being unserialized with the new class).
79
+             * A version number for this class. It should be changed whenever
80
+             * the class structure is changed (or anything else that would
81
+             * prevent serialized objects being unserialized with the new
82
+             * class).
80 83
              */
81 84
             private static final long serialVersionUID = 1;
82 85
 
83 86
             /** {@inheritDoc} */
84 87
             @Override
85
-            public void actionPerformed(ActionEvent e) {
88
+            public void actionPerformed(final ActionEvent e) {
86 89
                 doBufferUp();
87 90
             }
88 91
         });
@@ -104,29 +107,35 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
104 107
             localTarget = (JTextComponent) target;
105 108
         } else if (target instanceof SwingInputField) {
106 109
             localTarget = ((SwingInputField) target).getTextField();
110
+        } else {
111
+            throw new IllegalArgumentException("Unknown target");
107 112
         }
113
+
108 114
         localTarget.getActionMap().put("downArrow", new AbstractAction() {
109 115
 
110 116
             /**
111
-             * A version number for this class. It should be changed whenever the class
112
-             * structure is changed (or anything else that would prevent serialized
113
-             * objects being unserialized with the new class).
117
+             * A version number for this class. It should be changed whenever
118
+             * the class structure is changed (or anything else that would
119
+             * prevent serialized objects being unserialized with the new
120
+             * class).
114 121
              */
115 122
             private static final long serialVersionUID = 1;
116 123
 
117 124
             /** {@inheritDoc} */
118 125
             @Override
119
-            public void actionPerformed(ActionEvent e) {
126
+            public void actionPerformed(final ActionEvent e) {
120 127
                 doBufferDown();
121 128
             }
122 129
         });
123 130
         if (Apple.isAppleUI()) {
124 131
             localTarget.getInputMap(JComponent.WHEN_FOCUSED).
125
-                    put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "downArrow");
132
+                    put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
133
+                    "downArrow");
126 134
         } else {
127 135
             localTarget.getInputMap(
128 136
                     JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
129
-                    put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "downArrow");
137
+                    put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
138
+                    "downArrow");
130 139
         }
131 140
     }
132 141
 
@@ -141,12 +150,14 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
141 150
         } else {
142 151
             throw new IllegalArgumentException("Unknown target");
143 152
         }
153
+
144 154
         localTarget.getActionMap().put("insert-tab", new AbstractAction() {
145 155
 
146 156
             /**
147
-             * A version number for this class. It should be changed whenever the class
148
-             * structure is changed (or anything else that would prevent serialized
149
-             * objects being unserialized with the new class).
157
+             * A version number for this class. It should be changed whenever
158
+             * the class structure is changed (or anything else that would
159
+             * prevent serialized objects being unserialized with the new
160
+             * class).
150 161
              */
151 162
             private static final long serialVersionUID = 1;
152 163
 
@@ -171,12 +182,14 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
171 182
                 }.executeInExecutor();
172 183
             }
173 184
         });
174
-        localTarget.getActionMap().put("insert-shift-tab", new AbstractAction() {
185
+        localTarget.getActionMap().put("insert-shift-tab",
186
+                new AbstractAction() {
175 187
 
176 188
             /**
177
-             * A version number for this class. It should be changed whenever the class
178
-             * structure is changed (or anything else that would prevent serialized
179
-             * objects being unserialized with the new class).
189
+             * A version number for this class. It should be changed whenever
190
+             * the class structure is changed (or anything else that would
191
+             * prevent serialized objects being unserialized with the new
192
+             * class).
180 193
              */
181 194
             private static final long serialVersionUID = 1;
182 195
 
@@ -216,13 +229,17 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
216 229
             localTarget = (JTextComponent) target;
217 230
         } else if (target instanceof SwingInputField) {
218 231
             localTarget = ((SwingInputField) target).getTextField();
232
+        } else {
233
+            throw new IllegalArgumentException("Unknown target");
219 234
         }
235
+
220 236
         localTarget.getActionMap().put("enterButton", new AbstractAction() {
221 237
 
222 238
             /**
223
-             * A version number for this class. It should be changed whenever the class
224
-             * structure is changed (or anything else that would prevent serialized
225
-             * objects being unserialized with the new class).
239
+             * A version number for this class. It should be changed whenever
240
+             * the class structure is changed (or anything else that would
241
+             * prevent serialized objects being unserialized with the new
242
+             * class).
226 243
              */
227 244
             private static final long serialVersionUID = 1;
228 245
 
@@ -238,7 +255,8 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
238 255
                     public void run() {
239 256
                         final JTextField source;
240 257
                         if (e.getSource() instanceof SwingInputField) {
241
-                            source = ((SwingInputField) e.getSource()).getTextField();
258
+                            source = ((SwingInputField) e.getSource())
259
+                                    .getTextField();
242 260
                         } else if (e.getSource() instanceof JTextField) {
243 261
                             source = (JTextField) e.getSource();
244 262
                         } else {
@@ -252,8 +270,7 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
252 270
 
253 271
                                 /** {@inheritDoc} */
254 272
                                 @Override
255
-                                protected Object doInBackground() throws
256
-                                        Exception {
273
+                                protected Object doInBackground() {
257 274
                                     enterPressed(line);
258 275
                                     return null;
259 276
                                 }
@@ -264,7 +281,8 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
264 281
             }
265 282
         });
266 283
         localTarget.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
267
-                put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enterButton");
284
+                put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
285
+                "enterButton");
268 286
     }
269 287
 
270 288
     /** {@inheritDoc} */

+ 15
- 19
src/com/dmdirc/addons/ui_swing/components/statusbar/FeedbackNag.java Datei anzeigen

@@ -41,7 +41,7 @@ import javax.swing.JPopupMenu;
41 41
 /**
42 42
  * Feedback nag icon.
43 43
  */
44
-public class FeedbackNag extends JLabel implements StatusBarComponent, 
44
+public class FeedbackNag extends JLabel implements StatusBarComponent,
45 45
         MouseListener, ActionListener {
46 46
 
47 47
     /**
@@ -50,33 +50,30 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
50 50
      * objects being unserialized with the new class).
51 51
      */
52 52
     private static final long serialVersionUID = 1;
53
-    /** Nag icon. */
54
-    private final ImageIcon icon;
55 53
     /** Dismiss menu. */
56 54
     private final JPopupMenu menu;
57
-    /** Dismiss menu item. */
58
-    private final JMenuItem dismiss;
59 55
     /** Show menu item. */
60 56
     private final JMenuItem show;
61 57
     /** Swing Controller. */
62
-    private SwingController controller;
58
+    private final SwingController controller;
63 59
 
64 60
     /**
65 61
      * Creates a new feedback nag.
66
-     * 
62
+     *
67 63
      * @param controller Swing controller
68 64
      */
69 65
     public FeedbackNag(final SwingController controller) {
70 66
         super();
71 67
         this.controller = controller;
72
-        icon = new ImageIcon(IconManager.getIconManager().getImage("feedback"));
73 68
         menu = new JPopupMenu();
74
-        dismiss = new JMenuItem("Dismiss");
75 69
         show = new JMenuItem("Open");
70
+        final JMenuItem dismiss = new JMenuItem("Dismiss");
76 71
 
77
-        setIcon(icon);
72
+        setIcon(new ImageIcon(IconManager.getIconManager().getImage(
73
+                "feedback")));
78 74
         setBorder(BorderFactory.createEtchedBorder());
79
-        setToolTipText("We would appreciate any feedback you may have about DMDirc.");
75
+        setToolTipText("We would appreciate any feedback you may have about "
76
+                + "DMDirc.");
80 77
 
81 78
         menu.add(show);
82 79
         menu.add(dismiss);
@@ -84,7 +81,6 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
84 81
         show.addActionListener(this);
85 82
         dismiss.addActionListener(this);
86 83
         addMouseListener(this);
87
-
88 84
         controller.getSwingStatusBar().addComponent(this);
89 85
     }
90 86
 
@@ -94,7 +90,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
94 90
      * @param e Mouse event
95 91
      */
96 92
     @Override
97
-    public void mouseClicked(MouseEvent e) {
93
+    public void mouseClicked(final MouseEvent e) {
98 94
         checkMouseEvent(e);
99 95
     }
100 96
 
@@ -104,7 +100,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
104 100
      * @param e Mouse event
105 101
      */
106 102
     @Override
107
-    public void mousePressed(MouseEvent e) {
103
+    public void mousePressed(final MouseEvent e) {
108 104
         checkMouseEvent(e);
109 105
     }
110 106
 
@@ -114,7 +110,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
114 110
      * @param e Mouse event
115 111
      */
116 112
     @Override
117
-    public void mouseReleased(MouseEvent e) {
113
+    public void mouseReleased(final MouseEvent e) {
118 114
         if (e.getButton() == 1) {
119 115
             FeedbackDialog.showFeedbackDialog(controller.getMainFrame());
120 116
             controller.getSwingStatusBar().removeComponent(this);
@@ -128,7 +124,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
128 124
      * @param e Mouse event
129 125
      */
130 126
     @Override
131
-    public void mouseEntered(MouseEvent e) {
127
+    public void mouseEntered(final MouseEvent e) {
132 128
         checkMouseEvent(e);
133 129
     }
134 130
 
@@ -138,7 +134,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
138 134
      * @param e Mouse event
139 135
      */
140 136
     @Override
141
-    public void mouseExited(MouseEvent e) {
137
+    public void mouseExited(final MouseEvent e) {
142 138
         checkMouseEvent(e);
143 139
     }
144 140
 
@@ -147,7 +143,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
147 143
      *
148 144
      * @param e Mouse event
149 145
      */
150
-    private void checkMouseEvent(MouseEvent e) {
146
+    private void checkMouseEvent(final MouseEvent e) {
151 147
         if (e.isPopupTrigger()) {
152 148
             menu.show(this, e.getX(), e.getY());
153 149
         }
@@ -159,7 +155,7 @@ public class FeedbackNag extends JLabel implements StatusBarComponent,
159 155
      * @param e Action event
160 156
      */
161 157
     @Override
162
-    public void actionPerformed(ActionEvent e) {
158
+    public void actionPerformed(final ActionEvent e) {
163 159
         if (e.getSource() == show) {
164 160
             FeedbackDialog.showFeedbackDialog(controller.getMainFrame());
165 161
         }

+ 8
- 11
src/com/dmdirc/addons/ui_swing/components/substitutions/SubstitutionLabel.java Datei anzeigen

@@ -74,7 +74,6 @@ public class SubstitutionLabel extends JButton implements MouseListener,
74 74
 
75 75
         initComponents();
76 76
         addListeners();
77
-        layoutComponents();
78 77
     }
79 78
 
80 79
     /** Initialises the components. */
@@ -102,10 +101,6 @@ public class SubstitutionLabel extends JButton implements MouseListener,
102 101
         addActionListener(this);
103 102
     }
104 103
 
105
-    /** Lays out the components. */
106
-    private void layoutComponents() {
107
-    }
108
-
109 104
     /**
110 105
      * {@inheritDoc}
111 106
      *
@@ -159,8 +154,9 @@ public class SubstitutionLabel extends JButton implements MouseListener,
159 154
     /** {@inheritDoc} */
160 155
     @Override
161 156
     public void dragGestureRecognized(final DragGestureEvent dge) {
162
-        dragSource.startDrag(dge, Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
163
-                new StringTransferable(substitution.toString()), null);
157
+        dragSource.startDrag(dge, Cursor.getPredefinedCursor(
158
+                Cursor.HAND_CURSOR), new StringTransferable(substitution
159
+                .toString()), null);
164 160
     }
165 161
 
166 162
     /**
@@ -169,9 +165,10 @@ public class SubstitutionLabel extends JButton implements MouseListener,
169 165
      * @param e Action event
170 166
      */
171 167
     @Override
172
-    public void actionPerformed(ActionEvent e) {
168
+    public void actionPerformed(final ActionEvent e) {
173 169
         if (previousComponent instanceof JTextComponent) {
174
-            ((JTextComponent) previousComponent).replaceSelection(substitution.toString());
170
+            ((JTextComponent) previousComponent).replaceSelection(
171
+                    substitution.toString());
175 172
         }
176 173
     }
177 174
 
@@ -181,7 +178,7 @@ public class SubstitutionLabel extends JButton implements MouseListener,
181 178
      * @param e Focus event
182 179
      */
183 180
     @Override
184
-    public void focusGained(FocusEvent e) {
181
+    public void focusGained(final FocusEvent e) {
185 182
         previousComponent = e.getOppositeComponent();
186 183
     }
187 184
 
@@ -191,7 +188,7 @@ public class SubstitutionLabel extends JButton implements MouseListener,
191 188
      * @param e Focus event
192 189
      */
193 190
     @Override
194
-    public void focusLost(FocusEvent e) {
191
+    public void focusLost(final FocusEvent e) {
195 192
         //Ignore
196 193
     }
197 194
 }

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/text/DMDircHTMLFactory.java Datei anzeigen

@@ -34,7 +34,7 @@ public class DMDircHTMLFactory extends HTMLFactory {
34 34
 
35 35
     /** {@inheritDoc} */
36 36
     @Override
37
-    public View create(Element elem) {
37
+    public View create(final Element elem) {
38 38
         final View view = super.create(elem);
39 39
         if (view instanceof ImageView) {
40 40
             return new DMDircImageView(elem);

+ 78
- 62
src/com/dmdirc/addons/ui_swing/dialogs/FeedbackDialog.java Datei anzeigen

@@ -56,8 +56,8 @@ import javax.swing.event.DocumentListener;
56 56
 import net.miginfocom.swing.MigLayout;
57 57
 
58 58
 /** Feedback form. */
59
-public class FeedbackDialog extends StandardDialog implements ActionListener,
60
-        DocumentListener {
59
+public final class FeedbackDialog extends StandardDialog implements 
60
+        ActionListener, DocumentListener {
61 61
 
62 62
     /**
63 63
      * A version number for this class. It should be changed whenever the class
@@ -66,7 +66,7 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
66 66
      */
67 67
     private static final long serialVersionUID = 1;
68 68
     /** A previously created instance of FeedbackDialog. */
69
-    private static volatile FeedbackDialog me;
69
+    private static FeedbackDialog me;
70 70
     /** Information label. */
71 71
     private TextLabel info;
72 72
     /** Name field. */
@@ -82,9 +82,9 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
82 82
     /** Sent. */
83 83
     private boolean sentReport = false;
84 84
 
85
-    /** 
86
-     * Instantiates the feedback dialog. 
87
-     * 
85
+    /**
86
+     * Instantiates the feedback dialog.
87
+     *
88 88
      * @param parentWindow Parent window
89 89
      */
90 90
     private FeedbackDialog(final Window parentWindow) {
@@ -100,7 +100,7 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
100 100
 
101 101
     /**
102 102
      * Creates the new feedback dialog if one doesn't exist, and displays it.
103
-     * 
103
+     *
104 104
      * @param parentWindow Parent window
105 105
      */
106 106
     public static void showFeedbackDialog(final Window parentWindow) {
@@ -112,7 +112,7 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
112 112
 
113 113
     /**
114 114
      * Returns the current instance of the FeedbackDialog.
115
-     * 
115
+     *
116 116
      * @param parentWindow Parent window
117 117
      *
118 118
      * @return The current FeedbackDialog instance
@@ -142,15 +142,15 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
142 142
         getOkButton().setEnabled(false);
143 143
         getCancelButton().setActionCommand("Close");
144 144
 
145
-        info = new TextLabel("Thank you for using DMDirc. If you have any " +
146
-                "feedback about the client, such as bug reports or feature " +
147
-                "requests, please send it to us using the form below.  " +
148
-                "The name and e-mail address fields are optional if you " +
149
-                "don't want us to contact you about your feedback.\n\n" +
150
-                "Please note that this is for feedback such as bug reports " +
151
-                "and suggestions, not for technical support. For " +
152
-                "technical support, please join #DMDirc using the button " +
153
-                "in the help menu.");
145
+        info = new TextLabel("Thank you for using DMDirc. If you have any "
146
+                + "feedback about the client, such as bug reports or feature "
147
+                + "requests, please send it to us using the form below.  "
148
+                + "The name and e-mail address fields are optional if you "
149
+                + "don't want us to contact you about your feedback.\n\n"
150
+                + "Please note that this is for feedback such as bug reports "
151
+                + "and suggestions, not for technical support. For "
152
+                + "technical support, please join #DMDirc using the button "
153
+                + "in the help menu.");
154 154
         name = new JTextField();
155 155
         email = new JTextField();
156 156
         feedback = new JTextArea();
@@ -170,7 +170,8 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
170 170
         dmdircCheckbox.setMargin(new Insets(0, 0, 0, 0));
171 171
         dmdircCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
172 172
 
173
-        setLayout(new MigLayout("fill, wmin 600, wmax 600, hmin 400, hmax 400"));
173
+        setLayout(new MigLayout(
174
+                "fill, wmin 600, wmax 600, hmin 400, hmax 400"));
174 175
 
175 176
         add(info, "span, growx, wrap, gapbottom unrel");
176 177
 
@@ -201,7 +202,8 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
201 202
         getOkButton().setText("Close");
202 203
         getOkButton().setActionCommand("Close");
203 204
 
204
-        setLayout(new MigLayout("fill, wmin 600, wmax 600, hmin 400, hmax 400"));
205
+        setLayout(new MigLayout(
206
+                "fill, wmin 600, wmax 600, hmin 400, hmax 400"));
205 207
 
206 208
         info.setText(error.toString());
207 209
 
@@ -226,40 +228,45 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
226 228
         final StringBuilder serverInfo = new StringBuilder();
227 229
         final StringBuilder dmdircInfo = new StringBuilder();
228 230
         if (serverCheckbox.isSelected()) {
229
-            for (Server server : ServerManager.getServerManager().getServers()) {
230
-                if (!server.getState().isDisconnected()) {
231
-                    serverInfo.append("Server name: ").append(server.getName())
232
-                            .append("\n");
233
-                    serverInfo.append("Actual name: ").append(server.getParser()
234
-                            .getServerName()).append("\n");
235
-                    serverInfo.append("Network: ").append(server.getNetwork())
236
-                            .append("\n");
237
-                    serverInfo.append("IRCd: ").append(server.getParser()
238
-                            .getServerSoftware()).append(" - ");
239
-                    serverInfo.append(server.getParser()
240
-                            .getServerSoftwareType()).append("\n");
241
-                    serverInfo.append("Modes: ").append(server.getParser()
242
-                            .getBooleanChannelModes()).append(" ");
243
-                    serverInfo.append(server.getParser().getListChannelModes())
244
-                            .append(" ");
245
-                    serverInfo.append(server.getParser().
246
-                            getParameterChannelModes()).append(" ");
247
-                    serverInfo.append(server.getParser().
248
-                            getDoubleParameterChannelModes());
231
+            for (Server server : ServerManager.getServerManager()
232
+                    .getServers()) {
233
+                if (server.getState().isDisconnected()) {
234
+                    continue;
249 235
                 }
236
+                serverInfo.append("Server name: ").append(server.getName())
237
+                        .append("\n");
238
+                serverInfo.append("Actual name: ").append(server.getParser()
239
+                        .getServerName()).append("\n");
240
+                serverInfo.append("Network: ").append(server.getNetwork())
241
+                        .append("\n");
242
+                serverInfo.append("IRCd: ").append(server.getParser()
243
+                        .getServerSoftware()).append(" - ");
244
+                serverInfo.append(server.getParser().getServerSoftwareType())
245
+                        .append("\n");
246
+                serverInfo.append("Modes: ").append(server.getParser()
247
+                        .getBooleanChannelModes()).append(" ");
248
+                serverInfo.append(server.getParser().getListChannelModes())
249
+                        .append(" ");
250
+                serverInfo.append(server.getParser().getParameterChannelModes())
251
+                        .append(" ");
252
+                serverInfo.append(server.getParser().
253
+                        getDoubleParameterChannelModes());
250 254
             }
251 255
         }
252 256
         if (dmdircCheckbox.isSelected()) {
253
-            dmdircInfo.append("DMDirc version: " + Info.getDMDircVersion()).
254
-                    append("\n");
255
-            dmdircInfo.append("Profile directory: " + Main.getConfigDir()).
256
-                    append("\n");
257
-            dmdircInfo.append("Java version: " + Info.getJavaVersion()).append("\n");
258
-            dmdircInfo.append("OS Version: " + Info.getOSVersion()).append("\n");
259
-            dmdircInfo.append("Look & Feel: " + SwingController.getLookAndFeel());
257
+            dmdircInfo.append("DMDirc version: ").append(
258
+                    Info.getDMDircVersion()).append("\n");
259
+            dmdircInfo.append("Profile directory: ").append(
260
+                    Main.getConfigDir()).append("\n");
261
+            dmdircInfo.append("Java version: ").append(
262
+                    Info.getJavaVersion()).append("\n");
263
+            dmdircInfo.append("OS Version: ").append(
264
+                    Info.getOSVersion()).append("\n");
265
+            dmdircInfo.append("Look & Feel: ").append(
266
+                    SwingController.getLookAndFeel());
260 267
         }
261 268
         new SendWorker(me, name.getText().trim(), email.getText().trim(),
262
-                feedback.getText().trim(), serverInfo. toString().trim(),
269
+                feedback.getText().trim(), serverInfo.toString().trim(),
263 270
                 dmdircInfo.toString().trim()).executeInExecutor();
264 271
     }
265 272
 
@@ -290,19 +297,19 @@ public class FeedbackDialog extends StandardDialog implements ActionListener,
290 297
 
291 298
     /** {@inheritDoc} */
292 299
     @Override
293
-    public void insertUpdate(DocumentEvent e) {
300
+    public void insertUpdate(final DocumentEvent e) {
294 301
         validateInput();
295 302
     }
296 303
 
297 304
     /** {@inheritDoc} */
298 305
     @Override
299
-    public void removeUpdate(DocumentEvent e) {
306
+    public void removeUpdate(final DocumentEvent e) {
300 307
         validateInput();
301 308
     }
302 309
 
303 310
     /** {@inheritDoc} */
304 311
     @Override
305
-    public void changedUpdate(DocumentEvent e) {
312
+    public void changedUpdate(final DocumentEvent e) {
306 313
     //Ignore
307 314
     }
308 315
 
@@ -347,8 +354,8 @@ class SendWorker extends LoggingSwingWorker {
347 354
      * @param email Email
348 355
      * @param feedback Feedback
349 356
      */
350
-    public SendWorker(FeedbackDialog dialog, String name, String email,
351
-            String feedback) {
357
+    public SendWorker(final FeedbackDialog dialog, final String name,
358
+            final String email, final String feedback) {
352 359
         this(dialog, name, email, feedback, "", "");
353 360
     }
354 361
 
@@ -365,6 +372,8 @@ class SendWorker extends LoggingSwingWorker {
365 372
     public SendWorker(final FeedbackDialog dialog, final String name,
366 373
             final String email, final String feedback,
367 374
             final String serverInfo, final String dmdircInfo) {
375
+        super();
376
+
368 377
         this.dialog = dialog;
369 378
         this.name = name;
370 379
         this.email = email;
@@ -375,13 +384,9 @@ class SendWorker extends LoggingSwingWorker {
375 384
         error = new StringBuilder();
376 385
     }
377 386
 
378
-    /**
379
-     * {@inheritDoc}
380
-     *
381
-     * @throws java.lang.Exception If unable to return a result
382
-     */
387
+    /** {@inheritDoc} */
383 388
     @Override
384
-    protected Object doInBackground() throws Exception {
389
+    protected Object doInBackground() {
385 390
         final Map<String, String> postData =
386 391
                 new HashMap<String, String>();
387 392
 
@@ -394,7 +399,8 @@ class SendWorker extends LoggingSwingWorker {
394 399
         if (!feedback.isEmpty()) {
395 400
             postData.put("feedback", feedback);
396 401
         }
397
-        postData.put("version", IdentityManager.getGlobalConfig().getOption("version", "version"));
402
+        postData.put("version", IdentityManager.getGlobalConfig().getOption(
403
+                "version", "version"));
398 404
         if (!serverInfo.isEmpty()) {
399 405
             postData.put("serverInfo", serverInfo);
400 406
         }
@@ -402,6 +408,18 @@ class SendWorker extends LoggingSwingWorker {
402 408
             postData.put("dmdircInfo", dmdircInfo);
403 409
         }
404 410
 
411
+        sendData(postData);
412
+
413
+        return error;
414
+    }
415
+
416
+    /**
417
+     * Sends the error data to the server appending returned information to the
418
+     * global error variable.
419
+     *
420
+     * @param postData Feedback data to send
421
+     */
422
+    private void sendData(final Map<String, String> postData) {
405 423
         try {
406 424
             final List<String> response =
407 425
                     Downloader.getPage("http://www.dmdirc.com/feedback.php",
@@ -416,10 +434,8 @@ class SendWorker extends LoggingSwingWorker {
416 434
         } catch (MalformedURLException ex) {
417 435
             error.append("Malformed feedback URL.");
418 436
         } catch (IOException ex) {
419
-            error.append("Failure: " + ex.getMessage());
437
+            error.append("Failure: ").append(ex.getMessage());
420 438
         }
421
-
422
-        return error;
423 439
     }
424 440
 
425 441
     /** {@inheritDoc} */

+ 16
- 17
src/com/dmdirc/addons/ui_swing/dialogs/StandardInputDialog.java Datei anzeigen

@@ -58,15 +58,14 @@ public abstract class StandardInputDialog extends StandardDialog {
58 58
 
59 59
     /**
60 60
      * Instantiates a new standard input dialog.
61
-     * 
61
+     *
62 62
      * @param owner Dialog owner
63 63
      * @param modal modality type
64 64
      * @param title Dialog title
65 65
      * @param message Dialog message
66 66
      */
67
-    public StandardInputDialog(Window owner, ModalityType modal,
68
-            final String title,
69
-            final String message) {
67
+    public StandardInputDialog(final Window owner, final ModalityType modal,
68
+            final String title, final String message) {
70 69
         this(owner, modal, title, message, new Validator<String>() {
71 70
 
72 71
             /** {@inheritDoc} */
@@ -79,14 +78,14 @@ public abstract class StandardInputDialog extends StandardDialog {
79 78
 
80 79
     /**
81 80
      * Instantiates a new standard input dialog.
82
-     * 
81
+     *
83 82
      * @param owner Dialog owner
84 83
      * @param modal modality type
85 84
      * @param validator Textfield validator
86 85
      * @param title Dialog title
87 86
      * @param message Dialog message
88 87
      */
89
-    public StandardInputDialog(Window owner, ModalityType modal,
88
+    public StandardInputDialog(final Window owner, final ModalityType modal,
90 89
             final String title, final String message,
91 90
             final Validator<String> validator) {
92 91
         super(owner, modal);
@@ -104,7 +103,7 @@ public abstract class StandardInputDialog extends StandardDialog {
104 103
 
105 104
     /**
106 105
      * Called when the dialog's OK button is clicked.
107
-     * 
106
+     *
108 107
      * @return whether the dialog can close
109 108
      */
110 109
     public abstract boolean save();
@@ -125,14 +124,14 @@ public abstract class StandardInputDialog extends StandardDialog {
125 124
     }
126 125
 
127 126
     /**
128
-     * Adds the listeners
127
+     * Adds the listeners.
129 128
      */
130 129
     private void addListeners() {
131 130
         getOkButton().addActionListener(new ActionListener() {
132 131
 
133 132
             /** {@inheritDoc} */
134 133
             @Override
135
-            public void actionPerformed(ActionEvent e) {
134
+            public void actionPerformed(final ActionEvent e) {
136 135
                 if (save()) {
137 136
                     dispose();
138 137
                 }
@@ -142,7 +141,7 @@ public abstract class StandardInputDialog extends StandardDialog {
142 141
 
143 142
             /** {@inheritDoc} */
144 143
             @Override
145
-            public void actionPerformed(ActionEvent e) {
144
+            public void actionPerformed(final ActionEvent e) {
146 145
                 cancelled();
147 146
                 dispose();
148 147
             }
@@ -151,13 +150,13 @@ public abstract class StandardInputDialog extends StandardDialog {
151 150
 
152 151
             /** {@inheritDoc} */
153 152
             @Override
154
-            public void windowOpened(WindowEvent e) {
153
+            public void windowOpened(final WindowEvent e) {
155 154
                 textField.requestFocusInWindow();
156 155
             }
157 156
 
158 157
             /** {@inheritDoc} */
159 158
             @Override
160
-            public void windowClosed(WindowEvent e) {
159
+            public void windowClosed(final WindowEvent e) {
161 160
                 cancelled();
162 161
             //dispose();
163 162
             }
@@ -166,19 +165,19 @@ public abstract class StandardInputDialog extends StandardDialog {
166 165
 
167 166
             /** {@inheritDoc} */
168 167
             @Override
169
-            public void insertUpdate(DocumentEvent e) {
168
+            public void insertUpdate(final DocumentEvent e) {
170 169
                 validateText();
171 170
             }
172 171
 
173 172
             /** {@inheritDoc} */
174 173
             @Override
175
-            public void removeUpdate(DocumentEvent e) {
174
+            public void removeUpdate(final DocumentEvent e) {
176 175
                 validateText();
177 176
             }
178 177
 
179 178
             /** {@inheritDoc} */
180 179
             @Override
181
-            public void changedUpdate(DocumentEvent e) {
180
+            public void changedUpdate(final DocumentEvent e) {
182 181
             //Ignore
183 182
             }
184 183
         });
@@ -212,7 +211,7 @@ public abstract class StandardInputDialog extends StandardDialog {
212 211
 
213 212
     /**
214 213
      * Returns the text in the input field.
215
-     * 
214
+     *
216 215
      * @return Input text
217 216
      */
218 217
     public final String getText() {
@@ -221,7 +220,7 @@ public abstract class StandardInputDialog extends StandardDialog {
221 220
 
222 221
     /**
223 222
      * Sets the dialogs text to the specified text.
224
-     * 
223
+     *
225 224
      * @param text New test
226 225
      */
227 226
     public final void setText(final String text) {

+ 11
- 11
src/com/dmdirc/addons/ui_swing/dialogs/StandardMessageDialog.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -46,10 +45,10 @@ public class StandardMessageDialog extends StandardDialog {
46 45
      * objects being unserialized with the new class).
47 46
      */
48 47
     private static final long serialVersionUID = 1;
48
+    /** Message. */
49
+    private final String message;
49 50
     /** Blurb label. */
50 51
     private TextLabel blurb;
51
-    /** Message. */
52
-    private String message;
53 52
 
54 53
     /**
55 54
      * Instantiates a new standard input dialog.
@@ -59,7 +58,7 @@ public class StandardMessageDialog extends StandardDialog {
59 58
      * @param title Dialog title
60 59
      * @param message Dialog message
61 60
      */
62
-    public StandardMessageDialog(Window owner, ModalityType modal,
61
+    public StandardMessageDialog(final Window owner, final ModalityType modal,
63 62
             final String title, final String message) {
64 63
         super(owner, modal);
65 64
 
@@ -86,6 +85,7 @@ public class StandardMessageDialog extends StandardDialog {
86 85
      * Called when the dialog's cancel button is clicked, or otherwise closed.
87 86
      */
88 87
     public void cancelled() {
88
+        //Do nothing
89 89
     }
90 90
 
91 91
     /**
@@ -98,14 +98,14 @@ public class StandardMessageDialog extends StandardDialog {
98 98
     }
99 99
 
100 100
     /**
101
-     * Adds the listeners
101
+     * Adds the listeners.
102 102
      */
103 103
     private void addListeners() {
104 104
         final ActionListener listener = new ActionListener() {
105 105
 
106 106
             /** {@inheritDoc} */
107 107
             @Override
108
-            public void actionPerformed(ActionEvent e) {
108
+            public void actionPerformed(final ActionEvent e) {
109 109
                 if (save()) {
110 110
                     dispose();
111 111
                 }
@@ -117,13 +117,13 @@ public class StandardMessageDialog extends StandardDialog {
117 117
 
118 118
             /** {@inheritDoc} */
119 119
             @Override
120
-            public void windowOpened(WindowEvent e) {
120
+            public void windowOpened(final WindowEvent e) {
121 121
                 //Ignore
122 122
             }
123 123
 
124 124
             /** {@inheritDoc} */
125 125
             @Override
126
-            public void windowClosed(WindowEvent e) {
126
+            public void windowClosed(final WindowEvent e) {
127 127
                 cancelled();
128 128
             }
129 129
         });

+ 8
- 8
src/com/dmdirc/addons/ui_swing/dialogs/StandardQuestionDialog.java Datei anzeigen

@@ -39,10 +39,10 @@ import net.miginfocom.swing.MigLayout;
39 39
  */
40 40
 public abstract class StandardQuestionDialog extends StandardDialog {
41 41
 
42
+    /** Message. */
43
+    private final String message;
42 44
     /** Blurb label. */
43 45
     private TextLabel blurb;
44
-    /** Message. */
45
-    private String message;
46 46
     /** Question result. */
47 47
     private boolean result = false;
48 48
 
@@ -54,7 +54,7 @@ public abstract class StandardQuestionDialog extends StandardDialog {
54 54
      * @param title Dialog title
55 55
      * @param message Dialog message
56 56
      */
57
-    public StandardQuestionDialog(Window owner, ModalityType modal,
57
+    public StandardQuestionDialog(final Window owner, final ModalityType modal,
58 58
             final String title, final String message) {
59 59
         super(owner, modal);
60 60
 
@@ -91,14 +91,14 @@ public abstract class StandardQuestionDialog extends StandardDialog {
91 91
     }
92 92
 
93 93
     /**
94
-     * Adds the listeners
94
+     * Adds the listeners.
95 95
      */
96 96
     private void addListeners() {
97 97
         getOkButton().addActionListener(new ActionListener() {
98 98
 
99 99
             /** {@inheritDoc} */
100 100
             @Override
101
-            public void actionPerformed(ActionEvent e) {
101
+            public void actionPerformed(final ActionEvent e) {
102 102
                 if (save()) {
103 103
                     result = true;
104 104
                     dispose();
@@ -109,7 +109,7 @@ public abstract class StandardQuestionDialog extends StandardDialog {
109 109
 
110 110
             /** {@inheritDoc} */
111 111
             @Override
112
-            public void actionPerformed(ActionEvent e) {
112
+            public void actionPerformed(final ActionEvent e) {
113 113
                 cancelled();
114 114
                 dispose();
115 115
             }
@@ -118,13 +118,13 @@ public abstract class StandardQuestionDialog extends StandardDialog {
118 118
 
119 119
             /** {@inheritDoc} */
120 120
             @Override
121
-            public void windowOpened(WindowEvent e) {
121
+            public void windowOpened(final WindowEvent e) {
122 122
                 //Ignore
123 123
             }
124 124
 
125 125
             /** {@inheritDoc} */
126 126
             @Override
127
-            public void windowClosed(WindowEvent e) {
127
+            public void windowClosed(final WindowEvent e) {
128 128
                 if (!result) {
129 129
                     cancelled();
130 130
                 }

+ 8
- 5
src/com/dmdirc/addons/ui_swing/dialogs/about/AboutDialog.java Datei anzeigen

@@ -50,7 +50,7 @@ public final class AboutDialog extends StandardDialog implements
50 50
      */
51 51
     private static final long serialVersionUID = 5;
52 52
     /** Previously created instance of AboutDialog. */
53
-    private static volatile AboutDialog me = null;
53
+    private static AboutDialog me = null;
54 54
     /** Tabbed pane to use. */
55 55
     private JTabbedPane tabbedPane;
56 56
     /** Credits panel. */
@@ -66,7 +66,8 @@ public final class AboutDialog extends StandardDialog implements
66 66
      * @param parentWindow Parent window
67 67
      * @param urlHandler The URL Handler to use to handle clicked links
68 68
      */
69
-    private AboutDialog(final Window parentWindow, final URLHandler urlHandler) {
69
+    private AboutDialog(final Window parentWindow,
70
+            final URLHandler urlHandler) {
70 71
         super(parentWindow, ModalityType.MODELESS);
71 72
 
72 73
         this.urlHandler = urlHandler;
@@ -80,7 +81,8 @@ public final class AboutDialog extends StandardDialog implements
80 81
      * @param parentWindow Parent window
81 82
      * @param urlHandler The URL Handler to use to handle clicked links
82 83
      */
83
-    public static void showAboutDialog(final Window parentWindow, final URLHandler urlHandler) {
84
+    public static void showAboutDialog(final Window parentWindow,
85
+            final URLHandler urlHandler) {
84 86
         me = getAboutDialog(parentWindow, urlHandler);
85 87
 
86 88
         me.display();
@@ -163,10 +165,11 @@ public final class AboutDialog extends StandardDialog implements
163 165
 
164 166
     /** {@inheritDoc} */
165 167
     @Override
166
-    public void stateChanged(ChangeEvent e) {
168
+    public void stateChanged(final ChangeEvent e) {
167 169
         history = 10 * (history % 10000) + tabbedPane.getSelectedIndex();
168 170
 
169
-        if (history / 10 % 100 == 32 && (history & 1) == 1 && history >> 8 == 118) {
171
+        if (history / 10 % 100 == 32 && (history & 1) == 1
172
+                && history >> 8 == 118) {
170 173
             cp.showEE();
171 174
         }
172 175
     }

+ 11
- 9
src/com/dmdirc/addons/ui_swing/dialogs/about/LicenceLoader.java Datei anzeigen

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -48,9 +48,9 @@ import javax.swing.tree.DefaultTreeModel;
48 48
 public class LicenceLoader extends LoggingSwingWorker<Void, Void> {
49 49
 
50 50
     /** Tree. */
51
-    private JTree tree;
51
+    private final JTree tree;
52 52
     /** Model to load licences into. */
53
-    private DefaultTreeModel model;
53
+    private final DefaultTreeModel model;
54 54
 
55 55
     /**
56 56
      * Instantiates a new licence loader.
@@ -59,6 +59,8 @@ public class LicenceLoader extends LoggingSwingWorker<Void, Void> {
59 59
      * @param model Model to load licences into
60 60
      */
61 61
     public LicenceLoader(final JTree tree, final DefaultTreeModel model) {
62
+        super();
63
+
62 64
         this.tree = tree;
63 65
         this.model = model;
64 66
     }
@@ -66,18 +68,18 @@ public class LicenceLoader extends LoggingSwingWorker<Void, Void> {
66 68
     /**
67 69
      * {@inheritDoc}
68 70
      *
69
-     * @throws Exception on any exception in the background task
71
+     * @throws IOException on any exception in the background task
70 72
      */
71 73
     @Override
72
-    protected Void doInBackground() throws Exception {
74
+    protected Void doInBackground() throws IOException {
73 75
         final ResourceManager rm = ResourceManager.getResourceManager();
74 76
         if (rm == null) {
75 77
             Logger.userError(ErrorLevel.LOW, "Unable to load licences, "
76 78
                     + "no resource manager");
77 79
         } else {
78 80
             addCoreLicences(rm);
79
-            for (PluginInfo pi :
80
-                    PluginManager.getPluginManager().getPluginInfos()) {
81
+            for (PluginInfo pi : PluginManager.getPluginManager()
82
+                    .getPluginInfos()) {
81 83
                 addPluginLicences(pi);
82 84
             }
83 85
         }

+ 11
- 11
src/com/dmdirc/addons/ui_swing/dialogs/about/LicenceRenderer.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -47,16 +46,17 @@ public class LicenceRenderer extends DefaultTreeCellRenderer {
47 46
 
48 47
     /** {@inheritDoc} */
49 48
     @Override
50
-    public Component getTreeCellRendererComponent(JTree tree, Object value,
51
-            boolean sel, boolean expanded, boolean leaf, int row,
52
-            boolean hasFocus) {
49
+    public Component getTreeCellRendererComponent(final JTree tree,
50
+            final Object value, final boolean sel, final boolean expanded,
51
+            final boolean leaf, final int row, final boolean hasFocus) {
53 52
         final JLabel label = (JLabel) super.getTreeCellRendererComponent(tree,
54 53
                 value, sel, expanded, leaf, row, hasFocus);
55 54
         label.setIcon(null);
56 55
         label.setOpaque(false);
57
-        if (((DefaultMutableTreeNode) value).getUserObject() instanceof PluginInfo) {
58
-            setText(((PluginInfo) ((DefaultMutableTreeNode) value).getUserObject()).
59
-                    getNiceName());
56
+        if (((DefaultMutableTreeNode) value).getUserObject()
57
+                instanceof PluginInfo) {
58
+            setText(((PluginInfo) ((DefaultMutableTreeNode) value)
59
+                    .getUserObject()).getNiceName());
60 60
         }
61 61
         return label;
62 62
     }
@@ -75,5 +75,5 @@ public class LicenceRenderer extends DefaultTreeCellRenderer {
75 75
     @Override
76 76
     public Color getBackground() {
77 77
         return null;
78
-    } 
78
+    }
79 79
 }

+ 4
- 4
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionConditionEditorPanel.java Datei anzeigen

@@ -48,7 +48,7 @@ import net.miginfocom.swing.MigLayout;
48 48
 /**
49 49
  * Action conditioneditor panel.
50 50
  */
51
-public class ActionConditionEditorPanel extends JPanel implements 
51
+public class ActionConditionEditorPanel extends JPanel implements
52 52
         ActionListener, DocumentListener, PropertyChangeListener {
53 53
 
54 54
     /**
@@ -280,7 +280,7 @@ public class ActionConditionEditorPanel extends JPanel implements
280 280
 
281 281
     /** {@inheritDoc} */
282 282
     @Override
283
-    public void setEnabled(boolean enabled) {
283
+    public void setEnabled(final boolean enabled) {
284 284
         super.setEnabled(enabled);
285 285
         arguments.setEnabled(enabled);
286 286
         if (enabled) {
@@ -299,7 +299,7 @@ public class ActionConditionEditorPanel extends JPanel implements
299 299
      *
300 300
      * @param trigger new trigger
301 301
      */
302
-    void setTrigger(final ActionType trigger) {
302
+    public void setTrigger(final ActionType trigger) {
303 303
         this.trigger = trigger;
304 304
 
305 305
         setEnabled(trigger != null);
@@ -310,7 +310,7 @@ public class ActionConditionEditorPanel extends JPanel implements
310 310
 
311 311
     /** {@inheritDoc} */
312 312
     @Override
313
-    public void propertyChange(PropertyChangeEvent evt) {
313
+    public void propertyChange(final PropertyChangeEvent evt) {
314 314
         firePropertyChange("validationResult", evt.getOldValue(),
315 315
                 evt.getNewValue());
316 316
     }

+ 21
- 23
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersListPanel.java Datei anzeigen

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -62,7 +62,7 @@ public class ActionTriggersListPanel extends JPanel {
62 62
 
63 63
     /**
64 64
      * Instantiates the panel.
65
-     * 
65
+     *
66 66
      * @param triggers Trigger list
67 67
      */
68 68
     public ActionTriggersListPanel(final List<ActionType> triggers) {
@@ -71,7 +71,6 @@ public class ActionTriggersListPanel extends JPanel {
71 71
         this.triggers = new ArrayList<ActionType>(triggers);
72 72
 
73 73
         initComponents();
74
-        addListeners();
75 74
         layoutComponents();
76 75
     }
77 76
 
@@ -81,10 +80,6 @@ public class ActionTriggersListPanel extends JPanel {
81 80
         setLayout(new MigLayout("fillx, wrap 2"));
82 81
     }
83 82
 
84
-    /** Adds the listeners. */
85
-    private void addListeners() {
86
-    }
87
-
88 83
     /** Lays out the components. */
89 84
     private void layoutComponents() {
90 85
         synchronized (triggers) {
@@ -100,18 +95,18 @@ public class ActionTriggersListPanel extends JPanel {
100 95
 
101 96
                     /** {@inheritDoc} */
102 97
                     @Override
103
-                    public void actionPerformed(ActionEvent e) {
98
+                    public void actionPerformed(final ActionEvent e) {
104 99
                         delTrigger(trigger);
105 100
                     }
106 101
                 });
107
-                
102
+
108 103
                 button.setEnabled(isEnabled());
109
-                
104
+
110 105
                 add(new JLabel(trigger.getName()), "growx, pushx");
111 106
                 add(button, "right");
112 107
             }
113 108
 
114
-            if (triggers.size() == 0) {
109
+            if (triggers.isEmpty()) {
115 110
                 add(new TextLabel("No triggers."));
116 111
             }
117 112
             setVisible(true);
@@ -120,7 +115,7 @@ public class ActionTriggersListPanel extends JPanel {
120 115
 
121 116
     /**
122 117
      * Adds a trigger to the list.
123
-     * 
118
+     *
124 119
      * @param trigger Trigger to add
125 120
      */
126 121
     public void addTrigger(final ActionType trigger) {
@@ -142,7 +137,7 @@ public class ActionTriggersListPanel extends JPanel {
142 137
 
143 138
     /**
144 139
      * Deletes a trigger from the list.
145
-     * 
140
+     *
146 141
      * @param trigger Trigger to delete
147 142
      */
148 143
     public void delTrigger(final ActionType trigger) {
@@ -174,7 +169,7 @@ public class ActionTriggersListPanel extends JPanel {
174 169
 
175 170
     /**
176 171
      * Returns the current list of triggers.
177
-     * 
172
+     *
178 173
      * @return Trigger list
179 174
      */
180 175
     public List<ActionType> getTriggers() {
@@ -185,9 +180,9 @@ public class ActionTriggersListPanel extends JPanel {
185 180
 
186 181
     /**
187 182
      * Gets the trigger at the specified index.
188
-     * 
183
+     *
189 184
      * @param index Index to retrieve
190
-     * 
185
+     *
191 186
      * @return Requested action trigger
192 187
      */
193 188
     public ActionType getTrigger(final int index) {
@@ -196,7 +191,7 @@ public class ActionTriggersListPanel extends JPanel {
196 191
 
197 192
     /**
198 193
      * Returns the number of triggers.
199
-     * 
194
+     *
200 195
      * @return Trigger count
201 196
      */
202 197
     public int getTriggerCount() {
@@ -210,7 +205,8 @@ public class ActionTriggersListPanel extends JPanel {
210 205
      *
211 206
      * @param listener Listener to add
212 207
      */
213
-    public void addTriggerListener(final ActionTriggerRemovalListener listener) {
208
+    public void addTriggerListener(
209
+            final ActionTriggerRemovalListener listener) {
214 210
         if (listener == null) {
215 211
             return;
216 212
         }
@@ -223,7 +219,8 @@ public class ActionTriggersListPanel extends JPanel {
223 219
      *
224 220
      * @param listener Listener to remove
225 221
      */
226
-    public void removeTriggerListener(final ActionTriggerRemovalListener listener) {
222
+    public void removeTriggerListener(
223
+            final ActionTriggerRemovalListener listener) {
227 224
         listeners.remove(ActionTriggerRemovalListener.class, listener);
228 225
     }
229 226
 
@@ -233,7 +230,8 @@ public class ActionTriggersListPanel extends JPanel {
233 230
      * @param type Removed trigger
234 231
      */
235 232
     protected void fireTriggerRemoved(final ActionType type) {
236
-        for (ActionTriggerRemovalListener listener : listeners.get(ActionTriggerRemovalListener.class)) {
233
+        for (ActionTriggerRemovalListener listener : listeners.get(
234
+                ActionTriggerRemovalListener.class)) {
237 235
             listener.triggerRemoved(type);
238 236
         }
239 237
     }
@@ -251,7 +249,7 @@ public class ActionTriggersListPanel extends JPanel {
251 249
             }
252 250
         });
253 251
     }
254
-    
252
+
255 253
     /** Validates the triggers. */
256 254
     public void validateTriggers() {
257 255
         firePropertyChange("triggerCount", triggers.size(), triggers.size());

+ 23
- 22
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersPanel.java Datei anzeigen

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -91,15 +91,15 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
91 91
         trigger.addPopupMenuListener(new PopupMenuListener() {
92 92
 
93 93
             @Override
94
-            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
95
-                JComboBox box = (JComboBox) e.getSource();
96
-                Object comp = box.getUI().getAccessibleChild(box, 0);
94
+            public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
95
+                final JComboBox box = (JComboBox) e.getSource();
96
+                final Object comp = box.getUI().getAccessibleChild(box, 0);
97 97
                 if (!(comp instanceof JPopupMenu)) {
98 98
                     return;
99 99
                 }
100
-                JComponent scrollPane = (JComponent) ((JPopupMenu) comp).
100
+                final JComponent scrollPane = (JComponent) ((JPopupMenu) comp).
101 101
                         getComponent(0);
102
-                Dimension size = scrollPane.getPreferredSize();
102
+                final Dimension size = scrollPane.getPreferredSize();
103 103
                 if (scrollPane instanceof JScrollPane) {
104 104
                     size.width = Math.max(size.width, ((ActionTypeModel)
105 105
                             trigger.getModel()).getMaxWidth() + (int)
@@ -107,18 +107,20 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
107 107
                             getPreferredSize().getWidth());
108 108
                 } else {
109 109
                     size.width = Math.max(size.width, ((ActionTypeModel)
110
-                            trigger.getModel()). getMaxWidth());
110
+                            trigger.getModel()).getMaxWidth());
111 111
                 }
112 112
                 scrollPane.setPreferredSize(size);
113 113
                 scrollPane.setMaximumSize(size);
114 114
             }
115 115
 
116 116
             @Override
117
-            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
117
+            public void popupMenuWillBecomeInvisible(final PopupMenuEvent e) {
118
+                //Not required
118 119
             }
119 120
 
120 121
             @Override
121
-            public void popupMenuCanceled(PopupMenuEvent e) {
122
+            public void popupMenuCanceled(final PopupMenuEvent e) {
123
+                //Not required
122 124
             }
123 125
         });
124 126
 
@@ -142,9 +144,8 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
142 144
     private void layoutComponents() {
143 145
         setLayout(new MigLayout("fill, pack"));
144 146
 
145
-        add(new TextLabel(
146
-                "This action will be triggered when any of these events occurs: "),
147
-                "growx, pushx, wrap, spanx");
147
+        add(new TextLabel("This action will be triggered when any of these "
148
+                + "events occurs: "), "growx, pushx, wrap, spanx");
148 149
         add(triggerList, "grow, push, wrap, spanx");
149 150
         add(trigger, "growx, pushx");
150 151
         add(add, "right");
@@ -152,7 +153,7 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
152 153
 
153 154
     /**
154 155
      * Returns the primary trigger for this panel.
155
-     * 
156
+     *
156 157
      * @return Primary trigger or null
157 158
      */
158 159
     public ActionType getPrimaryTrigger() {
@@ -164,7 +165,7 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
164 165
 
165 166
     /**
166 167
      * Returns the list of triggers.
167
-     * 
168
+     *
168 169
      * @return Trigger list
169 170
      */
170 171
     public ActionType[] getTriggers() {
@@ -174,10 +175,10 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
174 175
 
175 176
     /**
176 177
      * Sets the triggers.
177
-     * 
178
+     *
178 179
      * @param triggers Sets the triggers.
179 180
      */
180
-    void setTriggers(final ActionType[] triggers) {
181
+    public void setTriggers(final ActionType[] triggers) {
181 182
         triggerList.clearTriggers();
182 183
 
183 184
         for (ActionType localTrigger : triggers) {
@@ -187,9 +188,9 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
187 188
         repopulateTriggers();
188 189
     }
189 190
 
190
-    /** 
191
+    /**
191 192
      * {@inheritDoc}
192
-     * 
193
+     *
193 194
      * @param e Action event
194 195
      */
195 196
     @Override
@@ -220,8 +221,8 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
220 221
                 ((ActionTypeModel) trigger.getModel()).removeAllElements();
221 222
 
222 223
                 if (triggerList.getTriggerCount() == 0) {
223
-                    ((ActionTypeModel) trigger.getModel()).setTypeGroup(ActionManager.
224
-                            getTypeGroups());
224
+                    ((ActionTypeModel) trigger.getModel()).setTypeGroup(
225
+                            ActionManager.getTypeGroups());
225 226
                     trigger.setEnabled((trigger.getModel().getSize() > 0));
226 227
                     return;
227 228
                 }

+ 21
- 18
src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionsGroupPanel.java Datei anzeigen

@@ -65,7 +65,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
65 65
      */
66 66
     private static final long serialVersionUID = 1;
67 67
     /** Parent dialog. */
68
-    private Window parent;
68
+    private final Window parent;
69 69
     /** Table scrollpane. */
70 70
     private JScrollPane scrollPane;
71 71
     /** Actions table. */
@@ -81,9 +81,9 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
81 81
     /** Action group. */
82 82
     private ActionGroup group;
83 83
 
84
-    /** 
84
+    /**
85 85
      * Creates a new instance of ActionsManagerDialog.
86
-     * 
86
+     *
87 87
      * @param parent Parent window
88 88
      * @param group Action group to display
89 89
      */
@@ -100,7 +100,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
100 100
 
101 101
     /**
102 102
      * Updates or creates the new action.
103
-     * 
103
+     *
104 104
      * @param action Action changed or created
105 105
      */
106 106
     public void actionChanged(final Action action) {
@@ -116,7 +116,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
116 116
 
117 117
     /**
118 118
      * Deletes an action from the group.
119
-     * 
119
+     *
120 120
      * @param name Name of the action
121 121
      */
122 122
     public void actionDeleted(final String name) {
@@ -131,14 +131,15 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
131 131
      */
132 132
     private void initComponents() {
133 133
         scrollPane = new JScrollPane();
134
-        model = new ActionTableModel(group == null ? new ArrayList<Action>() : group.
135
-                getActions());
134
+        model = new ActionTableModel(group == null ? new ArrayList<Action>()
135
+                : group.getActions());
136 136
         table = new PackingTable(model, false, scrollPane, false) {
137 137
 
138 138
             /**
139
-             * A version number for this class. It should be changed whenever the class
140
-             * structure is changed (or anything else that would prevent serialized
141
-             * objects being unserialized with the new class).
139
+             * A version number for this class. It should be changed whenever
140
+             * the class structure is changed (or anything else that would
141
+             * prevent serialized objects being unserialized with the new
142
+             * class).
142 143
              */
143 144
             private static final long serialVersionUID = 1;
144 145
             /** Action type renderer. */
@@ -150,7 +151,8 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
150 151
 
151 152
             /** {@inheritDoc} */
152 153
             @Override
153
-            public TableCellRenderer getCellRenderer(int row, int column) {
154
+            public TableCellRenderer getCellRenderer(final int row,
155
+                    final int column) {
154 156
                 switch (column) {
155 157
                     case 1:
156 158
                         return typeRenderer;
@@ -222,7 +224,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
222 224
 
223 225
     /**
224 226
      * Sets the action group for the panel.
225
-     * 
227
+     *
226 228
      * @param group New action group
227 229
      */
228 230
     public void setActionGroup(final ActionGroup group) {
@@ -232,9 +234,9 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
232 234
         add.setEnabled(group != null);
233 235
     }
234 236
 
235
-    /** 
237
+    /**
236 238
      * {@inheritDoc}
237
-     * 
239
+     *
238 240
      * @param e Action event
239 241
      */
240 242
     @Override
@@ -257,9 +259,10 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
257 259
                     getName() + "'?") {
258 260
 
259 261
                 /**
260
-                 * A version number for this class. It should be changed whenever the class
261
-                 * structure is changed (or anything else that would prevent serialized
262
-                 * objects being unserialized with the new class).
262
+                 * A version number for this class. It should be changed
263
+                 * whenever the class structure is changed (or anything else
264
+                 * that would prevent serialized objects being unserialized
265
+                 * with the new class).
263 266
                  */
264 267
                 private static final long serialVersionUID = 1;
265 268
 
@@ -273,7 +276,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
273 276
                 /** {@inheritDoc} */
274 277
                 @Override
275 278
                 public void cancelled() {
276
-                    return;
279
+                    //Ignore
277 280
                 }
278 281
             }.display();
279 282
         }

+ 4
- 5
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicTable.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -52,7 +51,7 @@ public class TopicTable extends JTable {
52 51
 
53 52
     /** {@inheritDoc} */
54 53
     @Override
55
-    public boolean isCellEditable(int row, int column) {
54
+    public boolean isCellEditable(final int row, final int column) {
56 55
         return false;
57 56
     }
58 57
 

+ 23
- 55
src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryLabel.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,14 +22,9 @@
23 22
 
24 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
25 24
 
26
-import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
27 25
 import com.dmdirc.config.prefs.PreferencesCategory;
28
-import com.dmdirc.logger.ErrorLevel;
29
-import com.dmdirc.logger.Logger;
30
-import com.dmdirc.ui.IconManager;
31 26
 
32 27
 import java.awt.Dimension;
33
-import java.util.concurrent.ExecutionException;
34 28
 
35 29
 import javax.swing.BorderFactory;
36 30
 import javax.swing.Icon;
@@ -54,17 +48,22 @@ public class CategoryLabel extends JLabel {
54 48
     /** Panel gap. */
55 49
     private final int padding = (int)
56 50
             (1.5 * PlatformDefaults.getUnitValueX("related").getValue());
57
-    private JList parentList;
51
+    /** Parent list. */
52
+    private final JList parentList;
58 53
 
59 54
     /**
60
-     * 
61
-     * @param parentList
62
-     * @param category
63
-     * @param numCats
64
-     * @param index 
55
+     * Creates a new category label.
56
+     *
57
+     * @param parentList Parent list
58
+     * @param category Parent category
59
+     * @param numCats Number of categories shown
60
+     * @param index Index of this label
65 61
      */
66 62
     public CategoryLabel(final JList parentList,
67
-            final PreferencesCategory category, final int numCats, final int index) {
63
+            final PreferencesCategory category, final int numCats,
64
+            final int index) {
65
+        super();
66
+        
68 67
         this.parentList = parentList;
69 68
 
70 69
         setText(category.getTitle());
@@ -77,11 +76,10 @@ public class CategoryLabel extends JLabel {
77 76
             level++;
78 77
         }
79 78
 
80
-        setPreferredSize(new Dimension(100000, Math.max(16,
81
-                getFont().getSize()) + padding));
82
-        setBorder(BorderFactory.createEmptyBorder(padding / 2, padding + level *
83
-                18, padding / 2,
84
-                padding));
79
+        setPreferredSize(new Dimension(100000, Math.max(16, getFont().getSize())
80
+                + padding));
81
+        setBorder(BorderFactory.createEmptyBorder(padding / 2, padding + level
82
+                * 18, padding / 2, padding));
85 83
         setBackground(parentList.getBackground());
86 84
         setForeground(parentList.getForeground());
87 85
         setOpaque(true);
@@ -101,9 +99,9 @@ public class CategoryLabel extends JLabel {
101 99
             setBackground(UIManager.getColor("ToolTip.background"));
102 100
             setForeground(UIManager.getColor("ToolTip.foreground"));
103 101
             setBorder(BorderFactory.createCompoundBorder(
104
-                    BorderFactory.createMatteBorder(1, 0, hasChildren ? 1 : 0, 0,
105
-                    UIManager.getColor("ToolTip.background").darker().darker()),
106
-                    getBorder()));
102
+                    BorderFactory.createMatteBorder(1, 0, hasChildren ? 1 : 0,
103
+                    0, UIManager.getColor("ToolTip.background").darker()
104
+                    .darker()), getBorder()));
107 105
         }
108 106
     }
109 107
 
@@ -113,7 +111,7 @@ public class CategoryLabel extends JLabel {
113 111
      * @param icon New icon
114 112
      */
115 113
     @Override
116
-    public void setIcon(Icon icon) {
114
+    public void setIcon(final Icon icon) {
117 115
         super.setIcon(icon);
118 116
 
119 117
         if (parentList != null) {
@@ -121,34 +119,4 @@ public class CategoryLabel extends JLabel {
121 119
         }
122 120
     }
123 121
 
124
-    private static class IconLoader extends LoggingSwingWorker<Icon, Void> {
125
-
126
-        private CategoryLabel label;
127
-        private String icon;
128
-
129
-        public IconLoader(final CategoryLabel label, final String icon) {
130
-            this.label = label;
131
-            this.icon = icon;
132
-        }
133
-
134
-        /** {@inheritDoc} */
135
-        @Override
136
-        protected Icon doInBackground() throws Exception {
137
-            return IconManager.getIconManager().getIcon(icon);
138
-        }
139
-
140
-        /** {@inheritDoc} */
141
-        @Override
142
-        protected void done() {
143
-            try {
144
-                label.setIcon(get());
145
-            } catch (InterruptedException ex) {
146
-                //Ignore
147
-            } catch (ExecutionException ex) {
148
-                Logger.appError(ErrorLevel.LOW, ex.getMessage(), ex);
149
-            }
150
-
151
-        }
152
-    }
153
-
154 122
 }

+ 74
- 0
src/com/dmdirc/addons/ui_swing/dialogs/prefs/IconLoader.java Datei anzeigen

@@ -0,0 +1,74 @@
1
+/*
2
+ * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
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
+package com.dmdirc.addons.ui_swing.dialogs.prefs;
23
+
24
+import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
25
+import com.dmdirc.logger.ErrorLevel;
26
+import com.dmdirc.logger.Logger;
27
+import com.dmdirc.ui.IconManager;
28
+import java.util.concurrent.ExecutionException;
29
+import javax.swing.Icon;
30
+
31
+/**
32
+ * Loads an icon in the background and uses it for a category label once it
33
+ * has been loaded.
34
+ */
35
+public class IconLoader extends LoggingSwingWorker<Icon, Void> {
36
+
37
+    /** Category this icon will be used for. */
38
+    private final CategoryLabel label;
39
+    /** Icon to load. */
40
+    private final String icon;
41
+
42
+    /**
43
+     * Creates a new icon loader adding the specified icon to the specified
44
+     * icon after it has been loaded in the background.
45
+     *
46
+     * @param label Label to load category for
47
+     * @param icon Icon to load
48
+     */
49
+    public IconLoader(final CategoryLabel label, final String icon) {
50
+        super();
51
+
52
+        this.label = label;
53
+        this.icon = icon;
54
+    }
55
+
56
+    /** {@inheritDoc} */
57
+    @Override
58
+    protected Icon doInBackground() {
59
+        return IconManager.getIconManager().getIcon(icon);
60
+    }
61
+
62
+    /** {@inheritDoc} */
63
+    @Override
64
+    protected void done() {
65
+        try {
66
+            label.setIcon(get());
67
+        } catch (InterruptedException ex) {
68
+            //Ignore
69
+        } catch (ExecutionException ex) {
70
+            Logger.appError(ErrorLevel.LOW, ex.getMessage(), ex);
71
+        }
72
+
73
+    }
74
+}

+ 4
- 30
src/com/dmdirc/addons/ui_swing/dialogs/prefs/NoRemovePanel.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -40,40 +39,15 @@ public class NoRemovePanel extends JPanel {
40 39
      */
41 40
     private static final long serialVersionUID = 1;
42 41
 
43
-    /**
44
-     * Creates a new JPanel that prevents components being removed.
45
-     */
46
-    public NoRemovePanel() {
47
-    }
48
-
49
-    /**
50
-     * Creates a new JPanel that prevents components being removed.
51
-     *
52
-     * @param isDoubleBuffered Use double buffering?
53
-     */
54
-    public NoRemovePanel(boolean isDoubleBuffered) {
55
-        super(isDoubleBuffered);
56
-    }
57
-
58 42
     /**
59 43
      * Creates a new JPanel that prevents components being removed.
60 44
      *
61 45
      * @param layout Layout manager
62 46
      */
63
-    public NoRemovePanel(LayoutManager layout) {
47
+    public NoRemovePanel(final LayoutManager layout) {
64 48
         super(layout);
65 49
     }
66 50
 
67
-    /**
68
-     * Creates a new JPanel that prevents components being removed.
69
-     *
70
-     * @param layout Layout manager
71
-     * @param isDoubleBuffered Use double buffering?
72
-     */
73
-    public NoRemovePanel(LayoutManager layout, boolean isDoubleBuffered) {
74
-        super(layout, isDoubleBuffered);
75
-    }
76
-
77 51
     /** {@inheritDoc} */
78 52
     @Override
79 53
     public void remove(final Component comp) {

+ 33
- 25
src/com/dmdirc/addons/ui_swing/dialogs/prefs/URLHandlerTableModel.java Datei anzeigen

@@ -57,12 +57,14 @@ public class URLHandlerTableModel extends AbstractTableModel {
57 57
 
58 58
     /**
59 59
      * Instantiates a new table model.
60
-     * 
60
+     *
61 61
      * @param uris URIs to show
62 62
      * @param handlers Handlers to show
63 63
      */
64 64
     public URLHandlerTableModel(final List<URI> uris,
65 65
             final List<String> handlers) {
66
+        super();
67
+
66 68
         this.uris = uris;
67 69
         this.handlers = handlers;
68 70
     }
@@ -88,8 +90,8 @@ public class URLHandlerTableModel extends AbstractTableModel {
88 90
             case 1:
89 91
                 return "Handler";
90 92
             default:
91
-                throw new IllegalArgumentException("Unknown column: " +
92
-                        columnIndex);
93
+                throw new IllegalArgumentException("Unknown column: "
94
+                        + columnIndex);
93 95
         }
94 96
     }
95 97
 
@@ -109,13 +111,14 @@ public class URLHandlerTableModel extends AbstractTableModel {
109 111
 
110 112
     /** {@inheritDoc} */
111 113
     @Override
112
-    public Object getValueAt(int rowIndex, int columnIndex) {
114
+    public Object getValueAt(final int rowIndex, final int columnIndex) {
113 115
         if (uris.size() <= rowIndex) {
114
-            throw new IndexOutOfBoundsException(rowIndex + " >= " +
115
-                    uris.size());
116
+            throw new IndexOutOfBoundsException(rowIndex + " >= "
117
+                    + uris.size());
116 118
         }
117 119
         if (rowIndex < 0) {
118
-            throw new IllegalArgumentException("Must specify a positive integer");
120
+            throw new IllegalArgumentException(
121
+                    "Must specify a positive integer");
119 122
         }
120 123
         switch (columnIndex) {
121 124
             case 0:
@@ -123,20 +126,22 @@ public class URLHandlerTableModel extends AbstractTableModel {
123 126
             case 1:
124 127
                 return handlers.get(rowIndex);
125 128
             default:
126
-                throw new IllegalArgumentException("Unknown column: " +
127
-                        columnIndex);
129
+                throw new IllegalArgumentException("Unknown column: "
130
+                        + columnIndex);
128 131
         }
129 132
     }
130 133
 
131 134
     /** {@inheritDoc} */
132 135
     @Override
133
-    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
136
+    public void setValueAt(final Object aValue, final int rowIndex,
137
+            final int columnIndex) {
134 138
         if (uris.size() <= rowIndex) {
135
-            throw new IndexOutOfBoundsException(rowIndex + " >= " +
136
-                    uris.size());
139
+            throw new IndexOutOfBoundsException(rowIndex + " >= "
140
+                    + uris.size());
137 141
         }
138 142
         if (rowIndex < 0) {
139
-            throw new IllegalArgumentException("Must specify a positive integer");
143
+            throw new IllegalArgumentException(
144
+                    "Must specify a positive integer");
140 145
         }
141 146
         switch (columnIndex) {
142 147
             case 0:
@@ -147,26 +152,29 @@ public class URLHandlerTableModel extends AbstractTableModel {
147 152
                 break;
148 153
             case 1:
149 154
                 if (!(aValue instanceof String)) {
150
-                    throw new IllegalArgumentException("Value must be a String");
155
+                    throw new IllegalArgumentException(
156
+                            "Value must be a String");
151 157
                 }
152 158
                 handlers.set(rowIndex, (String) aValue);
153 159
                 break;
154 160
             default:
155
-                throw new IllegalArgumentException("Unknown column: " +
156
-                        columnIndex);
161
+                throw new IllegalArgumentException("Unknown column: "
162
+                        + columnIndex);
157 163
         }
158 164
         fireTableCellUpdated(rowIndex, columnIndex);
159 165
     }
160 166
 
161 167
     /**
162 168
      * Adds a URI to the model.
163
-     * 
169
+     *
164 170
      * @param uri URI to add
165 171
      */
166 172
     public void addURI(final URI uri) {
167 173
         final String handler;
168
-        if (IdentityManager.getGlobalConfig().hasOptionString("protocol", uri.getScheme())) {
169
-            handler = IdentityManager.getGlobalConfig().getOption("protocol", uri.getScheme());
174
+        if (IdentityManager.getGlobalConfig().hasOptionString("protocol",
175
+                uri.getScheme())) {
176
+            handler = IdentityManager.getGlobalConfig().getOption("protocol",
177
+                    uri.getScheme());
170 178
         } else {
171 179
             handler = "";
172 180
         }
@@ -177,7 +185,7 @@ public class URLHandlerTableModel extends AbstractTableModel {
177 185
 
178 186
     /**
179 187
      * Removes a URI to the model.
180
-     * 
188
+     *
181 189
      * @param uri URI to remove
182 190
      */
183 191
     public void removeURI(final URI uri) {
@@ -186,7 +194,7 @@ public class URLHandlerTableModel extends AbstractTableModel {
186 194
 
187 195
     /**
188 196
      * Removes a URI to the model.
189
-     * 
197
+     *
190 198
      * @param index Index of the URI to remove
191 199
      */
192 200
     public void removeURI(final int index) {
@@ -196,19 +204,19 @@ public class URLHandlerTableModel extends AbstractTableModel {
196 204
             fireTableRowsDeleted(index, index);
197 205
         }
198 206
     }
199
-    
207
+
200 208
     /**
201 209
      * Returns a map of the URL handlers in this model.
202
-     * 
210
+     *
203 211
      * @return URL Handler map
204 212
      */
205 213
     public Map<URI, String> getURLHandlers() {
206 214
         final Map<URI, String> urlHandlers = new HashMap<URI, String>();
207
-        
215
+
208 216
         for (int i = 0; i < uris.size(); i++) {
209 217
             urlHandlers.put(uris.get(i), handlers.get(i));
210 218
         }
211
-        
219
+
212 220
         return urlHandlers;
213 221
     }
214 222
 }

+ 24
- 20
src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateTableModel.java Datei anzeigen

@@ -33,7 +33,7 @@ import java.util.Map;
33 33
 import javax.swing.table.AbstractTableModel;
34 34
 
35 35
 /**
36
- * Update component table model
36
+ * Update component table model.
37 37
  */
38 38
 public class UpdateTableModel extends AbstractTableModel {
39 39
 
@@ -57,10 +57,12 @@ public class UpdateTableModel extends AbstractTableModel {
57 57
 
58 58
     /**
59 59
      * Instantiates a new table model.
60
-     * 
60
+     *
61 61
      * @param updates Update components to show
62 62
      */
63 63
     public UpdateTableModel(final List<UpdateComponent> updates) {
64
+        super();
65
+
64 66
         this.updates = new ArrayList<UpdateComponent>(updates);
65 67
         this.enabled = new HashMap<UpdateComponent, Boolean>();
66 68
 
@@ -94,8 +96,8 @@ public class UpdateTableModel extends AbstractTableModel {
94 96
             case 2:
95 97
                 return "Version";
96 98
             default:
97
-                throw new IllegalArgumentException("Unknown column: " +
98
-                        columnIndex);
99
+                throw new IllegalArgumentException("Unknown column: "
100
+                        + columnIndex);
99 101
         }
100 102
     }
101 103
 
@@ -110,8 +112,8 @@ public class UpdateTableModel extends AbstractTableModel {
110 112
             case 2:
111 113
                 return Integer.class;
112 114
             default:
113
-                throw new IllegalArgumentException("Unknown column: " +
114
-                        columnIndex);
115
+                throw new IllegalArgumentException("Unknown column: "
116
+                        + columnIndex);
115 117
         }
116 118
     }
117 119
 
@@ -123,14 +125,15 @@ public class UpdateTableModel extends AbstractTableModel {
123 125
 
124 126
     /** {@inheritDoc} */
125 127
     @Override
126
-    public Object getValueAt(int rowIndex, int columnIndex) {
128
+    public Object getValueAt(final int rowIndex, final int columnIndex) {
127 129
         synchronized (updates) {
128 130
             if (updates.size() <= rowIndex) {
129
-                throw new IndexOutOfBoundsException(rowIndex + " >= " +
130
-                        updates.size());
131
+                throw new IndexOutOfBoundsException(rowIndex + " >= "
132
+                        + updates.size());
131 133
             }
132 134
             if (rowIndex < 0) {
133
-                throw new IllegalArgumentException("Must specify a positive integer");
135
+                throw new IllegalArgumentException(
136
+                        "Must specify a positive integer");
134 137
             }
135 138
             switch (columnIndex) {
136 139
                 case 0:
@@ -140,8 +143,8 @@ public class UpdateTableModel extends AbstractTableModel {
140 143
                 case 2:
141 144
                     return updates.get(rowIndex).getFriendlyVersion();
142 145
                 default:
143
-                    throw new IllegalArgumentException("Unknown column: " +
144
-                            columnIndex);
146
+                    throw new IllegalArgumentException("Unknown column: "
147
+                            + columnIndex);
145 148
             }
146 149
         }
147 150
     }
@@ -152,19 +155,20 @@ public class UpdateTableModel extends AbstractTableModel {
152 155
             final int columnIndex) {
153 156
         synchronized (updates) {
154 157
             if (updates.size() <= rowIndex) {
155
-                throw new IndexOutOfBoundsException(rowIndex + " >= " +
156
-                        updates.size());
158
+                throw new IndexOutOfBoundsException(rowIndex + " >= "
159
+                        + updates.size());
157 160
             }
158 161
             if (rowIndex < 0) {
159
-                throw new IllegalArgumentException("Must specify a positive integer");
162
+                throw new IllegalArgumentException(
163
+                        "Must specify a positive integer");
160 164
             }
161 165
             switch (columnIndex) {
162 166
                 case 1:
163 167
                     enabled.put(updates.get(rowIndex), (Boolean) aValue);
164 168
                     break;
165 169
                 default:
166
-                    throw new IllegalArgumentException("Unknown column: " +
167
-                            columnIndex);
170
+                    throw new IllegalArgumentException("Unknown column: "
171
+                            + columnIndex);
168 172
             }
169 173
             fireTableCellUpdated(rowIndex, columnIndex);
170 174
         }
@@ -172,7 +176,7 @@ public class UpdateTableModel extends AbstractTableModel {
172 176
 
173 177
     /**
174 178
      * Adds a update component to the model.
175
-     * 
179
+     *
176 180
      * @param component update component to add
177 181
      */
178 182
     public void add(final UpdateComponent component) {
@@ -184,7 +188,7 @@ public class UpdateTableModel extends AbstractTableModel {
184 188
 
185 189
     /**
186 190
      * Removes a update component to the model.
187
-     * 
191
+     *
188 192
      * @param component update component to remove
189 193
      */
190 194
     public void remove(final UpdateComponent component) {
@@ -195,7 +199,7 @@ public class UpdateTableModel extends AbstractTableModel {
195 199
 
196 200
     /**
197 201
      * Removes a update component to the model.
198
-     * 
202
+     *
199 203
      * @param index Index of the update component to remove
200 204
      */
201 205
     public void remove(final int index) {

+ 19
- 4
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/IgnoreListModel.java Datei anzeigen

@@ -36,12 +36,19 @@ public class IgnoreListModel extends AbstractListModel {
36 36
      * objects being unserialized with the new class).
37 37
      */
38 38
     private static final long serialVersionUID = 1;
39
-
39
+    /** Ignore list backing this model. */
40 40
     private final IgnoreList ignoreList;
41
-
41
+    /** Are we in simple mode. */
42 42
     private boolean isSimple;
43 43
 
44
+    /**
45
+     * Creates a new ignore list based on the specified ignore list.
46
+     *
47
+     * @param ignoreList Ignorelist backing this model
48
+     */
44 49
     public IgnoreListModel(final IgnoreList ignoreList) {
50
+        super();
51
+
45 52
         this.ignoreList = ignoreList;
46 53
         isSimple = ignoreList.canConvert();
47 54
     }
@@ -62,12 +69,20 @@ public class IgnoreListModel extends AbstractListModel {
62 69
         }
63 70
     }
64 71
 
65
-    public void setIsSimple(boolean isSimple) {
72
+    /**
73
+     * Sets the is simple flag.
74
+     *
75
+     * @param isSimple Are we in simple mode or not?
76
+     */
77
+    public void setIsSimple(final boolean isSimple) {
66 78
         this.isSimple = isSimple;
67 79
 
68 80
         fireContentsChanged(this, 0, getSize());
69 81
     }
70
-    
82
+
83
+    /**
84
+     * Notifies this model that it has been updated and needs to fire listeners.
85
+     */
71 86
     public void notifyUpdated() {
72 87
         fireContentsChanged(this, 0, getSize());
73 88
     }

+ 56
- 46
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java Datei anzeigen

@@ -71,12 +71,11 @@ import net.miginfocom.swing.MigLayout;
71 71
 /**
72 72
  * The button bar manager is a grid of buttons that presents a manager similar
73 73
  * to that used by mIRC.
74
- *
75
- * @author chris
76 74
  */
77 75
 public final class ButtonBar implements FrameManager, ActionListener,
78 76
         ComponentListener, Serializable, NotificationListener,
79
-        SelectionListener, FrameInfoListener, MouseListener, ConfigChangeListener {
77
+        SelectionListener, FrameInfoListener, MouseListener,
78
+        ConfigChangeListener {
80 79
 
81 80
     /**
82 81
      * A version number for this class. It should be changed whenever the class
@@ -84,32 +83,32 @@ public final class ButtonBar implements FrameManager, ActionListener,
84 83
      * objects being unserialized with the new class).
85 84
      */
86 85
     private static final long serialVersionUID = 3;
86
+    /** The default number of buttons per row or column. */
87
+    private static final int cells = 1;
88
+    /** The default number of buttons to render per {cell,row}. */
89
+    private static final int maxButtons = Integer.MAX_VALUE;
90
+    /** The default height of buttons. */
91
+    private static final int buttonHeight = 25;
87 92
     /** A map of windows to the buttons we're using for them. */
88 93
     private final Map<Window, FrameToggleButton> buttons;
89
-    /** The position of this frame manager. */
90
-    private final FramemanagerPosition position;
91
-    /** The parent for the manager. */
92
-    private JComponent parent;
93
-    /** The scrolling panel for our ButtonBar */
94
+    /** The scrolling panel for our ButtonBar. */
94 95
      private final JScrollPane scrollPane;
95 96
     /** The panel used for our buttons. */
96 97
     private final ButtonPanel buttonPanel;
98
+    /** The position of this frame manager. */
99
+    private FramemanagerPosition position;
100
+    /** The default width of buttons. */
101
+    private int buttonWidth = 0;
102
+    /** The parent for the manager. */
103
+    private JComponent parent;
97 104
     /** The currently selected frame. */
98 105
     private transient FrameContainer<?> selected;
99 106
     /** Selected window. */
100 107
     private Window activeWindow;
101
-    /** The default number of buttons per row or column. */
102
-    private int cells = 1;
103
-    /** The default number of buttons to render per {cell,row}. */
104
-    private int maxButtons = Integer.MAX_VALUE;
105
-    /** The default width of buttons. */
106
-    private int buttonWidth = 0;
107
-    /** The default height of buttons. */
108
-    private int buttonHeight = 25;
109
-    /** Sort root windows prefs setting */
108
+    /** Sort root windows prefs setting. */
110 109
     private boolean sortRootWindows = IdentityManager.getGlobalConfig()
111 110
             .getOptionBool("ui", "sortrootwindows");
112
-    /** Sort child windows prefs setting */
111
+    /** Sort child windows prefs setting. */
113 112
     private boolean sortChildWindows = IdentityManager.getGlobalConfig()
114 113
             .getOptionBool("ui", "sortchildwindows");
115 114
     /** UI Window Factory. */
@@ -126,9 +125,11 @@ public final class ButtonBar implements FrameManager, ActionListener,
126 125
         scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants
127 126
                 .VERTICAL_SCROLLBAR_AS_NEEDED);
128 127
         scrollPane.setMinimumSize(new Dimension(0, buttonHeight
129
-                + ((int) PlatformDefaults.getUnitValueX("related").getValue()) * 2));
128
+                + ((int) PlatformDefaults.getUnitValueX("related")
129
+                .getValue()) * 2));
130 130
 
131
-        buttons = Collections.synchronizedMap(new HashMap<Window, FrameToggleButton>());
131
+        buttons = Collections.synchronizedMap(
132
+                new HashMap<Window, FrameToggleButton>());
132 133
         position = FramemanagerPosition.getPosition(
133 134
                 IdentityManager.getGlobalConfig().getOption("ui",
134 135
                 "framemanagerPosition"));
@@ -160,7 +161,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
160 161
     }
161 162
 
162 163
     /**
163
-     * Returns the button object of the current selected window
164
+     * Returns the button object of the current selected window.
164 165
      *
165 166
      * @return Button object for the current selected window
166 167
      */
@@ -205,7 +206,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
205 206
      * @author Simon Mott
206 207
      * @since 0.6.4
207 208
      */
208
-    private void initButtons(final Collection<FrameContainer<?>> windowCollection) {
209
+    private void initButtons(
210
+            final Collection<FrameContainer<?>> windowCollection) {
209 211
         Window window;
210 212
         Window parentWindow;
211 213
         for (FrameContainer<?> frame : windowCollection) {
@@ -227,8 +229,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
227 229
      * Retreives the button object associated with {@link FrameContainer}.
228 230
      *
229 231
      * @param frame FrameContainer to find associated button for
230
-     * @return {@link FrameToggleButton} object asociated with this FrameContainer.
231
-     * Returns null if none exist
232
+     * @return {@link FrameToggleButton} object asociated with this
233
+     * FrameContainer. Returns null if none exist
232 234
      */
233 235
     public FrameToggleButton getButton(final FrameContainer<?> frame) {
234 236
         final Window window = windowFactory.getSwingWindow(frame);
@@ -242,8 +244,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
242 244
     @Override
243 245
     public void setController(final UIController controller) {
244 246
         if (!(controller instanceof SwingController)) {
245
-            throw new IllegalArgumentException("Controller must be an instance" +
246
-                    " of SwingController");
247
+            throw new IllegalArgumentException(
248
+                    "Controller must be an instance of SwingController");
247 249
         }
248 250
         this.windowFactory = ((SwingController) controller).getWindowFactory();
249 251
         this.controller = ((SwingController) controller);
@@ -262,18 +264,21 @@ public final class ButtonBar implements FrameManager, ActionListener,
262 264
      * @author Simon Mott
263 265
      * @since 0.6.4
264 266
      */
265
-    private void displayButtons(final Collection<FrameContainer<?>> windowCollection) {
267
+    private void displayButtons(
268
+            final Collection<FrameContainer<?>> windowCollection) {
266 269
         FrameToggleButton button;
267 270
         for (FrameContainer<?> window : windowCollection) {
268 271
             button = getButton(window);
269 272
             if (button != null) {
270
-                button.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
273
+                button.setPreferredSize(
274
+                        new Dimension(buttonWidth, buttonHeight));
271 275
                 buttonPanel.add(button);
272 276
                 if (!window.getChildren().isEmpty()) {
273 277
                     final ArrayList<FrameContainer<?>> childList = new ArrayList
274 278
                             <FrameContainer<?>>(window.getChildren());
275 279
                     if (sortChildWindows) {
276
-                         Collections.sort(childList, new FrameContainerComparator());
280
+                         Collections.sort(childList,
281
+                                 new FrameContainerComparator());
277 282
                     }
278 283
                     displayButtons(childList);
279 284
                 }
@@ -305,9 +310,9 @@ public final class ButtonBar implements FrameManager, ActionListener,
305 310
      * @param source The Container to get title/icon info from
306 311
      */
307 312
     private void addButton(final Window source) {
308
-        final FrameToggleButton button = new FrameToggleButton(source.getContainer()
309
-                .toString(), IconManager.getIconManager().getIcon(
310
-                source.getContainer().getIcon()), source);
313
+        final FrameToggleButton button = new FrameToggleButton(
314
+                source.getContainer().toString(), IconManager.getIconManager()
315
+                .getIcon(source.getContainer().getIcon()), source);
311 316
         button.addActionListener(this);
312 317
         button.addMouseListener(this);
313 318
         button.setHorizontalAlignment(SwingConstants.LEFT);
@@ -353,7 +358,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
353 358
             /** {@inheritDoc} */
354 359
             @Override
355 360
             public void run() {
356
-                window.getContainer().removeNotificationListener(ButtonBar.this);
361
+                window.getContainer().removeNotificationListener(
362
+                        ButtonBar.this);
357 363
                 window.getContainer().removeFrameInfoListener(ButtonBar.this);
358 364
                 window.getContainer().removeSelectionListener(ButtonBar.this);
359 365
                 if (buttons.containsKey(window)) {
@@ -389,7 +395,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
389 395
      */
390 396
     @Override
391 397
     public void componentResized(final ComponentEvent e) {
392
-        buttonWidth = position.isHorizontal() ? 150 : (parent.getWidth() / cells);
398
+        buttonWidth = position.isHorizontal() ? 150
399
+                : (parent.getWidth() / cells);
393 400
         relayout();
394 401
     }
395 402
 
@@ -425,7 +432,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
425 432
 
426 433
     /** {@inheritDoc} */
427 434
     @Override
428
-    public void notificationSet(final FrameContainer<?> window, final Color colour) {
435
+    public void notificationSet(final FrameContainer<?> window,
436
+            final Color colour) {
429 437
         UIUtilities.invokeLater(new Runnable() {
430 438
 
431 439
             /** {@inheritDoc} */
@@ -470,7 +478,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
470 478
                 selected = window;
471 479
                 button = getButton(window);
472 480
                 if (button != null) {
473
-                    scrollPane.getViewport().scrollRectToVisible(button.getBounds());
481
+                    scrollPane.getViewport().scrollRectToVisible(
482
+                            button.getBounds());
474 483
                     button.setSelected(true);
475 484
                 }
476 485
             }
@@ -511,7 +520,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
511 520
 
512 521
     /** {@inheritDoc} */
513 522
     @Override
514
-    public void titleChanged(final FrameContainer<?> window, final String title) {
523
+    public void titleChanged(final FrameContainer<?> window,
524
+            final String title) {
515 525
         // Do nothing
516 526
     }
517 527
 
@@ -520,16 +530,16 @@ public final class ButtonBar implements FrameManager, ActionListener,
520 530
      *
521 531
      * @param e MouseEvent for this event
522 532
      */
523
-    public void processMouseEvents(MouseEvent e) {
533
+    public void processMouseEvents(final MouseEvent e) {
524 534
         if (e.isPopupTrigger()) {
525 535
             final FrameToggleButton button = (FrameToggleButton) e.getSource();
526 536
 
527
-            TextFrame frame = (TextFrame) button.getWindow();
537
+            final TextFrame frame = (TextFrame) button.getWindow();
528 538
             if (frame == null) {
529 539
                 return;
530 540
             }
531 541
             final JPopupMenu popupMenu = frame.getPopupMenu(null,
532
-                    new Object[][] { new Object[] { "" } });
542
+                    new Object[][] {new Object[]{""}});
533 543
             frame.addCustomPopupItems(popupMenu);
534 544
             popupMenu.add(new JMenuItem(new CloseFrameContainerAction(frame.
535 545
                         getContainer())));
@@ -543,7 +553,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
543 553
      * @param e MouseEvent for this event
544 554
      */
545 555
     @Override
546
-    public void mouseClicked(MouseEvent e) {
556
+    public void mouseClicked(final MouseEvent e) {
547 557
         processMouseEvents(e);
548 558
     }
549 559
 
@@ -553,7 +563,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
553 563
      * @param e MouseEvent for this event
554 564
      */
555 565
     @Override
556
-    public void mousePressed(MouseEvent e) {
566
+    public void mousePressed(final MouseEvent e) {
557 567
         processMouseEvents(e);
558 568
     }
559 569
 
@@ -563,7 +573,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
563 573
      * @param e MouseEvent for this event
564 574
      */
565 575
     @Override
566
-    public void mouseReleased(MouseEvent e) {
576
+    public void mouseReleased(final MouseEvent e) {
567 577
         processMouseEvents(e);
568 578
     }
569 579
 
@@ -573,7 +583,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
573 583
      * @param e MouseEvent for this event
574 584
      */
575 585
     @Override
576
-    public void mouseEntered(MouseEvent e) {
586
+    public void mouseEntered(final MouseEvent e) {
577 587
         //Do nothing
578 588
     }
579 589
 
@@ -583,13 +593,13 @@ public final class ButtonBar implements FrameManager, ActionListener,
583 593
      * @param e MouseEvent for this event
584 594
      */
585 595
     @Override
586
-    public void mouseExited(MouseEvent e) {
596
+    public void mouseExited(final MouseEvent e) {
587 597
         //Do nothing
588 598
     }
589 599
 
590 600
     /** {@inheritDoc} */
591 601
     @Override
592
-    public void configChanged(String domain, String key) {
602
+    public void configChanged(final String domain, final String key) {
593 603
         if ("sortrootwindows".equals(key)) {
594 604
             sortRootWindows = IdentityManager.getGlobalConfig()
595 605
                     .getOptionBool("ui", "sortrootwindows");

+ 14
- 12
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonPanel.java Datei anzeigen

@@ -20,12 +20,12 @@
20 20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 21
  * SOFTWARE.
22 22
  */
23
+
23 24
 package com.dmdirc.addons.ui_swing.framemanager.buttonbar;
24 25
 
25 26
 import java.awt.Component;
26 27
 import java.awt.Dimension;
27 28
 import java.awt.Rectangle;
28
-
29 29
 import java.awt.event.MouseWheelEvent;
30 30
 import java.awt.event.MouseWheelListener;
31 31
 
@@ -37,10 +37,10 @@ import net.miginfocom.swing.MigLayout;
37 37
 /**
38 38
  * Implements scrollable onto a JPanel so we have more control over scrolling.
39 39
  *
40
- * @author Simon Mott
41 40
  * @since 0.6.4
42 41
  */
43
-public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListener {
42
+public class ButtonPanel extends JPanel implements Scrollable,
43
+        MouseWheelListener {
44 44
 
45 45
     /**
46 46
      * A version number for this class. It should be changed whenever the class
@@ -49,7 +49,7 @@ public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListene
49 49
      */
50 50
     private static final long serialVersionUID = 1;
51 51
     /** The ButtonBar that created this Panel. */
52
-    private ButtonBar buttonBar;
52
+    private final ButtonBar buttonBar;
53 53
 
54 54
     /**
55 55
      * Constructor for ButtonPanel.
@@ -57,7 +57,7 @@ public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListene
57 57
      * @param layout Layout settings for this ButtonPanel
58 58
      * @param buttonBar the buttonBar that created this Panel
59 59
      */
60
-    public ButtonPanel(final MigLayout layout, ButtonBar buttonBar) {
60
+    public ButtonPanel(final MigLayout layout, final ButtonBar buttonBar) {
61 61
         super(layout);
62 62
         this.buttonBar = buttonBar;
63 63
     }
@@ -70,13 +70,15 @@ public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListene
70 70
 
71 71
     /** {@inheritDoc} */
72 72
     @Override
73
-    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
73
+    public int getScrollableUnitIncrement(final Rectangle visibleRect,
74
+            final int orientation, final int direction) {
74 75
         return buttonBar.getButtonHeight();
75 76
     }
76 77
 
77 78
     /** {@inheritDoc} */
78 79
     @Override
79
-    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
80
+    public int getScrollableBlockIncrement(final Rectangle visibleRect,
81
+            final int orientation, final int direction) {
80 82
         return buttonBar.getButtonHeight();
81 83
     }
82 84
 
@@ -94,19 +96,20 @@ public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListene
94 96
 
95 97
     /** {@inheritDoc} */
96 98
     @Override
97
-    public void mouseWheelMoved(MouseWheelEvent e) {
99
+    public void mouseWheelMoved(final MouseWheelEvent e) {
98 100
         e.consume();
99 101
         final int selectedIndex = getSelectedIndex();
100 102
         int newIndex = 0;
101 103
         if (e.getWheelRotation() < 0) {
102 104
             //Up
103
-            newIndex = selectedIndex > 0 ? selectedIndex - 1 :
104
-                getComponentCount() - 1;
105
+            newIndex = selectedIndex > 0 ? selectedIndex - 1
106
+                    : getComponentCount() - 1;
105 107
         } else if (e.getWheelRotation() > 0) {
106 108
             //Down
107 109
             newIndex = (selectedIndex + 1) % getComponentCount();
108 110
         }
109
-        ((FrameToggleButton) getComponent(newIndex)).getWindow().activateFrame();
111
+        ((FrameToggleButton) getComponent(newIndex)).getWindow()
112
+                .activateFrame();
110 113
     }
111 114
 
112 115
     /**
@@ -128,5 +131,4 @@ public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListene
128 131
         }
129 132
         return selectedIndex;
130 133
     }
131
-
132 134
 }

+ 10
- 8
src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java Datei anzeigen

@@ -207,7 +207,7 @@ public class Tree extends JTree implements MouseMotionListener,
207 207
      * @param e Mouse event
208 208
      */
209 209
     @Override
210
-    public void mouseClicked(MouseEvent e) {
210
+    public void mouseClicked(final MouseEvent e) {
211 211
         processMouseEvents(e);
212 212
     }
213 213
 
@@ -217,12 +217,14 @@ public class Tree extends JTree implements MouseMotionListener,
217 217
      * @param e Mouse event
218 218
      */
219 219
     @Override
220
-    public void mousePressed(MouseEvent e) {
220
+    public void mousePressed(final MouseEvent e) {
221 221
         if (e.getButton() == MouseEvent.BUTTON1) {
222 222
             dragButton = true;
223
-            final TreePath selectedPath = getPathForLocation(e.getX(), e.getY());
223
+            final TreePath selectedPath = getPathForLocation(e.getX(),
224
+                    e.getY());
224 225
             if (selectedPath != null) {
225
-                ((TreeViewNode) selectedPath.getLastPathComponent()).getWindow().
226
+                ((TreeViewNode) selectedPath.getLastPathComponent())
227
+                        .getWindow().
226 228
                         activateFrame();
227 229
             }
228 230
         }
@@ -235,7 +237,7 @@ public class Tree extends JTree implements MouseMotionListener,
235 237
      * @param e Mouse event
236 238
      */
237 239
     @Override
238
-    public void mouseReleased(MouseEvent e) {
240
+    public void mouseReleased(final MouseEvent e) {
239 241
         dragButton = false;
240 242
         processMouseEvents(e);
241 243
     }
@@ -246,7 +248,7 @@ public class Tree extends JTree implements MouseMotionListener,
246 248
      * @param e Mouse event
247 249
      */
248 250
     @Override
249
-    public void mouseEntered(MouseEvent e) {
251
+    public void mouseEntered(final MouseEvent e) {
250 252
         //Ignore
251 253
     }
252 254
 
@@ -256,7 +258,7 @@ public class Tree extends JTree implements MouseMotionListener,
256 258
      * @param e Mouse event
257 259
      */
258 260
     @Override
259
-    public void mouseExited(MouseEvent e) {
261
+    public void mouseExited(final MouseEvent e) {
260 262
         manager.checkRollover(null);
261 263
     }
262 264
 
@@ -278,7 +280,7 @@ public class Tree extends JTree implements MouseMotionListener,
278 280
             }
279 281
 
280 282
             final JPopupMenu popupMenu = frame.getPopupMenu(null,
281
-                    new Object[][] { new Object[] { "" } });
283
+                    new Object[][] {new Object[]{""}});
282 284
             frame.addCustomPopupItems(popupMenu);
283 285
             if (popupMenu.getComponentCount() > 0) {
284 286
                 popupMenu.addSeparator();

+ 5
- 5
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNode.java Datei anzeigen

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -30,7 +30,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
30 30
  * Tree node representing a NodeLabel and a FrameContainer.
31 31
  */
32 32
 public class TreeViewNode extends DefaultMutableTreeNode {
33
-    
33
+
34 34
     /**
35 35
      * A version number for this class. It should be changed whenever the class
36 36
      * structure is changed (or anything else that would prevent serialized
@@ -50,7 +50,7 @@ public class TreeViewNode extends DefaultMutableTreeNode {
50 50
      */
51 51
     public TreeViewNode(final NodeLabel label, final FrameContainer<?> window) {
52 52
         super();
53
-        
53
+
54 54
         this.label = label;
55 55
         this.window = window;
56 56
     }

+ 7
- 8
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNodeMenuItem.java Datei anzeigen

@@ -1,17 +1,16 @@
1 1
 /*
2
- * 
3 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
3
+ *
5 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 5
  * of this software and associated documentation files (the "Software"), to deal
7 6
  * in the Software without restriction, including without limitation the rights
8 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 8
  * copies of the Software, and to permit persons to whom the Software is
10 9
  * furnished to do so, subject to the following conditions:
11
- * 
10
+ *
12 11
  * The above copyright notice and this permission notice shall be included in
13 12
  * all copies or substantial portions of the Software.
14
- * 
13
+ *
15 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -49,13 +48,13 @@ public class TreeViewNodeMenuItem extends JMenuItem {
49 48
     public TreeViewNodeMenuItem(final String name, final String actionCommand,
50 49
             final TreeViewNode treeNode) {
51 50
         super(name);
52
-        
51
+
53 52
         this.treeNode = treeNode;
54 53
         setActionCommand(actionCommand);
55 54
     }
56 55
 
57 56
     /**
58
-     * Get the value of treeNode
57
+     * Get the value of treeNode.
59 58
      *
60 59
      * @return the value of treeNode
61 60
      */
@@ -64,11 +63,11 @@ public class TreeViewNodeMenuItem extends JMenuItem {
64 63
     }
65 64
 
66 65
     /**
67
-     * Set the value of treeNode
66
+     * Set the value of treeNode.
68 67
      *
69 68
      * @param treeNode new value of treeNode
70 69
      */
71
-    public void setTreeNode(TreeViewNode treeNode) {
70
+    public void setTreeNode(final TreeViewNode treeNode) {
72 71
         this.treeNode = treeNode;
73 72
     }
74 73
 }

+ 16
- 15
src/com/dmdirc/addons/ui_swing/textpane/LineInfo.java Datei anzeigen

@@ -34,8 +34,8 @@ public final class LineInfo {
34 34
     /** Character index? */
35 35
     private int index;
36 36
 
37
-    /** 
38
-     * Creates a new instance of LineInfo. 
37
+    /**
38
+     * Creates a new instance of LineInfo.
39 39
      *
40 40
      * @param line Line number
41 41
      * @param part line wrap number
@@ -44,8 +44,8 @@ public final class LineInfo {
44 44
         this(line, part, -1);
45 45
     }
46 46
 
47
-    /** 
48
-     * Creates a new instance of LineInfo. 
47
+    /**
48
+     * Creates a new instance of LineInfo.
49 49
      *
50 50
      * @param line Line number
51 51
      * @param part line wrap number
@@ -77,43 +77,44 @@ public final class LineInfo {
77 77
 
78 78
     /**
79 79
      * Returns the index for this line.
80
-     * 
80
+     *
81 81
      * @return Index for the line of -1
82 82
      */
83 83
     public int getIndex() {
84 84
         return index;
85 85
     }
86
-    
86
+
87 87
     /**
88 88
      * Sets the index for this line.
89
-     * 
89
+     *
90 90
      * @param index New index
91 91
      */
92
-    public void setIndex(int index) {
92
+    public void setIndex(final int index) {
93 93
         this.index = index;
94 94
     }
95 95
 
96 96
     /**
97 97
      * Sets the line for this line.
98
-     * 
98
+     *
99 99
      * @param line New line
100 100
      */
101
-    public void setLine(int line) {
101
+    public void setLine(final int line) {
102 102
         this.line = line;
103 103
     }
104 104
 
105 105
     /**
106
-     * Sets the line part for this line
107
-     * 
106
+     * Sets the line part for this line.
107
+     *
108 108
      * @param part New part
109 109
      */
110
-    public void setPart(int part) {
110
+    public void setPart(final int part) {
111 111
         this.part = part;
112 112
     }
113
-    
113
+
114 114
     /* {@inheritDoc} */
115 115
     @Override
116 116
     public String toString() {
117
-        return "LineInfo[line=" + line + ", part=" + part + ", index=" + index + "]";
117
+        return "LineInfo[line=" + line + ", part=" + part + ", index="
118
+                + index + "]";
118 119
     }
119 120
 }

+ 9
- 9
src/com/dmdirc/addons/ui_swing/textpane/TextPane.java Datei anzeigen

@@ -44,7 +44,6 @@ import java.awt.event.MouseWheelEvent;
44 44
 import java.awt.event.MouseWheelListener;
45 45
 
46 46
 import javax.swing.BoundedRangeModel;
47
-import javax.swing.DefaultBoundedRangeModel;
48 47
 import javax.swing.JComponent;
49 48
 import javax.swing.JLabel;
50 49
 import javax.swing.JScrollBar;
@@ -116,19 +115,20 @@ public final class TextPane extends JComponent implements MouseWheelListener,
116 115
         document.addIRCDocumentListener(this);
117 116
         setAutoscrolls(true);
118 117
 
119
-        MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() {
118
+        final MouseMotionListener doScrollRectToVisible
119
+                = new MouseMotionAdapter() {
120 120
 
121 121
             /** {@inheritDoc} */
122 122
             @Override
123
-            public void mouseDragged(MouseEvent e) {
124
-                if (e.getXOnScreen() > getLocationOnScreen().getX() && e.
125
-                        getXOnScreen() < (getLocationOnScreen().
126
-                        getX() + getWidth()) && e.getModifiersEx() ==
127
-                        MouseEvent.BUTTON1_DOWN_MASK) {
123
+            public void mouseDragged(final MouseEvent e) {
124
+                if (e.getXOnScreen() > getLocationOnScreen().getX()
125
+                        && e.getXOnScreen() < (getLocationOnScreen().getX()
126
+                        + getWidth()) && e.getModifiersEx()
127
+                        == MouseEvent.BUTTON1_DOWN_MASK) {
128 128
                     if (getLocationOnScreen().getY() > e.getYOnScreen()) {
129 129
                         scrollModel.setValue(scrollBar.getValue() - 1);
130
-                    } else if (getLocationOnScreen().getY() + getHeight() <
131
-                            e.getYOnScreen()) {
130
+                    } else if (getLocationOnScreen().getY() + getHeight() 
131
+                            < e.getYOnScreen()) {
132 132
                         scrollModel.setValue(scrollBar.getValue() + 1);
133 133
                     }
134 134
                     canvas.highlightEvent(MouseEventType.DRAG, e);

+ 5
- 3
src/com/dmdirc/addons/ui_swing/textpane/TextPaneEndAction.java Datei anzeigen

@@ -39,7 +39,7 @@ public class TextPaneEndAction extends AbstractAction {
39 39
      */
40 40
     private static final long serialVersionUID = 1;
41 41
     /** TextPane instance. */
42
-    private TextPane textpane;
42
+    private final TextPane textpane;
43 43
 
44 44
     /**
45 45
      * Instantiates a new action.
@@ -47,6 +47,8 @@ public class TextPaneEndAction extends AbstractAction {
47 47
      * @param textpane Textpane
48 48
      */
49 49
     public TextPaneEndAction(final TextPane textpane) {
50
+        super();
51
+
50 52
         this.textpane = textpane;
51 53
     }
52 54
 
@@ -55,7 +57,7 @@ public class TextPaneEndAction extends AbstractAction {
55 57
      * @param e Action event
56 58
      */
57 59
     @Override
58
-    public void actionPerformed(ActionEvent e) {
60
+    public void actionPerformed(final ActionEvent e) {
59 61
         textpane.goToEnd();
60 62
     }
61
-}
63
+}

+ 5
- 3
src/com/dmdirc/addons/ui_swing/textpane/TextPaneHomeAction.java Datei anzeigen

@@ -39,7 +39,7 @@ public class TextPaneHomeAction extends AbstractAction {
39 39
      */
40 40
     private static final long serialVersionUID = 1;
41 41
     /** TextPane instance. */
42
-    private TextPane textpane;
42
+    private final TextPane textpane;
43 43
 
44 44
     /**
45 45
      * Instantiates a new action.
@@ -47,6 +47,8 @@ public class TextPaneHomeAction extends AbstractAction {
47 47
      * @param textpane Textpane
48 48
      */
49 49
     public TextPaneHomeAction(final TextPane textpane) {
50
+        super();
51
+
50 52
         this.textpane = textpane;
51 53
     }
52 54
 
@@ -55,7 +57,7 @@ public class TextPaneHomeAction extends AbstractAction {
55 57
      * @param e Action event
56 58
      */
57 59
     @Override
58
-    public void actionPerformed(ActionEvent e) {
60
+    public void actionPerformed(final ActionEvent e) {
59 61
         textpane.goToHome();
60 62
     }
61
-}
63
+}

+ 5
- 3
src/com/dmdirc/addons/ui_swing/textpane/TextPanePageDownAction.java Datei anzeigen

@@ -37,7 +37,7 @@ public class TextPanePageDownAction extends AbstractAction {
37 37
      */
38 38
     private static final long serialVersionUID = 1;
39 39
     /** TextPane instance. */
40
-    private TextPane textpane;
40
+    private final TextPane textpane;
41 41
 
42 42
     /**
43 43
      * Instantiates a new action.
@@ -45,6 +45,8 @@ public class TextPanePageDownAction extends AbstractAction {
45 45
      * @param textpane Textpane
46 46
      */
47 47
     public TextPanePageDownAction(final TextPane textpane) {
48
+        super();
49
+
48 50
         this.textpane = textpane;
49 51
     }
50 52
 
@@ -53,7 +55,7 @@ public class TextPanePageDownAction extends AbstractAction {
53 55
      * @param e Action event
54 56
      */
55 57
     @Override
56
-    public void actionPerformed(ActionEvent e) {
58
+    public void actionPerformed(final ActionEvent e) {
57 59
         textpane.pageDown();
58 60
     }
59
-}
61
+}

+ 5
- 3
src/com/dmdirc/addons/ui_swing/textpane/TextPanePageUpAction.java Datei anzeigen

@@ -37,7 +37,7 @@ public class TextPanePageUpAction extends AbstractAction {
37 37
      */
38 38
     private static final long serialVersionUID = 1;
39 39
     /** TextPane instance. */
40
-    private TextPane textpane;
40
+    private final TextPane textpane;
41 41
 
42 42
     /**
43 43
      * Instantiates a new action.
@@ -45,6 +45,8 @@ public class TextPanePageUpAction extends AbstractAction {
45 45
      * @param textpane Textpane
46 46
      */
47 47
     public TextPanePageUpAction(final TextPane textpane) {
48
+        super();
49
+        
48 50
         this.textpane = textpane;
49 51
     }
50 52
 
@@ -53,7 +55,7 @@ public class TextPanePageUpAction extends AbstractAction {
53 55
      * @param e Action event
54 56
      */
55 57
     @Override
56
-    public void actionPerformed(ActionEvent e) {
58
+    public void actionPerformed(final ActionEvent e) {
57 59
         textpane.pageUp();
58 60
     }
59
-}
61
+}

+ 5
- 3
src/com/dmdirc/addons/ui_web/Client.java Datei anzeigen

@@ -45,12 +45,14 @@ public class Client {
45 45
     private final List<Event> events = new LinkedList<Event>();
46 46
 
47 47
     public Client(final WebInterfaceUI controller, final String ip) {
48
-        events.add(new Event("statusbar", "Welcome to the DMDirc web interface"));
48
+        events.add(new Event("statusbar",
49
+                "Welcome to the DMDirc web interface"));
49 50
 
50 51
         this.ip = ip;
51 52
 
52 53
         final List<Window> added = new LinkedList<Window>();
53
-        final List<Window> queued = new LinkedList<Window>(WebWindow.getWindows());
54
+        final List<Window> queued = new LinkedList<Window>(
55
+                WebWindow.getWindows());
54 56
 
55 57
         while (!queued.isEmpty()) {
56 58
             final Window window = queued.remove(0);
@@ -81,7 +83,7 @@ public class Client {
81 83
         return events;
82 84
     }
83 85
 
84
-    public void setContinuation(Continuation continuation) {
86
+    public void setContinuation(final Continuation continuation) {
85 87
         this.continuation = continuation;
86 88
     }
87 89
 

+ 51
- 39
src/com/dmdirc/addons/ui_web/DynamicRequestHandler.java Datei anzeigen

@@ -55,16 +55,17 @@ import org.mortbay.util.ajax.JSONObjectConvertor;
55 55
 
56 56
 /**
57 57
  * Handles requests for dynamic resources (prefixed with /dynamic/).
58
- * 
58
+ *
59 59
  * @author chris
60 60
  */
61 61
 public class DynamicRequestHandler extends AbstractHandler {
62
-    
62
+
63 63
     /** Number of milliseconds before a client is timed out. */
64 64
     private static final long TIMEOUT = 1000 * 60 * 2; // Two minutes
65 65
 
66 66
     /** The last time each client was seen. */
67
-    private static final Map<String, Client> CLIENTS = new HashMap<String, Client>();
67
+    private static final Map<String, Client> CLIENTS
68
+            = new HashMap<String, Client>();
68 69
 
69 70
     /** The controller which owns this request handler. */
70 71
     private final WebInterfaceUI controller;
@@ -82,12 +83,12 @@ public class DynamicRequestHandler extends AbstractHandler {
82 83
         JSON.registerConvertor(WebWindow.class, new JSONObjectConvertor());
83 84
         JSON.registerConvertor(Message.class, new JSONObjectConvertor());
84 85
         JSON.registerConvertor(Client.class, new JSONObjectConvertor());
85
-        
86
+
86 87
         new Timer().schedule(new TimerTask() {
87 88
             @Override
88 89
             public void run() {
89 90
                 synchronized (CLIENTS) {
90
-                    for (Map.Entry<String, Client> entry 
91
+                    for (Map.Entry<String, Client> entry
91 92
                             : new HashMap<String, Client>(CLIENTS).entrySet()) {
92 93
                         if (entry.getValue().getTime() > TIMEOUT) {
93 94
                             CLIENTS.remove(entry.getKey());
@@ -100,7 +101,7 @@ public class DynamicRequestHandler extends AbstractHandler {
100 101
 
101 102
     /**
102 103
      * {@inheritDoc}
103
-     * 
104
+     *
104 105
      * @throws IOException If unable to write response
105 106
      */
106 107
     @Override
@@ -110,18 +111,19 @@ public class DynamicRequestHandler extends AbstractHandler {
110 111
 
111 112
         if (request.getParameter("clientID") != null) {
112 113
             final String clientID = request.getParameter("clientID");
113
-            
114
+
114 115
             if (!CLIENTS.containsKey(clientID)) {
115
-                CLIENTS.put(clientID, new Client(controller, request.getRemoteHost()));
116
+                CLIENTS.put(clientID, new Client(controller,
117
+                        request.getRemoteHost()));
116 118
             }
117 119
 
118 120
             synchronized (CLIENTS) {
119 121
                 CLIENTS.get(clientID).touch();
120 122
             }
121 123
         }
122
-        
123
-        if (((request instanceof Request) ? (Request) request
124
-                : HttpConnection.getCurrentConnection().getRequest()).isHandled()) {
124
+
125
+        if (((request instanceof Request) ? (Request) request : HttpConnection
126
+                .getCurrentConnection().getRequest()).isHandled()) {
125 127
             return;
126 128
         }
127 129
 
@@ -146,7 +148,8 @@ public class DynamicRequestHandler extends AbstractHandler {
146 148
         } else if (target.equals("/dynamic/tab")) {
147 149
             doTab(request, response);
148 150
             handled(request);
149
-        } else if (target.equals("/dynamic/keyup") || target.equals("/dynamic/keydown")) {
151
+        } else if (target.equals("/dynamic/keyup")
152
+                || target.equals("/dynamic/keydown")) {
150 153
             doKeyUpDown(target.equals("/dynamic/keyup"), request, response);
151 154
             handled(request);
152 155
         } else if (target.equals("/dynamic/key")) {
@@ -166,7 +169,7 @@ public class DynamicRequestHandler extends AbstractHandler {
166 169
 
167 170
     /**
168 171
      * Handles a request for the event feed.
169
-     * 
172
+     *
170 173
      * @param request The servlet request that is being handled
171 174
      * @param response The servlet response object to write to
172 175
      * @throws IOException If unable to write the response
@@ -182,8 +185,8 @@ public class DynamicRequestHandler extends AbstractHandler {
182 185
             List<Event> myEvents = client.retrieveEvents();
183 186
 
184 187
             if (myEvents.isEmpty()) {
185
-                Continuation continuation = ContinuationSupport.getContinuation(request,
186
-                        client.getMutex());
188
+                Continuation continuation = ContinuationSupport
189
+                        .getContinuation(request, client.getMutex());
187 190
                 client.setContinuation(continuation);
188 191
                 continuation.suspend(30000L);
189 192
 
@@ -199,7 +202,8 @@ public class DynamicRequestHandler extends AbstractHandler {
199 202
 
200 203
     private void doInput(final HttpServletRequest request,
201 204
             final HttpServletResponse response) throws IOException {
202
-        final WebWindow window = WebWindow.getWindow(request.getParameter("window"));
205
+        final WebWindow window = WebWindow.getWindow(
206
+                request.getParameter("window"));
203 207
 
204 208
         if (window instanceof WebInputWindow) {
205 209
             final WebInputWindow wiw = (WebInputWindow) window;
@@ -210,7 +214,8 @@ public class DynamicRequestHandler extends AbstractHandler {
210 214
 
211 215
     private void doKey(final HttpServletRequest request,
212 216
             final HttpServletResponse response) throws IOException {
213
-        final WebWindow window = WebWindow.getWindow(request.getParameter("window"));
217
+        final WebWindow window = WebWindow.getWindow(
218
+                request.getParameter("window"));
214 219
 
215 220
         if (window instanceof WebInputWindow) {
216 221
             final WebInputWindow wiw = (WebInputWindow) window;
@@ -231,21 +236,25 @@ public class DynamicRequestHandler extends AbstractHandler {
231 236
         }
232 237
     }
233 238
 
234
-    private void doTab(HttpServletRequest request, HttpServletResponse response)
235
-            throws IOException {
236
-        final WebWindow window = WebWindow.getWindow(request.getParameter("window"));
237
-        
239
+    private void doTab(final HttpServletRequest request,
240
+            final HttpServletResponse response) throws IOException {
241
+        final WebWindow window = WebWindow.getWindow(request.getParameter(
242
+                "window"));
243
+
238 244
         if (window instanceof WebInputWindow) {
239 245
             final WebInputWindow wiw = (WebInputWindow) window;
240
-            ((WebInputHandler) wiw.getInputHandler(request.getParameter("clientID"),
241
-                    request.getParameter("input"), request.getParameter("selstart"),
246
+            ((WebInputHandler) wiw.getInputHandler(request.getParameter(
247
+                    "clientID"),
248
+                    request.getParameter("input"), request.getParameter(
249
+                    "selstart"),
242 250
                     request.getParameter("selend"))).doTabCompletion(false);
243 251
         }
244 252
     }
245 253
 
246
-    private void doKeyUpDown(final boolean up, HttpServletRequest request,
247
-            HttpServletResponse response) throws IOException {
248
-        final WebWindow window = WebWindow.getWindow(request.getParameter("window"));
254
+    private void doKeyUpDown(final boolean up, final HttpServletRequest request,
255
+            final HttpServletResponse response) throws IOException {
256
+        final WebWindow window = WebWindow.getWindow(request.getParameter(
257
+                "window"));
249 258
 
250 259
         if (window instanceof WebInputWindow) {
251 260
             final WebInputWindow wiw = (WebInputWindow) window;
@@ -276,8 +285,8 @@ public class DynamicRequestHandler extends AbstractHandler {
276 285
         }
277 286
     }
278 287
 
279
-    private void doNicklist(HttpServletRequest request,
280
-            HttpServletResponse response) throws IOException {
288
+    private void doNicklist(final HttpServletRequest request,
289
+            final HttpServletResponse response) throws IOException {
281 290
         response.setStatus(HttpServletResponse.SC_OK);
282 291
         response.setContentType("application/json");
283 292
 
@@ -304,15 +313,16 @@ public class DynamicRequestHandler extends AbstractHandler {
304 313
 
305 314
         profileEvents.add(new Event("clearprofiles", null));
306 315
 
307
-        for (Identity identity : IdentityManager.getCustomIdentities("profile")) {
316
+        for (Identity identity : IdentityManager.getCustomIdentities(
317
+                "profile")) {
308 318
             profileEvents.add(new Event("addprofile", identity.getName()));
309 319
         }
310 320
 
311 321
         response.getWriter().write(JSON.toString(profileEvents.toArray()));
312 322
     }
313 323
 
314
-    private void doWindowRefresh(HttpServletRequest request,
315
-            HttpServletResponse response) throws IOException {
324
+    private void doWindowRefresh(final HttpServletRequest request,
325
+            final HttpServletResponse response) throws IOException {
316 326
         response.setStatus(HttpServletResponse.SC_OK);
317 327
         response.setContentType("application/json");
318 328
 
@@ -329,14 +339,14 @@ public class DynamicRequestHandler extends AbstractHandler {
329 339
 
330 340
         response.getWriter().write(JSON.toString(windowEvents.toArray()));
331 341
     }
332
-    
342
+
333 343
     private void doClients(final HttpServletRequest request,
334 344
             final HttpServletResponse response) throws IOException {
335 345
         response.setStatus(HttpServletResponse.SC_OK);
336 346
         response.setContentType("application/json");
337 347
         response.getWriter().write(JSON.toString(CLIENTS.values().toArray()));
338 348
     }
339
-    
349
+
340 350
     private void doJoinChannel(final HttpServletRequest request,
341 351
             final HttpServletResponse response) throws IOException {
342 352
         final String windowID = request.getParameter("source");
@@ -344,16 +354,18 @@ public class DynamicRequestHandler extends AbstractHandler {
344 354
         window.getContainer().getServer().join(new ChannelJoinRequest(request.
345 355
                 getParameter("channel")));
346 356
     }
347
-    
357
+
348 358
     private void doOpenQuery(final HttpServletRequest request,
349 359
             final HttpServletResponse response) throws IOException {
350 360
         final String windowID = request.getParameter("source");
351 361
         final WebWindow window = WebWindow.getWindow(windowID);
352
-        window.getContainer().getServer().getQuery(request.getParameter("target"));
362
+        window.getContainer().getServer().getQuery(request.getParameter(
363
+                "target"));
353 364
     }
354 365
 
355 366
     private Identity findProfile(final String parameter) {
356
-        for (Identity identity : IdentityManager.getCustomIdentities("profile")) {
367
+        for (Identity identity : IdentityManager.getCustomIdentities(
368
+                "profile")) {
357 369
             if (identity.getName().equals(parameter)) {
358 370
                 return identity;
359 371
             }
@@ -364,8 +376,8 @@ public class DynamicRequestHandler extends AbstractHandler {
364 376
 
365 377
     private void handled(final HttpServletRequest request) {
366 378
         ((request instanceof Request) ? (Request) request
367
-                : HttpConnection.getCurrentConnection().getRequest()).setHandled(
368
-                true);
379
+                : HttpConnection.getCurrentConnection().getRequest())
380
+                .setHandled(true);
369 381
     }
370 382
 
371 383
     public static void addEvent(final Event event) {
@@ -376,7 +388,7 @@ public class DynamicRequestHandler extends AbstractHandler {
376 388
         }
377 389
     }
378 390
 
379
-    public static void addEvent(String clientID, Event event) {
391
+    public static void addEvent(final String clientID, final Event event) {
380 392
         CLIENTS.get(clientID).addEvent(event);
381 393
     }
382 394
 

+ 5
- 5
src/com/dmdirc/addons/ui_web/Event.java Datei anzeigen

@@ -24,17 +24,17 @@ package com.dmdirc.addons.ui_web;
24 24
 
25 25
 /**
26 26
  * Details an event that occured.
27
- * 
27
+ *
28 28
  * @author chris
29 29
  */
30 30
 public class Event {
31
-   
31
+
32 32
     /** The type of event that occurred. */
33
-    private String type;
33
+    private final String type;
34 34
     /** The argument(s) for the event. */
35
-    private Object arg1;
35
+    private final Object arg1;
36 36
 
37
-    public Event(String type, Object arg1) {
37
+    public Event(final String type, final Object arg1) {
38 38
         this.type = type;
39 39
         this.arg1 = arg1;
40 40
     }

+ 6
- 6
src/com/dmdirc/addons/ui_web/Message.java Datei anzeigen

@@ -29,19 +29,19 @@ import com.dmdirc.addons.ui_web.uicomponents.WebWindow;
29 29
  * @author chris
30 30
  */
31 31
 public class Message {
32
-    
33
-    private String message;
34
-    private WebWindow window;
35 32
 
36
-    public Message(String message, WebWindow aThis) {
33
+    private final String message;
34
+    private final WebWindow window;
35
+
36
+    public Message(final String message, final WebWindow aThis) {
37 37
         this.message = message;
38 38
         this.window = aThis;
39 39
     }
40
-    
40
+
41 41
     public String getMessage() {
42 42
         return message;
43 43
     }
44
-    
44
+
45 45
     public String getWindow() {
46 46
         return window.getId();
47 47
     }

+ 5
- 4
src/com/dmdirc/addons/ui_web/WebPrincipal.java Datei anzeigen

@@ -29,7 +29,7 @@ import java.security.Principal;
29 29
  * @author chris
30 30
  */
31 31
 public class WebPrincipal implements Principal {
32
-    
32
+
33 33
     private final String username;
34 34
 
35 35
     public WebPrincipal(final String username) {
@@ -44,7 +44,7 @@ public class WebPrincipal implements Principal {
44 44
 
45 45
     /** {@inheritDoc} */
46 46
     @Override
47
-    public boolean equals(Object obj) {
47
+    public boolean equals(final Object obj) {
48 48
         if (obj == null) {
49 49
             return false;
50 50
         }
@@ -52,8 +52,9 @@ public class WebPrincipal implements Principal {
52 52
             return false;
53 53
         }
54 54
         final WebPrincipal other = (WebPrincipal) obj;
55
-        if (this.username != other.username &&
56
-            (this.username == null || !this.username.equals(other.username))) {
55
+        if (this.username != other.username 
56
+                && (this.username == null
57
+                || !this.username.equals(other.username))) {
57 58
             return false;
58 59
         }
59 60
         return true;

+ 17
- 14
src/com/dmdirc/addons/ui_web/WebUserRealm.java Datei anzeigen

@@ -38,13 +38,14 @@ import org.mortbay.jetty.security.UserRealm;
38 38
 
39 39
 /**
40 40
  * Describes the users allowed to access the web UI.
41
- * 
41
+ *
42 42
  * @author chris
43 43
  */
44 44
 public class WebUserRealm implements UserRealm {
45
-    
46
-    private final Map<String, Principal> principals = new HashMap<String, Principal>();
47
-    
45
+
46
+    private final Map<String, Principal> principals
47
+            = new HashMap<String, Principal>();
48
+
48 49
     private final ConfigManager config = IdentityManager.getGlobalConfig();
49 50
 
50 51
     /** {@inheritDoc} */
@@ -53,8 +54,9 @@ public class WebUserRealm implements UserRealm {
53 54
         if (config.hasOptionString(WebInterfaceUI.DOMAIN, "users")) {
54 55
             return "DMDirc web UI";
55 56
         } else {
56
-            return "DMDirc web UI first run -- " 
57
-                    + "enter the username and password you wish to use in the future";
57
+            return "DMDirc web UI first run -- "
58
+                    + "enter the username and password you wish to use in "
59
+                    + "the future";
58 60
         }
59 61
     }
60 62
 
@@ -66,16 +68,17 @@ public class WebUserRealm implements UserRealm {
66 68
 
67 69
     /** {@inheritDoc} */
68 70
     @Override
69
-    public Principal authenticate(final String username, final Object credentials,
70
-            final Request request) {
71
+    public Principal authenticate(final String username,
72
+            final Object credentials, final Request request) {
71 73
         if (!config.hasOptionString(WebInterfaceUI.DOMAIN, "users")) {
72 74
             final List<String> users = new ArrayList<String>();
73 75
             users.add(username + ":" + getHash(username, credentials));
74 76
             IdentityManager.getConfigIdentity().setOption(WebInterfaceUI.DOMAIN,
75 77
                     "users", users);
76 78
         }
77
-        
78
-        for (String userinfo : config.getOptionList(WebInterfaceUI.DOMAIN, "users")) {
79
+
80
+        for (String userinfo : config.getOptionList(WebInterfaceUI.DOMAIN,
81
+                "users")) {
79 82
             if (userinfo.startsWith(username + ":")) {
80 83
                 final String pass = userinfo.substring(username.length() + 1);
81 84
 
@@ -85,7 +88,7 @@ public class WebUserRealm implements UserRealm {
85 88
                 }
86 89
             }
87 90
         }
88
-        
91
+
89 92
         return null;
90 93
     }
91 94
 
@@ -127,12 +130,12 @@ public class WebUserRealm implements UserRealm {
127 130
         principals.remove(user.getName());
128 131
     }
129 132
 
130
-    private String getHash(String username, Object credentials) {
133
+    private String getHash(final String username, final Object credentials) {
131 134
         final String target = username + "--" + (String) credentials;
132
-        
135
+
133 136
         try {
134 137
             final MessageDigest md = MessageDigest.getInstance("SHA-512");
135
-            
138
+
136 139
             return new BigInteger(md.digest(target.getBytes())).toString(16);
137 140
         } catch (NoSuchAlgorithmException ex) {
138 141
             // Don't hash

+ 12
- 8
src/com/dmdirc/addons/ui_web/uicomponents/WebChannelWindow.java Datei anzeigen

@@ -36,29 +36,31 @@ import java.util.Collection;
36 36
  * @author chris
37 37
  */
38 38
 public class WebChannelWindow extends WebInputWindow implements ChannelWindow {
39
-    
39
+
40 40
     private final Channel channel;
41 41
 
42
-    public WebChannelWindow(final WebInterfaceUI controller, Channel channel) {
42
+    public WebChannelWindow(final WebInterfaceUI controller,
43
+            final Channel channel) {
43 44
         super(controller, channel);
44 45
         this.channel = channel;
45 46
     }
46 47
 
47 48
     /** {@inheritDoc} */
48 49
     @Override
49
-    public void updateNames(Collection<ChannelClientInfo> clients) {
50
+    public void updateNames(final Collection<ChannelClientInfo> clients) {
50 51
         updateNames();
51 52
     }
52 53
 
53 54
     /** {@inheritDoc} */
54 55
     @Override
55
-    public void addName(ChannelClientInfo client) {
56
-        DynamicRequestHandler.addEvent(new Event("addnicklist", client.getClient().getNickname()));
56
+    public void addName(final ChannelClientInfo client) {
57
+        DynamicRequestHandler.addEvent(new Event("addnicklist",
58
+                client.getClient().getNickname()));
57 59
     }
58 60
 
59 61
     /** {@inheritDoc} */
60 62
     @Override
61
-    public void removeName(ChannelClientInfo client) {
63
+    public void removeName(final ChannelClientInfo client) {
62 64
         updateNames();
63 65
     }
64 66
 
@@ -66,8 +68,10 @@ public class WebChannelWindow extends WebInputWindow implements ChannelWindow {
66 68
     @Override
67 69
     public void updateNames() {
68 70
         DynamicRequestHandler.addEvent(new Event("clearnicklist", null));
69
-        for (ChannelClientInfo cci : channel.getChannelInfo().getChannelClients()) {
70
-            DynamicRequestHandler.addEvent(new Event("addnicklist", cci.getClient().getNickname()));
71
+        for (ChannelClientInfo cci : channel.getChannelInfo()
72
+                .getChannelClients()) {
73
+            DynamicRequestHandler.addEvent(new Event("addnicklist",
74
+                    cci.getClient().getNickname()));
71 75
         }
72 76
     }
73 77
 

+ 17
- 15
src/com/dmdirc/addons/ui_web/uicomponents/WebInputField.java Datei anzeigen

@@ -34,29 +34,30 @@ import java.awt.event.KeyListener;
34 34
  * @author chris
35 35
  */
36 36
 public class WebInputField implements InputField {
37
-    
37
+
38 38
     private String clientID;
39
-    
39
+
40 40
     private String text;
41
-    
41
+
42 42
     private int selStart, selEnd;
43 43
 
44 44
     public WebInputField() {
45
+        super();
45 46
     }
46 47
 
47
-    public WebInputField(String clientID) {
48
+    public WebInputField(final String clientID) {
48 49
         this.clientID = clientID;
49 50
     }
50 51
 
51 52
     /** {@inheritDoc} */
52 53
     @Override
53
-    public void addActionListener(ActionListener listener) {
54
+    public void addActionListener(final ActionListener listener) {
54 55
         // Do nothing
55 56
     }
56 57
 
57 58
     /** {@inheritDoc} */
58 59
     @Override
59
-    public void addKeyListener(KeyListener listener) {
60
+    public void addKeyListener(final KeyListener listener) {
60 61
         // Do nothing
61 62
     }
62 63
 
@@ -69,13 +70,13 @@ public class WebInputField implements InputField {
69 70
 
70 71
     /** {@inheritDoc} */
71 72
     @Override
72
-    public void removeActionListener(ActionListener listener) {
73
+    public void removeActionListener(final ActionListener listener) {
73 74
         // Do nothing
74 75
     }
75 76
 
76 77
     /** {@inheritDoc} */
77 78
     @Override
78
-    public void removeKeyListener(KeyListener listener) {
79
+    public void removeKeyListener(final KeyListener listener) {
79 80
         // Do nothing
80 81
     }
81 82
 
@@ -105,7 +106,7 @@ public class WebInputField implements InputField {
105 106
 
106 107
     /** {@inheritDoc} */
107 108
     @Override
108
-    public void setText(String text) {
109
+    public void setText(final String text) {
109 110
         DynamicRequestHandler.addEvent(clientID, new Event("settext", text));
110 111
     }
111 112
 
@@ -117,13 +118,14 @@ public class WebInputField implements InputField {
117 118
 
118 119
     /** {@inheritDoc} */
119 120
     @Override
120
-    public void setCaretPosition(int position) {
121
-        DynamicRequestHandler.addEvent(clientID, new Event("setcaret", position));
121
+    public void setCaretPosition(final int position) {
122
+        DynamicRequestHandler.addEvent(clientID, new Event(
123
+                "setcaret", position));
122 124
     }
123 125
 
124 126
     /** {@inheritDoc} */
125 127
     @Override
126
-    public void showColourPicker(boolean irc, boolean hex) {
128
+    public void showColourPicker(final boolean irc, final boolean hex) {
127 129
         // Do nothing
128 130
     }
129 131
 
@@ -133,14 +135,14 @@ public class WebInputField implements InputField {
133 135
         // Do nothing
134 136
     }
135 137
 
136
-    public void setSelEnd(int selEnd) {
138
+    public void setSelEnd(final int selEnd) {
137 139
         this.selEnd = selEnd;
138 140
     }
139 141
 
140
-    public void setSelStart(int selStart) {
142
+    public void setSelStart(final int selStart) {
141 143
         this.selStart = selStart;
142 144
     }
143
-    
145
+
144 146
     public void setContent(final String text) {
145 147
         this.text = text;
146 148
     }

+ 4
- 4
src/com/dmdirc/addons/ui_web/uicomponents/WebInputHandler.java Datei anzeigen

@@ -33,9 +33,9 @@ import com.dmdirc.ui.interfaces.InputField;
33 33
  */
34 34
 public class WebInputHandler extends InputHandler {
35 35
 
36
-    public WebInputHandler(InputField thisTarget,
37
-                           CommandParser thisCommandParser,
38
-                           WebInputWindow thisParentWindow) {
36
+    public WebInputHandler(final InputField thisTarget,
37
+                           final CommandParser thisCommandParser,
38
+                           final WebInputWindow thisParentWindow) {
39 39
         super(thisTarget, thisCommandParser, thisParentWindow);
40 40
     }
41 41
 
@@ -80,7 +80,7 @@ public class WebInputHandler extends InputHandler {
80 80
     /** {@inheritDoc} */
81 81
     @Override
82 82
     @SuppressWarnings("PMD")
83
-    public void doTabCompletion(boolean shiftPressed) {
83
+    public void doTabCompletion(final boolean shiftPressed) {
84 84
         super.doTabCompletion(shiftPressed);
85 85
     }
86 86
 

+ 21
- 19
src/com/dmdirc/addons/ui_web/uicomponents/WebInputWindow.java Datei anzeigen

@@ -36,21 +36,23 @@ import java.util.Map;
36 36
  * @author chris
37 37
  */
38 38
 public class WebInputWindow extends WebWindow implements InputWindow {
39
-    
39
+
40 40
     private final WritableFrameContainer<?> parent;
41
-    
41
+
42 42
     private final CommandParser commandparser;
43
-    
43
+
44 44
     private final WebInputHandler inputhandler;
45
-    
45
+
46 46
     private final Map<String, WebInputHandler> inputHandlers
47 47
             = new HashMap<String, WebInputHandler>();
48 48
 
49
-    public WebInputWindow(WebInterfaceUI controller, WritableFrameContainer<?> parent) {
49
+    public WebInputWindow(final WebInterfaceUI controller,
50
+            final WritableFrameContainer<?> parent) {
50 51
         super(controller, parent);
51 52
         this.parent = parent;
52 53
         this.commandparser = parent.getCommandParser();
53
-        this.inputhandler = new WebInputHandler(new WebInputField(), commandparser, this);
54
+        this.inputhandler = new WebInputHandler(new WebInputField(),
55
+                commandparser, this);
54 56
     }
55 57
 
56 58
     /** {@inheritDoc} */
@@ -68,19 +70,19 @@ public class WebInputWindow extends WebWindow implements InputWindow {
68 70
 
69 71
     public InputHandler getInputHandler(final String clientID) {
70 72
         if (!inputHandlers.containsKey(clientID)) {
71
-            WebInputHandler ih
72
-                    = new WebInputHandler(new WebInputField(clientID), commandparser, this);
73
+            final WebInputHandler ih = new WebInputHandler(
74
+                    new WebInputField(clientID), commandparser, this);
73 75
             ih.setTabCompleter(inputhandler.getTabCompleter());
74 76
             inputHandlers.put(clientID, ih);
75 77
         }
76
-        
78
+
77 79
         return inputHandlers.get(clientID);
78 80
     }
79
-    
80
-    public InputHandler getInputHandler(final String clientID, final String text,
81
-            final String selStart, final String selEnd) {
81
+
82
+    public InputHandler getInputHandler(final String clientID,
83
+            final String text, final String selStart, final String selEnd) {
82 84
         int sel1, sel2;
83
-        
85
+
84 86
         try {
85 87
             sel1 = Integer.parseInt(selStart);
86 88
             sel2 = Integer.parseInt(selEnd);
@@ -88,20 +90,20 @@ public class WebInputWindow extends WebWindow implements InputWindow {
88 90
             sel1 = 0;
89 91
             sel2 = 0;
90 92
         }
91
-        
92
-        WebInputHandler ih = (WebInputHandler) getInputHandler(clientID);
93
-        WebInputField field = (WebInputField) ih.getTarget();
93
+
94
+        final WebInputHandler ih = (WebInputHandler) getInputHandler(clientID);
95
+        final WebInputField field = (WebInputField) ih.getTarget();
94 96
         field.setContent(text);
95 97
         field.setSelStart(sel1);
96 98
         field.setSelEnd(sel2);
97
-        
99
+
98 100
         return ih;
99
-    }    
101
+    }
100 102
 
101 103
     /** {@inheritDoc} */
102 104
     @Override
103 105
     @Deprecated
104
-    public void setAwayIndicator(boolean isAway) {
106
+    public void setAwayIndicator(final boolean isAway) {
105 107
         // Do nothing
106 108
     }
107 109
 

+ 2
- 2
src/com/dmdirc/addons/ui_web/uicomponents/WebMainWindow.java Datei anzeigen

@@ -48,7 +48,7 @@ public class WebMainWindow implements MainWindow {
48 48
 
49 49
     /** {@inheritDoc} */
50 50
     @Override
51
-    public void setMaximised(boolean max) {
51
+    public void setMaximised(final boolean max) {
52 52
         //TODO FIXME
53 53
         throw new UnsupportedOperationException("Not supported yet.");
54 54
     }
@@ -69,7 +69,7 @@ public class WebMainWindow implements MainWindow {
69 69
 
70 70
     /** {@inheritDoc} */
71 71
     @Override
72
-    public void setVisible(boolean visible) {
72
+    public void setVisible(final boolean visible) {
73 73
         //TODO FIXME
74 74
         throw new UnsupportedOperationException("Not supported yet.");
75 75
     }

+ 1
- 1
src/com/dmdirc/addons/ui_web/uicomponents/WebQueryWindow.java Datei anzeigen

@@ -31,7 +31,7 @@ import com.dmdirc.ui.interfaces.QueryWindow;
31 31
  * @author chris
32 32
  */
33 33
 public class WebQueryWindow extends WebInputWindow implements QueryWindow {
34
-    
34
+
35 35
     private final Query query;
36 36
 
37 37
     public WebQueryWindow(final WebInterfaceUI controller, final Query parent) {

+ 4
- 3
src/com/dmdirc/addons/ui_web/uicomponents/WebServerWindow.java Datei anzeigen

@@ -31,12 +31,13 @@ import com.dmdirc.ui.interfaces.ServerWindow;
31 31
  * @author chris
32 32
  */
33 33
 public class WebServerWindow extends WebInputWindow implements ServerWindow {
34
- 
34
+
35 35
     private final Server server;
36 36
 
37
-    public WebServerWindow(WebInterfaceUI controller, Server server) {
37
+    public WebServerWindow(final WebInterfaceUI controller,
38
+            final Server server) {
38 39
         super(controller, server);
39
-        
40
+
40 41
         this.server = server;
41 42
     }
42 43
 

+ 11
- 10
src/com/dmdirc/addons/ui_web/uicomponents/WebStatusBar.java Datei anzeigen

@@ -42,14 +42,15 @@ public class WebStatusBar implements StatusBar {
42 42
 
43 43
     /** {@inheritDoc} */
44 44
     @Override
45
-    public void setMessage(String newMessage, StatusMessageNotifier newNotifier) {
45
+    public void setMessage(final String newMessage,
46
+            final StatusMessageNotifier newNotifier) {
46 47
         DynamicRequestHandler.addEvent(new Event("statusbar", newMessage));
47 48
     }
48 49
 
49 50
     /** {@inheritDoc} */
50 51
     @Override
51
-    public void setMessage(String newMessage, StatusMessageNotifier newNotifier,
52
-                           int timeout) {
52
+    public void setMessage(final String newMessage,
53
+            final StatusMessageNotifier newNotifier, final int timeout) {
53 54
         DynamicRequestHandler.addEvent(new Event("statusbar", newMessage));
54 55
     }
55 56
 
@@ -61,33 +62,33 @@ public class WebStatusBar implements StatusBar {
61 62
 
62 63
     /** {@inheritDoc} */
63 64
     @Override
64
-    public void addComponent(StatusBarComponent component) {
65
+    public void addComponent(final StatusBarComponent component) {
65 66
         // Do nothing
66 67
     }
67 68
 
68 69
     /** {@inheritDoc} */
69 70
     @Override
70
-    public void removeComponent(StatusBarComponent component) {
71
+    public void removeComponent(final StatusBarComponent component) {
71 72
         // Do nothing
72 73
     }
73 74
 
74 75
     /** {@inheritDoc} */
75 76
     @Override
76
-    public void setMessage(String iconType, String newMessage) {
77
+    public void setMessage(final String iconType, final String newMessage) {
77 78
         DynamicRequestHandler.addEvent(new Event("statusbar", newMessage));
78 79
     }
79 80
 
80 81
     /** {@inheritDoc} */
81 82
     @Override
82
-    public void setMessage(String iconType, String newMessage,
83
-            StatusMessageNotifier newNotifier) {
83
+    public void setMessage(final String iconType, final String newMessage,
84
+            final StatusMessageNotifier newNotifier) {
84 85
         DynamicRequestHandler.addEvent(new Event("statusbar", newMessage));
85 86
     }
86 87
 
87 88
     /** {@inheritDoc} */
88 89
     @Override
89
-    public void setMessage(String iconType, String newMessage,
90
-            StatusMessageNotifier newNotifier, int timeout) {
90
+    public void setMessage(final String iconType, final String newMessage,
91
+            final StatusMessageNotifier newNotifier, final int timeout) {
91 92
         DynamicRequestHandler.addEvent(new Event("statusbar", newMessage));
92 93
     }
93 94
 

+ 35
- 27
src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java Datei anzeigen

@@ -52,21 +52,24 @@ import org.apache.commons.lang.StringEscapeUtils;
52 52
  *
53 53
  * @author chris
54 54
  */
55
-public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener {
55
+public class WebWindow implements Window, IRCDocumentListener,
56
+        FrameInfoListener {
56 57
 
57 58
     protected static int counter = 0;
58 59
 
59
-    protected static final Map<String, WebWindow> WINDOWS = new HashMap<String, WebWindow>();
60
+    protected static final Map<String, WebWindow> WINDOWS
61
+            = new HashMap<String, WebWindow>();
60 62
 
61 63
     protected int myID = ++counter;
62 64
 
63 65
     private final FrameContainer<?> parent;
64 66
 
65
-    private List<String> messages = new ArrayList<String>();
67
+    private final List<String> messages = new ArrayList<String>();
66 68
 
67 69
     private String title;
68 70
 
69
-    public WebWindow(final WebInterfaceUI controller, final FrameContainer<?> parent) {
71
+    public WebWindow(final WebInterfaceUI controller,
72
+            final FrameContainer<?> parent) {
70 73
         super();
71 74
 
72 75
         this.parent = parent;
@@ -81,8 +84,8 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
81 84
             DynamicRequestHandler.addEvent(new Event("newwindow", this));
82 85
         } else {
83 86
             DynamicRequestHandler.addEvent(new Event("newchildwindow",
84
-                    new Object[]{controller.getWindowManager().getWindow(parent.getParent()),
85
-                    this}));
87
+                    new Object[]{controller.getWindowManager().getWindow(
88
+                            parent.getParent()), this}));
86 89
         }
87 90
     }
88 91
 
@@ -101,28 +104,28 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
101 104
         for (int i = 0; i < getContainer().getDocument().getNumLines(); i++) {
102 105
             messages.add(style(getContainer().getDocument().getStyledLine(i)));
103 106
         }
104
-        
107
+
105 108
         return messages;
106 109
     }
107 110
 
108 111
     /** {@inheritDoc} */
109 112
     @Override
110 113
     @Deprecated
111
-    public void addLine(String messageType, Object... args) {
114
+    public void addLine(final String messageType, final Object... args) {
112 115
         parent.addLine(messageType, args);
113 116
     }
114 117
 
115 118
     /** {@inheritDoc} */
116 119
     @Override
117 120
     @Deprecated
118
-    public void addLine(StringBuffer messageType, Object... args) {
121
+    public void addLine(final StringBuffer messageType, final Object... args) {
119 122
         parent.addLine(messageType, args);
120 123
     }
121 124
 
122 125
     /** {@inheritDoc} */
123 126
     @Override
124 127
     @Deprecated
125
-    public void addLine(String line, boolean timestamp) {
128
+    public void addLine(final String line, final boolean timestamp) {
126 129
         parent.addLine(line, timestamp);
127 130
     }
128 131
 
@@ -156,7 +159,7 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
156 159
     /** {@inheritDoc} */
157 160
     @Override
158 161
     @Deprecated
159
-    public void setVisible(boolean isVisible) {
162
+    public void setVisible(final boolean isVisible) {
160 163
         // Do nothing
161 164
     }
162 165
 
@@ -177,14 +180,14 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
177 180
         return true;
178 181
     }
179 182
 
180
-    public void setMaximum(boolean b) throws PropertyVetoException {
183
+    public void setMaximum(final boolean b) throws PropertyVetoException {
181 184
         // Do nothing
182 185
     }
183 186
 
184 187
     /** {@inheritDoc} */
185 188
     @Override
186 189
     @Deprecated
187
-    public void setTitle(String title) {
190
+    public void setTitle(final String title) {
188 191
         this.title = title;
189 192
     }
190 193
 
@@ -242,7 +245,8 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
242 245
         return builder.toString();
243 246
     }
244 247
 
245
-    protected static void style(final Map<AttributedCharacterIterator.Attribute, Object> map,
248
+    protected static void style(
249
+            final Map<AttributedCharacterIterator.Attribute, Object> map,
246 250
             final StringBuilder builder) {
247 251
         if (builder.length() > 0) {
248 252
             builder.append("</span>");
@@ -252,7 +256,8 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
252 256
 
253 257
         builder.append("<span style=\"");
254 258
 
255
-        for (Map.Entry<AttributedCharacterIterator.Attribute, Object> entry : map.entrySet()) {
259
+        for (Map.Entry<AttributedCharacterIterator.Attribute, Object> entry
260
+                : map.entrySet()) {
256 261
 
257 262
             if (entry.getKey().equals(TextAttribute.FOREGROUND)) {
258 263
                 builder.append("color: ");
@@ -273,20 +278,22 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
273 278
             } else if (entry.getKey().equals(IRCTextAttribute.HYPERLINK)) {
274 279
                 builder.append("cursor: pointer; ");
275 280
                 link = "link_hyperlink('"
276
-                        + StringEscapeUtils.escapeHtml(
277
-                        StringEscapeUtils.escapeJavaScript((String) entry.getValue()))
281
+                        + StringEscapeUtils.escapeHtml(StringEscapeUtils
282
+                        .escapeJavaScript((String) entry.getValue()))
278 283
                         + "');";
279 284
             } else if (entry.getKey().equals(IRCTextAttribute.CHANNEL)) {
280 285
                 builder.append("cursor: pointer; ");
281 286
                 link = "link_channel('"
282 287
                         + StringEscapeUtils.escapeHtml(
283
-                        StringEscapeUtils.escapeJavaScript((String) entry.getValue()))
288
+                        StringEscapeUtils.escapeJavaScript(
289
+                        (String) entry.getValue()))
284 290
                         + "');";
285 291
             } else if (entry.getKey().equals(IRCTextAttribute.NICKNAME)) {
286 292
                 builder.append("cursor: pointer; ");
287 293
                 link = "link_query('"
288 294
                         + StringEscapeUtils.escapeHtml(
289
-                        StringEscapeUtils.escapeJavaScript((String) entry.getValue()))
295
+                        StringEscapeUtils.escapeJavaScript(
296
+                        (String) entry.getValue()))
290 297
                         + "');";
291 298
             }
292 299
         }
@@ -351,20 +358,20 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
351 358
     }
352 359
 
353 360
     @Override
354
-    public void lineAdded(int line, int size) {
355
-        DynamicRequestHandler.addEvent(new Event("lineadded",
356
-                new Message(style(parent.getDocument().getStyledLine(line)), this)));
361
+    public void lineAdded(final int line, final int size) {
362
+        DynamicRequestHandler.addEvent(new Event("lineadded", new Message(
363
+                style(parent.getDocument().getStyledLine(line)), this)));
357 364
     }
358 365
 
359 366
     @Override
360
-    public void linesAdded(int line, int length, int size) {
367
+    public void linesAdded(final int line, final int length, final int size) {
361 368
         for (int i = 0; i < length; i++) {
362 369
             lineAdded(line + i, size);
363 370
         }
364 371
     }
365 372
 
366 373
     @Override
367
-    public void trimmed(int newSize, int numTrimmed) {
374
+    public void trimmed(final int newSize, final int numTrimmed) {
368 375
         //TODO FIXME
369 376
     }
370 377
 
@@ -379,17 +386,18 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
379 386
     }
380 387
 
381 388
     @Override
382
-    public void iconChanged(FrameContainer<?> window, String icon) {
389
+    public void iconChanged(final FrameContainer<?> window, final String icon) {
383 390
         //TODO FIXME
384 391
     }
385 392
 
386 393
     @Override
387
-    public void nameChanged(FrameContainer<?> window, String name) {
394
+    public void nameChanged(final FrameContainer<?> window, final String name) {
388 395
         //TODO FIXME
389 396
     }
390 397
 
391 398
     @Override
392
-    public void titleChanged(FrameContainer<?> window, String title) {
399
+    public void titleChanged(final FrameContainer<?> window,
400
+            final String title) {
393 401
         this.title = title;
394 402
     }
395 403
 

Laden…
Abbrechen
Speichern