about summary refs log tree commit diff stats
path: root/client/trunk/src/com/fourisland
diff options
context:
space:
mode:
Diffstat (limited to 'client/trunk/src/com/fourisland')
-rw-r--r--client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.form89
-rw-r--r--client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.java221
-rw-r--r--client/trunk/src/com/fourisland/instadisc/DownloadItem/resources/DownloadItemModeTest.properties7
-rw-r--r--client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java20
-rw-r--r--client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java11
-rw-r--r--client/trunk/src/com/fourisland/instadisc/XmlRpc.java5
6 files changed, 341 insertions, 12 deletions
diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.form b/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.form new file mode 100644 index 0000000..9f62e4e --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.form
@@ -0,0 +1,89 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<Form version="1.5" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
4 <Properties>
5 <Property name="defaultCloseOperation" type="int" value="2"/>
6 <Property name="name" type="java.lang.String" value="Form" noResource="true"/>
7 </Properties>
8 <SyntheticProperties>
9 <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
10 </SyntheticProperties>
11 <AuxValues>
12 <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
13 <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
14 <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
15 <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
16 <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
17 <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
18 <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
19 <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
20 </AuxValues>
21
22 <Layout>
23 <DimensionLayout dim="0">
24 <Group type="103" groupAlignment="0" attributes="0">
25 <Group type="102" attributes="0">
26 <EmptySpace max="-2" attributes="0"/>
27 <Group type="103" groupAlignment="0" attributes="0">
28 <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
29 <Group type="102" alignment="0" attributes="0">
30 <EmptySpace min="12" pref="12" max="12" attributes="0"/>
31 <Group type="103" groupAlignment="0" attributes="0">
32 <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
33 <Component id="jLabel2" alignment="0" pref="364" max="32767" attributes="0"/>
34 </Group>
35 </Group>
36 <Component id="jButton1" alignment="1" min="-2" max="-2" attributes="0"/>
37 </Group>
38 <EmptySpace max="-2" attributes="0"/>
39 </Group>
40 </Group>
41 </DimensionLayout>
42 <DimensionLayout dim="1">
43 <Group type="103" groupAlignment="0" attributes="0">
44 <Group type="102" alignment="0" attributes="0">
45 <EmptySpace min="-2" max="-2" attributes="0"/>
46 <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
47 <EmptySpace min="-2" max="-2" attributes="0"/>
48 <Component id="jLabel2" pref="85" max="32767" attributes="0"/>
49 <EmptySpace max="-2" attributes="0"/>
50 <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
51 <EmptySpace max="-2" attributes="0"/>
52 <Component id="jButton1" min="-2" max="-2" attributes="0"/>
53 <EmptySpace min="-2" max="-2" attributes="0"/>
54 </Group>
55 </Group>
56 </DimensionLayout>
57 </Layout>
58 <SubComponents>
59 <Component class="javax.swing.JLabel" name="jLabel1">
60 <Properties>
61 <Property name="font" type="java.awt.Font" resourceKey="jLabel1.font"/>
62 <Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
63 <Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
64 </Properties>
65 </Component>
66 <Component class="javax.swing.JLabel" name="jLabel2">
67 <Properties>
68 <Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/>
69 <Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/>
70 </Properties>
71 </Component>
72 <Component class="javax.swing.JLabel" name="jLabel3">
73 <Properties>
74 <Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/>
75 <Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/>
76 </Properties>
77 </Component>
78 <Component class="javax.swing.JButton" name="jButton1">
79 <Properties>
80 <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/>
81 <Property name="enabled" type="boolean" value="false"/>
82 <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/>
83 </Properties>
84 <Events>
85 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
86 </Events>
87 </Component>
88 </SubComponents>
89</Form>
diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.java new file mode 100644 index 0000000..d085448 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemModeTest.java
@@ -0,0 +1,221 @@
1/*
2 * DownloadItemModeTest.java
3 *
4 * Created on September 27, 2008, 10:20 AM
5 */
6
7package com.fourisland.instadisc.DownloadItem;
8
9import com.fourisland.instadisc.Database.Wrapper;
10import com.fourisland.instadisc.FirstRun.StepEndResults;
11import com.fourisland.instadisc.XmlRpc;
12import java.io.IOException;
13import java.io.InputStream;
14import java.net.ServerSocket;
15import java.net.Socket;
16import java.net.SocketException;
17import java.util.logging.Level;
18import java.util.logging.Logger;
19
20/**
21 *
22 * @author hatkirby
23 */
24public class DownloadItemModeTest extends javax.swing.JDialog {
25
26 /** Creates new form DownloadItemModeTest */
27 public DownloadItemModeTest(java.awt.Frame parent, boolean modal) {
28 super(parent, modal);
29
30 initComponents();
31
32 new Thread(new Runnable() {
33 public void run() {
34 runDownloadItemModeTest();
35 }
36 }).start();
37 }
38
39 /** This method is called from within the constructor to
40 * initialize the form.
41 * WARNING: Do NOT modify this code. The content of this method is
42 * always regenerated by the Form Editor.
43 */
44 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
45 private void initComponents() {
46
47 jLabel1 = new javax.swing.JLabel();
48 jLabel2 = new javax.swing.JLabel();
49 jLabel3 = new javax.swing.JLabel();
50 jButton1 = new javax.swing.JButton();
51
52 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
53 setName("Form"); // NOI18N
54
55 org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.fourisland.instadisc.InstaDiscApp.class).getContext().getResourceMap(DownloadItemModeTest.class);
56 jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
57 jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
58 jLabel1.setName("jLabel1"); // NOI18N
59
60 jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
61 jLabel2.setName("jLabel2"); // NOI18N
62
63 jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
64 jLabel3.setName("jLabel3"); // NOI18N
65
66 jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
67 jButton1.setEnabled(false);
68 jButton1.setName("jButton1"); // NOI18N
69 jButton1.addActionListener(new java.awt.event.ActionListener() {
70 public void actionPerformed(java.awt.event.ActionEvent evt) {
71 jButton1ActionPerformed(evt);
72 }
73 });
74
75 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
76 getContentPane().setLayout(layout);
77 layout.setHorizontalGroup(
78 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
79 .addGroup(layout.createSequentialGroup()
80 .addContainerGap()
81 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
82 .addComponent(jLabel1)
83 .addGroup(layout.createSequentialGroup()
84 .addGap(12, 12, 12)
85 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
86 .addComponent(jLabel3)
87 .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)))
88 .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING))
89 .addContainerGap())
90 );
91 layout.setVerticalGroup(
92 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93 .addGroup(layout.createSequentialGroup()
94 .addContainerGap()
95 .addComponent(jLabel1)
96 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
97 .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
98 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
99 .addComponent(jLabel3)
100 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
101 .addComponent(jButton1)
102 .addContainerGap())
103 );
104
105 pack();
106 }// </editor-fold>//GEN-END:initComponents
107
108 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
109 StepEndResults.ok = true;
110 this.setVisible(false);
111 }//GEN-LAST:event_jButton1ActionPerformed
112
113 /**
114 * @param args the command line arguments
115 */
116 public static void main(String args[]) {
117 java.awt.EventQueue.invokeLater(new Runnable() {
118 public void run() {
119 DownloadItemModeTest dialog = new DownloadItemModeTest(new javax.swing.JFrame(), true);
120 dialog.addWindowListener(new java.awt.event.WindowAdapter() {
121 public void windowClosing(java.awt.event.WindowEvent e) {
122 System.exit(0);
123 }
124 });
125 dialog.setVisible(true);
126 }
127 });
128 }
129
130 // Variables declaration - do not modify//GEN-BEGIN:variables
131 private javax.swing.JButton jButton1;
132 private javax.swing.JLabel jLabel1;
133 private javax.swing.JLabel jLabel2;
134 private javax.swing.JLabel jLabel3;
135 // End of variables declaration//GEN-END:variables
136
137 public void runDownloadItemModeTest() {
138 try
139 {
140 ServerSocket svr = new ServerSocket();
141 java.net.InetSocketAddress addr = new java.net.InetSocketAddress(61200);
142 svr.bind(addr);
143
144 new Thread(new DownloadItemModeTestThread(svr)).start();
145
146 XmlRpc xmlrpc = new XmlRpc("downloadItemModeTest");
147 xmlrpc.resetParams();
148 if (((Integer) xmlrpc.execute()) == 1)
149 {
150 Wrapper.setConfig("downloadItemMode", "Pull");
151 }
152 } catch (IOException ex)
153 {
154 Logger.getLogger(DownloadItemModeTest.class.getName()).log(Level.SEVERE, null, ex);
155 }
156
157 jLabel3.setText("<HTML>You're download item mode has been set to <B>" + Wrapper.getConfig("downloadItemMode") + "</B>");
158 jButton1.setEnabled(true);
159 }
160}
161
162class DownloadItemModeTestThread implements Runnable
163{
164 ServerSocket svr;
165
166 public DownloadItemModeTestThread(ServerSocket svr)
167 {
168 this.svr = svr;
169 }
170
171 public void run() {
172 try
173 {
174 Socket s = svr.accept();
175
176 InputStream is = s.getInputStream();
177 int buffer[] = new int[1000];
178 int rs = 0;
179 int i = 0;
180
181 while (rs != -1)
182 {
183 try
184 {
185 rs = is.read();
186
187 if (rs != -1)
188 {
189 buffer[i] = rs;
190 }
191
192 i++;
193 } catch (SocketException ex)
194 {
195 return;
196 } catch (IOException ex)
197 {
198 Logger.getLogger(DownloadItemModeTest.class.getName()).log(Level.SEVERE, null, ex);
199 }
200 }
201
202 StringBuilder result = new StringBuilder();
203 int j = 0;
204 for (j = 0; j < i; j++)
205 {
206 result.append(Character.toString((char) buffer[j]));
207 }
208
209 if (result.toString().trim().equals("InstaDisc Download Item Mode Test"))
210 {
211 Wrapper.setConfig("downloadItemMode", "Push");
212 }
213
214 s.close();
215 svr.close();
216 } catch (IOException ex)
217 {
218 Logger.getLogger(DownloadItemModeTestThread.class.getName()).log(Level.SEVERE, null, ex);
219 }
220 }
221} \ No newline at end of file
diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/resources/DownloadItemModeTest.properties b/client/trunk/src/com/fourisland/instadisc/DownloadItem/resources/DownloadItemModeTest.properties new file mode 100644 index 0000000..d558d31 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/resources/DownloadItemModeTest.properties
@@ -0,0 +1,7 @@
1
2jLabel1.text=Download Item Mode Test
3#NOI18N
4jLabel1.font=DejaVu Sans-Plain-18
5jLabel2.text=<HTML>InstaDisc can recieve items for you in two ways, Push or Pull. Push is faster, but may not work for some people. Pull isn't as efficent, but should work for anyone. InstaDisc is now running a test to see which method is best for you.
6jLabel3.text=The test is running....
7jButton1.text=Next
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java index 0919f21..713cc83 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java
@@ -5,6 +5,8 @@
5 5
6package com.fourisland.instadisc.FirstRun; 6package com.fourisland.instadisc.FirstRun;
7 7
8import com.fourisland.instadisc.Database.Wrapper;
9import com.fourisland.instadisc.DownloadItem.DownloadItemModeTest;
8import javax.swing.JFrame; 10import javax.swing.JFrame;
9 11
10/** 12/**
@@ -25,8 +27,22 @@ public class FirstRunWizard implements Runnable {
25 if (StepEndResults.ok) 27 if (StepEndResults.ok)
26 { 28 {
27 StepEndResults.ok = false; 29 StepEndResults.ok = false;
28 Step3 s3 = new Step3(new JFrame(), true); 30 DownloadItemModeTest dIMT = new DownloadItemModeTest(new JFrame(), true);
29 s3.setVisible(true); 31 dIMT.setVisible(true);
32 if (StepEndResults.ok)
33 {
34 StepEndResults.ok = false;
35 Step3 s3 = new Step3(new JFrame(), true);
36 s3.setVisible(true);
37
38 Wrapper.setConfig("initCheck", "done");
39 Wrapper.setConfig("itemBufferSize", "10");
40 Wrapper.setConfig("verIDBufferSize", "10000");
41 Wrapper.setConfig("nextFilterID", "0");
42 Wrapper.setConfig("ipCheckValue", "1");
43 Wrapper.setConfig("ipCheckUnit", "day");
44 Wrapper.setConfig("useUnreadFlag", "true");
45 }
30 } 46 }
31 } 47 }
32 System.exit(0); 48 System.exit(0);
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java index 292dbb1..85180ee 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java
@@ -8,8 +8,6 @@ package com.fourisland.instadisc.FirstRun;
8import com.fourisland.instadisc.Database.Wrapper; 8import com.fourisland.instadisc.Database.Wrapper;
9import com.fourisland.instadisc.Item.MD5; 9import com.fourisland.instadisc.Item.MD5;
10import com.fourisland.instadisc.XmlRpc; 10import com.fourisland.instadisc.XmlRpc;
11import java.net.MalformedURLException;
12import java.net.URL;
13 11
14/** 12/**
15 * 13 *
@@ -142,17 +140,10 @@ public class Step2 extends javax.swing.JDialog {
142 140
143 if (r == 1) 141 if (r == 1)
144 { 142 {
145 jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); 143 jLabel5.setText("Error: Couldn't find the specified user.");
146 } else { 144 } else {
147 Wrapper.setConfig("username", jTextField1.getText()); 145 Wrapper.setConfig("username", jTextField1.getText());
148 Wrapper.setConfig("password", password); 146 Wrapper.setConfig("password", password);
149 Wrapper.setConfig("itemBufferSize", "10");
150 Wrapper.setConfig("verIDBufferSize", "10000");
151 Wrapper.setConfig("nextFilterID", "0");
152 Wrapper.setConfig("ipCheckValue", "1");
153 Wrapper.setConfig("ipCheckUnit", "day");
154 Wrapper.setConfig("useUnreadFlag", "true");
155 Wrapper.setConfig("initCheck", "done");
156 147
157 StepEndResults.ok = true; 148 StepEndResults.ok = true;
158 this.setVisible(false); 149 this.setVisible(false);
diff --git a/client/trunk/src/com/fourisland/instadisc/XmlRpc.java b/client/trunk/src/com/fourisland/instadisc/XmlRpc.java index 4fe5b4b..86bff6f 100644 --- a/client/trunk/src/com/fourisland/instadisc/XmlRpc.java +++ b/client/trunk/src/com/fourisland/instadisc/XmlRpc.java
@@ -88,4 +88,9 @@ public class XmlRpc {
88 } 88 }
89 return result; 89 return result;
90 } 90 }
91
92 public void resetParams()
93 {
94 params = new Object[] {};
95 }
91} 96}