about summary refs log tree commit diff stats
path: root/client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-07-31 16:37:50 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-07-31 16:37:50 +0000
commitd768477ac4d17279430cd5d53b870981fdb7e267 (patch)
tree559943a7d0f8e233ed974af037ae8977521e0e31 /client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java
parentd2b2be4e1aaddc13d435edce83e6c3aab76aa118 (diff)
downloadinstadisc-d768477ac4d17279430cd5d53b870981fdb7e267.tar.gz
instadisc-d768477ac4d17279430cd5d53b870981fdb7e267.tar.bz2
instadisc-d768477ac4d17279430cd5d53b870981fdb7e267.zip
Client: Created Manage Subscriptions form
Diffstat (limited to 'client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java')
-rw-r--r--client/trunk/src/com/fourisland/instadisc/ManageSubscriptionsForm.java174
1 files changed, 174 insertions, 0 deletions
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
7package com.fourisland.instadisc;
8
9import com.fourisland.instadisc.Database.Subscription;
10import com.fourisland.instadisc.Database.Wrapper;
11import javax.swing.DefaultListModel;
12
13/**
14 *
15 * @author hatkirby
16 */
17public 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}