diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-07-29 00:48:41 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-07-29 00:48:41 +0000 |
commit | 3bfabd220ce6c644168184a8464d78564adb05f5 (patch) | |
tree | 14fa2d6203161d99c5a71e082ff793ecc6057de8 /client/trunk/src/com/fourisland | |
parent | 97b7a1e491b419a82bb94289d1f957be48bcf35e (diff) | |
download | instadisc-3bfabd220ce6c644168184a8464d78564adb05f5.tar.gz instadisc-3bfabd220ce6c644168184a8464d78564adb05f5.tar.bz2 instadisc-3bfabd220ce6c644168184a8464d78564adb05f5.zip |
Added database
Because of the lack of SQLite Java wrappers, InstaDisc instead uses a BDB database.
Diffstat (limited to 'client/trunk/src/com/fourisland')
23 files changed, 1475 insertions, 10 deletions
diff --git a/client/trunk/src/com/fourisland/instadisc/CloseObjectThread.java b/client/trunk/src/com/fourisland/instadisc/CloseServerSocketThread.java index af8cecc..cfe1820 100644 --- a/client/trunk/src/com/fourisland/instadisc/CloseObjectThread.java +++ b/client/trunk/src/com/fourisland/instadisc/CloseServerSocketThread.java | |||
@@ -14,11 +14,11 @@ import java.util.logging.Logger; | |||
14 | * | 14 | * |
15 | * @author hatkirby | 15 | * @author hatkirby |
16 | */ | 16 | */ |
17 | class CloseObjectThread implements Runnable{ | 17 | class CloseServerSocketThread implements Runnable { |
18 | 18 | ||
19 | ServerSocket svr; | 19 | ServerSocket svr; |
20 | 20 | ||
21 | public CloseObjectThread(ServerSocket svr) { | 21 | public CloseServerSocketThread(ServerSocket svr) { |
22 | this.svr = svr; | 22 | this.svr = svr; |
23 | } | 23 | } |
24 | 24 | ||
@@ -26,7 +26,7 @@ class CloseObjectThread implements Runnable{ | |||
26 | try { | 26 | try { |
27 | svr.close(); | 27 | svr.close(); |
28 | } catch (IOException ex) { | 28 | } catch (IOException ex) { |
29 | Logger.getLogger(CloseObjectThread.class.getName()).log(Level.SEVERE, null, ex); | 29 | Logger.getLogger(CloseServerSocketThread.class.getName()).log(Level.SEVERE, null, ex); |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/CloseEntityStoreThread.java b/client/trunk/src/com/fourisland/instadisc/Database/CloseEntityStoreThread.java new file mode 100644 index 0000000..14ed006 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/CloseEntityStoreThread.java | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.instadisc.Database; | ||
7 | |||
8 | import com.sleepycat.je.DatabaseException; | ||
9 | import com.sleepycat.persist.EntityStore; | ||
10 | import java.util.logging.Level; | ||
11 | import java.util.logging.Logger; | ||
12 | |||
13 | /** | ||
14 | * | ||
15 | * @author hatkirby | ||
16 | */ | ||
17 | public class CloseEntityStoreThread implements Runnable { | ||
18 | |||
19 | EntityStore es; | ||
20 | |||
21 | public CloseEntityStoreThread(EntityStore es) { | ||
22 | this.es = es; | ||
23 | } | ||
24 | |||
25 | public void run() { | ||
26 | try { | ||
27 | es.close(); | ||
28 | } catch (DatabaseException ex) { | ||
29 | Logger.getLogger(CloseEntityStoreThread.class.getName()).log(Level.SEVERE, null, ex); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/CloseEnvironmentThread.java b/client/trunk/src/com/fourisland/instadisc/Database/CloseEnvironmentThread.java new file mode 100644 index 0000000..2a23aeb --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/CloseEnvironmentThread.java | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | package com.fourisland.instadisc.Database; | ||
6 | |||
7 | import com.sleepycat.je.DatabaseException; | ||
8 | import com.sleepycat.je.Environment; | ||
9 | import java.util.logging.Level; | ||
10 | import java.util.logging.Logger; | ||
11 | |||
12 | /** | ||
13 | * | ||
14 | * @author hatkirby | ||
15 | */ | ||
16 | public class CloseEnvironmentThread implements Runnable{ | ||
17 | |||
18 | Environment svr; | ||
19 | |||
20 | public CloseEnvironmentThread(Environment e) { | ||
21 | svr = e; | ||
22 | } | ||
23 | |||
24 | public void run() { | ||
25 | try { | ||
26 | svr.cleanLog(); | ||
27 | svr.close(); | ||
28 | } catch (DatabaseException ex) { | ||
29 | Logger.getLogger(CloseEnvironmentThread.class.getName()).log(Level.SEVERE, null, ex); | ||
30 | } | ||
31 | } | ||
32 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/IDConfig.java b/client/trunk/src/com/fourisland/instadisc/Database/IDConfig.java new file mode 100644 index 0000000..9799d6d --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/IDConfig.java | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.instadisc.Database; | ||
7 | |||
8 | import com.sleepycat.persist.model.Entity; | ||
9 | import com.sleepycat.persist.model.PrimaryKey; | ||
10 | |||
11 | /** | ||
12 | * | ||
13 | * @author hatkirby | ||
14 | */ | ||
15 | @Entity | ||
16 | public class IDConfig { | ||
17 | |||
18 | @PrimaryKey | ||
19 | private String key; | ||
20 | |||
21 | private String value; | ||
22 | |||
23 | public String getKey() | ||
24 | { | ||
25 | return key; | ||
26 | } | ||
27 | |||
28 | public String getValue() | ||
29 | { | ||
30 | return value; | ||
31 | } | ||
32 | |||
33 | public void setKey(String key) | ||
34 | { | ||
35 | this.key = key; | ||
36 | } | ||
37 | |||
38 | public void setValue(String value) | ||
39 | { | ||
40 | this.value = value; | ||
41 | } | ||
42 | |||
43 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/OldVerID.java b/client/trunk/src/com/fourisland/instadisc/Database/OldVerID.java new file mode 100644 index 0000000..d8cfcb9 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/OldVerID.java | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.instadisc.Database; | ||
7 | |||
8 | import com.sleepycat.persist.model.Entity; | ||
9 | import com.sleepycat.persist.model.PrimaryKey; | ||
10 | |||
11 | /** | ||
12 | * | ||
13 | * @author hatkirby | ||
14 | */ | ||
15 | @Entity | ||
16 | public class OldVerID { | ||
17 | |||
18 | @PrimaryKey | ||
19 | private Integer ID; | ||
20 | |||
21 | public void setID(Integer ID) | ||
22 | { | ||
23 | this.ID = ID; | ||
24 | } | ||
25 | |||
26 | public Integer getID() | ||
27 | { | ||
28 | return ID; | ||
29 | } | ||
30 | |||
31 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java new file mode 100644 index 0000000..1f905ee --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | package com.fourisland.instadisc.Database; | ||
6 | |||
7 | import com.sleepycat.je.DatabaseException; | ||
8 | import com.sleepycat.je.Environment; | ||
9 | import com.sleepycat.je.EnvironmentConfig; | ||
10 | import com.sleepycat.persist.EntityCursor; | ||
11 | import com.sleepycat.persist.EntityStore; | ||
12 | import com.sleepycat.persist.PrimaryIndex; | ||
13 | import com.sleepycat.persist.StoreConfig; | ||
14 | import java.io.File; | ||
15 | import java.util.Iterator; | ||
16 | import java.util.logging.Level; | ||
17 | import java.util.logging.Logger; | ||
18 | |||
19 | /** | ||
20 | * | ||
21 | * @author hatkirby | ||
22 | */ | ||
23 | public class Wrapper { | ||
24 | |||
25 | public static Environment e = null; | ||
26 | public static EntityStore es = null; | ||
27 | public static PrimaryIndex<Integer, OldVerID> oldVerID; | ||
28 | public static PrimaryIndex<String, IDConfig> idConfig; | ||
29 | |||
30 | public static void init(String loc) { | ||
31 | |||
32 | EnvironmentConfig envConfig = new EnvironmentConfig(); | ||
33 | StoreConfig esConfig = new StoreConfig(); | ||
34 | envConfig.setAllowCreate(true); | ||
35 | esConfig.setAllowCreate(true); | ||
36 | try { | ||
37 | e = new Environment(new File(loc + "db"), envConfig); | ||
38 | es = new EntityStore(e, "EntityStore", esConfig); | ||
39 | } catch (DatabaseException ex) { | ||
40 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
41 | System.exit(1); | ||
42 | } | ||
43 | Runtime.getRuntime().addShutdownHook(new Thread(new CloseEnvironmentThread(e))); | ||
44 | Runtime.getRuntime().addShutdownHook(new Thread(new CloseEntityStoreThread(es))); | ||
45 | |||
46 | try { | ||
47 | oldVerID = es.getPrimaryIndex(Integer.class, OldVerID.class); | ||
48 | idConfig = es.getPrimaryIndex(String.class, IDConfig.class); | ||
49 | } catch (DatabaseException ex) { | ||
50 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | public static String getConfig(String key) | ||
55 | { | ||
56 | try { | ||
57 | return idConfig.get(key).getValue(); | ||
58 | } catch (DatabaseException ex) { | ||
59 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
60 | return ""; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public static void setConfig(String key, String value) | ||
65 | { | ||
66 | try { | ||
67 | if (idConfig.contains(key)) { | ||
68 | IDConfig temp = idConfig.get(key); | ||
69 | temp.setValue(value); | ||
70 | idConfig.put(temp); | ||
71 | } else { | ||
72 | IDConfig temp = new IDConfig(); | ||
73 | temp.setKey(key); | ||
74 | temp.setValue(value); | ||
75 | idConfig.put(temp); | ||
76 | } | ||
77 | } catch (DatabaseException ex) { | ||
78 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | public static boolean containsOldVerID(Integer id) | ||
83 | { | ||
84 | try { | ||
85 | return oldVerID.contains(id); | ||
86 | } catch (DatabaseException ex) { | ||
87 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
88 | return false; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public static int countOldVerID() | ||
93 | { | ||
94 | try { | ||
95 | return (int) oldVerID.count(); | ||
96 | } catch (DatabaseException ex) { | ||
97 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
98 | return 0; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public static void emptyOldVerID() | ||
103 | { | ||
104 | try { | ||
105 | EntityCursor<OldVerID> ec = oldVerID.entities(); | ||
106 | try { | ||
107 | Iterator<OldVerID> i = ec.iterator(); | ||
108 | while (i.hasNext()) { | ||
109 | i.remove(); | ||
110 | } | ||
111 | } finally { | ||
112 | ec.close(); | ||
113 | } | ||
114 | } catch (DatabaseException ex) { | ||
115 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | public static void addOldVerID(Integer id) | ||
120 | { | ||
121 | try { | ||
122 | OldVerID temp = new OldVerID(); | ||
123 | temp.setID(id); | ||
124 | oldVerID.put(temp); | ||
125 | } catch (DatabaseException ex) { | ||
126 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
127 | } | ||
128 | } | ||
129 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java new file mode 100644 index 0000000..0919f21 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/FirstRunWizard.java | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.instadisc.FirstRun; | ||
7 | |||
8 | import javax.swing.JFrame; | ||
9 | |||
10 | /** | ||
11 | * | ||
12 | * @author hatkirby | ||
13 | */ | ||
14 | public class FirstRunWizard implements Runnable { | ||
15 | |||
16 | public void run() | ||
17 | { | ||
18 | Step1 s1 = new Step1(new JFrame(), true); | ||
19 | s1.setVisible(true); | ||
20 | if (StepEndResults.ok) | ||
21 | { | ||
22 | StepEndResults.ok = false; | ||
23 | Step2 s2 = new Step2(new JFrame(), true); | ||
24 | s2.setVisible(true); | ||
25 | if (StepEndResults.ok) | ||
26 | { | ||
27 | StepEndResults.ok = false; | ||
28 | Step3 s3 = new Step3(new JFrame(), true); | ||
29 | s3.setVisible(true); | ||
30 | } | ||
31 | } | ||
32 | System.exit(0); | ||
33 | } | ||
34 | |||
35 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step1.form b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step1.form new file mode 100644 index 0000000..b186d78 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step1.form | |||
@@ -0,0 +1,142 @@ | |||
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" alignment="0" attributes="0"> | ||
26 | <EmptySpace min="-2" pref="134" max="-2" attributes="0"/> | ||
27 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | ||
28 | <EmptySpace pref="178" max="32767" attributes="0"/> | ||
29 | </Group> | ||
30 | <Group type="102" alignment="0" attributes="0"> | ||
31 | <EmptySpace min="-2" pref="43" max="-2" attributes="0"/> | ||
32 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
33 | <EmptySpace pref="56" max="32767" attributes="0"/> | ||
34 | </Group> | ||
35 | <Group type="102" alignment="1" attributes="0"> | ||
36 | <EmptySpace min="-2" pref="57" max="-2" attributes="0"/> | ||
37 | <Component id="jScrollPane2" pref="346" max="32767" attributes="1"/> | ||
38 | <EmptySpace min="-2" pref="76" max="-2" attributes="0"/> | ||
39 | </Group> | ||
40 | <Group type="102" alignment="0" attributes="0"> | ||
41 | <EmptySpace min="-2" pref="202" max="-2" attributes="0"/> | ||
42 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
43 | <EmptySpace pref="235" max="32767" attributes="0"/> | ||
44 | </Group> | ||
45 | <Group type="102" alignment="0" attributes="0"> | ||
46 | <EmptySpace min="-2" pref="23" max="-2" attributes="0"/> | ||
47 | <Component id="jScrollPane1" min="-2" pref="426" max="-2" attributes="1"/> | ||
48 | <EmptySpace pref="30" max="32767" attributes="0"/> | ||
49 | </Group> | ||
50 | </Group> | ||
51 | </DimensionLayout> | ||
52 | <DimensionLayout dim="1"> | ||
53 | <Group type="103" groupAlignment="0" attributes="0"> | ||
54 | <Group type="102" alignment="0" attributes="0"> | ||
55 | <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> | ||
56 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
57 | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||
58 | <Component id="jScrollPane1" min="-2" pref="127" max="-2" attributes="0"/> | ||
59 | <EmptySpace type="separate" max="-2" attributes="0"/> | ||
60 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | ||
61 | <EmptySpace max="-2" attributes="0"/> | ||
62 | <Component id="jScrollPane2" min="-2" max="-2" attributes="0"/> | ||
63 | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||
64 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
65 | <EmptySpace pref="30" max="32767" attributes="0"/> | ||
66 | </Group> | ||
67 | </Group> | ||
68 | </DimensionLayout> | ||
69 | </Layout> | ||
70 | <SubComponents> | ||
71 | <Component class="javax.swing.JLabel" name="jLabel1"> | ||
72 | <Properties> | ||
73 | <Property name="font" type="java.awt.Font" resourceKey="jLabel1.font"/> | ||
74 | <Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/> | ||
75 | <Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/> | ||
76 | </Properties> | ||
77 | </Component> | ||
78 | <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | ||
79 | <Properties> | ||
80 | <Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/> | ||
81 | </Properties> | ||
82 | <AuxValues> | ||
83 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||
84 | </AuxValues> | ||
85 | |||
86 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||
87 | <SubComponents> | ||
88 | <Component class="javax.swing.JTextArea" name="jTextArea1"> | ||
89 | <Properties> | ||
90 | <Property name="background" type="java.awt.Color" resourceKey="jTextArea1.background"/> | ||
91 | <Property name="columns" type="int" value="20"/> | ||
92 | <Property name="editable" type="boolean" value="false"/> | ||
93 | <Property name="lineWrap" type="boolean" value="true"/> | ||
94 | <Property name="rows" type="int" value="5"/> | ||
95 | <Property name="text" type="java.lang.String" resourceKey="jTextArea1.text"/> | ||
96 | <Property name="wrapStyleWord" type="boolean" value="true"/> | ||
97 | <Property name="name" type="java.lang.String" value="jTextArea1" noResource="true"/> | ||
98 | </Properties> | ||
99 | </Component> | ||
100 | </SubComponents> | ||
101 | </Container> | ||
102 | <Component class="javax.swing.JLabel" name="jLabel2"> | ||
103 | <Properties> | ||
104 | <Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/> | ||
105 | <Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/> | ||
106 | </Properties> | ||
107 | </Component> | ||
108 | <Container class="javax.swing.JScrollPane" name="jScrollPane2"> | ||
109 | <Properties> | ||
110 | <Property name="name" type="java.lang.String" value="jScrollPane2" noResource="true"/> | ||
111 | </Properties> | ||
112 | <AuxValues> | ||
113 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||
114 | </AuxValues> | ||
115 | |||
116 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||
117 | <SubComponents> | ||
118 | <Component class="javax.swing.JTextArea" name="jTextArea2"> | ||
119 | <Properties> | ||
120 | <Property name="background" type="java.awt.Color" resourceKey="jTextArea2.background"/> | ||
121 | <Property name="columns" type="int" value="20"/> | ||
122 | <Property name="editable" type="boolean" value="false"/> | ||
123 | <Property name="lineWrap" type="boolean" value="true"/> | ||
124 | <Property name="rows" type="int" value="5"/> | ||
125 | <Property name="text" type="java.lang.String" resourceKey="jTextArea2.text"/> | ||
126 | <Property name="wrapStyleWord" type="boolean" value="true"/> | ||
127 | <Property name="name" type="java.lang.String" value="jTextArea2" noResource="true"/> | ||
128 | </Properties> | ||
129 | </Component> | ||
130 | </SubComponents> | ||
131 | </Container> | ||
132 | <Component class="javax.swing.JButton" name="jButton1"> | ||
133 | <Properties> | ||
134 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> | ||
135 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> | ||
136 | </Properties> | ||
137 | <Events> | ||
138 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> | ||
139 | </Events> | ||
140 | </Component> | ||
141 | </SubComponents> | ||
142 | </Form> | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step1.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step1.java new file mode 100644 index 0000000..c0abbfa --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step1.java | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Step1.java | ||
3 | * | ||
4 | * Created on July 28, 2008, 4:04 PM | ||
5 | */ | ||
6 | |||
7 | package com.fourisland.instadisc.FirstRun; | ||
8 | |||
9 | /** | ||
10 | * | ||
11 | * @author hatkirby | ||
12 | */ | ||
13 | public class Step1 extends javax.swing.JDialog { | ||
14 | |||
15 | /** Creates new form Step1 */ | ||
16 | public Step1(java.awt.Frame parent, boolean modal) { | ||
17 | super(parent, modal); | ||
18 | initComponents(); | ||
19 | } | ||
20 | |||
21 | /** This method is called from within the constructor to | ||
22 | * initialize the form. | ||
23 | * WARNING: Do NOT modify this code. The content of this method is | ||
24 | * always regenerated by the Form Editor. | ||
25 | */ | ||
26 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
27 | private void initComponents() { | ||
28 | |||
29 | jLabel1 = new javax.swing.JLabel(); | ||
30 | jScrollPane1 = new javax.swing.JScrollPane(); | ||
31 | jTextArea1 = new javax.swing.JTextArea(); | ||
32 | jLabel2 = new javax.swing.JLabel(); | ||
33 | jScrollPane2 = new javax.swing.JScrollPane(); | ||
34 | jTextArea2 = new javax.swing.JTextArea(); | ||
35 | jButton1 = new javax.swing.JButton(); | ||
36 | |||
37 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | ||
38 | setName("Form"); // NOI18N | ||
39 | |||
40 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.fourisland.instadisc.InstaDiscApp.class).getContext().getResourceMap(Step1.class); | ||
41 | jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N | ||
42 | jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N | ||
43 | jLabel1.setName("jLabel1"); // NOI18N | ||
44 | |||
45 | jScrollPane1.setName("jScrollPane1"); // NOI18N | ||
46 | |||
47 | jTextArea1.setBackground(resourceMap.getColor("jTextArea1.background")); // NOI18N | ||
48 | jTextArea1.setColumns(20); | ||
49 | jTextArea1.setEditable(false); | ||
50 | jTextArea1.setLineWrap(true); | ||
51 | jTextArea1.setRows(5); | ||
52 | jTextArea1.setText(resourceMap.getString("jTextArea1.text")); // NOI18N | ||
53 | jTextArea1.setWrapStyleWord(true); | ||
54 | jTextArea1.setName("jTextArea1"); // NOI18N | ||
55 | jScrollPane1.setViewportView(jTextArea1); | ||
56 | |||
57 | jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N | ||
58 | jLabel2.setName("jLabel2"); // NOI18N | ||
59 | |||
60 | jScrollPane2.setName("jScrollPane2"); // NOI18N | ||
61 | |||
62 | jTextArea2.setBackground(resourceMap.getColor("jTextArea2.background")); // NOI18N | ||
63 | jTextArea2.setColumns(20); | ||
64 | jTextArea2.setEditable(false); | ||
65 | jTextArea2.setLineWrap(true); | ||
66 | jTextArea2.setRows(5); | ||
67 | jTextArea2.setText(resourceMap.getString("jTextArea2.text")); // NOI18N | ||
68 | jTextArea2.setWrapStyleWord(true); | ||
69 | jTextArea2.setName("jTextArea2"); // NOI18N | ||
70 | jScrollPane2.setViewportView(jTextArea2); | ||
71 | |||
72 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N | ||
73 | jButton1.setName("jButton1"); // NOI18N | ||
74 | jButton1.addActionListener(new java.awt.event.ActionListener() { | ||
75 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
76 | jButton1ActionPerformed(evt); | ||
77 | } | ||
78 | }); | ||
79 | |||
80 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
81 | getContentPane().setLayout(layout); | ||
82 | layout.setHorizontalGroup( | ||
83 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
84 | .addGroup(layout.createSequentialGroup() | ||
85 | .addGap(134, 134, 134) | ||
86 | .addComponent(jLabel2) | ||
87 | .addContainerGap(178, Short.MAX_VALUE)) | ||
88 | .addGroup(layout.createSequentialGroup() | ||
89 | .addGap(43, 43, 43) | ||
90 | .addComponent(jLabel1) | ||
91 | .addContainerGap(56, Short.MAX_VALUE)) | ||
92 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
93 | .addGap(57, 57, 57) | ||
94 | .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE) | ||
95 | .addGap(76, 76, 76)) | ||
96 | .addGroup(layout.createSequentialGroup() | ||
97 | .addGap(202, 202, 202) | ||
98 | .addComponent(jButton1) | ||
99 | .addContainerGap(235, Short.MAX_VALUE)) | ||
100 | .addGroup(layout.createSequentialGroup() | ||
101 | .addGap(23, 23, 23) | ||
102 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 426, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
103 | .addContainerGap(30, Short.MAX_VALUE)) | ||
104 | ); | ||
105 | layout.setVerticalGroup( | ||
106 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
107 | .addGroup(layout.createSequentialGroup() | ||
108 | .addGap(18, 18, 18) | ||
109 | .addComponent(jLabel1) | ||
110 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||
111 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
112 | .addGap(18, 18, 18) | ||
113 | .addComponent(jLabel2) | ||
114 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
115 | .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
116 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||
117 | .addComponent(jButton1) | ||
118 | .addContainerGap(30, Short.MAX_VALUE)) | ||
119 | ); | ||
120 | |||
121 | pack(); | ||
122 | }// </editor-fold>//GEN-END:initComponents | ||
123 | |||
124 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed | ||
125 | StepEndResults.ok = true; | ||
126 | this.setVisible(false); | ||
127 | }//GEN-LAST:event_jButton1ActionPerformed | ||
128 | |||
129 | /** | ||
130 | * @param args the command line arguments | ||
131 | */ | ||
132 | public static void main(String args[]) { | ||
133 | java.awt.EventQueue.invokeLater(new Runnable() { | ||
134 | public void run() { | ||
135 | Step1 dialog = new Step1(new javax.swing.JFrame(), true); | ||
136 | dialog.addWindowListener(new java.awt.event.WindowAdapter() { | ||
137 | public void windowClosing(java.awt.event.WindowEvent e) { | ||
138 | System.exit(0); | ||
139 | } | ||
140 | }); | ||
141 | dialog.setVisible(true); | ||
142 | } | ||
143 | }); | ||
144 | } | ||
145 | |||
146 | // Variables declaration - do not modify//GEN-BEGIN:variables | ||
147 | private javax.swing.JButton jButton1; | ||
148 | private javax.swing.JLabel jLabel1; | ||
149 | private javax.swing.JLabel jLabel2; | ||
150 | private javax.swing.JScrollPane jScrollPane1; | ||
151 | private javax.swing.JScrollPane jScrollPane2; | ||
152 | private javax.swing.JTextArea jTextArea1; | ||
153 | private javax.swing.JTextArea jTextArea2; | ||
154 | // End of variables declaration//GEN-END:variables | ||
155 | |||
156 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form new file mode 100644 index 0000000..e408762 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form | |||
@@ -0,0 +1,176 @@ | |||
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 | <Group type="103" groupAlignment="0" attributes="0"> | ||
27 | <Group type="102" alignment="0" attributes="0"> | ||
28 | <EmptySpace max="-2" attributes="0"/> | ||
29 | <Group type="103" groupAlignment="0" attributes="0"> | ||
30 | <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> | ||
31 | <Group type="102" alignment="0" attributes="0"> | ||
32 | <EmptySpace min="12" pref="12" max="12" attributes="0"/> | ||
33 | <Group type="103" groupAlignment="0" attributes="0"> | ||
34 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | ||
35 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> | ||
36 | <Component id="jLabel4" min="-2" max="-2" attributes="0"/> | ||
37 | </Group> | ||
38 | <EmptySpace max="-2" attributes="0"/> | ||
39 | <Group type="103" groupAlignment="0" attributes="0"> | ||
40 | <Component id="jTextField2" alignment="0" pref="227" max="32767" attributes="0"/> | ||
41 | <Component id="jTextField1" alignment="0" pref="227" max="32767" attributes="0"/> | ||
42 | <Component id="jTextField3" alignment="0" pref="227" max="32767" attributes="0"/> | ||
43 | </Group> | ||
44 | </Group> | ||
45 | </Group> | ||
46 | </Group> | ||
47 | <Group type="102" alignment="1" attributes="0"> | ||
48 | <EmptySpace max="-2" attributes="0"/> | ||
49 | <Component id="jLabel5" pref="322" max="32767" attributes="0"/> | ||
50 | <EmptySpace max="-2" attributes="0"/> | ||
51 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
52 | </Group> | ||
53 | <Group type="102" alignment="1" attributes="0"> | ||
54 | <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> | ||
55 | <Component id="jScrollPane1" pref="364" max="32767" attributes="0"/> | ||
56 | </Group> | ||
57 | </Group> | ||
58 | <EmptySpace max="-2" attributes="0"/> | ||
59 | </Group> | ||
60 | </Group> | ||
61 | </DimensionLayout> | ||
62 | <DimensionLayout dim="1"> | ||
63 | <Group type="103" groupAlignment="0" attributes="0"> | ||
64 | <Group type="102" alignment="0" attributes="0"> | ||
65 | <EmptySpace max="-2" attributes="0"/> | ||
66 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
67 | <EmptySpace max="-2" attributes="0"/> | ||
68 | <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/> | ||
69 | <EmptySpace max="-2" attributes="0"/> | ||
70 | <Group type="103" groupAlignment="3" attributes="0"> | ||
71 | <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> | ||
72 | <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> | ||
73 | </Group> | ||
74 | <EmptySpace max="-2" attributes="0"/> | ||
75 | <Group type="103" groupAlignment="3" attributes="0"> | ||
76 | <Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/> | ||
77 | <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> | ||
78 | </Group> | ||
79 | <EmptySpace max="-2" attributes="0"/> | ||
80 | <Group type="103" groupAlignment="3" attributes="0"> | ||
81 | <Component id="jTextField3" alignment="3" min="-2" max="-2" attributes="0"/> | ||
82 | <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> | ||
83 | </Group> | ||
84 | <EmptySpace max="-2" attributes="0"/> | ||
85 | <Group type="103" groupAlignment="0" attributes="0"> | ||
86 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
87 | <Component id="jLabel5" alignment="0" min="-2" pref="40" max="-2" attributes="0"/> | ||
88 | </Group> | ||
89 | <EmptySpace pref="47" max="32767" attributes="0"/> | ||
90 | </Group> | ||
91 | </Group> | ||
92 | </DimensionLayout> | ||
93 | </Layout> | ||
94 | <SubComponents> | ||
95 | <Component class="javax.swing.JLabel" name="jLabel1"> | ||
96 | <Properties> | ||
97 | <Property name="font" type="java.awt.Font" resourceKey="jLabel1.font"/> | ||
98 | <Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/> | ||
99 | <Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/> | ||
100 | </Properties> | ||
101 | </Component> | ||
102 | <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | ||
103 | <Properties> | ||
104 | <Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/> | ||
105 | </Properties> | ||
106 | <AuxValues> | ||
107 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||
108 | </AuxValues> | ||
109 | |||
110 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||
111 | <SubComponents> | ||
112 | <Component class="javax.swing.JTextArea" name="jTextArea1"> | ||
113 | <Properties> | ||
114 | <Property name="background" type="java.awt.Color" resourceKey="jTextArea1.background"/> | ||
115 | <Property name="columns" type="int" value="20"/> | ||
116 | <Property name="editable" type="boolean" value="false"/> | ||
117 | <Property name="rows" type="int" value="5"/> | ||
118 | <Property name="text" type="java.lang.String" resourceKey="jTextArea1.text"/> | ||
119 | <Property name="name" type="java.lang.String" value="jTextArea1" noResource="true"/> | ||
120 | </Properties> | ||
121 | </Component> | ||
122 | </SubComponents> | ||
123 | </Container> | ||
124 | <Component class="javax.swing.JLabel" name="jLabel2"> | ||
125 | <Properties> | ||
126 | <Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/> | ||
127 | <Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/> | ||
128 | </Properties> | ||
129 | </Component> | ||
130 | <Component class="javax.swing.JTextField" name="jTextField1"> | ||
131 | <Properties> | ||
132 | <Property name="text" type="java.lang.String" resourceKey="jTextField1.text"/> | ||
133 | <Property name="name" type="java.lang.String" value="jTextField1" noResource="true"/> | ||
134 | </Properties> | ||
135 | </Component> | ||
136 | <Component class="javax.swing.JTextField" name="jTextField2"> | ||
137 | <Properties> | ||
138 | <Property name="text" type="java.lang.String" resourceKey="jTextField2.text"/> | ||
139 | <Property name="name" type="java.lang.String" value="jTextField2" noResource="true"/> | ||
140 | </Properties> | ||
141 | </Component> | ||
142 | <Component class="javax.swing.JTextField" name="jTextField3"> | ||
143 | <Properties> | ||
144 | <Property name="text" type="java.lang.String" resourceKey="jTextField3.text"/> | ||
145 | <Property name="name" type="java.lang.String" value="jTextField3" noResource="true"/> | ||
146 | </Properties> | ||
147 | </Component> | ||
148 | <Component class="javax.swing.JLabel" name="jLabel3"> | ||
149 | <Properties> | ||
150 | <Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/> | ||
151 | <Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/> | ||
152 | </Properties> | ||
153 | </Component> | ||
154 | <Component class="javax.swing.JLabel" name="jLabel4"> | ||
155 | <Properties> | ||
156 | <Property name="text" type="java.lang.String" resourceKey="jLabel4.text"/> | ||
157 | <Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/> | ||
158 | </Properties> | ||
159 | </Component> | ||
160 | <Component class="javax.swing.JLabel" name="jLabel5"> | ||
161 | <Properties> | ||
162 | <Property name="text" type="java.lang.String" resourceKey="jLabel5.text"/> | ||
163 | <Property name="name" type="java.lang.String" value="jLabel5" noResource="true"/> | ||
164 | </Properties> | ||
165 | </Component> | ||
166 | <Component class="javax.swing.JButton" name="jButton1"> | ||
167 | <Properties> | ||
168 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> | ||
169 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> | ||
170 | </Properties> | ||
171 | <Events> | ||
172 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> | ||
173 | </Events> | ||
174 | </Component> | ||
175 | </SubComponents> | ||
176 | </Form> | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java new file mode 100644 index 0000000..5460bc4 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java | |||
@@ -0,0 +1,219 @@ | |||
1 | /* | ||
2 | * Step2.java | ||
3 | * | ||
4 | * Created on July 28, 2008, 4:18 PM | ||
5 | */ | ||
6 | package com.fourisland.instadisc.FirstRun; | ||
7 | |||
8 | import com.fourisland.instadisc.Database.Wrapper; | ||
9 | import com.fourisland.instadisc.XmlRpc; | ||
10 | import java.net.MalformedURLException; | ||
11 | import java.net.URL; | ||
12 | |||
13 | /** | ||
14 | * | ||
15 | * @author hatkirby | ||
16 | */ | ||
17 | public class Step2 extends javax.swing.JDialog { | ||
18 | |||
19 | /** Creates new form Step2 */ | ||
20 | public Step2(java.awt.Frame parent, boolean modal) { | ||
21 | super(parent, modal); | ||
22 | initComponents(); | ||
23 | } | ||
24 | |||
25 | /** This method is called from within the constructor to | ||
26 | * initialize the form. | ||
27 | * WARNING: Do NOT modify this code. The content of this method is | ||
28 | * always regenerated by the Form Editor. | ||
29 | */ | ||
30 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
31 | private void initComponents() { | ||
32 | |||
33 | jLabel1 = new javax.swing.JLabel(); | ||
34 | jScrollPane1 = new javax.swing.JScrollPane(); | ||
35 | jTextArea1 = new javax.swing.JTextArea(); | ||
36 | jLabel2 = new javax.swing.JLabel(); | ||
37 | jTextField1 = new javax.swing.JTextField(); | ||
38 | jTextField2 = new javax.swing.JTextField(); | ||
39 | jTextField3 = new javax.swing.JTextField(); | ||
40 | jLabel3 = new javax.swing.JLabel(); | ||
41 | jLabel4 = new javax.swing.JLabel(); | ||
42 | jLabel5 = new javax.swing.JLabel(); | ||
43 | jButton1 = new javax.swing.JButton(); | ||
44 | |||
45 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | ||
46 | setName("Form"); // NOI18N | ||
47 | |||
48 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.fourisland.instadisc.InstaDiscApp.class).getContext().getResourceMap(Step2.class); | ||
49 | jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N | ||
50 | jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N | ||
51 | jLabel1.setName("jLabel1"); // NOI18N | ||
52 | |||
53 | jScrollPane1.setName("jScrollPane1"); // NOI18N | ||
54 | |||
55 | jTextArea1.setBackground(resourceMap.getColor("jTextArea1.background")); // NOI18N | ||
56 | jTextArea1.setColumns(20); | ||
57 | jTextArea1.setEditable(false); | ||
58 | jTextArea1.setRows(5); | ||
59 | jTextArea1.setText(resourceMap.getString("jTextArea1.text")); // NOI18N | ||
60 | jTextArea1.setName("jTextArea1"); // NOI18N | ||
61 | jScrollPane1.setViewportView(jTextArea1); | ||
62 | |||
63 | jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N | ||
64 | jLabel2.setName("jLabel2"); // NOI18N | ||
65 | |||
66 | jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N | ||
67 | jTextField1.setName("jTextField1"); // NOI18N | ||
68 | |||
69 | jTextField2.setText(resourceMap.getString("jTextField2.text")); // NOI18N | ||
70 | jTextField2.setName("jTextField2"); // NOI18N | ||
71 | |||
72 | jTextField3.setText(resourceMap.getString("jTextField3.text")); // NOI18N | ||
73 | jTextField3.setName("jTextField3"); // NOI18N | ||
74 | |||
75 | jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N | ||
76 | jLabel3.setName("jLabel3"); // NOI18N | ||
77 | |||
78 | jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N | ||
79 | jLabel4.setName("jLabel4"); // NOI18N | ||
80 | |||
81 | jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N | ||
82 | jLabel5.setName("jLabel5"); // NOI18N | ||
83 | |||
84 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N | ||
85 | jButton1.setName("jButton1"); // NOI18N | ||
86 | jButton1.addActionListener(new java.awt.event.ActionListener() { | ||
87 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
88 | jButton1ActionPerformed(evt); | ||
89 | } | ||
90 | }); | ||
91 | |||
92 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
93 | getContentPane().setLayout(layout); | ||
94 | layout.setHorizontalGroup( | ||
95 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
96 | .addGroup(layout.createSequentialGroup() | ||
97 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
98 | .addGroup(layout.createSequentialGroup() | ||
99 | .addContainerGap() | ||
100 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
101 | .addComponent(jLabel1) | ||
102 | .addGroup(layout.createSequentialGroup() | ||
103 | .addGap(12, 12, 12) | ||
104 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
105 | .addComponent(jLabel2) | ||
106 | .addComponent(jLabel3) | ||
107 | .addComponent(jLabel4)) | ||
108 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
109 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
110 | .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE) | ||
111 | .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE) | ||
112 | .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE))))) | ||
113 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
114 | .addContainerGap() | ||
115 | .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE) | ||
116 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
117 | .addComponent(jButton1)) | ||
118 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
119 | .addGap(24, 24, 24) | ||
120 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE))) | ||
121 | .addContainerGap()) | ||
122 | ); | ||
123 | layout.setVerticalGroup( | ||
124 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
125 | .addGroup(layout.createSequentialGroup() | ||
126 | .addContainerGap() | ||
127 | .addComponent(jLabel1) | ||
128 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
129 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
130 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
131 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | ||
132 | .addComponent(jLabel2) | ||
133 | .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | ||
134 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
135 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | ||
136 | .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
137 | .addComponent(jLabel3)) | ||
138 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
139 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | ||
140 | .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
141 | .addComponent(jLabel4)) | ||
142 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
143 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
144 | .addComponent(jButton1) | ||
145 | .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) | ||
146 | .addContainerGap(47, Short.MAX_VALUE)) | ||
147 | ); | ||
148 | |||
149 | pack(); | ||
150 | }// </editor-fold>//GEN-END:initComponents | ||
151 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed | ||
152 | if (jTextField1.getText().equals("")) { | ||
153 | jLabel5.setText("Error: You forgot to enter a username"); | ||
154 | } else { | ||
155 | if (jTextField2.getText().equals("")) { | ||
156 | jLabel5.setText("Error: You forgot to enter a password"); | ||
157 | } else { | ||
158 | if (jTextField3.getText().equals("")) { | ||
159 | jLabel5.setText("Error: You forgot to enter a Central Server URL"); | ||
160 | } else { | ||
161 | try { | ||
162 | URL url = new URL(jTextField3.getText()); | ||
163 | |||
164 | XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField3.getText(), jTextField1.getText(), jTextField2.getText()); | ||
165 | Integer r = (Integer) xmlrpc.execute(); | ||
166 | |||
167 | if (r == 1) | ||
168 | { | ||
169 | jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); | ||
170 | } else { | ||
171 | Wrapper.setConfig("username", jTextField1.getText()); | ||
172 | Wrapper.setConfig("password", jTextField2.getText()); | ||
173 | Wrapper.setConfig("centralServerURL", jTextField3.getText()); | ||
174 | |||
175 | StepEndResults.ok = true; | ||
176 | this.setVisible(false); | ||
177 | } | ||
178 | } catch (MalformedURLException ex) { | ||
179 | jLabel5.setText("Error: The Central Server URL is malformed"); | ||
180 | } catch (NullPointerException ex) { | ||
181 | jLabel5.setText("Error: The Central Server URL specified does not exist"); | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | }//GEN-LAST:event_jButton1ActionPerformed | ||
187 | |||
188 | /** | ||
189 | * @param args the command line arguments | ||
190 | */ | ||
191 | public static void main(String args[]) { | ||
192 | java.awt.EventQueue.invokeLater(new Runnable() { | ||
193 | |||
194 | public void run() { | ||
195 | Step2 dialog = new Step2(new javax.swing.JFrame(), true); | ||
196 | dialog.addWindowListener(new java.awt.event.WindowAdapter() { | ||
197 | |||
198 | public void windowClosing(java.awt.event.WindowEvent e) { | ||
199 | System.exit(0); | ||
200 | } | ||
201 | }); | ||
202 | dialog.setVisible(true); | ||
203 | } | ||
204 | }); | ||
205 | } | ||
206 | // Variables declaration - do not modify//GEN-BEGIN:variables | ||
207 | private javax.swing.JButton jButton1; | ||
208 | private javax.swing.JLabel jLabel1; | ||
209 | private javax.swing.JLabel jLabel2; | ||
210 | private javax.swing.JLabel jLabel3; | ||
211 | private javax.swing.JLabel jLabel4; | ||
212 | private javax.swing.JLabel jLabel5; | ||
213 | private javax.swing.JScrollPane jScrollPane1; | ||
214 | private javax.swing.JTextArea jTextArea1; | ||
215 | private javax.swing.JTextField jTextField1; | ||
216 | private javax.swing.JTextField jTextField2; | ||
217 | private javax.swing.JTextField jTextField3; | ||
218 | // End of variables declaration//GEN-END:variables | ||
219 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step3.form b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step3.form new file mode 100644 index 0000000..473876c --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step3.form | |||
@@ -0,0 +1,100 @@ | |||
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 | <Group type="103" groupAlignment="0" attributes="0"> | ||
27 | <Group type="102" attributes="0"> | ||
28 | <EmptySpace max="-2" attributes="0"/> | ||
29 | <Group type="103" groupAlignment="0" attributes="0"> | ||
30 | <Group type="102" alignment="0" attributes="0"> | ||
31 | <EmptySpace min="12" pref="12" max="12" attributes="0"/> | ||
32 | <Component id="jScrollPane1" pref="364" max="32767" attributes="0"/> | ||
33 | </Group> | ||
34 | <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> | ||
35 | </Group> | ||
36 | </Group> | ||
37 | <Group type="102" alignment="0" attributes="0"> | ||
38 | <EmptySpace min="-2" pref="167" max="-2" attributes="0"/> | ||
39 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
40 | </Group> | ||
41 | </Group> | ||
42 | <EmptySpace max="-2" attributes="0"/> | ||
43 | </Group> | ||
44 | </Group> | ||
45 | </DimensionLayout> | ||
46 | <DimensionLayout dim="1"> | ||
47 | <Group type="103" groupAlignment="0" attributes="0"> | ||
48 | <Group type="102" alignment="0" attributes="0"> | ||
49 | <EmptySpace max="-2" attributes="0"/> | ||
50 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
51 | <EmptySpace max="-2" attributes="0"/> | ||
52 | <Component id="jScrollPane1" min="-2" pref="104" max="-2" attributes="0"/> | ||
53 | <EmptySpace max="-2" attributes="0"/> | ||
54 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
55 | <EmptySpace max="32767" attributes="0"/> | ||
56 | </Group> | ||
57 | </Group> | ||
58 | </DimensionLayout> | ||
59 | </Layout> | ||
60 | <SubComponents> | ||
61 | <Component class="javax.swing.JLabel" name="jLabel1"> | ||
62 | <Properties> | ||
63 | <Property name="font" type="java.awt.Font" resourceKey="jLabel1.font"/> | ||
64 | <Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/> | ||
65 | <Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/> | ||
66 | </Properties> | ||
67 | </Component> | ||
68 | <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | ||
69 | <Properties> | ||
70 | <Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/> | ||
71 | </Properties> | ||
72 | <AuxValues> | ||
73 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||
74 | </AuxValues> | ||
75 | |||
76 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||
77 | <SubComponents> | ||
78 | <Component class="javax.swing.JTextArea" name="jTextArea1"> | ||
79 | <Properties> | ||
80 | <Property name="background" type="java.awt.Color" resourceKey="jTextArea1.background"/> | ||
81 | <Property name="columns" type="int" value="20"/> | ||
82 | <Property name="editable" type="boolean" value="false"/> | ||
83 | <Property name="rows" type="int" value="5"/> | ||
84 | <Property name="text" type="java.lang.String" resourceKey="jTextArea1.text"/> | ||
85 | <Property name="name" type="java.lang.String" value="jTextArea1" noResource="true"/> | ||
86 | </Properties> | ||
87 | </Component> | ||
88 | </SubComponents> | ||
89 | </Container> | ||
90 | <Component class="javax.swing.JButton" name="jButton1"> | ||
91 | <Properties> | ||
92 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> | ||
93 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> | ||
94 | </Properties> | ||
95 | <Events> | ||
96 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> | ||
97 | </Events> | ||
98 | </Component> | ||
99 | </SubComponents> | ||
100 | </Form> | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step3.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step3.java new file mode 100644 index 0000000..5eb7840 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step3.java | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * Step3.java | ||
3 | * | ||
4 | * Created on July 28, 2008, 4:51 PM | ||
5 | */ | ||
6 | |||
7 | package com.fourisland.instadisc.FirstRun; | ||
8 | |||
9 | /** | ||
10 | * | ||
11 | * @author hatkirby | ||
12 | */ | ||
13 | public class Step3 extends javax.swing.JDialog { | ||
14 | |||
15 | /** Creates new form Step3 */ | ||
16 | public Step3(java.awt.Frame parent, boolean modal) { | ||
17 | super(parent, modal); | ||
18 | initComponents(); | ||
19 | } | ||
20 | |||
21 | /** This method is called from within the constructor to | ||
22 | * initialize the form. | ||
23 | * WARNING: Do NOT modify this code. The content of this method is | ||
24 | * always regenerated by the Form Editor. | ||
25 | */ | ||
26 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
27 | private void initComponents() { | ||
28 | |||
29 | jLabel1 = new javax.swing.JLabel(); | ||
30 | jScrollPane1 = new javax.swing.JScrollPane(); | ||
31 | jTextArea1 = new javax.swing.JTextArea(); | ||
32 | jButton1 = new javax.swing.JButton(); | ||
33 | |||
34 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | ||
35 | setName("Form"); // NOI18N | ||
36 | |||
37 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.fourisland.instadisc.InstaDiscApp.class).getContext().getResourceMap(Step3.class); | ||
38 | jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N | ||
39 | jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N | ||
40 | jLabel1.setName("jLabel1"); // NOI18N | ||
41 | |||
42 | jScrollPane1.setName("jScrollPane1"); // NOI18N | ||
43 | |||
44 | jTextArea1.setBackground(resourceMap.getColor("jTextArea1.background")); // NOI18N | ||
45 | jTextArea1.setColumns(20); | ||
46 | jTextArea1.setEditable(false); | ||
47 | jTextArea1.setRows(5); | ||
48 | jTextArea1.setText(resourceMap.getString("jTextArea1.text")); // NOI18N | ||
49 | jTextArea1.setName("jTextArea1"); // NOI18N | ||
50 | jScrollPane1.setViewportView(jTextArea1); | ||
51 | |||
52 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N | ||
53 | jButton1.setName("jButton1"); // NOI18N | ||
54 | jButton1.addActionListener(new java.awt.event.ActionListener() { | ||
55 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
56 | jButton1ActionPerformed(evt); | ||
57 | } | ||
58 | }); | ||
59 | |||
60 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
61 | getContentPane().setLayout(layout); | ||
62 | layout.setHorizontalGroup( | ||
63 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
64 | .addGroup(layout.createSequentialGroup() | ||
65 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
66 | .addGroup(layout.createSequentialGroup() | ||
67 | .addContainerGap() | ||
68 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
69 | .addGroup(layout.createSequentialGroup() | ||
70 | .addGap(12, 12, 12) | ||
71 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)) | ||
72 | .addComponent(jLabel1))) | ||
73 | .addGroup(layout.createSequentialGroup() | ||
74 | .addGap(167, 167, 167) | ||
75 | .addComponent(jButton1))) | ||
76 | .addContainerGap()) | ||
77 | ); | ||
78 | layout.setVerticalGroup( | ||
79 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
80 | .addGroup(layout.createSequentialGroup() | ||
81 | .addContainerGap() | ||
82 | .addComponent(jLabel1) | ||
83 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
84 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
85 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
86 | .addComponent(jButton1) | ||
87 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | ||
88 | ); | ||
89 | |||
90 | pack(); | ||
91 | }// </editor-fold>//GEN-END:initComponents | ||
92 | |||
93 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed | ||
94 | StepEndResults.ok = true; | ||
95 | this.setVisible(false); | ||
96 | }//GEN-LAST:event_jButton1ActionPerformed | ||
97 | |||
98 | /** | ||
99 | * @param args the command line arguments | ||
100 | */ | ||
101 | public static void main(String args[]) { | ||
102 | java.awt.EventQueue.invokeLater(new Runnable() { | ||
103 | public void run() { | ||
104 | Step3 dialog = new Step3(new javax.swing.JFrame(), true); | ||
105 | dialog.addWindowListener(new java.awt.event.WindowAdapter() { | ||
106 | public void windowClosing(java.awt.event.WindowEvent e) { | ||
107 | System.exit(0); | ||
108 | } | ||
109 | }); | ||
110 | dialog.setVisible(true); | ||
111 | } | ||
112 | }); | ||
113 | } | ||
114 | |||
115 | // Variables declaration - do not modify//GEN-BEGIN:variables | ||
116 | private javax.swing.JButton jButton1; | ||
117 | private javax.swing.JLabel jLabel1; | ||
118 | private javax.swing.JScrollPane jScrollPane1; | ||
119 | private javax.swing.JTextArea jTextArea1; | ||
120 | // End of variables declaration//GEN-END:variables | ||
121 | |||
122 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/StepEndResults.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/StepEndResults.java new file mode 100644 index 0000000..ccdd4b9 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/StepEndResults.java | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.instadisc.FirstRun; | ||
7 | |||
8 | /** | ||
9 | * | ||
10 | * @author hatkirby | ||
11 | */ | ||
12 | public class StepEndResults { | ||
13 | |||
14 | public static boolean ok = false; | ||
15 | |||
16 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step1.properties b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step1.properties new file mode 100644 index 0000000..8da8235 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step1.properties | |||
@@ -0,0 +1,11 @@ | |||
1 | jLabel1.text=Welcome to the InstaDisc FirstRun Wizard! | ||
2 | jTextArea1.text=This is, apparently, the first time you've run InstaDisc, so you need to step through me before being able to use InstaDisc.\n\nFirst, ensure that you've chosen and signed up for a Central Server. If you haven't, or don't even know what that means, please read:\n | ||
3 | #NOI18N | ||
4 | jTextArea1.background=239, 235, 231 | ||
5 | jLabel2.text=<html><a href="http://fourisland.com/projects/instadisc/wiki/ChoosingACentralServer">Choosing a Central Server</a> | ||
6 | #NOI18N | ||
7 | jLabel1.font=DejaVu Sans-Plain-18 | ||
8 | jTextArea2.text=before continuing. If you do know what you're doing, feel free to click on the NEXT button and get on with InstaDisc. | ||
9 | #NOI18N | ||
10 | jTextArea2.background=239, 235, 231 | ||
11 | jButton1.text=Next | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties new file mode 100644 index 0000000..0c1f735 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties | |||
@@ -0,0 +1,14 @@ | |||
1 | jLabel1.text=Central Server Details | ||
2 | #NOI18N | ||
3 | jLabel1.font=DejaVu Sans-Plain-18 | ||
4 | jTextArea1.text=To use InstaDisc, you must have chosen and signed up\nfor a Central Server. Please input below the details it\ngave you after registration. | ||
5 | #NOI18N | ||
6 | jTextArea1.background=239, 235, 231 | ||
7 | jLabel2.text=Username: | ||
8 | jTextField1.text= | ||
9 | jTextField2.text= | ||
10 | jTextField3.text= | ||
11 | jLabel3.text=Password: | ||
12 | jLabel4.text=Central Server URL: | ||
13 | jLabel5.text= | ||
14 | jButton1.text=Next | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step3.properties b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step3.properties new file mode 100644 index 0000000..948623f --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step3.properties | |||
@@ -0,0 +1,7 @@ | |||
1 | jLabel1.text=Congradulations | ||
2 | #NOI18N | ||
3 | jLabel1.font=DejaVu Sans-Plain-18 | ||
4 | jTextArea1.text=YAY! You've successfully set up InstaDisc. To start using\nInstaDisc, quit this wizard (the DONE button), open\nInstaDisc again, and have fun!\n\nIf you're ever confused, remember, the Help menu is\nyour friend. | ||
5 | #NOI18N | ||
6 | jTextArea1.background=239, 235, 231 | ||
7 | jButton1.text=Done | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java index 806460a..ffac22d 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java | |||
@@ -1,9 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * InstaDiscApp.java | 2 | * InstaDiscApp.java |
3 | */ | 3 | */ |
4 | |||
5 | package com.fourisland.instadisc; | 4 | package com.fourisland.instadisc; |
6 | 5 | ||
6 | import com.fourisland.instadisc.Database.Wrapper; | ||
7 | import com.fourisland.instadisc.FirstRun.FirstRunWizard; | ||
8 | import java.io.File; | ||
7 | import org.jdesktop.application.Application; | 9 | import org.jdesktop.application.Application; |
8 | import org.jdesktop.application.SingleFrameApplication; | 10 | import org.jdesktop.application.SingleFrameApplication; |
9 | 11 | ||
@@ -15,7 +17,8 @@ public class InstaDiscApp extends SingleFrameApplication { | |||
15 | /** | 17 | /** |
16 | * At startup create and show the main frame of the application. | 18 | * At startup create and show the main frame of the application. |
17 | */ | 19 | */ |
18 | @Override protected void startup() { | 20 | @Override |
21 | protected void startup() { | ||
19 | show(new InstaDiscView(this)); | 22 | show(new InstaDiscView(this)); |
20 | } | 23 | } |
21 | 24 | ||
@@ -24,7 +27,8 @@ public class InstaDiscApp extends SingleFrameApplication { | |||
24 | * Windows shown in our application come fully initialized from the GUI | 27 | * Windows shown in our application come fully initialized from the GUI |
25 | * builder, so this additional configuration is not needed. | 28 | * builder, so this additional configuration is not needed. |
26 | */ | 29 | */ |
27 | @Override protected void configureWindow(java.awt.Window root) { | 30 | @Override |
31 | protected void configureWindow(java.awt.Window root) { | ||
28 | } | 32 | } |
29 | 33 | ||
30 | /** | 34 | /** |
@@ -39,6 +43,26 @@ public class InstaDiscApp extends SingleFrameApplication { | |||
39 | * Main method launching the application. | 43 | * Main method launching the application. |
40 | */ | 44 | */ |
41 | public static void main(String[] args) { | 45 | public static void main(String[] args) { |
42 | launch(InstaDiscApp.class, args); | 46 | if (args.length > 0) { |
47 | File db = new File(args[0] + "db"); | ||
48 | if (!db.exists()) { | ||
49 | db.mkdir(); | ||
50 | } | ||
51 | |||
52 | Wrapper.init(args[0]); | ||
53 | if (args.length > 1) { | ||
54 | if (args[1].equals("-r")) { | ||
55 | XmlRpc xmlrpc = new XmlRpc("requestRetained"); | ||
56 | xmlrpc.execute(); | ||
57 | } else if (args[1].equals("-n")) { | ||
58 | Thread th = new Thread(new FirstRunWizard()); | ||
59 | th.start(); | ||
60 | } | ||
61 | } else { | ||
62 | launch(InstaDiscApp.class, args); | ||
63 | } | ||
64 | } else { | ||
65 | System.out.println("Oops, you seem to be running this application incorrectly. Try running it using the startup script provided."); | ||
66 | } | ||
43 | } | 67 | } |
44 | } | 68 | } |
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java index fcde8d8..55baf28 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java | |||
@@ -9,6 +9,7 @@ import java.io.IOException; | |||
9 | import java.io.InputStream; | 9 | import java.io.InputStream; |
10 | import java.net.ServerSocket; | 10 | import java.net.ServerSocket; |
11 | import java.net.Socket; | 11 | import java.net.Socket; |
12 | import java.net.SocketException; | ||
12 | import java.util.HashMap; | 13 | import java.util.HashMap; |
13 | import java.util.logging.Level; | 14 | import java.util.logging.Level; |
14 | import java.util.logging.Logger; | 15 | import java.util.logging.Logger; |
@@ -30,13 +31,15 @@ public class InstaDiscThread implements Runnable { | |||
30 | ServerSocket svr = new ServerSocket(); | 31 | ServerSocket svr = new ServerSocket(); |
31 | java.net.InetSocketAddress addr = new java.net.InetSocketAddress(4444); | 32 | java.net.InetSocketAddress addr = new java.net.InetSocketAddress(4444); |
32 | svr.bind(addr); | 33 | svr.bind(addr); |
33 | Runtime.getRuntime().addShutdownHook(new Thread(new CloseObjectThread(svr))); | 34 | Runtime.getRuntime().addShutdownHook(new Thread(new CloseServerSocketThread(svr))); |
34 | while (!cancelled) { | 35 | while (!cancelled) { |
35 | try { | 36 | try { |
36 | Socket s = svr.accept(); | 37 | Socket s = svr.accept(); |
37 | HandleItemThread hit = new HandleItemThread(s); | 38 | HandleItemThread hit = new HandleItemThread(s); |
38 | Thread hitt = new Thread(hit); | 39 | Thread hitt = new Thread(hit); |
39 | hitt.start(); | 40 | hitt.start(); |
41 | } catch (SocketException ex) { | ||
42 | cancel(); | ||
40 | } catch (Exception ex) { | 43 | } catch (Exception ex) { |
41 | cancel(); | 44 | cancel(); |
42 | Logger.getLogger(InstaDiscThread.class.getName()).log(Level.SEVERE, null, ex); | 45 | Logger.getLogger(InstaDiscThread.class.getName()).log(Level.SEVERE, null, ex); |
@@ -105,7 +108,7 @@ class HandleItemThread implements Runnable { | |||
105 | } catch (IOException ex) { | 108 | } catch (IOException ex) { |
106 | Logger.getLogger(HandleItemThread.class.getName()).log(Level.SEVERE, null, ex); | 109 | Logger.getLogger(HandleItemThread.class.getName()).log(Level.SEVERE, null, ex); |
107 | } | 110 | } |
108 | 111 | ||
109 | Item idI = new Item(headerMap); | 112 | Item idI = new Item(headerMap); |
110 | idI.start(); | 113 | idI.start(); |
111 | } catch (IOException ex) { | 114 | } catch (IOException ex) { |
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Item.java b/client/trunk/src/com/fourisland/instadisc/Item/Item.java index fd52d5f..56bc03c 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Item.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Item.java | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | package com.fourisland.instadisc.Item; | 6 | package com.fourisland.instadisc.Item; |
7 | 7 | ||
8 | import com.fourisland.instadisc.XmlRpc; | ||
8 | import java.util.HashMap; | 9 | import java.util.HashMap; |
9 | 10 | ||
10 | /** | 11 | /** |
@@ -25,7 +26,9 @@ public class Item { | |||
25 | WellFormedItem wfi = new WellFormedItem(this); | 26 | WellFormedItem wfi = new WellFormedItem(this); |
26 | if (wfi.check()) | 27 | if (wfi.check()) |
27 | { | 28 | { |
28 | 29 | XmlRpc xmlrpc = new XmlRpc("deleteItem"); | |
30 | xmlrpc.addParam(Integer.decode(headerMap.get("ID"))); | ||
31 | xmlrpc.execute(); | ||
29 | } | 32 | } |
30 | } | 33 | } |
31 | } | 34 | } |
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java new file mode 100644 index 0000000..57c69f4 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | package com.fourisland.instadisc.Item; | ||
6 | |||
7 | import com.fourisland.instadisc.Database.Wrapper; | ||
8 | import java.util.Random; | ||
9 | |||
10 | /** | ||
11 | * | ||
12 | * @author hatkirby | ||
13 | */ | ||
14 | public class Verification { | ||
15 | |||
16 | private String username; | ||
17 | private String hash; | ||
18 | private int id; | ||
19 | |||
20 | public Verification() { | ||
21 | Random r = new Random(); | ||
22 | id = r.nextInt(Integer.MAX_VALUE); | ||
23 | username = Wrapper.getConfig("username"); | ||
24 | String temp = username + ":" + Wrapper.getConfig("password") + ":" + id; | ||
25 | MD5 md5 = new MD5(temp); | ||
26 | hash = md5.hash(); | ||
27 | } | ||
28 | |||
29 | public Verification(int ID) throws VerificationIDReusedException { | ||
30 | id = ID; | ||
31 | if (Wrapper.containsOldVerID(id)) { | ||
32 | throw new VerificationIDReusedException(); | ||
33 | } else { | ||
34 | if (Wrapper.countOldVerID() == 100) { | ||
35 | Wrapper.emptyOldVerID(); | ||
36 | } | ||
37 | Wrapper.addOldVerID(id); | ||
38 | } | ||
39 | |||
40 | username = Wrapper.getConfig("username"); | ||
41 | String temp = username + ":" + Wrapper.getConfig("password") + ":" + id; | ||
42 | MD5 md5 = new MD5(temp); | ||
43 | hash = md5.hash(); | ||
44 | System.out.println(temp); | ||
45 | } | ||
46 | |||
47 | public Verification(String username, String password) { | ||
48 | Random r = new Random(); | ||
49 | id = r.nextInt(Integer.MAX_VALUE); | ||
50 | String temp = username + ":" + password + ":" + id; | ||
51 | MD5 md5 = new MD5(temp); | ||
52 | hash = md5.hash(); | ||
53 | this.username = username; | ||
54 | } | ||
55 | |||
56 | public String getUsername() | ||
57 | { | ||
58 | return username; | ||
59 | } | ||
60 | |||
61 | public String getHash() { | ||
62 | return hash; | ||
63 | } | ||
64 | |||
65 | public int getID() { | ||
66 | return id; | ||
67 | } | ||
68 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/VerificationIDReusedException.java b/client/trunk/src/com/fourisland/instadisc/Item/VerificationIDReusedException.java new file mode 100644 index 0000000..e56f60e --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Item/VerificationIDReusedException.java | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.instadisc.Item; | ||
7 | |||
8 | /** | ||
9 | * | ||
10 | * @author hatkirby | ||
11 | */ | ||
12 | class VerificationIDReusedException extends SecurityException { | ||
13 | |||
14 | public VerificationIDReusedException() { | ||
15 | } | ||
16 | |||
17 | } | ||
diff --git a/client/trunk/src/com/fourisland/instadisc/XmlRpc.java b/client/trunk/src/com/fourisland/instadisc/XmlRpc.java new file mode 100644 index 0000000..8c22155 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/XmlRpc.java | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | package com.fourisland.instadisc; | ||
6 | |||
7 | import com.fourisland.instadisc.Database.Wrapper; | ||
8 | import com.fourisland.instadisc.Item.Verification; | ||
9 | import java.net.MalformedURLException; | ||
10 | import java.net.URL; | ||
11 | import java.util.logging.Level; | ||
12 | import java.util.logging.Logger; | ||
13 | import org.apache.xmlrpc.XmlRpcException; | ||
14 | import org.apache.xmlrpc.client.XmlRpcClient; | ||
15 | import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; | ||
16 | |||
17 | /** | ||
18 | * | ||
19 | * @author hatkirby | ||
20 | */ | ||
21 | public class XmlRpc { | ||
22 | |||
23 | private String function; | ||
24 | private Object[] params; | ||
25 | private int step = 3; | ||
26 | private String url = ""; | ||
27 | |||
28 | public XmlRpc(String function) { | ||
29 | this.function = function; | ||
30 | if (url.equals("")) | ||
31 | { | ||
32 | url = Wrapper.getConfig("centralServerURL"); | ||
33 | } | ||
34 | |||
35 | Verification ver = new Verification(); | ||
36 | params = new Object[3]; | ||
37 | params[0] = ver.getUsername(); | ||
38 | params[1] = ver.getHash(); | ||
39 | params[2] = ver.getID(); | ||
40 | } | ||
41 | |||
42 | public XmlRpc(String function, String url, String username, String password) | ||
43 | { | ||
44 | this.function = function; | ||
45 | this.url = url; | ||
46 | |||
47 | Verification ver = new Verification(username, password); | ||
48 | params = new Object[3]; | ||
49 | params[0] = ver.getUsername(); | ||
50 | params[1] = ver.getHash(); | ||
51 | params[2] = ver.getID(); | ||
52 | } | ||
53 | |||
54 | public void addParam(Object param) | ||
55 | { | ||
56 | Object oldParams[] = params; | ||
57 | Object temp[] = new Object[step+1]; | ||
58 | int i=0; | ||
59 | for (i=0;i<step;i++) | ||
60 | { | ||
61 | temp[i] = oldParams[i]; | ||
62 | } | ||
63 | temp[step] = param; | ||
64 | step++; | ||
65 | params = temp; | ||
66 | } | ||
67 | |||
68 | public Object execute() { | ||
69 | Object result = null; | ||
70 | try { | ||
71 | XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); | ||
72 | config.setServerURL(new URL(url)); | ||
73 | XmlRpcClient client = new XmlRpcClient(); | ||
74 | client.setConfig(config); | ||
75 | |||
76 | result = client.execute("InstaDisc." + function, params); | ||
77 | } catch (XmlRpcException ex) { | ||
78 | Logger.getLogger(InstaDiscApp.class.getName()).log(Level.SEVERE, null, ex); | ||
79 | } catch (MalformedURLException ex) { | ||
80 | Logger.getLogger(InstaDiscApp.class.getName()).log(Level.SEVERE, null, ex); | ||
81 | } | ||
82 | return result; | ||
83 | } | ||
84 | } | ||