diff options
Diffstat (limited to 'client/trunk/src/com/fourisland')
11 files changed, 405 insertions, 7 deletions
| diff --git a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form index 91459ed..22f7ea6 100644 --- a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form +++ b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form | |||
| @@ -103,6 +103,9 @@ | |||
| 103 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> | 103 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> |
| 104 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> | 104 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> |
| 105 | </Properties> | 105 | </Properties> |
| 106 | <Events> | ||
| 107 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> | ||
| 108 | </Events> | ||
| 106 | </Component> | 109 | </Component> |
| 107 | <Component class="javax.swing.JButton" name="jButton2"> | 110 | <Component class="javax.swing.JButton" name="jButton2"> |
| 108 | <Properties> | 111 | <Properties> |
| diff --git a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java index fb05037..1609875 100644 --- a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java +++ b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java | |||
| @@ -57,6 +57,11 @@ public class AddSubscriptionForm extends javax.swing.JDialog { | |||
| 57 | 57 | ||
| 58 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N | 58 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N |
| 59 | jButton1.setName("jButton1"); // NOI18N | 59 | jButton1.setName("jButton1"); // NOI18N |
| 60 | jButton1.addActionListener(new java.awt.event.ActionListener() { | ||
| 61 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
| 62 | jButton1ActionPerformed(evt); | ||
| 63 | } | ||
| 64 | }); | ||
| 60 | 65 | ||
| 61 | jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N | 66 | jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N |
| 62 | jButton2.setName("jButton2"); // NOI18N | 67 | jButton2.setName("jButton2"); // NOI18N |
| @@ -117,12 +122,16 @@ public class AddSubscriptionForm extends javax.swing.JDialog { | |||
| 117 | 122 | ||
| 118 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed | 123 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed |
| 119 | try { | 124 | try { |
| 120 | URL url = new URL(jTextField1.getText());//GEN-LAST:event_jButton2ActionPerformed | 125 | URL url = new URL(jTextField1.getText()); |
| 121 | SubscriptionFile sf = new SubscriptionFile(url, jLabel4); | 126 | SubscriptionFile sf = new SubscriptionFile(url, jLabel4); |
| 122 | } catch (MalformedURLException ex) { | 127 | } catch (MalformedURLException ex) { |
| 123 | jLabel4.setText("Error: Subscription URL is malformed"); | 128 | jLabel4.setText("Error: Subscription URL is malformed"); |
| 124 | } | 129 | } |
| 125 | } | 130 | }//GEN-LAST:event_jButton2ActionPerformed |
| 131 | |||
| 132 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed | ||
| 133 | setVisible(false); | ||
| 134 | }//GEN-LAST:event_jButton1ActionPerformed | ||
| 126 | 135 | ||
| 127 | /** | 136 | /** |
| 128 | * @param args the command line arguments | 137 | * @param args the command line arguments |
| diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java index 57ec799..3aed859 100644 --- a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java +++ b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java | |||
| @@ -223,4 +223,41 @@ public class Wrapper { | |||
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | |||
| 227 | public static Subscription[] getAllSubscription() { | ||
| 228 | synchronized (subscription) { | ||
| 229 | try { | ||
| 230 | Iterator<Subscription> i = subscription.entities().iterator(); | ||
| 231 | Subscription[] temp = new Subscription[0]; | ||
| 232 | int len = 0; | ||
| 233 | |||
| 234 | while (i.hasNext()) { | ||
| 235 | Subscription[] temp2 = new Subscription[len + 1]; | ||
| 236 | int j = 0; | ||
| 237 | for (j = 0; j < len; j++) { | ||
| 238 | temp2[j] = temp[j]; | ||
| 239 | } | ||
| 240 | temp2[len] = i.next(); | ||
| 241 | temp = temp2; | ||
| 242 | } | ||
| 243 | |||
| 244 | return temp; | ||
| 245 | } catch (DatabaseException ex) { | ||
| 246 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
| 247 | return new Subscription[0]; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | } | ||
| 251 | |||
| 252 | public static void deleteSubscription(String url) | ||
| 253 | { | ||
| 254 | synchronized (subscription) | ||
| 255 | { | ||
| 256 | try { | ||
| 257 | subscription.delete(url); | ||
| 258 | } catch (DatabaseException ex) { | ||
| 259 | Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); | ||
| 260 | } | ||
| 261 | } | ||
| 262 | } | ||
| 226 | } | 263 | } |
| diff --git a/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java b/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java index 39c6445..b5204e6 100644 --- a/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java +++ b/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java | |||
| @@ -7,9 +7,7 @@ package com.fourisland.instadisc; | |||
| 7 | import com.fourisland.instadisc.Database.Item; | 7 | import com.fourisland.instadisc.Database.Item; |
| 8 | import com.fourisland.instadisc.Database.Wrapper; | 8 | import com.fourisland.instadisc.Database.Wrapper; |
| 9 | import com.fourisland.instadisc.Item.Categories.Category; | 9 | import com.fourisland.instadisc.Item.Categories.Category; |
| 10 | import java.awt.Color; | ||
| 11 | import java.awt.Component; | 10 | import java.awt.Component; |
| 12 | import javax.swing.ImageIcon; | ||
| 13 | import javax.swing.JLabel; | 11 | import javax.swing.JLabel; |
| 14 | import javax.swing.JList; | 12 | import javax.swing.JList; |
| 15 | import javax.swing.ListCellRenderer; | 13 | import javax.swing.ListCellRenderer; |
| diff --git a/client/trunk/src/com/fourisland/instadisc/IDSubscriptionListCellRenderer.java b/client/trunk/src/com/fourisland/instadisc/IDSubscriptionListCellRenderer.java new file mode 100644 index 0000000..546f3ac --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/IDSubscriptionListCellRenderer.java | |||
| @@ -0,0 +1,36 @@ | |||
| 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.Subscription; | ||
| 8 | import java.awt.Component; | ||
| 9 | import javax.swing.JLabel; | ||
| 10 | import javax.swing.JList; | ||
| 11 | import javax.swing.ListCellRenderer; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * | ||
| 15 | * @author hatkirby | ||
| 16 | */ | ||
| 17 | class IDSubscriptionListCellRenderer extends JLabel implements ListCellRenderer { | ||
| 18 | |||
| 19 | public Component getListCellRendererComponent(JList arg0, Object arg1, int arg2, boolean arg3, boolean arg4) { | ||
| 20 | this.setText(((Subscription) arg1).getTitle()); | ||
| 21 | |||
| 22 | if (arg3) { | ||
| 23 | this.setForeground(arg0.getSelectionForeground()); | ||
| 24 | this.setBackground(arg0.getSelectionBackground()); | ||
| 25 | } else { | ||
| 26 | this.setForeground(arg0.getForeground()); | ||
| 27 | this.setBackground(arg0.getBackground()); | ||
| 28 | } | ||
| 29 | |||
| 30 | this.setOpaque(true); | ||
| 31 | this.setFont(arg0.getFont()); | ||
| 32 | this.setEnabled(arg0.isEnabled()); | ||
| 33 | |||
| 34 | return this; | ||
| 35 | } | ||
| 36 | } | ||
| diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form index 0f42036..7baafca 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form | |||
| @@ -79,6 +79,9 @@ | |||
| 79 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem2.text"/> | 79 | <Property name="text" type="java.lang.String" resourceKey="jMenuItem2.text"/> |
| 80 | <Property name="name" type="java.lang.String" value="jMenuItem2" noResource="true"/> | 80 | <Property name="name" type="java.lang.String" value="jMenuItem2" noResource="true"/> |
| 81 | </Properties> | 81 | </Properties> |
| 82 | <Events> | ||
| 83 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem2ActionPerformed"/> | ||
| 84 | </Events> | ||
| 82 | </MenuItem> | 85 | </MenuItem> |
| 83 | <MenuItem class="javax.swing.JSeparator" name="jSeparator1"> | 86 | <MenuItem class="javax.swing.JSeparator" name="jSeparator1"> |
| 84 | <Properties> | 87 | <Properties> |
| diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java index 7cce3cd..2a4481a 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java | |||
| @@ -7,7 +7,6 @@ import com.fourisland.instadisc.Database.Item; | |||
| 7 | import com.fourisland.instadisc.Database.Wrapper; | 7 | import com.fourisland.instadisc.Database.Wrapper; |
| 8 | import com.fourisland.instadisc.Item.Categories.InstaDiscIcon; | 8 | import com.fourisland.instadisc.Item.Categories.InstaDiscIcon; |
| 9 | import java.awt.AWTException; | 9 | import java.awt.AWTException; |
| 10 | import java.awt.Image; | ||
| 11 | import java.awt.SystemTray; | 10 | import java.awt.SystemTray; |
| 12 | import java.awt.TrayIcon; | 11 | import java.awt.TrayIcon; |
| 13 | import org.jdesktop.application.Action; | 12 | import org.jdesktop.application.Action; |
| @@ -198,6 +197,11 @@ public class InstaDiscView extends FrameView { | |||
| 198 | 197 | ||
| 199 | jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N | 198 | jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N |
| 200 | jMenuItem2.setName("jMenuItem2"); // NOI18N | 199 | jMenuItem2.setName("jMenuItem2"); // NOI18N |
| 200 | jMenuItem2.addActionListener(new java.awt.event.ActionListener() { | ||
| 201 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
| 202 | jMenuItem2ActionPerformed(evt); | ||
| 203 | } | ||
| 204 | }); | ||
| 201 | fileMenu.add(jMenuItem2); | 205 | fileMenu.add(jMenuItem2); |
| 202 | 206 | ||
| 203 | jSeparator1.setName("jSeparator1"); // NOI18N | 207 | jSeparator1.setName("jSeparator1"); // NOI18N |
| @@ -296,6 +300,11 @@ public class InstaDiscView extends FrameView { | |||
| 296 | asf.setVisible(true); | 300 | asf.setVisible(true); |
| 297 | }//GEN-LAST:event_jMenuItem1ActionPerformed | 301 | }//GEN-LAST:event_jMenuItem1ActionPerformed |
| 298 | 302 | ||
| 303 | private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed | ||
| 304 | ManageSubscriptionsForm msf = new ManageSubscriptionsForm(new JFrame(), true); | ||
| 305 | msf.setVisible(true); | ||
| 306 | }//GEN-LAST:event_jMenuItem2ActionPerformed | ||
| 307 | |||
| 299 | // Variables declaration - do not modify//GEN-BEGIN:variables | 308 | // Variables declaration - do not modify//GEN-BEGIN:variables |
| 300 | private javax.swing.JList jList1; | 309 | private javax.swing.JList jList1; |
| 301 | private javax.swing.JMenu jMenu1; | 310 | private javax.swing.JMenu jMenu1; |
| @@ -322,7 +331,7 @@ public class InstaDiscView extends FrameView { | |||
| 322 | private DefaultListModel lm = new DefaultListModel(); | 331 | private DefaultListModel lm = new DefaultListModel(); |
| 323 | 332 | ||
| 324 | public void refreshItemPane() { | 333 | public void refreshItemPane() { |
| 325 | lm.capacity(); | 334 | lm.clear(); |
| 326 | Item[] items = Wrapper.getAllItem(); | 335 | Item[] items = Wrapper.getAllItem(); |
| 327 | int i = 0; | 336 | int i = 0; |
| 328 | for (i = 0; i < items.length; i++) { | 337 | for (i = 0; i < items.length; i++) { |
| diff --git a/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.form b/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.form new file mode 100644 index 0000000..aba7b45 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.form | |||
| @@ -0,0 +1,123 @@ | |||
| 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="jScrollPane1" alignment="0" min="-2" pref="343" max="-2" attributes="0"/> | ||
| 35 | <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> | ||
| 36 | </Group> | ||
| 37 | </Group> | ||
| 38 | </Group> | ||
| 39 | </Group> | ||
| 40 | <Group type="102" alignment="1" attributes="0"> | ||
| 41 | <EmptySpace pref="235" max="32767" attributes="0"/> | ||
| 42 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
| 43 | <EmptySpace max="-2" attributes="0"/> | ||
| 44 | <Component id="jButton2" min="-2" max="-2" attributes="0"/> | ||
| 45 | </Group> | ||
| 46 | </Group> | ||
| 47 | <EmptySpace max="-2" attributes="0"/> | ||
| 48 | </Group> | ||
| 49 | </Group> | ||
| 50 | </DimensionLayout> | ||
| 51 | <DimensionLayout dim="1"> | ||
| 52 | <Group type="103" groupAlignment="0" attributes="0"> | ||
| 53 | <Group type="102" alignment="0" attributes="0"> | ||
| 54 | <EmptySpace max="-2" attributes="0"/> | ||
| 55 | <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
| 56 | <EmptySpace max="-2" attributes="0"/> | ||
| 57 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | ||
| 58 | <EmptySpace max="-2" attributes="0"/> | ||
| 59 | <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/> | ||
| 60 | <EmptySpace max="32767" attributes="0"/> | ||
| 61 | <Group type="103" groupAlignment="3" attributes="0"> | ||
| 62 | <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> | ||
| 63 | <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/> | ||
| 64 | </Group> | ||
| 65 | <EmptySpace max="-2" 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 | <Component class="javax.swing.JLabel" name="jLabel2"> | ||
| 79 | <Properties> | ||
| 80 | <Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/> | ||
| 81 | <Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/> | ||
| 82 | </Properties> | ||
| 83 | </Component> | ||
| 84 | <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | ||
| 85 | <Properties> | ||
| 86 | <Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/> | ||
| 87 | </Properties> | ||
| 88 | <AuxValues> | ||
| 89 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||
| 90 | </AuxValues> | ||
| 91 | |||
| 92 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||
| 93 | <SubComponents> | ||
| 94 | <Component class="javax.swing.JList" name="jList1"> | ||
| 95 | <Properties> | ||
| 96 | <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> | ||
| 97 | <StringArray count="0"/> | ||
| 98 | </Property> | ||
| 99 | <Property name="name" type="java.lang.String" value="jList1" noResource="true"/> | ||
| 100 | </Properties> | ||
| 101 | </Component> | ||
| 102 | </SubComponents> | ||
| 103 | </Container> | ||
| 104 | <Component class="javax.swing.JButton" name="jButton1"> | ||
| 105 | <Properties> | ||
| 106 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> | ||
| 107 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> | ||
| 108 | </Properties> | ||
| 109 | <Events> | ||
| 110 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> | ||
| 111 | </Events> | ||
| 112 | </Component> | ||
| 113 | <Component class="javax.swing.JButton" name="jButton2"> | ||
| 114 | <Properties> | ||
| 115 | <Property name="text" type="java.lang.String" resourceKey="jButton2.text"/> | ||
| 116 | <Property name="name" type="java.lang.String" value="jButton2" noResource="true"/> | ||
| 117 | </Properties> | ||
| 118 | <Events> | ||
| 119 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> | ||
| 120 | </Events> | ||
| 121 | </Component> | ||
| 122 | </SubComponents> | ||
| 123 | </Form> | ||
| diff --git a/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java b/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java new file mode 100644 index 0000000..c3cbf4a --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java | |||
| @@ -0,0 +1,174 @@ | |||
| 1 | /* | ||
| 2 | * ManageSubscriptionsForm.java | ||
| 3 | * | ||
| 4 | * Created on July 31, 2008, 12:14 PM | ||
| 5 | */ | ||
| 6 | |||
| 7 | package com.fourisland.instadisc; | ||
| 8 | |||
| 9 | import com.fourisland.instadisc.Database.Subscription; | ||
| 10 | import com.fourisland.instadisc.Database.Wrapper; | ||
| 11 | import javax.swing.DefaultListModel; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * | ||
| 15 | * @author hatkirby | ||
| 16 | */ | ||
| 17 | public class ManageSubscriptionsForm extends javax.swing.JDialog { | ||
| 18 | |||
| 19 | /** Creates new form ManageSubscriptionsForm */ | ||
| 20 | public ManageSubscriptionsForm(java.awt.Frame parent, boolean modal) { | ||
| 21 | super(parent, modal); | ||
| 22 | initComponents(); | ||
| 23 | |||
| 24 | jList1.setCellRenderer(new IDSubscriptionListCellRenderer()); | ||
| 25 | jList1.setModel(lm); | ||
| 26 | refreshSubscriptionPane(); | ||
| 27 | } | ||
| 28 | |||
| 29 | /** This method is called from within the constructor to | ||
| 30 | * initialize the form. | ||
| 31 | * WARNING: Do NOT modify this code. The content of this method is | ||
| 32 | * always regenerated by the Form Editor. | ||
| 33 | */ | ||
| 34 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
| 35 | private void initComponents() { | ||
| 36 | |||
| 37 | jLabel1 = new javax.swing.JLabel(); | ||
| 38 | jLabel2 = new javax.swing.JLabel(); | ||
| 39 | jScrollPane1 = new javax.swing.JScrollPane(); | ||
| 40 | jList1 = new javax.swing.JList(); | ||
| 41 | jButton1 = new javax.swing.JButton(); | ||
| 42 | jButton2 = new javax.swing.JButton(); | ||
| 43 | |||
| 44 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | ||
| 45 | setName("Form"); // NOI18N | ||
| 46 | |||
| 47 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.fourisland.instadisc.InstaDiscApp.class).getContext().getResourceMap(ManageSubscriptionsForm.class); | ||
| 48 | jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N | ||
| 49 | jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N | ||
| 50 | jLabel1.setName("jLabel1"); // NOI18N | ||
| 51 | |||
| 52 | jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N | ||
| 53 | jLabel2.setName("jLabel2"); // NOI18N | ||
| 54 | |||
| 55 | jScrollPane1.setName("jScrollPane1"); // NOI18N | ||
| 56 | |||
| 57 | jList1.setName("jList1"); // NOI18N | ||
| 58 | jScrollPane1.setViewportView(jList1); | ||
| 59 | |||
| 60 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N | ||
| 61 | jButton1.setName("jButton1"); // NOI18N | ||
| 62 | jButton1.addActionListener(new java.awt.event.ActionListener() { | ||
| 63 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
| 64 | jButton1ActionPerformed(evt); | ||
| 65 | } | ||
| 66 | }); | ||
| 67 | |||
| 68 | jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N | ||
| 69 | jButton2.setName("jButton2"); // NOI18N | ||
| 70 | jButton2.addActionListener(new java.awt.event.ActionListener() { | ||
| 71 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
| 72 | jButton2ActionPerformed(evt); | ||
| 73 | } | ||
| 74 | }); | ||
| 75 | |||
| 76 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
| 77 | getContentPane().setLayout(layout); | ||
| 78 | layout.setHorizontalGroup( | ||
| 79 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 80 | .addGroup(layout.createSequentialGroup() | ||
| 81 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 82 | .addGroup(layout.createSequentialGroup() | ||
| 83 | .addContainerGap() | ||
| 84 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 85 | .addComponent(jLabel1) | ||
| 86 | .addGroup(layout.createSequentialGroup() | ||
| 87 | .addGap(12, 12, 12) | ||
| 88 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 89 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 343, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
| 90 | .addComponent(jLabel2))))) | ||
| 91 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
| 92 | .addContainerGap(235, Short.MAX_VALUE) | ||
| 93 | .addComponent(jButton1) | ||
| 94 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 95 | .addComponent(jButton2))) | ||
| 96 | .addContainerGap()) | ||
| 97 | ); | ||
| 98 | layout.setVerticalGroup( | ||
| 99 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 100 | .addGroup(layout.createSequentialGroup() | ||
| 101 | .addContainerGap() | ||
| 102 | .addComponent(jLabel1) | ||
| 103 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 104 | .addComponent(jLabel2) | ||
| 105 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 106 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
| 107 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | ||
| 108 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | ||
| 109 | .addComponent(jButton2) | ||
| 110 | .addComponent(jButton1)) | ||
| 111 | .addContainerGap()) | ||
| 112 | ); | ||
| 113 | |||
| 114 | pack(); | ||
| 115 | }// </editor-fold>//GEN-END:initComponents | ||
| 116 | |||
| 117 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed | ||
| 118 | if (!jList1.isSelectionEmpty()) | ||
| 119 | { | ||
| 120 | Subscription subscription = (Subscription) jList1.getSelectedValue(); | ||
| 121 | Wrapper.deleteSubscription(subscription.getURL()); | ||
| 122 | |||
| 123 | XmlRpc xmlrpc = new XmlRpc("deleteSubscription"); | ||
| 124 | xmlrpc.addParam(subscription.getURL()); | ||
| 125 | xmlrpc.execute(); | ||
| 126 | |||
| 127 | refreshSubscriptionPane(); | ||
| 128 | } | ||
| 129 | }//GEN-LAST:event_jButton1ActionPerformed | ||
| 130 | |||
| 131 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed | ||
| 132 | setVisible(false); | ||
| 133 | }//GEN-LAST:event_jButton2ActionPerformed | ||
| 134 | |||
| 135 | /** | ||
| 136 | * @param args the command line arguments | ||
| 137 | */ | ||
| 138 | public static void main(String args[]) { | ||
| 139 | java.awt.EventQueue.invokeLater(new Runnable() { | ||
| 140 | public void run() { | ||
| 141 | ManageSubscriptionsForm dialog = new ManageSubscriptionsForm(new javax.swing.JFrame(), true); | ||
| 142 | dialog.addWindowListener(new java.awt.event.WindowAdapter() { | ||
| 143 | public void windowClosing(java.awt.event.WindowEvent e) { | ||
| 144 | System.exit(0); | ||
| 145 | } | ||
| 146 | }); | ||
| 147 | dialog.setVisible(true); | ||
| 148 | } | ||
| 149 | }); | ||
| 150 | } | ||
| 151 | |||
| 152 | // Variables declaration - do not modify//GEN-BEGIN:variables | ||
| 153 | private javax.swing.JButton jButton1; | ||
| 154 | private javax.swing.JButton jButton2; | ||
| 155 | private javax.swing.JLabel jLabel1; | ||
| 156 | private javax.swing.JLabel jLabel2; | ||
| 157 | private javax.swing.JList jList1; | ||
| 158 | private javax.swing.JScrollPane jScrollPane1; | ||
| 159 | // End of variables declaration//GEN-END:variables | ||
| 160 | |||
| 161 | DefaultListModel lm = new DefaultListModel(); | ||
| 162 | |||
| 163 | public void refreshSubscriptionPane() { | ||
| 164 | lm.clear(); | ||
| 165 | Subscription[] subscriptions = Wrapper.getAllSubscription(); | ||
| 166 | int i = 0; | ||
| 167 | for (i = 0; i < subscriptions.length; i++) { | ||
| 168 | lm.addElement(subscriptions[i]); | ||
| 169 | } | ||
| 170 | |||
| 171 | jList1.setEnabled(!lm.isEmpty()); | ||
| 172 | jButton1.setEnabled(!lm.isEmpty()); | ||
| 173 | } | ||
| 174 | } | ||
| diff --git a/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties b/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties index 1bafc98..a528bf6 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties | |||
| @@ -4,6 +4,6 @@ jLabel1.font=DejaVu Sans-Plain-18 | |||
| 4 | jLabel2.text=<HTML>To recieve InstaDisc notifications, you need to subscribe<BR>to a website's content. If a website supports InstaDisc<BR>it should be advertising a link to an "InstaDisc Subscription<BR>File". To subscribe to that website's content, copy the URL<BR>into the box below. | 4 | jLabel2.text=<HTML>To recieve InstaDisc notifications, you need to subscribe<BR>to a website's content. If a website supports InstaDisc<BR>it should be advertising a link to an "InstaDisc Subscription<BR>File". To subscribe to that website's content, copy the URL<BR>into the box below. |
| 5 | jLabel3.text=Subscription File URL: | 5 | jLabel3.text=Subscription File URL: |
| 6 | jTextField1.text= | 6 | jTextField1.text= |
| 7 | jButton1.text=Cancel | 7 | jButton1.text=Done |
| 8 | jButton2.text=OK | 8 | jButton2.text=OK |
| 9 | jLabel4.text= | 9 | jLabel4.text= |
| diff --git a/client/trunk/src/com/fourisland/instadisc/resources/ManageSubscriptionsForm.properties b/client/trunk/src/com/fourisland/instadisc/resources/ManageSubscriptionsForm.properties new file mode 100644 index 0000000..1fae114 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/resources/ManageSubscriptionsForm.properties | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | jLabel1.text=Manage Subscriptions | ||
| 2 | #NOI18N | ||
| 3 | jLabel1.font=DejaVu Sans-Plain-18 | ||
| 4 | jLabel2.text=<HTML>If you get bored or annoyed with a certain subscription,<BR>you can unsubscribe from it right here. Just choose the<BR>subscription from the list below and click "Unsubscribe". | ||
| 5 | jButton1.text=Unsubscribe | ||
| 6 | jButton2.text=Done | ||
