Просмотр исходного кода

Annoying code tidying.

Change-Id: I052f46c59cfb19b64afbcaf2fbc02b17d1f40da6
Reviewed-on: http://gerrit.dmdirc.com/1633
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.5
Greg Holmes 13 лет назад
Родитель
Сommit
615d8bd09d
47 измененных файлов: 398 добавлений и 647 удалений
  1. 21
    0
      src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java
  2. 8
    7
      src/com/dmdirc/addons/ui_swing/actions/ChannelCopyAction.java
  3. 6
    6
      src/com/dmdirc/addons/ui_swing/actions/CloseFrameContainerAction.java
  4. 12
    12
      src/com/dmdirc/addons/ui_swing/actions/CommandAction.java
  5. 1
    2
      src/com/dmdirc/addons/ui_swing/actions/CopyAction.java
  6. 2
    5
      src/com/dmdirc/addons/ui_swing/actions/CutAction.java
  7. 7
    7
      src/com/dmdirc/addons/ui_swing/actions/HyperlinkCopyAction.java
  8. 2
    2
      src/com/dmdirc/addons/ui_swing/actions/InputTextFramePasteAction.java
  9. 7
    7
      src/com/dmdirc/addons/ui_swing/actions/NicknameCopyAction.java
  10. 0
    94
      src/com/dmdirc/addons/ui_swing/actions/NoNewlinesPasteAction.java
  11. 0
    92
      src/com/dmdirc/addons/ui_swing/actions/NoSpacesPasteAction.java
  12. 5
    6
      src/com/dmdirc/addons/ui_swing/actions/PasteAction.java
  13. 8
    8
      src/com/dmdirc/addons/ui_swing/actions/RedoAction.java
  14. 33
    33
      src/com/dmdirc/addons/ui_swing/actions/ReplacePasteAction.java
  15. 11
    11
      src/com/dmdirc/addons/ui_swing/actions/SearchAction.java
  16. 5
    4
      src/com/dmdirc/addons/ui_swing/actions/TopicEnterAction.java
  17. 7
    8
      src/com/dmdirc/addons/ui_swing/actions/UndoAction.java
  18. 8
    7
      src/com/dmdirc/addons/ui_swing/components/DMDircUndoableEditListener.java
  19. 14
    19
      src/com/dmdirc/addons/ui_swing/components/EtchedLineBorder.java
  20. 5
    4
      src/com/dmdirc/addons/ui_swing/components/ExecutableFileFilter.java
  21. 7
    8
      src/com/dmdirc/addons/ui_swing/components/FileBrowser.java
  22. 13
    1
      src/com/dmdirc/addons/ui_swing/components/FontPicker.java
  23. 2
    2
      src/com/dmdirc/addons/ui_swing/components/GenericComboBoxModel.java
  24. 22
    11
      src/com/dmdirc/addons/ui_swing/components/GenericListModel.java
  25. 10
    10
      src/com/dmdirc/addons/ui_swing/components/ImageButton.java
  26. 10
    10
      src/com/dmdirc/addons/ui_swing/components/ImageToggleButton.java
  27. 1
    1
      src/com/dmdirc/addons/ui_swing/components/ListScroller.java
  28. 3
    2
      src/com/dmdirc/addons/ui_swing/components/LockedLayer.java
  29. 4
    4
      src/com/dmdirc/addons/ui_swing/components/LoggingSwingWorker.java
  30. 3
    1
      src/com/dmdirc/addons/ui_swing/components/NewlinesDocumentFilter.java
  31. 32
    29
      src/com/dmdirc/addons/ui_swing/components/NickList.java
  32. 9
    14
      src/com/dmdirc/addons/ui_swing/components/NicklistComparator.java
  33. 7
    10
      src/com/dmdirc/addons/ui_swing/components/NicklistListModel.java
  34. 5
    0
      src/com/dmdirc/addons/ui_swing/components/NoFocusButton.java
  35. 18
    8
      src/com/dmdirc/addons/ui_swing/components/OptionalJSpinner.java
  36. 13
    7
      src/com/dmdirc/addons/ui_swing/components/PackingTable.java
  37. 4
    4
      src/com/dmdirc/addons/ui_swing/components/ParamModePanel.java
  38. 17
    11
      src/com/dmdirc/addons/ui_swing/components/SanitisedFilenameFilter.java
  39. 7
    5
      src/com/dmdirc/addons/ui_swing/components/SortedListModel.java
  40. 9
    137
      src/com/dmdirc/addons/ui_swing/components/SplitPane.java
  41. 5
    2
      src/com/dmdirc/addons/ui_swing/components/SwingSearchBar.java
  42. 3
    8
      src/com/dmdirc/addons/ui_swing/components/TitlePanel.java
  43. 0
    1
      src/com/dmdirc/addons/ui_swing/components/ToolTipPanel.java
  44. 11
    4
      src/com/dmdirc/addons/ui_swing/components/TopicBar.java
  45. 12
    13
      src/com/dmdirc/addons/ui_swing/components/URLProtocolPanel.java
  46. 1
    2
      src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java
  47. 8
    8
      src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicDisplayPane.java

+ 21
- 0
src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java Просмотреть файл

@@ -1,3 +1,24 @@
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
+ */
1 22
 
2 23
 package com.dmdirc.addons.ui_swing;
3 24
 

+ 8
- 7
src/com/dmdirc/addons/ui_swing/actions/ChannelCopyAction.java Просмотреть файл

@@ -42,9 +42,9 @@ public final class ChannelCopyAction extends AbstractAction {
42 42
     /** channel to be copied. */
43 43
     private final String channel;
44 44
 
45
-    /** 
45
+    /**
46 46
      * Instantiates a new channel copy action.
47
-     * 
47
+     *
48 48
      * @param channel channel to be copied
49 49
      */
50 50
     public ChannelCopyAction(final String channel) {
@@ -53,13 +53,14 @@ public final class ChannelCopyAction extends AbstractAction {
53 53
         this.channel = channel;
54 54
     }
55 55
 
56
-    /** 
56
+    /**
57 57
      * {@inheritDoc}
58
-     * 
58
+     *
59 59
      * @param e Action event
60 60
      */
61
+    @Override
61 62
     public void actionPerformed(final ActionEvent e) {
62
-        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(channel),
63
-                null);
63
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
64
+                new StringSelection(channel), null);
64 65
     }
65
-} 
66
+}

+ 6
- 6
src/com/dmdirc/addons/ui_swing/actions/CloseFrameContainerAction.java Просмотреть файл

@@ -40,11 +40,11 @@ public final class CloseFrameContainerAction extends AbstractAction {
40 40
      */
41 41
     private static final long serialVersionUID = 1;
42 42
     /** Frame container to be closed. */
43
-    private FrameContainer frame;
43
+    private final FrameContainer frame;
44 44
 
45
-    /** 
45
+    /**
46 46
      * Instantiates a new close a frame container action.
47
-     * 
47
+     *
48 48
      * @param frame frame container to be closed
49 49
      */
50 50
     public CloseFrameContainerAction(final FrameContainer frame) {
@@ -53,9 +53,9 @@ public final class CloseFrameContainerAction extends AbstractAction {
53 53
         this.frame = frame;
54 54
     }
55 55
 
56
-    /** 
56
+    /**
57 57
      * {@inheritDoc}
58
-     * 
58
+     *
59 59
      * @param e Action event
60 60
      */
61 61
     @Override
@@ -64,4 +64,4 @@ public final class CloseFrameContainerAction extends AbstractAction {
64 64
             frame.close();
65 65
         }
66 66
     }
67
-} 
67
+}

+ 12
- 12
src/com/dmdirc/addons/ui_swing/actions/CommandAction.java Просмотреть файл

@@ -30,28 +30,28 @@ import java.awt.event.ActionEvent;
30 30
 import javax.swing.AbstractAction;
31 31
 
32 32
 /**
33
- * Executes a command. 
33
+ * Executes a command.
34 34
  */
35 35
 public class CommandAction extends AbstractAction {
36
-    
36
+
37 37
     /**
38 38
      * A version number for this class. It should be changed whenever the class
39 39
      * structure is changed (or anything else that would prevent serialized
40 40
      * objects being unserialized with the new class).
41 41
      */
42 42
     private static final long serialVersionUID = 2;
43
-    
43
+
44 44
     /** Command parser. */
45 45
     private final CommandParser parser;
46
-    
46
+
47 47
     /** Window. */
48 48
     private final transient Window window;
49
-    
49
+
50 50
     /** Command. */
51 51
     private final String command;
52
-    
53
-    /** 
54
-     * Creates a new instance of CommandAction. 
52
+
53
+    /**
54
+     * Creates a new instance of CommandAction.
55 55
      *
56 56
      * @param parser Command parser
57 57
      * @param window Window
@@ -61,15 +61,15 @@ public class CommandAction extends AbstractAction {
61 61
     public CommandAction(final CommandParser parser, final Window window,
62 62
             final String name, final String command) {
63 63
         super(name);
64
-        
64
+
65 65
         this.parser = parser;
66 66
         this.window = window;
67 67
         this.command = command;
68 68
     }
69 69
 
70
-    /** 
70
+    /**
71 71
      * {@inheritDoc}
72
-     * 
72
+     *
73 73
      * @param e Action event
74 74
      */
75 75
     @Override
@@ -78,5 +78,5 @@ public class CommandAction extends AbstractAction {
78 78
             parser.parseCommand(window.getContainer(), window, line);
79 79
         }
80 80
     }
81
-    
81
+
82 82
 }

+ 1
- 2
src/com/dmdirc/addons/ui_swing/actions/CopyAction.java Просмотреть файл

@@ -67,8 +67,7 @@ public final class CopyAction extends AbstractAction {
67 67
     /** {@inheritDoc} */
68 68
     @Override
69 69
     public boolean isEnabled() {
70
-        return comp.isEnabled()
71
-                && comp.getSelectedText() != null
70
+        return comp.isEnabled() && comp.getSelectedText() != null
72 71
                 && !(comp instanceof JPasswordField);
73 72
     }
74 73
 }

+ 2
- 5
src/com/dmdirc/addons/ui_swing/actions/CutAction.java Просмотреть файл

@@ -39,7 +39,6 @@ public final class CutAction extends AbstractAction {
39 39
      * objects being unserialized with the new class).
40 40
      */
41 41
     private static final long serialVersionUID = 1;
42
-
43 42
     /** Text component to be acted upon. */
44 43
     private final JTextComponent comp;
45 44
 
@@ -67,9 +66,7 @@ public final class CutAction extends AbstractAction {
67 66
     /** {@inheritDoc} */
68 67
     @Override
69 68
     public boolean isEnabled() {
70
-        return comp.isEditable()
71
-                && comp.isEnabled()
72
-                && comp.getSelectedText() != null
73
-                && !(comp instanceof JPasswordField);
69
+        return comp.isEditable() && comp.isEnabled() && comp.getSelectedText()
70
+                != null && !(comp instanceof JPasswordField);
74 71
     }
75 72
 }

+ 7
- 7
src/com/dmdirc/addons/ui_swing/actions/HyperlinkCopyAction.java Просмотреть файл

@@ -42,9 +42,9 @@ public final class HyperlinkCopyAction extends AbstractAction {
42 42
     /** hyperlink to be copied. */
43 43
     private final String hyperlink;
44 44
 
45
-    /** 
45
+    /**
46 46
      * Instantiates a new hyperlink copy action.
47
-     * 
47
+     *
48 48
      * @param hyperlink hyperlink to be copied
49 49
      */
50 50
     public HyperlinkCopyAction(final String hyperlink) {
@@ -53,14 +53,14 @@ public final class HyperlinkCopyAction extends AbstractAction {
53 53
         this.hyperlink = hyperlink;
54 54
     }
55 55
 
56
-    /** 
56
+    /**
57 57
      * {@inheritDoc}
58
-     * 
58
+     *
59 59
      * @param e Action event
60 60
      */
61 61
     @Override
62 62
     public void actionPerformed(final ActionEvent e) {
63
-        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(hyperlink),
64
-                null);
63
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
64
+                new StringSelection(hyperlink), null);
65 65
     }
66
-} 
66
+}

+ 2
- 2
src/com/dmdirc/addons/ui_swing/actions/InputTextFramePasteAction.java Просмотреть файл

@@ -55,9 +55,9 @@ public final class InputTextFramePasteAction extends AbstractAction {
55 55
         this.inputFrame = inputFrame;
56 56
     }
57 57
 
58
-    /** 
58
+    /**
59 59
      * {@inheritDoc}
60
-     * 
60
+     *
61 61
      * @param e Action event
62 62
      */
63 63
     @Override

+ 7
- 7
src/com/dmdirc/addons/ui_swing/actions/NicknameCopyAction.java Просмотреть файл

@@ -42,9 +42,9 @@ public final class NicknameCopyAction extends AbstractAction {
42 42
     /** Nickname to be copied. */
43 43
     private final String nickname;
44 44
 
45
-    /** 
45
+    /**
46 46
      * Instantiates a new nickname copy action.
47
-     * 
47
+     *
48 48
      * @param nickname Nickname to be copied
49 49
      */
50 50
     public NicknameCopyAction(final String nickname) {
@@ -53,14 +53,14 @@ public final class NicknameCopyAction extends AbstractAction {
53 53
         this.nickname = nickname;
54 54
     }
55 55
 
56
-    /** 
56
+    /**
57 57
      * {@inheritDoc}
58
-     * 
58
+     *
59 59
      * @param e Action event
60 60
      */
61 61
     @Override
62 62
     public void actionPerformed(final ActionEvent e) {
63
-        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(nickname),
64
-                null);
63
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
64
+                new StringSelection(nickname), null);
65 65
     }
66
-} 
66
+}

+ 0
- 94
src/com/dmdirc/addons/ui_swing/actions/NoNewlinesPasteAction.java Просмотреть файл

@@ -1,94 +0,0 @@
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
-
23
-package com.dmdirc.addons.ui_swing.actions;
24
-
25
-import com.dmdirc.logger.ErrorLevel;
26
-import com.dmdirc.logger.Logger;
27
-
28
-import java.awt.Toolkit;
29
-import java.awt.datatransfer.DataFlavor;
30
-import java.awt.datatransfer.UnsupportedFlavorException;
31
-import java.awt.event.ActionEvent;
32
-import java.io.IOException;
33
-
34
-import javax.swing.AbstractAction;
35
-import javax.swing.text.JTextComponent;
36
-
37
-/**
38
- * Paste action that strips newlines from pastes.
39
- */
40
-public final class NoNewlinesPasteAction extends AbstractAction {
41
-    
42
-    /**
43
-     * A version number for this class. It should be changed whenever the class
44
-     * structure is changed (or anything else that would prevent serialized
45
-     * objects being unserialized with the new class).
46
-     */
47
-    private static final long serialVersionUID = 1;
48
-    
49
-    /**
50
-     * Creates a new instance of NoNewlinesPasteAction.
51
-     */
52
-    public NoNewlinesPasteAction() {
53
-        super("TopicPasteAction");
54
-    }
55
-    
56
-    /** 
57
-     * {@inheritDoc}
58
-     * 
59
-     * @param e Action event
60
-     */
61
-    @Override
62
-    public void actionPerformed(final ActionEvent e) {
63
-        final JTextComponent comp;
64
-        
65
-        if (e.getSource() instanceof JTextComponent) {
66
-            comp = (JTextComponent) e.getSource();
67
-        } else {
68
-            return;
69
-        }
70
-        
71
-        String clipboard = null;
72
-        
73
-        if (!Toolkit.getDefaultToolkit().getSystemClipboard().
74
-                isDataFlavorAvailable(DataFlavor.stringFlavor)) {
75
-            return;
76
-        }
77
-        
78
-        try {
79
-            //get the contents of the clipboard
80
-            clipboard = (String) Toolkit.getDefaultToolkit().
81
-                    getSystemClipboard().getData(DataFlavor.stringFlavor);
82
-            //remove newlines
83
-            clipboard = clipboard.replaceAll("(\r\n|\n|\r)", " ");
84
-            
85
-            //insert the contents at the current cursor position
86
-            comp.replaceSelection(clipboard);
87
-        } catch (IOException ex) {
88
-            Logger.userError(ErrorLevel.LOW, "Unable to get clipboard contents: " + ex.getMessage());
89
-        } catch (UnsupportedFlavorException ex) {
90
-            Logger.appError(ErrorLevel.LOW, "Unable to get clipboard contents", ex);
91
-        }
92
-    }
93
-    
94
-}

+ 0
- 92
src/com/dmdirc/addons/ui_swing/actions/NoSpacesPasteAction.java Просмотреть файл

@@ -1,92 +0,0 @@
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
-
23
-package com.dmdirc.addons.ui_swing.actions;
24
-
25
-import com.dmdirc.logger.ErrorLevel;
26
-import com.dmdirc.logger.Logger;
27
-
28
-import java.awt.Toolkit;
29
-import java.awt.datatransfer.DataFlavor;
30
-import java.awt.datatransfer.UnsupportedFlavorException;
31
-import java.awt.event.ActionEvent;
32
-import java.io.IOException;
33
-
34
-import javax.swing.AbstractAction;
35
-import javax.swing.text.JTextComponent;
36
-
37
-/**
38
- * Paste action that strips newlines from pastes.
39
- */
40
-public final class NoSpacesPasteAction extends AbstractAction {
41
-    
42
-    /**
43
-     * A version number for this class. It should be changed whenever the class
44
-     * structure is changed (or anything else that would prevent serialized
45
-     * objects being unserialized with the new class).
46
-     */
47
-    private static final long serialVersionUID = 1;
48
-    
49
-    /** Creates a new instance of TopicPasteAction. */
50
-    public NoSpacesPasteAction() {
51
-        super("NoSpacesPasteAction");
52
-    }
53
-    
54
-    /**
55
-     * {@inheritDoc}
56
-     *
57
-     * @param e Action event
58
-     */
59
-    @Override
60
-    public void actionPerformed(final ActionEvent e) {
61
-        final JTextComponent comp;
62
-        
63
-        if (e.getSource() instanceof JTextComponent) {
64
-            comp = (JTextComponent) e.getSource();
65
-        } else {
66
-            return;
67
-        }
68
-        
69
-        String clipboard = null;
70
-        
71
-        if (!Toolkit.getDefaultToolkit().getSystemClipboard().
72
-                isDataFlavorAvailable(DataFlavor.stringFlavor)) {
73
-            return;
74
-        }
75
-        
76
-        try {
77
-            //get the contents of the clipboard
78
-            clipboard = (String) Toolkit.getDefaultToolkit().
79
-                    getSystemClipboard().getData(DataFlavor.stringFlavor);
80
-            //remove spaces
81
-            clipboard = clipboard.replaceAll("\\s", "");
82
-            
83
-            //insert the contents at the current cursor position
84
-        comp.replaceSelection(clipboard);
85
-        } catch (IOException ex) {
86
-            Logger.userError(ErrorLevel.LOW, "Unable to get clipboard contents: " + ex.getMessage());
87
-        } catch (UnsupportedFlavorException ex) {
88
-            Logger.appError(ErrorLevel.LOW, "Unable to get clipboard contents", ex);
89
-        }
90
-    }
91
-    
92
-}

+ 5
- 6
src/com/dmdirc/addons/ui_swing/actions/PasteAction.java Просмотреть файл

@@ -34,17 +34,16 @@ import javax.swing.text.JTextComponent;
34 34
  * Paste action.
35 35
  */
36 36
 public final class PasteAction extends AbstractAction {
37
-    
37
+
38 38
     /**
39 39
      * A version number for this class. It should be changed whenever the class
40 40
      * structure is changed (or anything else that would prevent serialized
41 41
      * objects being unserialized with the new class).
42 42
      */
43 43
     private static final long serialVersionUID = 1;
44
-    
45 44
     /** Text component to be acted upon. */
46 45
     private final JTextComponent comp;
47
-    
46
+
48 47
     /**
49 48
      * Instantiates a new paste action.
50 49
      *
@@ -52,10 +51,10 @@ public final class PasteAction extends AbstractAction {
52 51
      */
53 52
     public PasteAction(final JTextComponent comp) {
54 53
         super("Paste");
55
-        
54
+
56 55
         this.comp = comp;
57 56
     }
58
-    
57
+
59 58
     /**
60 59
      * {@inheritDoc}
61 60
      *
@@ -65,7 +64,7 @@ public final class PasteAction extends AbstractAction {
65 64
     public void actionPerformed(final ActionEvent e) {
66 65
         comp.paste();
67 66
     }
68
-    
67
+
69 68
     /** {@inheritDoc} */
70 69
     @Override
71 70
     public boolean isEnabled() {

+ 8
- 8
src/com/dmdirc/addons/ui_swing/actions/RedoAction.java Просмотреть файл

@@ -35,28 +35,28 @@ import javax.swing.undo.UndoManager;
35 35
  * Handles redo's on text components.
36 36
  */
37 37
 public final class RedoAction extends AbstractAction {
38
-    
38
+
39 39
     /**
40 40
      * A version number for this class. It should be changed whenever the class
41 41
      * structure is changed (or anything else that would prevent serialized
42 42
      * objects being unserialized with the new class).
43 43
      */
44 44
     private static final long serialVersionUID = 1;
45
-    
45
+
46 46
     /** Undo manager. */
47 47
     private final UndoManager undoManager;
48
-    
49
-    /** 
50
-     * Creates a new instance of RedoAction. 
48
+
49
+    /**
50
+     * Creates a new instance of RedoAction.
51 51
      *
52 52
      * @param undoManager UndoManager to use for this redo action
53 53
      */
54 54
     public RedoAction(final UndoManager undoManager) {
55 55
         super("Undo");
56
-        
56
+
57 57
         this.undoManager = undoManager;
58 58
     }
59
-    
59
+
60 60
     /**
61 61
      * {@inheritDoc}
62 62
      *
@@ -72,5 +72,5 @@ public final class RedoAction extends AbstractAction {
72 72
             Logger.userError(ErrorLevel.LOW, "Unable to redo");
73 73
         }
74 74
     }
75
-    
75
+
76 76
 }

src/com/dmdirc/addons/ui_swing/actions/SanitisedFilenamePasteAction.java → src/com/dmdirc/addons/ui_swing/actions/ReplacePasteAction.java Просмотреть файл

@@ -35,27 +35,35 @@ import javax.swing.AbstractAction;
35 35
 import javax.swing.text.JTextComponent;
36 36
 
37 37
 /**
38
- * Paste action that sanitises filenames
38
+ * Paste action that replaces matching regexes.
39 39
  */
40
-public final class SanitisedFilenamePasteAction extends AbstractAction {
41
-    
40
+public final class ReplacePasteAction extends AbstractAction {
41
+
42 42
     /**
43 43
      * A version number for this class. It should be changed whenever the class
44 44
      * structure is changed (or anything else that would prevent serialized
45 45
      * objects being unserialized with the new class).
46 46
      */
47 47
     private static final long serialVersionUID = 1;
48
-    
49
-    /** Invalid filename characters. */
50
-    private static final String INVALID_CHARS = "^[^\\w\\.\\s\\-\\#\\&\\_]";
51
-    
48
+    /** Regex to match for replacement. */
49
+    private final String replacementRegex;
50
+    /** Replacement string. */
51
+    private final String replacementString;
52
+
52 53
     /**
53
-     * Creates a new instance of SanitisedFilenamePasteAction.
54
+     * Creates a new instance of regex replacement paste action.
55
+     *
56
+     * @param replacementRegex Regex to match for replacement
57
+     * @param replacementString Replacement string
54 58
      */
55
-    public SanitisedFilenamePasteAction() {
59
+    public ReplacePasteAction(final String replacementRegex,
60
+            final String replacementString) {
56 61
         super("NoSpacesPasteAction");
62
+
63
+        this.replacementRegex = replacementRegex;
64
+        this.replacementString = replacementString;
57 65
     }
58
-    
66
+
59 67
     /**
60 68
      * {@inheritDoc}
61 69
      *
@@ -63,35 +71,27 @@ public final class SanitisedFilenamePasteAction extends AbstractAction {
63 71
      */
64 72
     @Override
65 73
     public void actionPerformed(final ActionEvent e) {
66
-        final JTextComponent comp;
67
-        
68
-        if (e.getSource() instanceof JTextComponent) {
69
-            comp = (JTextComponent) e.getSource();
70
-        } else {
71
-            return;
72
-        }
73
-        
74
-        String clipboard = null;
75
-        
76
-        if (!Toolkit.getDefaultToolkit().getSystemClipboard().
74
+        if (!(e.getSource() instanceof JTextComponent)
75
+                || !Toolkit.getDefaultToolkit().getSystemClipboard().
77 76
                 isDataFlavorAvailable(DataFlavor.stringFlavor)) {
78 77
             return;
79 78
         }
80
-        
79
+
81 80
         try {
82
-            //get the contents of the clipboard
83
-            clipboard = (String) Toolkit.getDefaultToolkit().
84
-                    getSystemClipboard().getData(DataFlavor.stringFlavor);
85
-            //remove invalid letters
86
-            clipboard = clipboard.replaceAll(INVALID_CHARS, "");
87
-            
88
-            //insert the contents at the current cursor position
89
-        comp.replaceSelection(clipboard);
81
+            //Get clipboard clipboard contents
82
+            //Replace spaces with nothing
83
+            //Replace the current selection with the contents of the clipboard
84
+            ((JTextComponent) e.getSource()).replaceSelection(((String)
85
+                    Toolkit.getDefaultToolkit()
86
+                    .getSystemClipboard().getData(DataFlavor.stringFlavor))
87
+                    .replaceAll(replacementRegex, replacementString));
90 88
         } catch (IOException ex) {
91
-            Logger.userError(ErrorLevel.LOW, "Unable to get clipboard contents: " + ex.getMessage());
89
+            Logger.userError(ErrorLevel.LOW, "Unable to get clipboard "
90
+                    + "contents: " + ex.getMessage());
92 91
         } catch (UnsupportedFlavorException ex) {
93
-            Logger.appError(ErrorLevel.LOW, "Unable to get clipboard contents", ex);
92
+            Logger.appError(ErrorLevel.LOW, "Unable to get clipboard "
93
+                    + "contents", ex);
94 94
         }
95 95
     }
96
-    
96
+
97 97
 }

+ 11
- 11
src/com/dmdirc/addons/ui_swing/actions/SearchAction.java Просмотреть файл

@@ -32,41 +32,41 @@ import javax.swing.AbstractAction;
32 32
  * Opens and focuses the search bar.
33 33
  */
34 34
 public final class SearchAction extends AbstractAction {
35
-    
35
+
36 36
     /**
37 37
      * A version number for this class. It should be changed whenever the class
38 38
      * structure is changed (or anything else that would prevent serialized
39 39
      * objects being unserialized with the new class).
40 40
      */
41 41
     private static final long serialVersionUID = 2;
42
-    
43 42
     /** Parent searchbar. */
44 43
     private final SwingSearchBar searchBar;
45
-    
46
-    /** 
47
-     * Creates a new instance of SearchAction. 
44
+
45
+    /**
46
+     * Creates a new instance of SearchAction.
48 47
      *
49 48
      * @param searchBar Parent searchbar.
50 49
      */
51 50
     public SearchAction(final SwingSearchBar searchBar) {
52 51
         super("Search");
53
-        
52
+
54 53
         this.searchBar = searchBar;
55 54
     }
56
-    
55
+
57 56
     /**
58 57
      * {@inheritDoc}
59 58
      *
60 59
      * @param e Action event
61 60
      */
62 61
     @Override
63
-    public void actionPerformed(final ActionEvent e) { 
62
+    public void actionPerformed(final ActionEvent e) {
64 63
         if (searchBar.isVisible()) {
65 64
             searchBar.getFocus();
66
-            searchBar.search(searchBar.getSearchPhrase(), searchBar.isCaseSensitive());
65
+            searchBar.search(searchBar.getSearchPhrase(),
66
+                    searchBar.isCaseSensitive());
67 67
         } else {
68 68
             searchBar.open();
69 69
         }
70
-    } 
71
-    
70
+    }
71
+
72 72
 }

+ 5
- 4
src/com/dmdirc/addons/ui_swing/actions/TopicEnterAction.java Просмотреть файл

@@ -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
@@ -38,7 +38,7 @@ public class TopicEnterAction extends AbstractAction {
38 38
      */
39 39
     private static final long serialVersionUID = 1;
40 40
     /** Parent pane. */
41
-    private ChannelSettingsDialog parent;
41
+    private final ChannelSettingsDialog parent;
42 42
 
43 43
     /**
44 44
      * Creates a new topic enter action with the associated parent.
@@ -46,6 +46,7 @@ public class TopicEnterAction extends AbstractAction {
46 46
      * @param parent Parent dialog
47 47
      */
48 48
     public TopicEnterAction(final ChannelSettingsDialog parent) {
49
+        super("TopicEnterAction");
49 50
         this.parent = parent;
50 51
     }
51 52
 

+ 7
- 8
src/com/dmdirc/addons/ui_swing/actions/UndoAction.java Просмотреть файл

@@ -35,28 +35,27 @@ import javax.swing.undo.UndoManager;
35 35
  * Handles undo's on text components.
36 36
  */
37 37
 public final class UndoAction extends AbstractAction {
38
-    
38
+
39 39
     /**
40 40
      * A version number for this class. It should be changed whenever the class
41 41
      * structure is changed (or anything else that would prevent serialized
42 42
      * objects being unserialized with the new class).
43 43
      */
44 44
     private static final long serialVersionUID = 1;
45
-    
46 45
     /** Undo manager. */
47 46
     private final UndoManager undoManager;
48
-    
49
-    /** 
50
-     * Creates a new instance of UndoAction. 
47
+
48
+    /**
49
+     * Creates a new instance of UndoAction.
51 50
      *
52 51
      * @param undoManager UndoManager to use for this redo action
53 52
      */
54 53
     public UndoAction(final UndoManager undoManager) {
55 54
         super("Undo");
56
-        
55
+
57 56
         this.undoManager = undoManager;
58 57
     }
59
-    
58
+
60 59
     /**
61 60
      * {@inheritDoc}
62 61
      *
@@ -72,5 +71,5 @@ public final class UndoAction extends AbstractAction {
72 71
             Logger.userError(ErrorLevel.LOW, "Unable to undo");
73 72
         }
74 73
     }
75
-    
74
+
76 75
 }

+ 8
- 7
src/com/dmdirc/addons/ui_swing/components/DMDircUndoableEditListener.java Просмотреть файл

@@ -30,24 +30,25 @@ import javax.swing.undo.UndoManager;
30 30
  * Undoable edit listener.
31 31
  */
32 32
 public final class DMDircUndoableEditListener implements UndoableEditListener {
33
-    
33
+
34 34
     /** Undo manager. */
35 35
     private final UndoManager undoManager;
36
-    
37
-    /** 
38
-     * Creates a new instance of DMDircUndoableEditListener. 
36
+
37
+    /**
38
+     * Creates a new instance of DMDircUndoableEditListener.
39 39
      *
40 40
      * @param undoManager UndoManager to use for this listener
41 41
      */
42 42
     public DMDircUndoableEditListener(final UndoManager undoManager) {
43 43
         super();
44
-        
44
+
45 45
         this.undoManager = undoManager;
46 46
     }
47
-    
47
+
48 48
     /** {@inheritDoc} */
49
+    @Override
49 50
     public void undoableEditHappened(final UndoableEditEvent evt) {
50 51
         undoManager.addEdit(evt.getEdit());
51 52
     }
52
-    
53
+
53 54
 }

+ 14
- 19
src/com/dmdirc/addons/ui_swing/components/EtchedLineBorder.java Просмотреть файл

@@ -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
@@ -43,20 +43,20 @@ public class EtchedLineBorder extends EtchedBorder {
43 43
     /** Border side. */
44 44
     public enum BorderSide {
45 45
         /** Creates a border at the top. */
46
-        TOP, 
46
+        TOP,
47 47
         /** Creates a border at the bottom. */
48
-        BOTTOM, 
48
+        BOTTOM,
49 49
     };
50 50
 
51 51
     /**
52 52
      * Creates a new etched line border.
53
-     * 
53
+     *
54 54
      * @param type Etch type
55 55
      * @param side Border side
56 56
      */
57 57
     public EtchedLineBorder(final int type, final BorderSide side) {
58 58
         super(type);
59
-        
59
+
60 60
         this.side = side;
61 61
     }
62 62
 
@@ -66,24 +66,19 @@ public class EtchedLineBorder extends EtchedBorder {
66 66
             final int y, final int width, final int height) {
67 67
         g.translate(x, y);
68 68
 
69
-        g.setColor(etchType == LOWERED ? getShadowColor(c) : getHighlightColor(c));
69
+        g.setColor(etchType == LOWERED
70
+                ? getShadowColor(c) : getHighlightColor(c));
70 71
         switch (side) {
71 72
             case TOP:
72 73
                 g.drawLine(0, 0, width - 2, 0);
73
-                break;
74
-            case BOTTOM:
75
-                g.drawLine(0, height - 1, width - 2, height - 1);
76
-                break;
77
-            default:
78
-                break;
79
-        }
80
-
81
-        g.setColor(etchType == LOWERED ? getHighlightColor(c) : getShadowColor(c));
82
-        switch (side) {
83
-            case TOP:
74
+                g.setColor(etchType == LOWERED
75
+                        ? getHighlightColor(c) : getShadowColor(c));
84 76
                 g.drawLine(0, 1, width - 2, 1);
85 77
                 break;
86 78
             case BOTTOM:
79
+                g.drawLine(0, height - 1, width - 2, height - 1);
80
+                g.setColor(etchType == LOWERED
81
+                        ? getHighlightColor(c) : getShadowColor(c));
87 82
                 g.drawLine(0, height, width - 2, height);
88 83
                 break;
89 84
             default:

+ 5
- 4
src/com/dmdirc/addons/ui_swing/components/ExecutableFileFilter.java Просмотреть файл

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25 25
 import java.io.File;
26
+
26 27
 import javax.swing.filechooser.FileFilter;
27 28
 
28 29
 /**
@@ -32,7 +33,7 @@ public class ExecutableFileFilter extends FileFilter {
32 33
 
33 34
     /**
34 35
      * {@inheritDoc}
35
-     * 
36
+     *
36 37
      * @param file File to check
37 38
      */
38 39
     @Override
@@ -40,13 +41,13 @@ public class ExecutableFileFilter extends FileFilter {
40 41
         return (file.isDirectory() || file.canExecute());
41 42
     }
42 43
 
43
-    /** 
44
+    /**
44 45
      * {@inheritDoc}
45
-     * 
46
+     *
46 47
      * @return Description
47 48
      */
48 49
     @Override
49 50
     public String getDescription() {
50 51
         return "Executable files";
51 52
     }
52
-}
53
+}

+ 7
- 8
src/com/dmdirc/addons/ui_swing/components/FileBrowser.java Просмотреть файл

@@ -29,8 +29,8 @@ import com.dmdirc.util.ListenerList;
29 29
 
30 30
 import java.awt.event.ActionEvent;
31 31
 import java.awt.event.ActionListener;
32
-
33 32
 import java.awt.event.KeyListener;
33
+
34 34
 import javax.swing.JButton;
35 35
 import javax.swing.JFileChooser;
36 36
 import javax.swing.JPanel;
@@ -52,13 +52,10 @@ public class FileBrowser extends JPanel implements ActionListener {
52 52
      * objects being unserialized with the new class).
53 53
      */
54 54
     private static final long serialVersionUID = 1;
55
-
56
-    /** Browse button. */
57
-    private JButton browseButton;
58 55
     /** Text field to show path of chosen file. */
59
-    private ValidatingJTextField pathField;
56
+    private final ValidatingJTextField pathField;
60 57
     /** File browsing window. */
61
-    private JFileChooser fileChooser = new JFileChooser();
58
+    private final JFileChooser fileChooser = new JFileChooser();
62 59
     /** Our listeners. */
63 60
     private final ListenerList listeners = new ListenerList();
64 61
 
@@ -69,9 +66,11 @@ public class FileBrowser extends JPanel implements ActionListener {
69 66
      * @param type The type of filechooser we want (Files/Directories/Both)
70 67
      */
71 68
     public FileBrowser(final PreferencesSetting setting, final int type) {
69
+        super();
70
+
72 71
         fileChooser.setFileSelectionMode(type);
73
-        
74
-        browseButton = new JButton("Browse");
72
+
73
+        final JButton browseButton = new JButton("Browse");
75 74
         browseButton.addActionListener(this);
76 75
 
77 76
         pathField = new ValidatingJTextField(new JTextField(setting.getValue()),

+ 13
- 1
src/com/dmdirc/addons/ui_swing/components/FontPicker.java Просмотреть файл

@@ -39,8 +39,14 @@ import javax.swing.SwingUtilities;
39 39
  */
40 40
 public class FontPicker extends JComboBox {
41 41
 
42
+    /**
43
+     * A version number for this class. It should be changed whenever the class
44
+     * structure is changed (or anything else that would prevent serialized
45
+     * objects being unserialized with the new class).
46
+     */
42 47
     private static final long serialVersionUID = -9054812588033935839L;
43
-    private String fontFamily;
48
+    /** Font family to choose from. */
49
+    private final String fontFamily;
44 50
 
45 51
     /**
46 52
      * Creates a new Font picker for the specified font family.
@@ -76,6 +82,12 @@ public class FontPicker extends JComboBox {
76 82
         }.executeInExecutor();
77 83
     }
78 84
 
85
+
86
+    /**
87
+     * Loads the fonts and adds them to the font picker.
88
+     *
89
+     * @param fonts Fonts to load
90
+     */
79 91
     private void loadFonts(final String[] fonts) {
80 92
         final int size = getFont().getSize();
81 93
         for (final String font : fonts) {

+ 2
- 2
src/com/dmdirc/addons/ui_swing/components/GenericComboBoxModel.java Просмотреть файл

@@ -45,8 +45,8 @@ public class GenericComboBoxModel<T> extends GenericListModel<T> implements
45 45
     @Override
46 46
     @SuppressWarnings("unchecked")
47 47
     public void setSelectedItem(final Object anItem) {
48
-        if ((selectedObject != null && !selectedObject.equals(anItem)) || selectedObject
49
-                == null && anItem != null) {
48
+        if ((selectedObject != null && !selectedObject.equals(anItem))
49
+                || selectedObject == null && anItem != null) {
50 50
             selectedObject = (T) anItem;
51 51
             fireContentsChanged(this, -1, -1);
52 52
         }

+ 22
- 11
src/com/dmdirc/addons/ui_swing/components/GenericListModel.java Просмотреть файл

@@ -1,17 +1,17 @@
1 1
 /*
2
- * 
2
+ *
3 3
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
4
+ *
5 5
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 6
  * of this software and associated documentation files (the "Software"), to deal
7 7
  * in the Software without restriction, including without limitation the rights
8 8
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 9
  * copies of the Software, and to permit persons to whom the Software is
10 10
  * furnished to do so, subject to the following conditions:
11
- * 
11
+ *
12 12
  * The above copyright notice and this permission notice shall be included in
13 13
  * all copies or substantial portions of the Software.
14
- * 
14
+ *
15 15
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 16
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 17
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,22 +37,32 @@ import javax.swing.AbstractListModel;
37 37
  */
38 38
 public class GenericListModel<T> extends AbstractListModel {
39 39
 
40
+    /**
41
+     * A version number for this class. It should be changed whenever the class
42
+     * structure is changed (or anything else that would prevent serialized
43
+     * objects being unserialized with the new class).
44
+     */
40 45
     private static final long serialVersionUID = -4227892376992714545L;
41
-    private List<T> list;
46
+    /** Data stored in list. */
47
+    private final List<T> list;
42 48
 
43 49
     /**
44 50
      * Instantiates an empty generic list model.
45 51
      */
46 52
     public GenericListModel() {
53
+        super();
54
+
47 55
         this.list = Collections.synchronizedList(new ArrayList<T>());
48 56
     }
49 57
 
50 58
     /**
51 59
      * Instantiates a list model containing the specified list items.
52 60
      *
53
-     * @param list
61
+     * @param list Data to be included in the model
54 62
      */
55 63
     public GenericListModel(final List<T> list) {
64
+        super();
65
+
56 66
         this.list = Collections.synchronizedList(new ArrayList<T>(list));
57 67
     }
58 68
 
@@ -63,7 +73,7 @@ public class GenericListModel<T> extends AbstractListModel {
63 73
     }
64 74
 
65 75
     /**
66
-     * Returns the specified index in the list
76
+     * Returns the specified index in the list.
67 77
      *
68 78
      * @param index Index of the item to return
69 79
      *
@@ -167,7 +177,7 @@ public class GenericListModel<T> extends AbstractListModel {
167 177
      */
168 178
     public boolean remove(final T obj) {
169 179
         final int index = indexOf(obj);
170
-        boolean succes = list.remove(obj);
180
+        final boolean succes = list.remove(obj);
171 181
         if (index >= 0) {
172 182
             fireIntervalRemoved(this, index, index);
173 183
         }
@@ -199,7 +209,8 @@ public class GenericListModel<T> extends AbstractListModel {
199 209
      */
200 210
     public void removeRange(final int start, final int end) {
201 211
         if (start > end) {
202
-            throw new IllegalArgumentException("start must be greater than or equal to end");
212
+            throw new IllegalArgumentException("start must be greater than "
213
+                    + "or equal to end");
203 214
         }
204 215
         for (int i = end; i >= start; i--) {
205 216
             list.remove(i);
@@ -208,7 +219,7 @@ public class GenericListModel<T> extends AbstractListModel {
208 219
     }
209 220
 
210 221
     /**
211
-     * Adds all the objects in the specified collection to this list
222
+     * Adds all the objects in the specified collection to this list.
212 223
      *
213 224
      * @param collection Collection to add
214 225
      */
@@ -219,7 +230,7 @@ public class GenericListModel<T> extends AbstractListModel {
219 230
     /**
220 231
      * Adds all the objects in the specified collection to this list at the
221 232
      * specified index.
222
-     * 
233
+     *
223 234
      * @param index Index to add the items
224 235
      * @param collection Collection to add
225 236
      */

+ 10
- 10
src/com/dmdirc/addons/ui_swing/components/ImageButton.java Просмотреть файл

@@ -33,14 +33,14 @@ import javax.swing.JButton;
33 33
  * Image button.
34 34
  */
35 35
 public class ImageButton extends JButton {
36
-    
36
+
37 37
     /**
38 38
      * A version number for this class. It should be changed whenever the class
39 39
      * structure is changed (or anything else that would prevent serialized
40 40
      * objects being unserialized with the new class).
41 41
      */
42 42
     private static final long serialVersionUID = 2;
43
-    
43
+
44 44
     /**
45 45
      * Creates a new instance of ImageButton.
46 46
      *
@@ -50,7 +50,7 @@ public class ImageButton extends JButton {
50 50
     public ImageButton(final String actionCommand, final Icon icon) {
51 51
         this(actionCommand, icon, icon);
52 52
     }
53
-    
53
+
54 54
     /**
55 55
      * Creates a new instance of ImageButton.
56 56
      *
@@ -58,11 +58,11 @@ public class ImageButton extends JButton {
58 58
      * @param icon Normal icon for the button
59 59
      * @param rolloverIcon Rollover icon for the button
60 60
      */
61
-    public ImageButton(final String actionCommand, final Icon icon, 
61
+    public ImageButton(final String actionCommand, final Icon icon,
62 62
             final Icon rolloverIcon) {
63 63
         this(actionCommand, icon, rolloverIcon, rolloverIcon);
64 64
     }
65
-    
65
+
66 66
     /**
67 67
      * Creates a new instance of ImageButton.
68 68
      *
@@ -71,10 +71,10 @@ public class ImageButton extends JButton {
71 71
      * @param rolloverIcon Rollover icon for the button
72 72
      * @param pressedIcon Pressed icon for the button
73 73
      */
74
-    public ImageButton(final String actionCommand, final Icon icon, 
74
+    public ImageButton(final String actionCommand, final Icon icon,
75 75
             final Icon rolloverIcon, final Icon pressedIcon) {
76 76
         super();
77
-        
77
+
78 78
         setIcon(icon);
79 79
         setRolloverIcon(rolloverIcon);
80 80
         setPressedIcon(pressedIcon);
@@ -84,10 +84,10 @@ public class ImageButton extends JButton {
84 84
         setPreferredSize(new Dimension(16, 0));
85 85
         setActionCommand(actionCommand);
86 86
     }
87
-    
87
+
88 88
     /**
89
-     * Sets all the image buttons icons
90
-     * 
89
+     * Sets all the image buttons icons.
90
+     *
91 91
      * @param icon New icon
92 92
      */
93 93
     public void setIcons(final Icon icon) {

+ 10
- 10
src/com/dmdirc/addons/ui_swing/components/ImageToggleButton.java Просмотреть файл

@@ -33,14 +33,14 @@ import javax.swing.JToggleButton;
33 33
  * Image toggle button.
34 34
  */
35 35
 public class ImageToggleButton extends JToggleButton {
36
-    
36
+
37 37
     /**
38 38
      * A version number for this class. It should be changed whenever the class
39 39
      * structure is changed (or anything else that would prevent serialized
40 40
      * objects being unserialized with the new class).
41 41
      */
42 42
     private static final long serialVersionUID = 2;
43
-    
43
+
44 44
     /**
45 45
      * Creates a new instance of ImageToggleButton.
46 46
      *
@@ -50,7 +50,7 @@ public class ImageToggleButton extends JToggleButton {
50 50
     public ImageToggleButton(final String actionCommand, final Icon icon) {
51 51
         this(actionCommand, icon, icon);
52 52
     }
53
-    
53
+
54 54
     /**
55 55
      * Creates a new instance of ImageToggleButton.
56 56
      *
@@ -58,11 +58,11 @@ public class ImageToggleButton extends JToggleButton {
58 58
      * @param icon Normal icon for the button
59 59
      * @param rolloverIcon Rollover icon for the button
60 60
      */
61
-    public ImageToggleButton(final String actionCommand, final Icon icon, 
61
+    public ImageToggleButton(final String actionCommand, final Icon icon,
62 62
             final Icon rolloverIcon) {
63 63
         this(actionCommand, icon, rolloverIcon, rolloverIcon);
64 64
     }
65
-    
65
+
66 66
     /**
67 67
      * Creates a new instance of ImageToggleButton.
68 68
      *
@@ -71,10 +71,10 @@ public class ImageToggleButton extends JToggleButton {
71 71
      * @param rolloverIcon Rollover icon for the button
72 72
      * @param pressedIcon Pressed icon for the button
73 73
      */
74
-    public ImageToggleButton(final String actionCommand, final Icon icon, 
74
+    public ImageToggleButton(final String actionCommand, final Icon icon,
75 75
             final Icon rolloverIcon, final Icon pressedIcon) {
76 76
         super();
77
-        
77
+
78 78
         setIcon(icon);
79 79
         setRolloverIcon(rolloverIcon);
80 80
         setPressedIcon(pressedIcon);
@@ -85,10 +85,10 @@ public class ImageToggleButton extends JToggleButton {
85 85
         setPreferredSize(new Dimension(16, 0));
86 86
         setActionCommand(actionCommand);
87 87
     }
88
-    
88
+
89 89
     /**
90
-     * Sets all the image buttons icons
91
-     * 
90
+     * Sets all the image buttons icons.
91
+     *
92 92
      * @param icon New icon
93 93
      */
94 94
     public void setIcons(final Icon icon) {

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/ListScroller.java Просмотреть файл

@@ -64,7 +64,7 @@ public class ListScroller implements MouseWheelListener {
64 64
 
65 65
     /**
66 66
      * {@inheritDoc}
67
-     * 
67
+     *
68 68
      * @param e Moust wheel event
69 69
      */
70 70
     @Override

+ 3
- 2
src/com/dmdirc/addons/ui_swing/components/LockedLayer.java Просмотреть файл

@@ -29,6 +29,7 @@
29 29
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 30
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 31
  */
32
+
32 33
 package com.dmdirc.addons.ui_swing.components;
33 34
 
34 35
 import java.awt.Component;
@@ -101,7 +102,7 @@ public class LockedLayer<T extends JComponent> extends
101 102
     /** Effect to apply when locked. */
102 103
     private LayerEffect[] lockedEffects = new LayerEffect[0];
103 104
     /** Focus listener. */
104
-    private final FocusListener focusListener = new FocusListener() {
105
+    private final transient FocusListener focusListener = new FocusListener() {
105 106
 
106 107
         /** {@inheritDoc} */
107 108
         @Override
@@ -232,7 +233,7 @@ public class LockedLayer<T extends JComponent> extends
232 233
 
233 234
     /** {@inheritDoc} */
234 235
     @Override
235
-    protected void paintLayer(final Graphics2D g2, 
236
+    protected void paintLayer(final Graphics2D g2,
236 237
             final JXLayer<? extends T> l) {
237 238
         if (isLocked()) {
238 239
             // Note: this code will be called only if layer changes its size,

+ 4
- 4
src/com/dmdirc/addons/ui_swing/components/LoggingSwingWorker.java Просмотреть файл

@@ -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
@@ -47,7 +47,7 @@ public abstract class LoggingSwingWorker<T, V> extends SwingWorker<T, V> {
47 47
         try {
48 48
             get();
49 49
         } catch (InterruptedException ex) {
50
-        //Ignore
50
+            //Ignore
51 51
         } catch (ExecutionException ex) {
52 52
             Logger.appError(ErrorLevel.MEDIUM, ex.getMessage(), ex);
53 53
         }

+ 3
- 1
src/com/dmdirc/addons/ui_swing/components/NewlinesDocumentFilter.java Просмотреть файл

@@ -55,8 +55,10 @@ public class NewlinesDocumentFilter extends DocumentFilter {
55 55
 
56 56
     /**
57 57
      * Removes new lines from the text.
58
-     * 
58
+     *
59 59
      * @param text Text to sanitise
60
+     *
61
+     * @return Sanitised string
60 62
      */
61 63
     private String sanitise(final String text) {
62 64
         if (text.contains("\n")) {

+ 32
- 29
src/com/dmdirc/addons/ui_swing/components/NickList.java Просмотреть файл

@@ -1,5 +1,4 @@
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
@@ -57,7 +56,7 @@ public class NickList extends JScrollPane implements ConfigChangeListener,
57 56
      */
58 57
     private static final long serialVersionUID = 10;
59 58
     /** Nick list. */
60
-    private JList nickList;
59
+    private final JList nickList;
61 60
     /** Parent frame. */
62 61
     private final ChannelFrame frame;
63 62
     /** Config. */
@@ -91,7 +90,8 @@ public class NickList extends JScrollPane implements ConfigChangeListener,
91 90
         config.addChangeListener("ui", "nickListAltBackgroundColour", this);
92 91
 
93 92
         nickList.setCellRenderer(new NicklistRenderer(config, nickList));
94
-        nickList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
93
+        nickList.setSelectionMode(
94
+                ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
95 95
 
96 96
         nickList.addMouseListener(this);
97 97
 
@@ -167,28 +167,30 @@ public class NickList extends JScrollPane implements ConfigChangeListener,
167 167
      */
168 168
     @Override
169 169
     public void processMouseEvent(final MouseEvent e) {
170
-        if (e.getSource() == nickList && nickList.getMousePosition() != null &&
171
-                getMousePosition() != null) {
172
-            if (checkCursorInSelectedCell() || selectNickUnderCursor()) {
173
-                if (e.isPopupTrigger()) {
174
-                    final Object[] values = nickList.getSelectedValues();
175
-                    final StringBuilder builder = new StringBuilder();
176
-
177
-                    for (Object value : values) {
178
-                        if (builder.length() > 0) {
179
-                            builder.append("\n");
180
-                        }
181
-
182
-                        builder.append(((ChannelClientInfo) value).getClient().getNickname());
183
-                    }
184
-
185
-                    frame.showPopupMenu(new ClickTypeValue(ClickType.NICKNAME,
186
-                            builder.toString()), new Point(e.getXOnScreen(),
187
-                            e.getYOnScreen()));
170
+        if (!e.isPopupTrigger()
171
+                || e.getSource() != nickList
172
+                || getMousePosition() == null
173
+                || nickList.getMousePosition() != null) {
174
+            return;
175
+        }
176
+        if (checkCursorInSelectedCell() || selectNickUnderCursor()) {
177
+            final Object[] values = nickList.getSelectedValues();
178
+            final StringBuilder builder = new StringBuilder();
179
+
180
+            for (Object value : values) {
181
+                if (builder.length() > 0) {
182
+                    builder.append("\n");
188 183
                 }
189
-            } else {
190
-                nickList.clearSelection();
184
+
185
+                builder.append(((ChannelClientInfo) value).getClient()
186
+                        .getNickname());
191 187
             }
188
+
189
+            frame.showPopupMenu(new ClickTypeValue(ClickType.NICKNAME,
190
+                    builder.toString()), new Point(e.getXOnScreen(),
191
+                    e.getYOnScreen()));
192
+        } else {
193
+            nickList.clearSelection();
192 194
         }
193 195
 
194 196
         super.processMouseEvent(e);
@@ -243,11 +245,11 @@ public class NickList extends JScrollPane implements ConfigChangeListener,
243 245
     /** {@inheritDoc} */
244 246
     @Override
245 247
     public void configChanged(final String domain, final String key) {
246
-        if ("nickListAltBackgroundColour".equals(key) ||
247
-                "nicklistbackgroundcolour".equals(key) ||
248
-                "backgroundcolour".equals(key) ||
249
-                "nicklistforegroundcolour".equals(key) ||
250
-                "foregroundcolour".equals(key)) {
248
+        if ("nickListAltBackgroundColour".equals(key)
249
+                || "nicklistbackgroundcolour".equals(key)
250
+                || "backgroundcolour".equals(key)
251
+                || "nicklistforegroundcolour".equals(key)
252
+                || "foregroundcolour".equals(key)) {
251 253
             nickList.setBackground(config.getOptionColour(
252 254
                     "ui", "nicklistbackgroundcolour",
253 255
                     "ui", "backgroundcolour"));
@@ -256,7 +258,8 @@ public class NickList extends JScrollPane implements ConfigChangeListener,
256 258
                     "ui", "foregroundcolour"));
257 259
             nickList.repaint();
258 260
         }
259
-        nickList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
261
+        nickList.setSelectionMode(
262
+                ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
260 263
     }
261 264
 
262 265
     /** {@inheritDoc} */

+ 9
- 14
src/com/dmdirc/addons/ui_swing/components/NicklistComparator.java Просмотреть файл

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25 25
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
26
+
26 27
 import java.io.Serializable;
27 28
 import java.util.Comparator;
28 29
 
@@ -37,17 +38,11 @@ public final class NicklistComparator implements Comparator<ChannelClientInfo>,
37 38
      * objects being unserialized with the new class).
38 39
      */
39 40
     private static final long serialVersionUID = 1;
40
-    
41
-    /**
42
-     * whether to sort the nicklist by modes.
43
-     */
41
+    /** whether to sort the nicklist by modes. */
44 42
     private final boolean sortByMode;
45
-    
46
-    /**
47
-     * whether to sort the nicklist by case.
48
-     */
43
+    /** whether to sort the nicklist by case. */
49 44
     private final boolean sortByCase;
50
-    
45
+
51 46
     /**
52 47
      * Creates a new instance of NicklistComparator.
53 48
      * @param newSortByMode sorts by channel mode of the user
@@ -58,7 +53,7 @@ public final class NicklistComparator implements Comparator<ChannelClientInfo>,
58 53
         this.sortByMode = newSortByMode;
59 54
         this.sortByCase = newSortByCase;
60 55
     }
61
-    
56
+
62 57
     /**
63 58
      * Compares two ChannelClient objects based on the settings the comparator
64 59
      * was initialised with.
@@ -70,9 +65,6 @@ public final class NicklistComparator implements Comparator<ChannelClientInfo>,
70 65
     @Override
71 66
     public int compare(final ChannelClientInfo client1,
72 67
             final ChannelClientInfo client2) {
73
-        final String nickname1 = client1.getClient().getNickname();
74
-        final String nickname2 = client2.getClient().getNickname();
75
-        
76 68
         if (sortByMode) {
77 69
             final int modeCom = client2.compareTo(client1);
78 70
 
@@ -80,7 +72,10 @@ public final class NicklistComparator implements Comparator<ChannelClientInfo>,
80 72
                 return modeCom;
81 73
             }
82 74
         }
83
-        
75
+
76
+        final String nickname1 = client1.getClient().getNickname();
77
+        final String nickname2 = client2.getClient().getNickname();
78
+
84 79
         if (sortByCase) {
85 80
             return nickname1.compareTo(nickname2);
86 81
         } else {

+ 7
- 10
src/com/dmdirc/addons/ui_swing/components/NicklistListModel.java Просмотреть файл

@@ -58,7 +58,8 @@ public final class NicklistListModel extends AbstractListModel implements
58 58
      * @param config Config manager
59 59
      */
60 60
     public NicklistListModel(final ConfigManager config) {
61
-        this(config, Collections.synchronizedList(new ArrayList<ChannelClientInfo>()));
61
+        this(config, Collections.synchronizedList(
62
+                new ArrayList<ChannelClientInfo>()));
62 63
     }
63 64
 
64 65
     /**
@@ -122,13 +123,11 @@ public final class NicklistListModel extends AbstractListModel implements
122 123
      * @return boolean success
123 124
      */
124 125
     public boolean replace(final Collection<ChannelClientInfo> clients) {
125
-        boolean returnValue = false;
126
-
127 126
         nicknames.clear();
128
-        returnValue = nicknames.addAll(clients);
127
+        nicknames.addAll(clients);
129 128
         sort();
130 129
 
131
-        return returnValue;
130
+        return true;
132 131
     }
133 132
 
134 133
     /**
@@ -139,12 +138,10 @@ public final class NicklistListModel extends AbstractListModel implements
139 138
      * @return boolean success
140 139
      */
141 140
     public boolean add(final ChannelClientInfo client) {
142
-        boolean returnValue = false;
143
-
144
-        returnValue = nicknames.add(client);
141
+        nicknames.add(client);
145 142
         sort();
146 143
 
147
-        return returnValue;
144
+        return true;
148 145
     }
149 146
 
150 147
     /**
@@ -197,4 +194,4 @@ public final class NicklistListModel extends AbstractListModel implements
197 194
 
198 195
         sort();
199 196
     }
200
-}
197
+}

+ 5
- 0
src/com/dmdirc/addons/ui_swing/components/NoFocusButton.java Просмотреть файл

@@ -33,6 +33,11 @@ import javax.swing.JButton;
33 33
  */
34 34
 class NoFocusButton extends JButton {
35 35
 
36
+    /**
37
+     * A version number for this class. It should be changed whenever the class
38
+     * structure is changed (or anything else that would prevent serialized
39
+     * objects being unserialized with the new class).
40
+     */
36 41
     private static final long serialVersionUID = -8282006158788878000L;
37 42
 
38 43
     /**

+ 18
- 8
src/com/dmdirc/addons/ui_swing/components/OptionalJSpinner.java Просмотреть файл

@@ -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
@@ -44,9 +43,17 @@ import net.miginfocom.swing.MigLayout;
44 43
 public class OptionalJSpinner extends JPanel implements ActionListener,
45 44
         ChangeListener {
46 45
 
46
+    /**
47
+     * A version number for this class. It should be changed whenever the class
48
+     * structure is changed (or anything else that would prevent serialized
49
+     * objects being unserialized with the new class).
50
+     */
47 51
     private static final long serialVersionUID = -2867331420063503447L;
52
+    /** Composite spinner. */
48 53
     private final JSpinner spinner;
54
+    /** Composite checkbox. */
49 55
     private final JCheckBox checkbox;
56
+    /** Our listeners. */
50 57
     private final ListenerList listeners;
51 58
 
52 59
     /**
@@ -81,19 +88,21 @@ public class OptionalJSpinner extends JPanel implements ActionListener,
81 88
      * @param enabled Initial selected state
82 89
      */
83 90
     public OptionalJSpinner(final SpinnerModel model, final boolean enabled) {
91
+        super();
92
+
84 93
         checkbox = new JCheckBox("", enabled);
85 94
         spinner = new JSpinner(model);
86 95
         listeners = new ListenerList();
87 96
 
88 97
         spinner.setEnabled(enabled);
89 98
 
90
-        spinner.addChangeListener(this);
91
-        checkbox.addActionListener(this);
92
-
93 99
         setLayout(new MigLayout("fill"));
94 100
 
95 101
         add(checkbox, "");
96 102
         add(spinner, "growx, pushx");
103
+
104
+        spinner.addChangeListener(this);
105
+        checkbox.addActionListener(this);
97 106
     }
98 107
 
99 108
     /**
@@ -123,7 +132,7 @@ public class OptionalJSpinner extends JPanel implements ActionListener,
123 132
      * deal with this.
124 133
      *
125 134
      * This method simply delegates to the model. It is equivalent to:
126
-     * 
135
+     *
127 136
      * getModel().getValue()
128 137
      *
129 138
      * @return The current value
@@ -188,6 +197,7 @@ public class OptionalJSpinner extends JPanel implements ActionListener,
188 197
         listeners.remove(ChangeListener.class, listener);
189 198
     }
190 199
 
200
+    /** Fires change listeners. */
191 201
     private void fireChangeListener() {
192 202
         for (ChangeListener listener : listeners.get(ChangeListener.class)) {
193 203
             listener.stateChanged(new ChangeEvent(this));

+ 13
- 7
src/com/dmdirc/addons/ui_swing/components/PackingTable.java Просмотреть файл

@@ -30,6 +30,7 @@ import javax.swing.table.DefaultTableModel;
30 30
 import javax.swing.table.TableColumn;
31 31
 import javax.swing.table.TableColumnModel;
32 32
 import javax.swing.table.TableModel;
33
+
33 34
 import net.miginfocom.layout.PlatformDefaults;
34 35
 
35 36
 /**
@@ -51,7 +52,7 @@ public class PackingTable extends JTable {
51 52
     /** Border padding. */
52 53
     private final int padding = (int) PlatformDefaults.getUnitValueX("related").
53 54
             getValue();
54
-    
55
+
55 56
     /**
56 57
      * Creates a new packing table.
57 58
      *
@@ -72,7 +73,8 @@ public class PackingTable extends JTable {
72 73
      * @param cols Column data
73 74
      * @param editable Whether the table should be editable or not
74 75
      * @param scrollPane Scrollpane parent
75
-     * @param lastColumnFit Should the last column fit text (true), or fit viewport (false).
76
+     * @param lastColumnFit Should the last column fit text (true),
77
+     * or fit viewport (false).
76 78
      */
77 79
     public PackingTable(final Object[][] rows, final Object[] cols,
78 80
             final boolean editable, final JScrollPane scrollPane,
@@ -80,7 +82,7 @@ public class PackingTable extends JTable {
80 82
         this(new DefaultTableModel(rows, cols), editable, scrollPane,
81 83
                 lastColumnFit);
82 84
     }
83
-    
85
+
84 86
     /**
85 87
      * Creates a new packing table.
86 88
      *
@@ -99,7 +101,8 @@ public class PackingTable extends JTable {
99 101
      * @param tableModel Table data model
100 102
      * @param editable Whether the table should be editable or not
101 103
      * @param scrollPane Scrollpane parent
102
-     * @param lastColumnFit Should the last column fit text (true), or fit viewport (false).
104
+     * @param lastColumnFit Should the last column fit text (true),
105
+     * or fit viewport (false).
103 106
      */
104 107
     public PackingTable(final TableModel tableModel, final boolean editable,
105 108
             final JScrollPane scrollPane, final boolean lastColumnFit) {
@@ -143,9 +146,11 @@ public class PackingTable extends JTable {
143 146
             return;
144 147
         }
145 148
 
146
-        final TableColumnModel myColumnModel = getTableHeader().getColumnModel();
149
+        final TableColumnModel myColumnModel = getTableHeader()
150
+                .getColumnModel();
147 151
         final int numCols = myColumnModel.getColumnCount();
148
-        final int totalSize = (int) (scrollPane.getViewportBorderBounds().width * 0.99);
152
+        final int totalSize = (int) (scrollPane.getViewportBorderBounds()
153
+                .width * 0.99);
149 154
         final int[] widths = new int[numCols];
150 155
         int widthsTotal = 0;
151 156
 
@@ -153,7 +158,8 @@ public class PackingTable extends JTable {
153 158
         if (!lastColumnFit) {
154 159
             checkNumCols--;
155 160
         }
156
-        for (int i = 0; i < checkNumCols; i++) { //NOPMD im not copying a damn array fgs
161
+        
162
+        for (int i = 0; i < checkNumCols; i++) { //NOPMD I'm not copying
157 163
             widths[i] = getWidth(i);
158 164
             widthsTotal += widths[i];
159 165
         }

+ 4
- 4
src/com/dmdirc/addons/ui_swing/components/ParamModePanel.java Просмотреть файл

@@ -83,8 +83,8 @@ public final class ParamModePanel extends JPanel implements ActionListener {
83 83
         text = "Mode " + mode + ": ";
84 84
 
85 85
         if (configManager.hasOptionString("server", "mode" + mode)) {
86
-            text = configManager.getOption("server", "mode" + mode) +
87
-                    " [+"+mode+"]: ";
86
+            text = configManager.getOption("server", "mode" + mode)
87
+                    + " [+" + mode + "]: ";
88 88
         }
89 89
 
90 90
         checkBox = new JCheckBox(text, state);
@@ -154,7 +154,7 @@ public final class ParamModePanel extends JPanel implements ActionListener {
154 154
 
155 155
     /**
156 156
      * Returns the checkbox component.
157
-     * 
157
+     *
158 158
      * @return Checkbox component.
159 159
      */
160 160
     public Component getCheckboxComponent() {
@@ -163,7 +163,7 @@ public final class ParamModePanel extends JPanel implements ActionListener {
163 163
 
164 164
     /**
165 165
      * Returns the value component.
166
-     * 
166
+     *
167 167
      * @return Value component
168 168
      */
169 169
     public Component getValueComponent() {

+ 17
- 11
src/com/dmdirc/addons/ui_swing/components/SanitisedFilenameFilter.java Просмотреть файл

@@ -30,48 +30,54 @@ import javax.swing.text.DocumentFilter;
30 30
  * Filters input to create valid filenames.
31 31
  */
32 32
 public class SanitisedFilenameFilter extends DocumentFilter {
33
-    
33
+
34 34
     /** Invalid filename characters. */
35 35
     private static final String INVALID_CHARS = "^[^\\w\\.\\s\\-\\#\\&\\_]";
36
-    
36
+
37 37
     /** Creates a new instance of SanitisedFilenameFilter. */
38 38
     public SanitisedFilenameFilter() {
39 39
         super();
40 40
     }
41
-    
41
+
42 42
     /** {@inheritDoc} */
43 43
     @Override
44 44
     public void insertString(final DocumentFilter.FilterBypass fb,
45 45
             final int offset, final String string, final AttributeSet attr)
46 46
             throws BadLocationException {
47
-        
47
+
48 48
         if (string == null || string.isEmpty()) {
49 49
             return;
50 50
         } else {
51 51
             replace(fb, offset, string.length(), string, attr);
52 52
         }
53 53
     }
54
-    
54
+
55 55
     /** {@inheritDoc} */
56 56
     @Override
57 57
     public void remove(final DocumentFilter.FilterBypass fb, final int offset,
58 58
             final int length) throws BadLocationException {
59
-        
59
+
60 60
         replace(fb, offset, length, "", null);
61 61
     }
62
-    
62
+
63 63
     /** {@inheritDoc} */
64 64
     @Override
65 65
     public void replace(final DocumentFilter.FilterBypass fb, final int offset,
66 66
             final int length, final String text, final AttributeSet attrs)
67 67
             throws BadLocationException {
68
-        
68
+
69 69
         fb.replace(offset, length, sanitise(text), attrs);
70 70
     }
71
-    
72
-    /** Sanitises the proposed value. */
71
+
72
+    /**
73
+     * Sanitises the proposed value.
74
+     *
75
+     * @param proposedValue String to sanitise
76
+     *
77
+     * @return Sanitised string
78
+     */
73 79
     private String sanitise(final String proposedValue) {
74 80
         return proposedValue.replaceAll(INVALID_CHARS, "");
75 81
     }
76
-    
82
+
77 83
 }

+ 7
- 5
src/com/dmdirc/addons/ui_swing/components/SortedListModel.java Просмотреть файл

@@ -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
@@ -24,6 +23,7 @@
24 23
 package com.dmdirc.addons.ui_swing.components;
25 24
 
26 25
 import java.util.Comparator;
26
+
27 27
 import javax.swing.DefaultListModel;
28 28
 
29 29
 /**
@@ -40,7 +40,7 @@ public class SortedListModel<T> extends DefaultListModel {
40 40
      */
41 41
     private static final long serialVersionUID = 1L;
42 42
     /** Comparator. */
43
-    private Comparator<T> comparator;
43
+    private final Comparator<T> comparator;
44 44
 
45 45
     /**
46 46
      * Creates a new sorted list model using the specified comparator.
@@ -48,6 +48,8 @@ public class SortedListModel<T> extends DefaultListModel {
48 48
      * @param comparator Comparator
49 49
      */
50 50
     public SortedListModel(final Comparator<T> comparator) {
51
+        super();
52
+        
51 53
         this.comparator = comparator;
52 54
     }
53 55
 

+ 9
- 137
src/com/dmdirc/addons/ui_swing/components/SplitPane.java Просмотреть файл

@@ -50,11 +50,10 @@ public class SplitPane extends JSplitPane implements ConfigChangeListener {
50 50
 
51 51
     /** Orientation type . */
52 52
     public enum Orientation {
53
-
54 53
         /** Horizontal orientation. */
55 54
         HORIZONTAL,
56 55
         /** Vertical orientation. */
57
-        VERTICAL
56
+        VERTICAL;
58 57
     }
59 58
 
60 59
     /**
@@ -62,65 +61,17 @@ public class SplitPane extends JSplitPane implements ConfigChangeListener {
62 61
      * split, two null components and snapping to the left component.
63 62
      */
64 63
     public SplitPane() {
65
-        this(Orientation.HORIZONTAL);
64
+        this(Orientation.HORIZONTAL, null, null);
66 65
     }
67 66
 
68 67
     /**
69 68
      * Instantiates a new snapping split pane. Defaults to using a horizontal
70 69
      * split, two null components and snapping to the left component.
71 70
      *
72
-     * @param snapDistance Distance to around the preferred size
73
-     */
74
-    public SplitPane(final int snapDistance) {
75
-        this(Orientation.HORIZONTAL, snapDistance);
76
-    }
77
-
78
-    /**
79
-     * Instantiates a new snapping split pane. Defaults to using a horizontal
80
-     * split and two null components.
81
-     *
82
-     * @param leftComponentSnap Snap to the preferred size of the left component?
83
-     */
84
-    public SplitPane(final boolean leftComponentSnap) {
85
-        this(Orientation.HORIZONTAL, leftComponentSnap, 10);
86
-    }
87
-
88
-    /**
89
-     * Instantiates a new snapping split pane. Defaults to using a horizontal
90
-     * split and two null components.
91
-     *
92
-     * @param leftComponentSnap Snap to the preferred size of the left component?
93
-     * @param snapDistance Distance to around the preferred size
94
-     */
95
-    public SplitPane(final boolean leftComponentSnap,
96
-            final int snapDistance) {
97
-        this(Orientation.HORIZONTAL, leftComponentSnap, snapDistance);
98
-    }
99
-
100
-    /**
101
-     * Instantiates a new snapping split pane. Defaults to using two null
102
-     * components and snapping to the left component.
103
-     *
104 71
      * @param orientation Split pane orientation
105
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
106
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
107 72
      */
108 73
     public SplitPane(final Orientation orientation) {
109
-        this(orientation, null, null, 10);
110
-    }
111
-
112
-    /**
113
-     * Instantiates a new snapping split pane. Defaults to using two null
114
-     * components and snapping to the left component.
115
-     *
116
-     * @param orientation Split pane orientation
117
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
118
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
119
-     * @param snapDistance Distance to around the preferred size
120
-     */
121
-    public SplitPane(final Orientation orientation,
122
-            final int snapDistance) {
123
-        this(orientation, null, null, snapDistance);
74
+        this(orientation, null, null);
124 75
     }
125 76
 
126 77
     /**
@@ -130,97 +81,18 @@ public class SplitPane extends JSplitPane implements ConfigChangeListener {
130 81
      * @param orientation Split pane orientation
131 82
      * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
132 83
      * <code>JSplitPane.VERTICAL_SPLIT</code>
133
-     * @param leftComponentSnap Snap to the preferred size of the left component?
134
-     */
135
-    public SplitPane(final Orientation orientation,
136
-            final boolean leftComponentSnap) {
137
-        this(orientation, null, null, leftComponentSnap, 10);
138
-    }
139
-
140
-    /**
141
-     * Instantiates a new snapping split pane. Defaults to using two null
142
-     * components.
143
-     *
144
-     * @param orientation Split pane orientation
145
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
146
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
147
-     * @param leftComponentSnap Snap to the preferred size of the left component?
148
-     * @param snapDistance Distance to around the preferred size
149
-     */
150
-    public SplitPane(final Orientation orientation,
151
-            final boolean leftComponentSnap, final int snapDistance) {
152
-        this(orientation, null, null, leftComponentSnap, snapDistance);
153
-    }
154
-
155
-    /**
156
-     * Instantiates a new snapping split pane. Defaults to using two null
157
-     * components and snapping to the left component.
158
-     *
159
-     * @param orientation Split pane orientation
160
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
161
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
162 84
      * @param leftComponent left component
163 85
      * @param rightComponent right component
164 86
      */
165 87
     public SplitPane(final Orientation orientation,
166 88
             final Component leftComponent, final Component rightComponent) {
167
-        this(orientation, leftComponent, rightComponent, true, 10);
168
-    }
169
-
170
-    /**
171
-     * Instantiates a new snapping split pane. Defaults to using two null
172
-     * components and snapping to the left component.
173
-     *
174
-     * @param orientation Split pane orientation
175
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
176
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
177
-     * @param leftComponent left component
178
-     * @param rightComponent right component
179
-     * @param snapDistance Distance to around the preferred size
180
-     */
181
-    public SplitPane(final Orientation orientation,
182
-            final Component leftComponent, final Component rightComponent,
183
-            final int snapDistance) {
184
-        this(orientation, leftComponent, rightComponent, true, snapDistance);
185
-    }
186
-
187
-    /**
188
-     * Instantiates a new snapping split pane. Defaults to using two null
189
-     * components.
190
-     *
191
-     * @param orientation Split pane orientation
192
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
193
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
194
-     * @param leftComponent left component
195
-     * @param rightComponent right component
196
-     * @param leftComponentSnap Snap to the preferred size of the left component?
197
-     */
198
-    public SplitPane(final Orientation orientation,
199
-            final Component leftComponent, final Component rightComponent,
200
-            final boolean leftComponentSnap) {
201
-        this(orientation, leftComponent, rightComponent, leftComponentSnap, 10);
202
-    }
203
-
204
-    /**
205
-     * Instantiates a new snapping split pane. Defaults to using two null
206
-     * components.
207
-     *
208
-     * @param orientation Split pane orientation
209
-     * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
210
-     * <code>JSplitPane.VERTICAL_SPLIT</code>
211
-     * @param leftComponent left component
212
-     * @param rightComponent right component
213
-     * @param leftComponentSnap Snap to the preferred size of the left component?
214
-     * @param snapDistance Distance to around the preferred size
215
-     */
216
-    public SplitPane(final Orientation orientation,
217
-            final Component leftComponent, final Component rightComponent,
218
-            final boolean leftComponentSnap, final int snapDistance) {
219
-        super((orientation.equals(Orientation.HORIZONTAL)) ? HORIZONTAL_SPLIT : VERTICAL_SPLIT,
89
+        super((orientation.equals(Orientation.HORIZONTAL))
90
+                ? HORIZONTAL_SPLIT : VERTICAL_SPLIT,
220 91
                 true, leftComponent, rightComponent);
221 92
 
222 93
         config = IdentityManager.getGlobalConfig();
223
-        useOneTouchExpandable = config.getOptionBool("ui", "useOneTouchExpandable");
94
+        useOneTouchExpandable = config.getOptionBool(
95
+                "ui", "useOneTouchExpandable");
224 96
 
225 97
         setOneTouchExpandable(useOneTouchExpandable);
226 98
         setContinuousLayout(true);
@@ -234,7 +106,8 @@ public class SplitPane extends JSplitPane implements ConfigChangeListener {
234 106
     /** {@inheritDoc} */
235 107
     @Override
236 108
     public void configChanged(final String domain, final String key) {
237
-        useOneTouchExpandable = config.getOptionBool("ui", "useOneTouchExpandable");
109
+        useOneTouchExpandable = config.getOptionBool(
110
+                "ui", "useOneTouchExpandable");
238 111
 
239 112
         UIUtilities.invokeLater(new Runnable() {
240 113
 
@@ -246,4 +119,3 @@ public class SplitPane extends JSplitPane implements ConfigChangeListener {
246 119
         });
247 120
     }
248 121
 }
249
-

+ 5
- 2
src/com/dmdirc/addons/ui_swing/components/SwingSearchBar.java Просмотреть файл

@@ -294,7 +294,8 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
294 294
             if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
295 295
                 close();
296 296
             } else if (event.getKeyCode() == KeyEvent.VK_ENTER) {
297
-                search(Direction.UP, searchBox.getText(), caseCheck.isSelected());
297
+                search(Direction.UP, searchBox.getText(),
298
+                        caseCheck.isSelected());
298 299
             } else if (event.getKeyCode() != KeyEvent.VK_F3 && event.
299 300
                     getKeyCode() != KeyEvent.VK_F) {
300 301
                 line = parent.getTextPane().getLastVisibleLine();
@@ -408,6 +409,7 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
408 409
         setColours();
409 410
     }
410 411
 
412
+    /** Sets the colours used in this document. */
411 413
     private void setColours() {
412 414
         searchBox.setForeground(IdentityManager.getGlobalConfig().
413 415
                 getOptionColour("ui", "foregroundcolour"));
@@ -443,7 +445,8 @@ class SearchValidator implements Validator<String> {
443 445
 
444 446
     /**
445 447
      * Sets whether this validator validates.
446
-     * @param validates
448
+     *
449
+     * @param validates Does this search bar validate?
447 450
      */
448 451
     public void setValidates(final boolean validates) {
449 452
         this.validates = validates;

+ 3
- 8
src/com/dmdirc/addons/ui_swing/components/TitlePanel.java Просмотреть файл

@@ -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
@@ -45,8 +44,6 @@ public class TitlePanel extends JPanel {
45 44
     private static final long serialVersionUID = -4026633984970698130L;
46 45
     /** Title label. */
47 46
     private JLabel title;
48
-    /** Title border. */
49
-    final Border border;
50 47
 
51 48
     /**
52 49
      * Instantiates a new title panel.
@@ -75,8 +72,6 @@ public class TitlePanel extends JPanel {
75 72
     public TitlePanel(final Border border, final String text) {
76 73
         super(new MigLayout());
77 74
 
78
-        this.border = border;
79
-
80 75
         title = new JLabel(text);
81 76
         title.setFont(title.getFont().deriveFont((float) (title.getFont().
82 77
                 getSize() * 1.5)));

+ 0
- 1
src/com/dmdirc/addons/ui_swing/components/ToolTipPanel.java Просмотреть файл

@@ -1,5 +1,4 @@
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

+ 11
- 4
src/com/dmdirc/addons/ui_swing/components/TopicBar.java Просмотреть файл

@@ -28,7 +28,7 @@ import com.dmdirc.Channel;
28 28
 import com.dmdirc.Topic;
29 29
 import com.dmdirc.addons.ui_swing.SwingController;
30 30
 import com.dmdirc.addons.ui_swing.UIUtilities;
31
-import com.dmdirc.addons.ui_swing.actions.NoNewlinesPasteAction;
31
+import com.dmdirc.addons.ui_swing.actions.ReplacePasteAction;
32 32
 import com.dmdirc.addons.ui_swing.components.frames.ChannelFrame;
33 33
 import com.dmdirc.addons.ui_swing.components.text.WrapEditorKit;
34 34
 import com.dmdirc.config.IdentityManager;
@@ -117,7 +117,7 @@ public class TopicBar extends JComponent implements ActionListener,
117 117
                 new NewlinesDocumentFilter());
118 118
 
119 119
         topicText.getActionMap().put("paste-from-clipboard",
120
-                new NoNewlinesPasteAction());
120
+                new ReplacePasteAction("(\r\n|\n|\r)", " "));
121 121
         topicEdit = new ImageButton("edit", IconManager.getIconManager().
122 122
                 getIcon("edit-inactive"), IconManager.getIconManager().
123 123
                 getIcon("edit"));
@@ -153,6 +153,11 @@ public class TopicBar extends JComponent implements ActionListener,
153 153
         topicText.getActionMap().put("enterButton", new AbstractAction(
154 154
                 "enterButton") {
155 155
 
156
+            /**
157
+             * A version number for this class. It should be changed whenever the class
158
+             * structure is changed (or anything else that would prevent serialized
159
+             * objects being unserialized with the new class).
160
+             */
156 161
             private static final long serialVersionUID = 1;
157 162
 
158 163
             /** {@inheritDoc} */
@@ -255,9 +260,11 @@ public class TopicBar extends JComponent implements ActionListener,
255 260
      * Commits a topic edit to the parent channel.
256 261
      */
257 262
     private void commitTopicEdit() {
258
-        if ((channel.getCurrentTopic() == null && !topicText.getText().isEmpty())
263
+        if ((channel.getCurrentTopic() == null
264
+                && !topicText.getText().isEmpty())
259 265
                 || (channel.getCurrentTopic() != null
260
-                && !channel.getCurrentTopic().getTopic().equals(topicText.getText()))) {
266
+                && !channel.getCurrentTopic().getTopic()
267
+                .equals(topicText.getText()))) {
261 268
             channel.setTopic(topicText.getText());
262 269
         }
263 270
         ((ChannelFrame) controller.getWindowFactory().getSwingWindow(channel))

+ 12
- 13
src/com/dmdirc/addons/ui_swing/components/URLProtocolPanel.java Просмотреть файл

@@ -89,7 +89,8 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
89 89
      * @param useInsets Show insets?
90 90
      * @param urlHandler The URL Handler to use to handle clicked links
91 91
      */
92
-    public URLProtocolPanel(final URI url, final boolean useInsets, final URLHandler urlHandler) {
92
+    public URLProtocolPanel(final URI url, final boolean useInsets,
93
+            final URLHandler urlHandler) {
93 94
         super();
94 95
 
95 96
         this.uri = url;
@@ -107,7 +108,8 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
107 108
         commandPath = new JTextField();
108 109
         optionType = new ButtonGroup();
109 110
         dmdirc = new JRadioButton("Use DMDirc");
110
-        browser = new JRadioButton("Use browser (or system registered handler)");
111
+        browser = new JRadioButton(
112
+                "Use browser (or system registered handler)");
111 113
         mail = new JRadioButton("Use mail client");
112 114
         custom = new JRadioButton("Custom command");
113 115
         subsLabel = new JLabel();
@@ -128,7 +130,7 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
128 130
             "password"
129 131
         }));
130 132
         subsPanel.setVisible(custom.isSelected());
131
-        
133
+
132 134
         updateSelection();
133 135
     }
134 136
 
@@ -173,20 +175,17 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
173 175
      * @return Selected value
174 176
      */
175 177
     public String getSelection() {
176
-        final String value;
177 178
         if (optionType.getSelection() == dmdirc.getModel()) {
178
-            value = "DMDIRC";
179
+            return "DMDIRC";
179 180
         } else if (optionType.getSelection() == browser.getModel()) {
180
-            value = "BROWSER";
181
+            return "BROWSER";
181 182
         } else if (optionType.getSelection() == mail.getModel()) {
182
-            value = "MAIL";
183
+            return "MAIL";
183 184
         } else if (optionType.getSelection() == custom.getModel()) {
184
-            value = commandPath.getText();
185
+            return commandPath.getText();
185 186
         } else {
186
-            value = "";
187
+            return "";
187 188
         }
188
-
189
-        return value;
190 189
     }
191 190
 
192 191
     /**
@@ -252,8 +251,8 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
252 251
             final JFileChooser fileChooser = new JFileChooser();
253 252
             fileChooser.addChoosableFileFilter(new ExecutableFileFilter());
254 253
             fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
255
-            if (fileChooser.showDialog(this, "Select") ==
256
-                    JFileChooser.APPROVE_OPTION) {
254
+            if (fileChooser.showDialog(this, "Select") 
255
+                    == JFileChooser.APPROVE_OPTION) {
257 256
                 commandPath.setText(fileChooser.getSelectedFile().toString());
258 257
             }
259 258
         } else {

+ 1
- 2
src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java Просмотреть файл

@@ -189,8 +189,7 @@ public final class ChannelFrame extends InputTextFrame implements ActionListener
189 189
         topicBar.setVisible(getContainer().getConfigManager().getOptionBool(
190 190
                 getController().getDomain(), "showtopicbar"));
191 191
 
192
-        splitPane = new SplitPane(
193
-                SplitPane.Orientation.HORIZONTAL, false);
192
+        splitPane = new SplitPane(SplitPane.Orientation.HORIZONTAL);
194 193
 
195 194
         getContentPane().setLayout(new MigLayout(
196 195
                 "fill, ins 0, hidemode 3, wrap 1"));

+ 8
- 8
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicDisplayPane.java Просмотреть файл

@@ -1,17 +1,17 @@
1 1
 /*
2
- * 
2
+ *
3 3
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
4
+ *
5 5
  * Permission is hereby granted, free of charge, to any person obtaining a copy
6 6
  * of this software and associated documentation files (the "Software"), to deal
7 7
  * in the Software without restriction, including without limitation the rights
8 8
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 9
  * copies of the Software, and to permit persons to whom the Software is
10 10
  * furnished to do so, subject to the following conditions:
11
- * 
11
+ *
12 12
  * The above copyright notice and this permission notice shall be included in
13 13
  * all copies or substantial portions of the Software.
14
- * 
14
+ *
15 15
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 16
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 17
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -26,7 +26,7 @@ package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
26 26
 import com.dmdirc.Channel;
27 27
 import com.dmdirc.Topic;
28 28
 import com.dmdirc.addons.ui_swing.UIUtilities;
29
-import com.dmdirc.addons.ui_swing.actions.NoNewlinesPasteAction;
29
+import com.dmdirc.addons.ui_swing.actions.ReplacePasteAction;
30 30
 import com.dmdirc.addons.ui_swing.actions.TopicEnterAction;
31 31
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputHandler;
32 32
 import com.dmdirc.addons.ui_swing.components.inputfields.TextAreaInputField;
@@ -109,9 +109,9 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
109 109
         handler.setTypes(true, false, true, false);
110 110
         handler.setTabCompleter(channel.getTabCompleter());
111 111
 
112
-        topicText.getActionMap().put("paste-from-clipboard",    
113
-                    new NoNewlinesPasteAction());
114
-        topicText.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 
112
+        topicText.getActionMap().put("paste-from-clipboard",
113
+                    new ReplacePasteAction("(\r\n|\n|\r)", " "));
114
+        topicText.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
115 115
                 0), new TopicEnterAction(parent));
116 116
         topicText.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
117 117
                 UIUtilities.getCtrlDownMask()), new TopicEnterAction(parent));

Загрузка…
Отмена
Сохранить