Explorar el Código

Core javadoc. Fixes issue 633.

Removed some now-unused popup type stuff

git-svn-id: http://svn.dmdirc.com/trunk@3137 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith hace 16 años
padre
commit
8cdeab2ef4

+ 17
- 0
src/com/dmdirc/CustomWindow.java Ver fichero

28
 import com.dmdirc.ui.interfaces.Window;
28
 import com.dmdirc.ui.interfaces.Window;
29
 
29
 
30
 /**
30
 /**
31
+ * A generic custom window implementation.
31
  * 
32
  * 
32
  * @author chris
33
  * @author chris
33
  */
34
  */
39
     /** This custom window's title. */
40
     /** This custom window's title. */
40
     private final String title;
41
     private final String title;
41
 
42
 
43
+    /** The window used by this container. */
42
     private Window window;
44
     private Window window;
43
 
45
 
46
+    /** This window's parent window. */
44
     private Window parent = null;
47
     private Window parent = null;
45
 
48
 
49
+    /**
50
+     * Creates a new custom window as a child of the specified window.
51
+     * 
52
+     * @param name The name of this custom window
53
+     * @param title The title of this custom window
54
+     * @param parent The parent of this custom window
55
+     */
46
     public CustomWindow(final String name, final String title,
56
     public CustomWindow(final String name, final String title,
47
             final Window parent) {
57
             final Window parent) {
48
         super();
58
         super();
62
         window.setVisible(true);
72
         window.setVisible(true);
63
     }
73
     }
64
 
74
 
75
+    /**
76
+     * Creates a new custom window as a top-level window.
77
+     * 
78
+     * @param name The name of this custom window
79
+     * @param title The parent of this custom window
80
+     */
65
     public CustomWindow(final String name, final String title) {
81
     public CustomWindow(final String name, final String title) {
66
         super();
82
         super();
67
 
83
 
134
         return title;
150
         return title;
135
     }
151
     }
136
 
152
 
153
+    /** {@inheritDoc} */
137
     @Override
154
     @Override
138
     public ConfigManager getConfigManager() {
155
     public ConfigManager getConfigManager() {
139
         return parent == null ? IdentityManager.getGlobalConfig() : parent
156
         return parent == null ? IdentityManager.getGlobalConfig() : parent

+ 8
- 1
src/com/dmdirc/commandline/RemoteInterface.java Ver fichero

29
 import java.util.List;
29
 import java.util.List;
30
 
30
 
31
 /**
31
 /**
32
- *
32
+ * Defines the interface that is available using RMI.
33
+ * 
33
  * @author chris
34
  * @author chris
34
  */
35
  */
35
 public interface RemoteInterface extends Remote {
36
 public interface RemoteInterface extends Remote {
36
     
37
     
38
+    /**
39
+     * Connects to the specified list of addresses.
40
+     * 
41
+     * @param addresses The addresses to connect to.
42
+     * @throws java.rmi.RemoteException on problems communicating
43
+     */
37
     void connect(List<IrcAddress> addresses) throws RemoteException;
44
     void connect(List<IrcAddress> addresses) throws RemoteException;
38
 
45
 
39
 }
46
 }

+ 6
- 1
src/com/dmdirc/commandline/RemoteServer.java Ver fichero

32
 import java.util.List;
32
 import java.util.List;
33
 
33
 
34
 /**
34
 /**
35
- *
35
+ * An RMI server that allows other clients to interact with DMDirc.
36
+ * 
36
  * @author chris
37
  * @author chris
37
  */
38
  */
38
 public class RemoteServer implements RemoteInterface {
39
 public class RemoteServer implements RemoteInterface {
39
     
40
     
41
+    /**
42
+     * Creates a new instance of RemoteServer.
43
+     */
40
     public RemoteServer() {
44
     public RemoteServer() {
41
         super();
45
         super();
42
     }
46
     }
43
     
47
     
48
+    /** {@inheritDoc} */
44
     @Override
49
     @Override
45
     public void connect(List<IrcAddress> addresses) throws RemoteException {
50
     public void connect(List<IrcAddress> addresses) throws RemoteException {
46
         for (IrcAddress address : addresses) {
51
         for (IrcAddress address : addresses) {

+ 27
- 1
src/com/dmdirc/commandparser/CommandManager.java Ver fichero

43
 import com.dmdirc.logger.Logger;
43
 import com.dmdirc.logger.Logger;
44
 import com.dmdirc.ui.input.TabCompleter;
44
 import com.dmdirc.ui.input.TabCompleter;
45
 import com.dmdirc.util.MapList;
45
 import com.dmdirc.util.MapList;
46
-import com.dmdirc.util.WeakList;
47
 
46
 
48
 import java.util.ArrayList;
47
 import java.util.ArrayList;
49
 import java.util.HashMap;
48
 import java.util.HashMap;
376
         return getCommand(null, name);
375
         return getCommand(null, name);
377
     }
376
     }
378
     
377
     
378
+    /**
379
+     * Retrieves a command of the specified type with the specified name.
380
+     * 
381
+     * @param type The type of the command to look for
382
+     * @param name The name to look for
383
+     * @return A command with a matching signature, or null if none were found
384
+     */
379
     public static Command getCommand(final CommandType type, final String name) {
385
     public static Command getCommand(final CommandType type, final String name) {
380
         final List<Command> res = getCommands(type, name);
386
         final List<Command> res = getCommands(type, name);
381
         
387
         
393
                 || getCommand(CommandType.TYPE_CHAT, command) != null;
399
                 || getCommand(CommandType.TYPE_CHAT, command) != null;
394
     }
400
     }
395
        
401
        
402
+    /**
403
+     * Retrieves a list of the names of all commands of the specified type.
404
+     * 
405
+     * @param type The type of command to list
406
+     * @return A list of command names
407
+     */
396
     public static List<String> getCommandNames(final CommandType type) {
408
     public static List<String> getCommandNames(final CommandType type) {
397
         final List<String> res = new ArrayList<String>();
409
         final List<String> res = new ArrayList<String>();
398
         
410
         
403
         return res;
415
         return res;
404
     }
416
     }
405
     
417
     
418
+    /**
419
+     * Retrieves a list of all commands of the specified type.
420
+     * 
421
+     * @param type The type of command to list
422
+     * @return A list of commands
423
+     */    
406
     public static List<Command> getCommands(final CommandType type) {    
424
     public static List<Command> getCommands(final CommandType type) {    
407
         return getCommands(type, null);
425
         return getCommands(type, null);
408
     }
426
     }
409
     
427
     
428
+    /**
429
+     * Retrieves a list of all commands of the specified type, with the
430
+     * specified name.
431
+     * 
432
+     * @param type The type of command to list, or null for all types
433
+     * @param name The name of the command to look for, or null for any name
434
+     * @return A list of matching commands
435
+     */    
410
     private static List<Command> getCommands(final CommandType type,
436
     private static List<Command> getCommands(final CommandType type,
411
             final String name) {
437
             final String name) {
412
         final List<Command> res = new ArrayList<Command>();
438
         final List<Command> res = new ArrayList<Command>();

+ 15
- 2
src/com/dmdirc/commandparser/CommandType.java Ver fichero

30
 import com.dmdirc.commandparser.commands.ServerCommand;
30
 import com.dmdirc.commandparser.commands.ServerCommand;
31
 
31
 
32
 /**
32
 /**
33
- *
33
+ * Defines the possible targets for commands.
34
+ * 
34
  * @author chris
35
  * @author chris
35
  */
36
  */
36
 public enum CommandType {
37
 public enum CommandType {
37
     
38
     
39
+    /** A global command, which may be executed anywhere. */
38
     TYPE_GLOBAL,
40
     TYPE_GLOBAL,
41
+    /** A server command, which only makes sense in the context of a connection. */
39
     TYPE_SERVER,
42
     TYPE_SERVER,
43
+    /** A chat command, which needs a MessageTarget to make sense. */
40
     TYPE_CHAT,
44
     TYPE_CHAT,
45
+    /** A channel command. */
41
     TYPE_CHANNEL,
46
     TYPE_CHANNEL,
47
+    /** A query command. */
42
     TYPE_QUERY;
48
     TYPE_QUERY;
43
-    
49
+   
50
+    /**
51
+     * Looks up the command type for the specified command, by inspecting its
52
+     * class.
53
+     * 
54
+     * @param command The command to look up
55
+     * @return The type of the specified command
56
+     */
44
     public static CommandType fromCommand(final Command command) {
57
     public static CommandType fromCommand(final Command command) {
45
         if (command instanceof GlobalCommand) {
58
         if (command instanceof GlobalCommand) {
46
             return TYPE_GLOBAL;
59
             return TYPE_GLOBAL;

+ 15
- 7
src/com/dmdirc/commandparser/PopupManager.java Ver fichero

22
 
22
 
23
 package com.dmdirc.commandparser;
23
 package com.dmdirc.commandparser;
24
 
24
 
25
-import com.dmdirc.Precondition;
26
 import com.dmdirc.config.ConfigManager;
25
 import com.dmdirc.config.ConfigManager;
27
-import com.dmdirc.logger.ErrorLevel;
28
-import com.dmdirc.logger.Logger;
29
 
26
 
30
-import java.util.LinkedHashMap;
31
-import java.util.List;
32
-import java.util.Map;
33
 
27
 
34
 /**
28
 /**
35
  * The popup manager manages which commands should be present in popup menus.
29
  * The popup manager manages which commands should be present in popup menus.
50
      * Configuration data is read from the specified config manager.
44
      * Configuration data is read from the specified config manager.
51
      * 
45
      * 
52
      * @param menuType The type of the menu that is needed
46
      * @param menuType The type of the menu that is needed
53
-     * @param configManager The config manager to be used for the mnenu
47
+     * @param configManager The config manager to be used for the menu
54
      * @return The PopupMenu that should be displayed
48
      * @return The PopupMenu that should be displayed
55
      */
49
      */
56
     public static PopupMenu getMenu(final PopupType menuType, final ConfigManager configManager) {
50
     public static PopupMenu getMenu(final PopupType menuType, final ConfigManager configManager) {
57
         return getMenu(menuType.toString(), configManager);
51
         return getMenu(menuType.toString(), configManager);
58
     }
52
     }
59
     
53
     
54
+    /**
55
+     * Retrieves the menu with the specified name.
56
+     * 
57
+     * @param menuName The name of the menu to read
58
+     * @param configManager The config manager to be used for the menu
59
+     * @return The PopupMenu with the specified name
60
+     */
60
     private static PopupMenu getMenu(final String menuName, final ConfigManager configManager) {
61
     private static PopupMenu getMenu(final String menuName, final ConfigManager configManager) {
61
         final PopupMenu res = new PopupMenu();
62
         final PopupMenu res = new PopupMenu();
62
         
63
         
71
         return res;
72
         return res;
72
     }
73
     }
73
     
74
     
75
+    /**
76
+     * Creates a PopupMenuItem for the specified item.
77
+     * 
78
+     * @param item The item to be turned into a PopupMenuItem
79
+     * @param configManager The config manager to beused for the menu
80
+     * @return The corresponding PopupMenuItem
81
+     */
74
     private static PopupMenuItem getItem(final String item, final ConfigManager configManager) {
82
     private static PopupMenuItem getItem(final String item, final ConfigManager configManager) {
75
         PopupMenuItem res;
83
         PopupMenuItem res;
76
         
84
         

+ 22
- 5
src/com/dmdirc/commandparser/PopupMenu.java Ver fichero

27
 import java.util.List;
27
 import java.util.List;
28
 
28
 
29
 /**
29
 /**
30
- *
30
+ * Represents an abstract, UI-independent popup menu.
31
+ * 
31
  * @author chris
32
  * @author chris
32
  */
33
  */
33
 public class PopupMenu {
34
 public class PopupMenu {
34
     
35
     
36
+    /** The items contained within this popup menu. */
35
     private final List<PopupMenuItem> items = new ArrayList<PopupMenuItem>();
37
     private final List<PopupMenuItem> items = new ArrayList<PopupMenuItem>();
36
     
38
     
39
+    /**
40
+     * Retrieves a list of items contained within this popup menu.
41
+     * 
42
+     * @return A list of this popup menu's items.
43
+     */
37
     public List<PopupMenuItem> getItems() {
44
     public List<PopupMenuItem> getItems() {
38
         return items;
45
         return items;
39
     }
46
     }
40
 
47
 
41
-    public boolean add(final PopupMenuItem e) {
42
-        return items.add(e);
48
+    /**
49
+     * Adds the specified item to this popup menu.
50
+     * 
51
+     * @param e The item to be added to the popup menu.
52
+     */
53
+    public void add(final PopupMenuItem e) {
54
+        items.add(e);
43
     }
55
     }
44
 
56
 
45
-    public boolean addAll(final Collection<? extends PopupMenuItem> c) {
46
-        return items.addAll(c);
57
+    /**
58
+     * Adds all of the items in the specified collection to this popup menu.
59
+     * 
60
+     * @param c The collection whose items should be added.
61
+     */
62
+    public void addAll(final Collection<? extends PopupMenuItem> c) {
63
+        items.addAll(c);
47
     }    
64
     }    
48
 
65
 
49
 }
66
 }

+ 50
- 3
src/com/dmdirc/commandparser/PopupMenuItem.java Ver fichero

23
 package com.dmdirc.commandparser;
23
 package com.dmdirc.commandparser;
24
 
24
 
25
 /**
25
 /**
26
- *
26
+ * Represents an abstract, UI-independent popup menu item.
27
+ * 
27
  * @author chris
28
  * @author chris
28
  */
29
  */
29
 public class PopupMenuItem {
30
 public class PopupMenuItem {
30
-    
31
+   
32
+    /** Whether this item is a divider. */
31
     private boolean divider = false;
33
     private boolean divider = false;
34
+    /** The submenu for this item, if any. */
32
     private PopupMenu submenu = null;
35
     private PopupMenu submenu = null;
36
+    /** The name of this item, if any. */
33
     private String name;
37
     private String name;
38
+    /** The command for this item, if any. */
34
     private String command;
39
     private String command;
35
     
40
     
41
+    /**
42
+     * Creates a new PopupMenuItem that is used as a divider.
43
+     */
36
     public PopupMenuItem() {
44
     public PopupMenuItem() {
37
         divider = true;
45
         divider = true;
38
     }
46
     }
39
     
47
     
48
+    /**
49
+     * Creates a new PopupMenuItem that is used as a submenu.
50
+     * 
51
+     * @param name The name of the menu item
52
+     * @param submenu The submenu of this item
53
+     */
40
     public PopupMenuItem(final String name, final PopupMenu submenu) {
54
     public PopupMenuItem(final String name, final PopupMenu submenu) {
41
         this.name = name;
55
         this.name = name;
42
         this.submenu = submenu;
56
         this.submenu = submenu;
43
     }
57
     }
44
     
58
     
59
+    /**
60
+     * Creates a new PopupMenuItem that executes a command.
61
+     * 
62
+     * @param name The name of the menu item
63
+     * @param command The command to be executed
64
+     */
45
     public PopupMenuItem(final String name, final String command) {
65
     public PopupMenuItem(final String name, final String command) {
46
         this.name = name;
66
         this.name = name;
47
         this.command = command;
67
         this.command = command;
48
     }
68
     }
49
     
69
     
70
+    /**
71
+     * Determines if this menu item is a divider or not.
72
+     * 
73
+     * @return True if this item is a divider, false otherwise.
74
+     */
50
     public boolean isDivider() {
75
     public boolean isDivider() {
51
         return divider;
76
         return divider;
52
     }
77
     }
53
-    
78
+
79
+    /**
80
+     * Determines if this menu item contains a submenu or not.
81
+     * 
82
+     * @return True if this item contains a submenu, false otherwise.
83
+     */    
54
     public boolean isSubMenu() {
84
     public boolean isSubMenu() {
55
         return submenu != null;
85
         return submenu != null;
56
     }
86
     }
57
     
87
     
88
+    /**
89
+     * Retrieves the submenu associated with this item.
90
+     * 
91
+     * @return This menu item's submenu.
92
+     */
58
     public PopupMenu getSubMenu() {
93
     public PopupMenu getSubMenu() {
59
         return submenu;
94
         return submenu;
60
     }
95
     }
61
     
96
     
97
+    /**
98
+     * Retrieves the name of this menu item.
99
+     * 
100
+     * @return This menu item's name.
101
+     */
62
     public String getName() {
102
     public String getName() {
63
         return name;
103
         return name;
64
     }
104
     }
65
     
105
     
106
+    /**
107
+     * Retrieves the command for this menu item, with the specified argumenwits
108
+     * substituted in.
109
+     * 
110
+     * @param arguments The arguments needed for this command
111
+     * @return The command to be passed to a command parser
112
+     */
66
     public String getCommand(final Object... arguments) {
113
     public String getCommand(final Object... arguments) {
67
         return CommandManager.getCommandChar() + String.format(command, arguments);
114
         return CommandManager.getCommandChar() + String.format(command, arguments);
68
     }
115
     }

+ 4
- 24
src/com/dmdirc/commandparser/PopupType.java Ver fichero

35
      * 
35
      * 
36
      * Expected arguments: the nickname of the user who was clicked on.
36
      * Expected arguments: the nickname of the user who was clicked on.
37
      */
37
      */
38
-    CHAN_NICKLIST("nick", "chan-nick", "chan-nick-list"),
38
+    CHAN_NICKLIST,
39
         
39
         
40
     /**
40
     /**
41
      * The menu that appears when right clicking in a channel window.
41
      * The menu that appears when right clicking in a channel window.
42
      * 
42
      * 
43
      * Expected arguments: none.
43
      * Expected arguments: none.
44
      */
44
      */
45
-    CHAN_CHAN("chan"),
45
+    CHAN_CHAN,
46
     
46
     
47
     /**
47
     /**
48
      * The menu that appears when right clicking in a query window.
48
      * The menu that appears when right clicking in a query window.
49
      * 
49
      * 
50
      * Expected arguments: the nickname of the user who the query is with.
50
      * Expected arguments: the nickname of the user who the query is with.
51
      */
51
      */
52
-    QUERY_QUERY("nick", "query");
53
-    
54
-    private final String[] domains;
55
-    
56
-    /**
57
-     * Instansiates one of the PopupTypes.
58
-     * 
59
-     * @param domains The configuration domains used for the type
60
-     */
61
-    PopupType(final String ... domains) {
62
-        this.domains = domains;
63
-    }
64
-    
65
-    /**
66
-     * Retrieve a list of the domains that should be used by this type.
67
-     * 
68
-     * @return This type's domains
69
-     */
70
-    public String[] getDomains() {
71
-        return domains.clone();
72
-    }
73
-    
52
+    QUERY_QUERY;
53
+       
74
 }
54
 }

+ 24
- 1
src/com/dmdirc/commandparser/commands/PreviousCommand.java Ver fichero

24
 
24
 
25
 import java.util.Date;
25
 import java.util.Date;
26
 
26
 
27
+/**
28
+ * Stores information about a previously executed command.
29
+ * 
30
+ * @author chris
31
+ */
27
 public final class PreviousCommand {
32
 public final class PreviousCommand {
28
-    
33
+   
34
+    /** The full command that was executed. */
29
     private final String line;
35
     private final String line;
36
+    
37
+    /** The timestamp of its execution. */
30
     private final long time;
38
     private final long time;
31
     
39
     
40
+    /**
41
+     * Creates a new record of the specified command.
42
+     * 
43
+     * @param line The full command that was executed
44
+     */
32
     public PreviousCommand(final String line) {
45
     public PreviousCommand(final String line) {
33
         this.line = line;
46
         this.line = line;
34
         this.time = new Date().getTime();
47
         this.time = new Date().getTime();
35
     }
48
     }
36
     
49
     
50
+    /**
51
+     * Retrieves the time that the command was executed at.
52
+     * 
53
+     * @return The timestamp that the command was executed at
54
+     */
37
     public long getTime() {
55
     public long getTime() {
38
         return time;
56
         return time;
39
     }
57
     }
40
     
58
     
59
+    /**
60
+     * Retrieves the command that was executed.
61
+     * 
62
+     * @return The command that was executed.
63
+     */
41
     public String getLine() {
64
     public String getLine() {
42
         return line;
65
         return line;
43
     }
66
     }

+ 0
- 1
src/com/dmdirc/commandparser/commands/global/LoadPlugin.java Ver fichero

25
 import com.dmdirc.commandparser.CommandManager;
25
 import com.dmdirc.commandparser.CommandManager;
26
 import com.dmdirc.commandparser.commands.GlobalCommand;
26
 import com.dmdirc.commandparser.commands.GlobalCommand;
27
 import com.dmdirc.commandparser.commands.IntelligentCommand;
27
 import com.dmdirc.commandparser.commands.IntelligentCommand;
28
-import com.dmdirc.plugins.Plugin;
29
 import com.dmdirc.plugins.PluginInfo;
28
 import com.dmdirc.plugins.PluginInfo;
30
 import com.dmdirc.plugins.PluginManager;
29
 import com.dmdirc.plugins.PluginManager;
31
 import com.dmdirc.ui.input.AdditionalTabTargets;
30
 import com.dmdirc.ui.input.AdditionalTabTargets;

+ 1
- 0
src/com/dmdirc/commandparser/commands/server/RawServerCommand.java Ver fichero

35
  */
35
  */
36
 public final class RawServerCommand extends ServerCommand {
36
 public final class RawServerCommand extends ServerCommand {
37
     
37
     
38
+    /** The name of this raw command. */
38
     private final String myName;
39
     private final String myName;
39
     
40
     
40
     /**
41
     /**

+ 17
- 1
src/com/dmdirc/config/ConfigTarget.java Ver fichero

35
     
35
     
36
     /** The possible target types. */
36
     /** The possible target types. */
37
     public static enum TYPE {
37
     public static enum TYPE {
38
-        GLOBALDEFAULT, GLOBAL, THEME, PROFILE, IRCD, NETWORK, SERVER, CHANNEL,
38
+        /** Client-wide default settings. */
39
+        GLOBALDEFAULT,
40
+        /** Client-wide settings. */
41
+        GLOBAL,
42
+        /** Settings for a theme. */
43
+        THEME,
44
+        /** Settings for a profile. */
45
+        PROFILE,
46
+        /** Settings for an IRCd. */
47
+        IRCD,
48
+        /** Settings for a network. */
49
+        NETWORK,
50
+        /** Settings for a server. */
51
+        SERVER,
52
+        /** Settings for a channel. */
53
+        CHANNEL,
39
     }
54
     }
40
     
55
     
41
     /**
56
     /**
224
      *
239
      *
225
      * @return A string representation of this object
240
      * @return A string representation of this object
226
      */
241
      */
242
+    @Override
227
     public String toString() {
243
     public String toString() {
228
         switch (type) {
244
         switch (type) {
229
         case GLOBALDEFAULT:
245
         case GLOBALDEFAULT:

+ 7
- 0
src/com/dmdirc/config/Identity.java Ver fichero

74
     /** The configuration details for this identity. */
74
     /** The configuration details for this identity. */
75
     protected final Properties properties;
75
     protected final Properties properties;
76
     
76
     
77
+    /** The global config manager. */
77
     protected ConfigManager globalConfig;
78
     protected ConfigManager globalConfig;
78
     
79
     
79
     /** The config change listeners for this source. */
80
     /** The config change listeners for this source. */
220
         }
221
         }
221
     }
222
     }
222
     
223
     
224
+    /**
225
+     * Fires the config changed listener for the specified option after this
226
+     * identity is reloaded.
227
+     * 
228
+     * @param object A string describing the changed option (domain.key)
229
+     */
223
     private void fireReloadChange(final Object object) {
230
     private void fireReloadChange(final Object object) {
224
         final String string = (String) object;
231
         final String string = (String) object;
225
         final String domain = string.substring(0, string.indexOf('.'));
232
         final String domain = string.substring(0, string.indexOf('.'));

+ 6
- 0
src/com/dmdirc/config/IdentityManager.java Ver fichero

157
         }
157
         }
158
     }
158
     }
159
     
159
     
160
+    /**
161
+     * Loads an identity from the specified file. If the identity already
162
+     * exists, it is told to reload instead.
163
+     * 
164
+     * @param file The file to load the identity from.
165
+     */
160
     private static void loadIdentity(final File file) {
166
     private static void loadIdentity(final File file) {
161
         for (Identity identity : identities) {
167
         for (Identity identity : identities) {
162
             if (file.equals(identity.getFile())) {
168
             if (file.equals(identity.getFile())) {

+ 2
- 2
src/com/dmdirc/logger/DMDircExceptionHandler.java Ver fichero

33
     }
33
     }
34
     
34
     
35
     /** {@inheritDoc} */
35
     /** {@inheritDoc} */
36
-    public void uncaughtException(final Thread thread, final Throwable throwable) {
37
-        Logger.appError(ErrorLevel.HIGH, throwable.toString(), throwable);
36
+    public void uncaughtException(final Thread t, final Throwable e) {
37
+        Logger.appError(ErrorLevel.HIGH, e.toString(), e);
38
     }
38
     }
39
 }
39
 }

+ 1
- 1
src/com/dmdirc/themes/Theme.java Ver fichero

27
 import com.dmdirc.logger.ErrorLevel;
27
 import com.dmdirc.logger.ErrorLevel;
28
 import com.dmdirc.logger.Logger;
28
 import com.dmdirc.logger.Logger;
29
 import com.dmdirc.util.resourcemanager.ZipResourceManager;
29
 import com.dmdirc.util.resourcemanager.ZipResourceManager;
30
-import com.dmdirc.ui.messages.Formatter;
31
 
30
 
32
 import java.io.File;
31
 import java.io.File;
33
 import java.io.IOException;
32
 import java.io.IOException;
43
     /** The file to load the theme from. */
42
     /** The file to load the theme from. */
44
     private final File file;
43
     private final File file;
45
     
44
     
45
+    /** The resource manager we're using for this theme. */
46
     private ZipResourceManager rm;
46
     private ZipResourceManager rm;
47
     
47
     
48
     /**
48
     /**

+ 6
- 0
src/com/dmdirc/updater/Update.java Ver fichero

43
      * An enumeration of possible statuses.
43
      * An enumeration of possible statuses.
44
      */
44
      */
45
     public static enum STATUS {
45
     public static enum STATUS {
46
+        /** The update is waiting to be started. */
46
         PENDING,
47
         PENDING,
48
+        /** The update is currently downloading. */
47
         DOWNLOADING,
49
         DOWNLOADING,
50
+        /** The update is currently installing. */
48
         INSTALLING,
51
         INSTALLING,
52
+        /** The update has been installed correctly. */
49
         INSTALLED,
53
         INSTALLED,
54
+        /** An error was encountered during update. */
50
         ERROR,
55
         ERROR,
56
+        /** A restart is needed to complete the update. */
51
         RESTART_NEEDED
57
         RESTART_NEEDED
52
     }
58
     }
53
 
59
 

+ 1
- 0
src/com/dmdirc/updater/components/ActionGroupComponent.java Ver fichero

34
  */
34
  */
35
 public class ActionGroupComponent implements UpdateComponent {
35
 public class ActionGroupComponent implements UpdateComponent {
36
     
36
     
37
+    /** The group that this component represents. */
37
     private ActionGroup group;
38
     private ActionGroup group;
38
     
39
     
39
     /**
40
     /**

+ 9
- 0
src/com/dmdirc/util/Downloader.java Ver fichero

161
         output.close();
161
         output.close();
162
     }    
162
     }    
163
     
163
     
164
+    /**
165
+     * Creates an URL connection for the specified URL and data.
166
+     * 
167
+     * @param url The URL to connect to
168
+     * @param postData The POST data to pass to the URL
169
+     * @return An URLConnection for the specified URL/data
170
+     * @throws java.net.MalformedURLException If the specified URL is malformed
171
+     * @throws java.io.IOException If an I/O exception occurs while connecting
172
+     */
164
     private static URLConnection getConnection(final String url, final String postData)
173
     private static URLConnection getConnection(final String url, final String postData)
165
             throws MalformedURLException, IOException {
174
             throws MalformedURLException, IOException {
166
         final URL myUrl = new URL(url);
175
         final URL myUrl = new URL(url);

+ 6
- 0
src/com/dmdirc/util/EquatableWeakReference.java Ver fichero

29
  * An extension of WeakReference that implements a sane equals and hashcode
29
  * An extension of WeakReference that implements a sane equals and hashcode
30
  * method.
30
  * method.
31
  * 
31
  * 
32
+ * @param <T> The type of object that this reference contains
32
  * @author chris
33
  * @author chris
33
  */
34
  */
34
 public class EquatableWeakReference<T> extends WeakReference<T> {
35
 public class EquatableWeakReference<T> extends WeakReference<T> {
35
     
36
     
37
+    /**
38
+     * Creates a new instance of EquatableWeakReference.
39
+     * 
40
+     * @param referent The object that this weak reference should reference.
41
+     */
36
     public EquatableWeakReference(T referent) {
42
     public EquatableWeakReference(T referent) {
37
         super(referent);
43
         super(referent);
38
     }
44
     }

+ 11
- 1
src/com/dmdirc/util/InvalidConfigFileException.java Ver fichero

23
 package com.dmdirc.util;
23
 package com.dmdirc.util;
24
 
24
 
25
 /**
25
 /**
26
- *
26
+ * Thrown to indicate that a config file is invalid.
27
  * @author chris
27
  * @author chris
28
  */
28
  */
29
 public class InvalidConfigFileException extends Exception {
29
 public class InvalidConfigFileException extends Exception {
30
     
30
     
31
+    /**
32
+     * A version number for this class. It should be changed whenever the class
33
+     * structure is changed (or anything else that would prevent serialized
34
+     * objects being unserialized with the new class).
35
+     */    
31
     private static final long serialVersionUID = 1;
36
     private static final long serialVersionUID = 1;
32
 
37
 
38
+    /**
39
+     * Creates a new InvalidConfigFileException.
40
+     * 
41
+     * @param string A description of the exception that occured.
42
+     */
33
     public InvalidConfigFileException(String string) {
43
     public InvalidConfigFileException(String string) {
34
         super(string);
44
         super(string);
35
     }
45
     }

+ 5
- 0
src/com/dmdirc/util/IrcAddress.java Ver fichero

39
  */
39
  */
40
 public class IrcAddress implements Serializable {
40
 public class IrcAddress implements Serializable {
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
     private final static long serialVersionUID = 1;
47
     private final static long serialVersionUID = 1;
43
 
48
 
44
     /** Whether or not this address uses SSL. */
49
     /** Whether or not this address uses SSL. */

+ 101
- 7
src/com/dmdirc/util/RollingList.java Ver fichero

26
 import java.util.List;
26
 import java.util.List;
27
 
27
 
28
 /**
28
 /**
29
- *
29
+ * Implements a "rolling list". A rolling list has a maximum capacity, and
30
+ * removes the oldest elements from the list to maintain this capacity.
31
+ * 
30
  * @param <T> The type if items that this list contains 
32
  * @param <T> The type if items that this list contains 
31
  * @author chris
33
  * @author chris
32
  */
34
  */
33
 public class RollingList<T> {
35
 public class RollingList<T> {
34
-    
36
+   
37
+    /** The items in this rolling list. */
35
     private final List<T> items = new ArrayList<T>();
38
     private final List<T> items = new ArrayList<T>();
36
     
39
     
40
+    /** The maximum capacity of this list. */
37
     private final int capacity;
41
     private final int capacity;
38
     
42
     
43
+    /** This list's position pointer. */
39
     private int position = 0;
44
     private int position = 0;
40
     
45
     
46
+    /** Whether or not to add a fake empty item to the end of this list. */
41
     private boolean addEmpty;
47
     private boolean addEmpty;
48
+    /** The "empty" item to be added. */
42
     private T empty;
49
     private T empty;
43
     
50
     
44
-    public RollingList(int capacity) {
51
+    /**
52
+     * Creates a new RollingList of the specified capacity.
53
+     * 
54
+     * @param capacity The capacity of this list.
55
+     */
56
+    public RollingList(final int capacity) {
45
         this.capacity = capacity;
57
         this.capacity = capacity;
46
         this.addEmpty = false;
58
         this.addEmpty = false;
47
     }
59
     }
48
 
60
 
49
-    public RollingList(int capacity, T empty) {
61
+    /**
62
+     * Creates a new RollingList of the specified capacity, with the specified
63
+     * "empty" element appended to the end.
64
+     * 
65
+     * @param capacity The capacity of this list.
66
+     * @param empty The "empty" element to be added
67
+     */    
68
+    public RollingList(final int capacity, final T empty) {
50
         this.capacity = capacity;
69
         this.capacity = capacity;
51
         this.addEmpty = true;
70
         this.addEmpty = true;
52
         this.empty = empty;
71
         this.empty = empty;
53
     }
72
     }
54
 
73
 
55
-    public boolean remove(Object o) {
74
+    /**
75
+     * Removes the specified element from this list.
76
+     * 
77
+     * @param o The object to be removed from the list.
78
+     * @return True if the list contained the specified element, false otherwise.
79
+     */
80
+    public boolean remove(final Object o) {
56
         return items.remove(o);
81
         return items.remove(o);
57
     }
82
     }
58
 
83
 
84
+    /**
85
+     * Determines if this list is currently empty.
86
+     * 
87
+     * @return True if the list is empty, false otherwise.
88
+     */
59
     public boolean isEmpty() {
89
     public boolean isEmpty() {
60
         return items.isEmpty();
90
         return items.isEmpty();
61
     }
91
     }
62
 
92
 
63
-    public T get(int index) {
93
+    /**
94
+     * Retrieves the item at the specified index in this list.
95
+     * 
96
+     * @param index The index to look up
97
+     * @return The item at the specified index
98
+     */
99
+    public T get(final int index) {
64
         return items.get(index);
100
         return items.get(index);
65
     }
101
     }
66
 
102
 
67
-    public boolean contains(Object o) {
103
+    /**
104
+     * Determines if this list contains the specified object.
105
+     * 
106
+     * @param o The object to be checked
107
+     * @return True if this list contains the item, false otherwise.
108
+     */
109
+    public boolean contains(final Object o) {
68
         return items.contains(o);
110
         return items.contains(o);
69
     }
111
     }
70
 
112
 
113
+    /**
114
+     * Clears all items from this list.
115
+     */
71
     public void clear() {
116
     public void clear() {
72
         items.clear();
117
         items.clear();
73
     }  
118
     }  
74
     
119
     
120
+    /**
121
+     * Adds the specified item to this list. If the list has reached its
122
+     * maximum capacity, this method will remove elements from the start of the
123
+     * list until there is sufficient room for the new element.
124
+     * 
125
+     * @param e The element to be added to the list.
126
+     * @return True
127
+     */
75
     public boolean add(T e) {
128
     public boolean add(T e) {
76
         while (items.size() > capacity - 1) {
129
         while (items.size() > capacity - 1) {
77
             items.remove(0);
130
             items.remove(0);
81
         return items.add(e);
134
         return items.add(e);
82
     }
135
     }
83
     
136
     
137
+    /**
138
+     * Retrieves the current position within the list.
139
+     * 
140
+     * @return This list's positional pointer
141
+     */
84
     public int getPosition() {
142
     public int getPosition() {
85
         return position;
143
         return position;
86
     }
144
     }
87
 
145
 
146
+    /**
147
+     * Sets the positional pointer of this list.
148
+     * 
149
+     * @param position The new position
150
+     */
88
     public void setPosition(int position) {
151
     public void setPosition(int position) {
89
         this.position = position;
152
         this.position = position;
90
     }    
153
     }    
91
     
154
     
155
+    /**
156
+     * Determines if there is an element after the positional pointer of the list.
157
+     * 
158
+     * @return True if there is an element, false otherwise.
159
+     */
92
     public boolean hasNext() {
160
     public boolean hasNext() {
93
         return (items.size() > position + 1) || ((items.size() > position) && addEmpty);
161
         return (items.size() > position + 1) || ((items.size() > position) && addEmpty);
94
     }
162
     }
95
     
163
     
164
+    /**
165
+     * Retrieves the element after the positional pointer of the list.
166
+     * 
167
+     * @return The next element in the list
168
+     */
96
     public T getNext() {
169
     public T getNext() {
97
         if (items.size() > position + 1 || !addEmpty) {
170
         if (items.size() > position + 1 || !addEmpty) {
98
             return get(++position);
171
             return get(++position);
102
         }
175
         }
103
     }
176
     }
104
     
177
     
178
+    /**
179
+     * Determines if there is an element befpre the positional pointer of the list.
180
+     * 
181
+     * @return True if there is an element, false otherwise.
182
+     */    
105
     public boolean hasPrevious() {
183
     public boolean hasPrevious() {
106
         return 0 < position;
184
         return 0 < position;
107
     }
185
     }
108
     
186
     
187
+    /**
188
+     * Retrieves the element before the positional pointer of the list.
189
+     * 
190
+     * @return The previous element in the list
191
+     */    
109
     public T getPrevious() {
192
     public T getPrevious() {
110
         return get(--position);
193
         return get(--position);
111
     }    
194
     }    
112
     
195
     
196
+    /**
197
+     * Sets the positional pointer of this list to the end.
198
+     */
113
     public void seekToEnd() {
199
     public void seekToEnd() {
114
         position = items.size();
200
         position = items.size();
115
     }
201
     }
116
     
202
     
203
+    /**
204
+     * Sets the positional pointer of this list to the start.
205
+     */
117
     public void seekToStart() {
206
     public void seekToStart() {
118
         position = 0;
207
         position = 0;
119
     }
208
     }
120
     
209
     
210
+    /**
211
+     * Retrieves a list of items that this rolling list contains.
212
+     * 
213
+     * @return A list of items in this rolling list.
214
+     */
121
     public List<T> getList() {
215
     public List<T> getList() {
122
         return new ArrayList<T>(items);
216
         return new ArrayList<T>(items);
123
     }
217
     }

+ 1
- 0
src/com/dmdirc/util/StringTranscoder.java Ver fichero

31
  */
31
  */
32
 public class StringTranscoder {
32
 public class StringTranscoder {
33
    
33
    
34
+    /** The charset that is used by this transcoder. */
34
     private final Charset charset;
35
     private final Charset charset;
35
     
36
     
36
     /**
37
     /**

+ 25
- 2
src/com/dmdirc/util/WeakList.java Ver fichero

30
 import java.util.ListIterator;
30
 import java.util.ListIterator;
31
 
31
 
32
 /**
32
 /**
33
- *
34
- * @param <T>
33
+ * Implements a list of weak references. The weak references (and subsequent
34
+ * garbage collection) are handled transparently.
35
+ * 
36
+ * @param <T> The type of object that this list will contain.
35
  * @author chris
37
  * @author chris
36
  */
38
  */
37
 public class WeakList<T> implements List<T> {
39
 public class WeakList<T> implements List<T> {
38
 
40
 
41
+    /** The items in this list. */
39
     private final List<WeakReference<T>> list = new ArrayList<WeakReference<T>>();
42
     private final List<WeakReference<T>> list = new ArrayList<WeakReference<T>>();
40
 
43
 
44
+    /**
45
+     * Creates a new instance of WeakList.
46
+     */
41
     public WeakList() {
47
     public WeakList() {
42
         super();
48
         super();
43
     }
49
     }
44
 
50
 
51
+    /**
52
+     * Removes any entries from the list that have been GC'd.
53
+     */
45
     private void cleanUp() {
54
     private void cleanUp() {
46
         for (int i = 0; i < list.size(); i++) {
55
         for (int i = 0; i < list.size(); i++) {
47
             if (list.get(i).get() == null) {
56
             if (list.get(i).get() == null) {
50
         }
59
         }
51
     }
60
     }
52
 
61
 
62
+    /**
63
+     * Dereferences the specified list of WeakReferences to get a plain List.
64
+     * 
65
+     * @param list The list to be dereferenced
66
+     * @return A list containing the items referenced by the specified list
67
+     */
53
     private List<T> dereferenceList(final List<WeakReference<T>> list) {
68
     private List<T> dereferenceList(final List<WeakReference<T>> list) {
54
         final List<T> res = new ArrayList<T>();
69
         final List<T> res = new ArrayList<T>();
55
 
70
 
62
         return res;
77
         return res;
63
     }
78
     }
64
 
79
 
80
+    /**
81
+     * Creates a new collection of weak references to elements in the specified
82
+     * collection.
83
+     * 
84
+     * @param c The collection whose elements should be referenced
85
+     * @return A copy of the specified collection, with each item wrapped in
86
+     * a weak reference.
87
+     */
65
     @SuppressWarnings(value = "unchecked")
88
     @SuppressWarnings(value = "unchecked")
66
     private Collection<WeakReference<T>> referenceCollection(final Collection<?> c) {
89
     private Collection<WeakReference<T>> referenceCollection(final Collection<?> c) {
67
         final Collection<WeakReference<T>> res = new ArrayList<WeakReference<T>>();
90
         final Collection<WeakReference<T>> res = new ArrayList<WeakReference<T>>();

Loading…
Cancelar
Guardar