Browse Source

fix some unit tests, fix some other things i cant remember

tags/0.6.3m1rc1
Gregory Holmes 15 years ago
parent
commit
6dbacd1161

+ 8
- 8
src/com/dmdirc/addons/ui_swing/dialogs/profiles/ProfileDetailPanel.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.profiles;
24 24
 
25
+import com.dmdirc.addons.ui_swing.MainFrame;
25 26
 import com.dmdirc.config.prefs.validator.FileNameValidator;
26 27
 import com.dmdirc.config.prefs.validator.IdentValidator;
27 28
 import com.dmdirc.config.prefs.validator.NicknameValidator;
@@ -31,7 +32,6 @@ import com.dmdirc.addons.ui_swing.components.StandardInputDialog;
31 32
 import com.dmdirc.addons.ui_swing.components.validating.ValidatingJTextField;
32 33
 
33 34
 import java.awt.Dialog.ModalityType;
34
-import java.awt.Window;
35 35
 import java.awt.event.ActionEvent;
36 36
 import java.awt.event.ActionListener;
37 37
 import java.util.ArrayList;
@@ -79,19 +79,19 @@ public final class ProfileDetailPanel extends JPanel implements ActionListener,
79 79
     private JButton delButton;
80 80
     /** Edit button. */
81 81
     private JButton editButton;
82
-    /** Parent window. */
83
-    private Window parentWindow;
82
+    /** Main frame. */
83
+    private MainFrame mainFrame;
84 84
 
85 85
     /**
86 86
      * Creates a new profile detail panel.
87 87
      * 
88 88
      * @param model The list model to use to validate names
89
-     * @param parentWindow Parent window
89
+     * @param mainFrame Main frame
90 90
      */
91 91
     public ProfileDetailPanel(final ProfileListModel model,
92
-            final Window parentWindow) {
92
+            final MainFrame mainFrame) {
93 93
         super();
94
-        this.parentWindow = parentWindow;
94
+        this.mainFrame = mainFrame;
95 95
 
96 96
         this.model = model;
97 97
 
@@ -230,7 +230,7 @@ public final class ProfileDetailPanel extends JPanel implements ActionListener,
230 230
     @Override
231 231
     public void actionPerformed(final ActionEvent e) {
232 232
         if (e.getSource() == addButton) {
233
-            new StandardInputDialog(ProfileManagerDialog.getProfileManagerDialog(parentWindow),
233
+            new StandardInputDialog(ProfileManagerDialog.getProfileManagerDialog(mainFrame),
234 234
                     ModalityType.DOCUMENT_MODAL, "New Nickname",
235 235
                     "Please enter the new nickname", new NicknameValidator()) {
236 236
 
@@ -256,7 +256,7 @@ public final class ProfileDetailPanel extends JPanel implements ActionListener,
256 256
             }.display();
257 257
         } else if (e.getSource() == editButton) {
258 258
             final StandardInputDialog dialog = new StandardInputDialog(
259
-                    ProfileManagerDialog.getProfileManagerDialog(parentWindow),
259
+                    ProfileManagerDialog.getProfileManagerDialog(mainFrame),
260 260
                     ModalityType.DOCUMENT_MODAL, "Edit Nickname",
261 261
                     "Please enter the new nickname", new NicknameValidator()) {
262 262
 

+ 16
- 16
src/com/dmdirc/addons/ui_swing/dialogs/profiles/ProfileManagerDialog.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.profiles;
24 24
 
25
+import com.dmdirc.addons.ui_swing.MainFrame;
25 26
 import com.dmdirc.config.Identity;
26 27
 import com.dmdirc.config.IdentityManager;
27 28
 import com.dmdirc.addons.ui_swing.components.ListScroller;
@@ -31,7 +32,6 @@ import com.dmdirc.addons.ui_swing.components.renderers.ProfileListCellRenderer;
31 32
 import com.dmdirc.addons.ui_swing.dialogs.NewServerDialog;
32 33
 
33 34
 import java.awt.Dialog.ModalityType;
34
-import java.awt.Window;
35 35
 import java.awt.event.ActionEvent;
36 36
 import java.awt.event.ActionListener;
37 37
 import java.util.ArrayList;
@@ -77,17 +77,17 @@ public final class ProfileManagerDialog extends StandardDialog implements Action
77 77
     private int selectedIndex;
78 78
     /** Deleted profiles. */
79 79
     private final List<Profile> deletedProfiles;
80
-    /** Parent window. */
81
-    private Window parentWindow;
80
+    /** main frame. */
81
+    private MainFrame mainFrame;
82 82
 
83 83
     /** 
84 84
      * Creates a new instance of ProfileEditorDialog. 
85 85
      * 
86
-     * @param parentWindow Parent window
86
+     * @param parentWindow main frame
87 87
      */
88
-    private ProfileManagerDialog(final Window parentWindow) {
89
-        super(parentWindow, ModalityType.MODELESS);
90
-        this.parentWindow = parentWindow;
88
+    private ProfileManagerDialog(final MainFrame mainFrame) {
89
+        super(mainFrame, ModalityType.MODELESS);
90
+        this.mainFrame = mainFrame;
91 91
         deletedProfiles = new ArrayList<Profile>();
92 92
 
93 93
         initComponents();
@@ -106,13 +106,13 @@ public final class ProfileManagerDialog extends StandardDialog implements Action
106 106
     /** 
107 107
      * Creates the dialog if one doesn't exist, and displays it. 
108 108
      * 
109
-     * @param parentWindow Parent window
109
+     * @param mainFrame Main frame
110 110
      */
111
-    public static void showProfileManagerDialog(final Window parentWindow) {
112
-        me = getProfileManagerDialog(parentWindow);
111
+    public static void showProfileManagerDialog(final MainFrame mainFrame) {
112
+        me = getProfileManagerDialog(mainFrame);
113 113
 
114 114
         me.pack();
115
-        me.setLocationRelativeTo(parentWindow);
115
+        me.setLocationRelativeTo(mainFrame);
116 116
         me.setVisible(true);
117 117
         me.requestFocusInWindow();
118 118
     }
@@ -120,14 +120,14 @@ public final class ProfileManagerDialog extends StandardDialog implements Action
120 120
     /**
121 121
      * Returns the current instance of the ProfileManagerDialog.
122 122
      * 
123
-     * @param parentWindow Parent window
123
+     * @param mainFrame Main frame
124 124
      *
125 125
      * @return The current ProfileManagerDialog instance
126 126
      */
127
-    public static ProfileManagerDialog getProfileManagerDialog(final Window parentWindow) {
127
+    public static ProfileManagerDialog getProfileManagerDialog(final MainFrame mainFrame) {
128 128
         synchronized (ProfileManagerDialog.class) {
129 129
             if (me == null) {
130
-                me = new ProfileManagerDialog(parentWindow);
130
+                me = new ProfileManagerDialog(mainFrame);
131 131
             }
132 132
         }
133 133
 
@@ -144,7 +144,7 @@ public final class ProfileManagerDialog extends StandardDialog implements Action
144 144
 
145 145
         model = new ProfileListModel();
146 146
         profileList = new JList(model);
147
-        details = new ProfileDetailPanel(model, parentWindow);
147
+        details = new ProfileDetailPanel(model, mainFrame);
148 148
         addButton = new JButton("Add");
149 149
         deleteButton = new JButton("Delete");
150 150
         infoLabel =
@@ -217,7 +217,7 @@ public final class ProfileManagerDialog extends StandardDialog implements Action
217 217
             dispose();
218 218
         }
219 219
         if (NewServerDialog.isNewServerDialogShowing()) {
220
-            NewServerDialog.getNewServerDialog(parentWindow).populateProfiles();
220
+            NewServerDialog.getNewServerDialog(mainFrame).populateProfiles();
221 221
         }
222 222
     }
223 223
 

+ 2
- 1
src/com/dmdirc/addons/ui_swing/wizard/firstrun/SwingFirstRunWizard.java View File

@@ -26,6 +26,7 @@ import com.dmdirc.Main;
26 26
 import com.dmdirc.actions.ActionManager;
27 27
 import com.dmdirc.actions.CoreActionType;
28 28
 import com.dmdirc.actions.interfaces.ActionType;
29
+import com.dmdirc.addons.ui_swing.MainFrame;
29 30
 import com.dmdirc.config.IdentityManager;
30 31
 import com.dmdirc.interfaces.ActionListener;
31 32
 import com.dmdirc.logger.ErrorLevel;
@@ -103,7 +104,7 @@ public final class SwingFirstRunWizard implements WizardListener,
103 104
                 @Override
104 105
                 public void processEvent(final ActionType type,
105 106
                         final StringBuffer format, final Object... arguments) {
106
-                    ProfileManagerDialog.showProfileManagerDialog(wizardDialog);
107
+                    ProfileManagerDialog.showProfileManagerDialog((MainFrame) Main.getUI().getMainWindow());
107 108
                 }
108 109
             }, CoreActionType.CLIENT_OPENED);
109 110
             

+ 1
- 1
test/com/dmdirc/addons/ui_swing/MainFrameTest.java View File

@@ -63,7 +63,7 @@ public class MainFrameTest implements UITestIface {
63 63
     @Before
64 64
     public void setUp() {
65 65
         if (window == null) {
66
-            window = new FrameFixture(SwingController.getMainFrame());
66
+            window = new FrameFixture((MainFrame) Main.getUI().getMainWindow());
67 67
             window.show();
68 68
         }
69 69
     }

+ 4
- 2
test/com/dmdirc/addons/ui_swing/components/frames/InputTextFrameTest.java View File

@@ -25,6 +25,7 @@ package com.dmdirc.addons.ui_swing.components.frames;
25 25
 import com.dmdirc.addons.ui_swing.components.*;
26 26
 import com.dmdirc.addons.ui_swing.components.frames.InputTextFrame;
27 27
 import com.dmdirc.Main;
28
+import com.dmdirc.addons.ui_swing.MainFrame;
28 29
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
29 30
 import com.dmdirc.config.ConfigManager;
30 31
 import com.dmdirc.config.IdentityManager;
@@ -147,11 +148,12 @@ public class InputTextFrameTest implements UITestIface {
147 148
     protected void setupWindow(final ConfigManager configManager) {
148 149
         UIUtilities.initUISettings();
149 150
 
150
-        mainframe = new FrameFixture(SwingController.getMainFrame());
151
+        mainframe = new FrameFixture((MainFrame) Main.getUI().getMainWindow());
151 152
         mainframe.robot.settings().eventMode(EventMode.AWT);
152 153
 
153 154
         final CustomInputFrame titf = new CustomInputFrame(owner,
154
-                GlobalCommandParser.getGlobalCommandParser());
155
+                GlobalCommandParser.getGlobalCommandParser(), 
156
+                (SwingController) Main.getUI());
155 157
 
156 158
         titf.setTitle("testing123");
157 159
 

+ 1
- 0
test/com/dmdirc/harness/TestCommandParser.java View File

@@ -30,6 +30,7 @@ import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.ui.interfaces.InputWindow;
31 31
 
32 32
 public class TestCommandParser extends CommandParser {
33
+    private static final long serialVersionUID = 7073002401375438532L;
33 34
 
34 35
     public String nonCommandLine;
35 36
 

+ 1
- 0
test/com/dmdirc/harness/TestConfigManagerMap.java View File

@@ -27,6 +27,7 @@ import java.util.HashMap;
27 27
 import java.util.Map;
28 28
 
29 29
 public class TestConfigManagerMap extends ConfigManager {
30
+    private static final long serialVersionUID = 3604727894041756961L;
30 31
 
31 32
     public final Map<String, String> settings =
32 33
             new HashMap<String, String>();

+ 1
- 0
test/com/dmdirc/harness/TestConfigManagerOptionToggle.java View File

@@ -25,6 +25,7 @@ package com.dmdirc.harness;
25 25
 import com.dmdirc.config.ConfigManager;
26 26
 
27 27
 public class TestConfigManagerOptionToggle extends ConfigManager {
28
+    private static final long serialVersionUID = 8078917248288638755L;
28 29
 
29 30
     public TestConfigManagerOptionToggle() {
30 31
         super(null, null, null);

Loading…
Cancel
Save