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

Tidied up formatting of all (non-parser) code and javadoc'd everything except for autogenerated UI variables

git-svn-id: http://svn.dmdirc.com/trunk@34 00569f92-eb28-0410-84fd-f71c24880f
tags/0.1
Chris Smith 17 лет назад
Родитель
Сommit
e12ac657fe

+ 6
- 6
src/dmdirc/Channel.java Просмотреть файл

@@ -4,17 +4,17 @@
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
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
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
- * The above copyright notice and this permission notice shall be included in 
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
- * 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 
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 18
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.

+ 19
- 0
src/dmdirc/Config.java Просмотреть файл

@@ -31,6 +31,9 @@ import java.util.Properties;
31 31
  */
32 32
 public class Config {
33 33
     
34
+    /**
35
+     * The application's current configuration
36
+     */
34 37
     private static Properties properties;
35 38
     
36 39
     /** Creates a new instance of Config */
@@ -54,6 +57,10 @@ public class Config {
54 57
         return System.getProperty("user.home")+fs+".DMDirc"+fs;
55 58
     }
56 59
     
60
+    /**
61
+     * Returns the default settings for DMDirc
62
+     * @return default settings
63
+     */
57 64
     private static Properties getDefaults() {
58 65
         Properties defaults = new Properties();
59 66
         
@@ -63,12 +70,24 @@ public class Config {
63 70
         return defaults;
64 71
     }
65 72
     
73
+    /**
74
+     * Determines if the specified option exists
75
+     * @return true iff the option exists, false otherwise
76
+     * @param domain the domain of the option
77
+     * @param option the name of the option
78
+     */
66 79
     public static boolean hasOption(String domain, String option) {
67 80
         assert(properties != null);
68 81
         
69 82
         return (properties.getProperty(domain+"."+option) != null);
70 83
     }
71 84
     
85
+    /**
86
+     * Returns the specified option
87
+     * @return the value of the specified option
88
+     * @param domain the domain of the option
89
+     * @param option the name of the option
90
+     */
72 91
     public static String getOption(String domain, String option) {
73 92
         assert(properties != null);
74 93
         

+ 6
- 6
src/dmdirc/Main.java Просмотреть файл

@@ -4,17 +4,17 @@
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
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
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
- * The above copyright notice and this permission notice shall be included in 
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
- * 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 
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 18
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.

+ 12
- 2
src/dmdirc/Raw.java Просмотреть файл

@@ -27,15 +27,25 @@ import dmdirc.ui.MainFrame;
27 27
 import dmdirc.ui.ServerFrame;
28 28
 
29 29
 /**
30
- *
30
+ * Handles the raw window (which shows the user raw data being sent and
31
+ * received to/from the server)
31 32
  * @author chris
32 33
  */
33 34
 public class Raw {
34 35
     
36
+    /**
37
+     * The server object that's being monitored
38
+     */
35 39
     private Server server;
40
+    /**
41
+     * A serverframe instance used for displaying the raw data
42
+     */
36 43
     private ServerFrame frame;
37 44
     
38
-    /** Creates a new instance of Raw */
45
+    /**
46
+     * Creates a new instance of Raw
47
+     * @param server the server to monitor
48
+     */
39 49
     public Raw(Server server) {
40 50
         this.server = server;
41 51
         

+ 33
- 11
src/dmdirc/Server.java Просмотреть файл

@@ -4,17 +4,17 @@
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
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
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
- * The above copyright notice and this permission notice shall be included in 
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
- * 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 
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 18
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
@@ -51,7 +51,11 @@ public class Server {
51 51
      */
52 52
     private IRCParser parser;
53 53
     
54
-    /** Creates a new instance of Server */
54
+    /**
55
+     * Creates a new instance of Server
56
+     * @param server The hostname/ip of the server to connect to
57
+     * @param port The port to connect to
58
+     */
55 59
     public Server(String server, int port) {
56 60
         
57 61
         channels = new Vector(0,1);
@@ -86,15 +90,33 @@ public class Server {
86 90
     
87 91
     /**
88 92
      * Called on destruction, the server unregisters itself with the ServerManager
93
+     * @throws java.lang.Throwable ...
89 94
      */
90 95
     protected void finalize() throws Throwable {
91 96
         ServerManager.getServerManager().unregisterServer(this);
92 97
     }
93 98
     
94
-    public void AddDataIn (Object eMethod) { parser.AddDataIn(eMethod); }
95
-    public void AddDataOut (Object eMethod) { parser.AddDataOut(eMethod); }
96
-    public void AddMOTDEnd (Object eMethod) { parser.AddMOTDEnd(eMethod); }
99
+    /**
100
+     * Adds a listener for the DataIn event for this server's connection
101
+     * @param eMethod the listener to notify
102
+     */
103
+    public void AddDataIn(Object eMethod) { parser.AddDataIn(eMethod); }
104
+    /**
105
+     * Adds a listener for the DataOut event for this server's connection
106
+     * @param eMethod the listener to notify
107
+     */
108
+    public void AddDataOut(Object eMethod) { parser.AddDataOut(eMethod); }
109
+    /**
110
+     * Adds a listener for the EndOfMOTD event for this server's connection
111
+     * @param eMethod The listener to notify
112
+     */
113
+    public void AddMOTDEnd(Object eMethod) { parser.AddMOTDEnd(eMethod); }
97 114
     
98
-    public void SendRawLine (String line) { parser.SendLine(line); }
115
+    /**
116
+     * Sends a raw line directly to the server
117
+     * @param line The line of text to send to the server
118
+     * @see IRCParser.SendLine(java.lang.String)
119
+     */
120
+    public void SendRawLine(String line) { parser.SendLine(line); }
99 121
     
100 122
 }

+ 15
- 11
src/dmdirc/ServerManager.java Просмотреть файл

@@ -4,17 +4,17 @@
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
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
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
- * The above copyright notice and this permission notice shall be included in 
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
- * 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 
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 18
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
@@ -25,7 +25,7 @@ package dmdirc;
25 25
 import java.util.Vector;
26 26
 
27 27
 /**
28
- * The ServerManager maintains a list of all servers, and provides methods to 
28
+ * The ServerManager maintains a list of all servers, and provides methods to
29 29
  * search or iterate over them.
30 30
  * @author chris
31 31
  */
@@ -61,7 +61,7 @@ public class ServerManager {
61 61
      * Registers a new server with the manager
62 62
      * @param server The server to be registered
63 63
      */
64
-    public void registerServer (Server server) {
64
+    public void registerServer(Server server) {
65 65
         servers.add(server);
66 66
     }
67 67
     
@@ -69,12 +69,16 @@ public class ServerManager {
69 69
      * Unregisters a server from the manager
70 70
      * @param server The server to be unregistered
71 71
      */
72
-    public void unregisterServer (Server server) {
72
+    public void unregisterServer(Server server) {
73 73
         servers.remove(server);
74 74
     }
75 75
     
76
-    public int numServers () {
76
+    /**
77
+     * Returns the number of servers that are registered with the manager
78
+     * @return number of registered servers
79
+     */
80
+    public int numServers() {
77 81
         return servers.size();
78 82
     }
79
-       
83
+    
80 84
 }

+ 11
- 7
src/dmdirc/ui/MainFrame.java Просмотреть файл

@@ -4,17 +4,17 @@
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
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
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
- * The above copyright notice and this permission notice shall be included in 
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
- * 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 
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 18
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
@@ -61,9 +61,13 @@ public class MainFrame extends javax.swing.JFrame {
61 61
         });
62 62
     }
63 63
     
64
+    /**
65
+     * Adds the specified InternalFrame as a child of the main frame
66
+     * @param frame the frame to be added
67
+     */
64 68
     public void addChild(JInternalFrame frame) {
65 69
         desktopPane.add(frame);
66
-    }    
70
+    }
67 71
     
68 72
     /** This method is called from within the constructor to
69 73
      * initialize the form.

+ 22
- 2
src/dmdirc/ui/NewServerDialog.java Просмотреть файл

@@ -33,13 +33,19 @@ import javax.swing.JComponent;
33 33
 import javax.swing.JTextField;
34 34
 
35 35
 /**
36
- *
37
- * @author  chris
36
+ * Dialog that allows the user to enter details of a new server to connect to
37
+ * @author chris
38 38
  */
39 39
 public class NewServerDialog extends javax.swing.JDialog {
40 40
     
41
+    /**
42
+     * A previously created instance of NewServerDialog
43
+     */
41 44
     private static NewServerDialog me;
42 45
     
46
+    /**
47
+     * Creates a new instance of the dialog
48
+     */
43 49
     private NewServerDialog() {
44 50
         super((java.awt.Frame)MainFrame.getMainFrame(), false);
45 51
         
@@ -57,6 +63,9 @@ public class NewServerDialog extends javax.swing.JDialog {
57 63
         setVisible(true);
58 64
     }
59 65
     
66
+    /**
67
+     * Creates the new server dialog if one doesn't exist, and displays it.
68
+     */
60 69
     public static void showNewServerDialog() {
61 70
         if (me == null) {
62 71
             me = new NewServerDialog();
@@ -66,6 +75,9 @@ public class NewServerDialog extends javax.swing.JDialog {
66 75
         }
67 76
     }
68 77
     
78
+    /**
79
+     * Adds listeners for various objects in the dialog
80
+     */
69 81
     private void addCallbacks() {
70 82
         jButton2.addActionListener(new ActionListener() {
71 83
             public void actionPerformed(ActionEvent actionEvent) {
@@ -224,8 +236,16 @@ public class NewServerDialog extends javax.swing.JDialog {
224 236
     
225 237
 }
226 238
 
239
+/**
240
+ * Verifies that the port number is a valid port
241
+ */
227 242
 class PortVerifier extends InputVerifier {
228 243
     
244
+    /**
245
+     * Verifies that the number specified in the textfield is a valid port
246
+     * @param jComponent The component to be tested
247
+     * @return true iff the number is a valid port, false otherwise
248
+     */
229 249
     public boolean verify(JComponent jComponent) {
230 250
         JTextField tf = (JTextField)jComponent;
231 251
         try {

+ 20
- 7
src/dmdirc/ui/ServerFrame.java Просмотреть файл

@@ -4,17 +4,17 @@
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
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
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
- * The above copyright notice and this permission notice shall be included in 
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
- * 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 
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 18
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
@@ -37,10 +37,19 @@ import javax.swing.plaf.metal.MetalInternalFrameUI;
37 37
  */
38 38
 public class ServerFrame extends javax.swing.JInternalFrame {
39 39
     
40
+    /**
41
+     * The Server object that owns this frame
42
+     */
40 43
     private Server parent;
44
+    /**
45
+     * The border used when the frame is not maximised
46
+     */
41 47
     private Border myborder;
42 48
     
43
-    /** Creates new form ServerFrame */
49
+    /**
50
+     * Creates new form ServerFrame
51
+     * @param parent The server instance that owns this frame
52
+     */
44 53
     public ServerFrame(Server parent) {
45 54
         initComponents();
46 55
         setMaximizable(true);
@@ -70,6 +79,10 @@ public class ServerFrame extends javax.swing.JInternalFrame {
70 79
         
71 80
     }
72 81
     
82
+    /**
83
+     * Adds a line of text to the main text area
84
+     * @param line text to add
85
+     */
73 86
     public void addLine(String line) {
74 87
         jTextArea1.append(line+"\n");
75 88
     }

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