diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 14:31:19 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 14:31:19 +0000 |
commit | beba85c2c0593acaa08a7337f82cfb128bd91262 (patch) | |
tree | c624a45c99a2ba3b7fa36f0fc4d934057953fd0e /client | |
parent | 4f12915c1d15ba6446455ed1c483eb2600ba46a3 (diff) | |
download | instadisc-beba85c2c0593acaa08a7337f82cfb128bd91262.tar.gz instadisc-beba85c2c0593acaa08a7337f82cfb128bd91262.tar.bz2 instadisc-beba85c2c0593acaa08a7337f82cfb128bd91262.zip |
Client: Completed step 5
Instead of forcing restart after running the DownloadItemMode, ModeControl is deinitalized before the test is run and reinitalized after the test is run so that the DownloadItemMode can change smoothly. Refs #69
Diffstat (limited to 'client')
4 files changed, 64 insertions, 14 deletions
diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java index 3fcaa4b..73b48c8 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java | |||
@@ -1,12 +1,15 @@ | |||
1 | package com.fourisland.instadisc.DownloadItem; | 1 | package com.fourisland.instadisc.DownloadItem; |
2 | 2 | ||
3 | import java.util.Timer; | ||
4 | |||
5 | public class ModeControl implements DownloadItemMode | 3 | public class ModeControl implements DownloadItemMode |
6 | { | 4 | { |
7 | public static final ModeControl INSTANCE = new ModeControl(); | 5 | public static final ModeControl INSTANCE = new ModeControl(); |
8 | private DownloadItemMode dim; | 6 | private DownloadItemMode dim; |
9 | 7 | ||
8 | public ModeControl() | ||
9 | { | ||
10 | Runtime.getRuntime().addShutdownHook(new Thread(new DeinitalizeModeThread())); | ||
11 | } | ||
12 | |||
10 | public void initalize(String dim) throws UnknownDownloadItemModeException | 13 | public void initalize(String dim) throws UnknownDownloadItemModeException |
11 | { | 14 | { |
12 | if (dim.equals("Push")) | 15 | if (dim.equals("Push")) |
@@ -18,8 +21,6 @@ public class ModeControl implements DownloadItemMode | |||
18 | } else { | 21 | } else { |
19 | throw new UnknownDownloadItemModeException(); | 22 | throw new UnknownDownloadItemModeException(); |
20 | } | 23 | } |
21 | |||
22 | Runtime.getRuntime().addShutdownHook(new Thread(new DeinitalizeModeThread())); | ||
23 | } | 24 | } |
24 | 25 | ||
25 | public void modeInitalize() { | 26 | public void modeInitalize() { |
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form index f570bb8..e91cd9b 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form | |||
@@ -123,6 +123,20 @@ | |||
123 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem7ActionPerformed"/> | 123 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem7ActionPerformed"/> |
124 | </Events> | 124 | </Events> |
125 | </MenuItem> | 125 | </MenuItem> |
126 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem8"> | ||
127 | <Properties> | ||
128 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem8.text"/> | ||
129 | <Property name="name" type="java.lang.String" value="jMenuItem8" noResource="true"/> | ||
130 | </Properties> | ||
131 | <Events> | ||
132 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem8ActionPerformed"/> | ||
133 | </Events> | ||
134 | </MenuItem> | ||
135 | <MenuItem class="javax.swing.JSeparator" name="jSeparator2"> | ||
136 | <Properties> | ||
137 | <Property name="name" type="java.lang.String" value="jSeparator2" noResource="true"/> | ||
138 | </Properties> | ||
139 | </MenuItem> | ||
126 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem3"> | 140 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem3"> |
127 | <Properties> | 141 | <Properties> |
128 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem3.text"/> | 142 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem3.text"/> |
@@ -141,13 +155,13 @@ | |||
141 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem4ActionPerformed"/> | 155 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem4ActionPerformed"/> |
142 | </Events> | 156 | </Events> |
143 | </MenuItem> | 157 | </MenuItem> |
144 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem8"> | 158 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem9"> |
145 | <Properties> | 159 | <Properties> |
146 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem8.text"/> | 160 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem9.text"/> |
147 | <Property name="name" type="java.lang.String" value="jMenuItem8" noResource="true"/> | 161 | <Property name="name" type="java.lang.String" value="jMenuItem9" noResource="true"/> |
148 | </Properties> | 162 | </Properties> |
149 | <Events> | 163 | <Events> |
150 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem8ActionPerformed"/> | 164 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem9ActionPerformed"/> |
151 | </Events> | 165 | </Events> |
152 | </MenuItem> | 166 | </MenuItem> |
153 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem5"> | 167 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem5"> |
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java index 99a7ab3..4ad567f 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java | |||
@@ -5,6 +5,7 @@ package com.fourisland.instadisc; | |||
5 | 5 | ||
6 | import com.fourisland.instadisc.Database.Item; | 6 | import com.fourisland.instadisc.Database.Item; |
7 | import com.fourisland.instadisc.Database.Wrapper; | 7 | import com.fourisland.instadisc.Database.Wrapper; |
8 | import com.fourisland.instadisc.DownloadItem.DownloadItemModeTest; | ||
8 | import com.fourisland.instadisc.DownloadItem.ModeControl; | 9 | import com.fourisland.instadisc.DownloadItem.ModeControl; |
9 | import com.fourisland.instadisc.DownloadItem.UnknownDownloadItemModeException; | 10 | import com.fourisland.instadisc.DownloadItem.UnknownDownloadItemModeException; |
10 | import com.fourisland.instadisc.Item.Categories.InstaDiscIcon; | 11 | import com.fourisland.instadisc.Item.Categories.InstaDiscIcon; |
@@ -166,9 +167,11 @@ public class InstaDiscView extends FrameView { | |||
166 | javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); | 167 | javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); |
167 | jMenu1 = new javax.swing.JMenu(); | 168 | jMenu1 = new javax.swing.JMenu(); |
168 | jMenuItem7 = new javax.swing.JMenuItem(); | 169 | jMenuItem7 = new javax.swing.JMenuItem(); |
170 | jMenuItem8 = new javax.swing.JMenuItem(); | ||
171 | jSeparator2 = new javax.swing.JSeparator(); | ||
169 | jMenuItem3 = new javax.swing.JMenuItem(); | 172 | jMenuItem3 = new javax.swing.JMenuItem(); |
170 | jMenuItem4 = new javax.swing.JMenuItem(); | 173 | jMenuItem4 = new javax.swing.JMenuItem(); |
171 | jMenuItem8 = new javax.swing.JMenuItem(); | 174 | jMenuItem9 = new javax.swing.JMenuItem(); |
172 | jMenuItem5 = new javax.swing.JMenuItem(); | 175 | jMenuItem5 = new javax.swing.JMenuItem(); |
173 | javax.swing.JMenu helpMenu = new javax.swing.JMenu(); | 176 | javax.swing.JMenu helpMenu = new javax.swing.JMenu(); |
174 | jMenuItem6 = new javax.swing.JMenuItem(); | 177 | jMenuItem6 = new javax.swing.JMenuItem(); |
@@ -269,6 +272,18 @@ public class InstaDiscView extends FrameView { | |||
269 | }); | 272 | }); |
270 | jMenu1.add(jMenuItem7); | 273 | jMenu1.add(jMenuItem7); |
271 | 274 | ||
275 | jMenuItem8.setText(resourceMap.getString("jMenuItem8.text")); // NOI18N | ||
276 | jMenuItem8.setName("jMenuItem8"); // NOI18N | ||
277 | jMenuItem8.addActionListener(new java.awt.event.ActionListener() { | ||
278 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
279 | jMenuItem8ActionPerformed(evt); | ||
280 | } | ||
281 | }); | ||
282 | jMenu1.add(jMenuItem8); | ||
283 | |||
284 | jSeparator2.setName("jSeparator2"); // NOI18N | ||
285 | jMenu1.add(jSeparator2); | ||
286 | |||
272 | jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N | 287 | jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N |
273 | jMenuItem3.setName("jMenuItem3"); // NOI18N | 288 | jMenuItem3.setName("jMenuItem3"); // NOI18N |
274 | jMenuItem3.addActionListener(new java.awt.event.ActionListener() { | 289 | jMenuItem3.addActionListener(new java.awt.event.ActionListener() { |
@@ -287,14 +302,14 @@ public class InstaDiscView extends FrameView { | |||
287 | }); | 302 | }); |
288 | jMenu1.add(jMenuItem4); | 303 | jMenu1.add(jMenuItem4); |
289 | 304 | ||
290 | jMenuItem8.setText(resourceMap.getString("jMenuItem8.text")); // NOI18N | 305 | jMenuItem9.setText(resourceMap.getString("jMenuItem9.text")); // NOI18N |
291 | jMenuItem8.setName("jMenuItem8"); // NOI18N | 306 | jMenuItem9.setName("jMenuItem9"); // NOI18N |
292 | jMenuItem8.addActionListener(new java.awt.event.ActionListener() { | 307 | jMenuItem9.addActionListener(new java.awt.event.ActionListener() { |
293 | public void actionPerformed(java.awt.event.ActionEvent evt) { | 308 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
294 | jMenuItem8ActionPerformed(evt); | 309 | jMenuItem9ActionPerformed(evt); |
295 | } | 310 | } |
296 | }); | 311 | }); |
297 | jMenu1.add(jMenuItem8); | 312 | jMenu1.add(jMenuItem9); |
298 | 313 | ||
299 | jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N | 314 | jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N |
300 | jMenuItem5.setName("jMenuItem5"); // NOI18N | 315 | jMenuItem5.setName("jMenuItem5"); // NOI18N |
@@ -485,6 +500,23 @@ public class InstaDiscView extends FrameView { | |||
485 | jMenuItem8.setEnabled(Wrapper.getConfig("useUnreadFlag").equals("true")); | 500 | jMenuItem8.setEnabled(Wrapper.getConfig("useUnreadFlag").equals("true")); |
486 | }//GEN-LAST:event_jMenu1MenuSelected | 501 | }//GEN-LAST:event_jMenu1MenuSelected |
487 | 502 | ||
503 | private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed | ||
504 | try | ||
505 | { | ||
506 | ModeControl.INSTANCE.modeDeinitalize(); | ||
507 | |||
508 | DownloadItemModeTest dIMT = new DownloadItemModeTest(new JFrame(), true); | ||
509 | dIMT.setVisible(true); | ||
510 | |||
511 | ModeControl.INSTANCE.initalize(Wrapper.getConfig("downloadItemMode")); | ||
512 | ModeControl.INSTANCE.modeInitalize();//GEN-LAST:event_jMenuItem9ActionPerformed | ||
513 | ModeControl.INSTANCE.requestRetained(); | ||
514 | } catch (UnknownDownloadItemModeException ex) | ||
515 | { | ||
516 | Logger.getLogger(InstaDiscView.class.getName()).log(Level.SEVERE, null, ex); | ||
517 | } | ||
518 | } | ||
519 | |||
488 | // Variables declaration - do not modify//GEN-BEGIN:variables | 520 | // Variables declaration - do not modify//GEN-BEGIN:variables |
489 | private javax.swing.JList jList1; | 521 | private javax.swing.JList jList1; |
490 | private javax.swing.JMenu jMenu1; | 522 | private javax.swing.JMenu jMenu1; |
@@ -496,8 +528,10 @@ public class InstaDiscView extends FrameView { | |||
496 | private javax.swing.JMenuItem jMenuItem6; | 528 | private javax.swing.JMenuItem jMenuItem6; |
497 | private javax.swing.JMenuItem jMenuItem7; | 529 | private javax.swing.JMenuItem jMenuItem7; |
498 | private javax.swing.JMenuItem jMenuItem8; | 530 | private javax.swing.JMenuItem jMenuItem8; |
531 | private javax.swing.JMenuItem jMenuItem9; | ||
499 | private javax.swing.JScrollPane jScrollPane1; | 532 | private javax.swing.JScrollPane jScrollPane1; |
500 | private javax.swing.JSeparator jSeparator1; | 533 | private javax.swing.JSeparator jSeparator1; |
534 | private javax.swing.JSeparator jSeparator2; | ||
501 | private javax.swing.JPanel mainPanel; | 535 | private javax.swing.JPanel mainPanel; |
502 | private javax.swing.JMenuBar menuBar; | 536 | private javax.swing.JMenuBar menuBar; |
503 | private javax.swing.JProgressBar progressBar; | 537 | private javax.swing.JProgressBar progressBar; |
diff --git a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties index 927eecf..7c504b6 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties | |||
@@ -39,3 +39,4 @@ jMenuItem5.text=Advanced Settings | |||
39 | jMenuItem6.text=InstaDisc Website | 39 | jMenuItem6.text=InstaDisc Website |
40 | jMenuItem7.text=Change Password | 40 | jMenuItem7.text=Change Password |
41 | jMenuItem8.text=Mark all as Read | 41 | jMenuItem8.text=Mark all as Read |
42 | jMenuItem9.text=Run Download Item Test | ||