From bac48f155528976a1bd411693cb61a672d6623d0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 31 Jul 2008 19:24:58 +0000 Subject: Client: Added Advanced Settings form --- .../fourisland/instadisc/AddSubscriptionForm.form | 46 ++--- .../fourisland/instadisc/AddSubscriptionForm.java | 40 ++--- .../fourisland/instadisc/AdvancedSettingsForm.form | 152 +++++++++++++++++ .../fourisland/instadisc/AdvancedSettingsForm.java | 186 +++++++++++++++++++++ .../com/fourisland/instadisc/FirstRun/Step2.java | 3 +- .../com/fourisland/instadisc/InstaDiscView.form | 3 + .../com/fourisland/instadisc/InstaDiscView.java | 10 ++ .../src/com/fourisland/instadisc/Item/Item.java | 2 +- .../fourisland/instadisc/Item/Verification.java | 2 +- .../resources/AddSubscriptionForm.properties | 2 +- .../resources/AdvancedSettingsForm.properties | 9 + 11 files changed, 411 insertions(+), 44 deletions(-) create mode 100644 client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form create mode 100644 client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java create mode 100644 client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties (limited to 'client/trunk/src') diff --git a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form index 22f7ea6..c381e8d 100644 --- a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form +++ b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.form @@ -24,28 +24,30 @@ - + - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - + @@ -62,10 +64,12 @@ - - - - + + + + + + diff --git a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java index 1609875..7b0fc08 100644 --- a/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java +++ b/client/trunk/src/com/fourisland/instadisc/AddSubscriptionForm.java @@ -80,22 +80,23 @@ public class AddSubscriptionForm extends javax.swing.JDialog { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) - .addGroup(layout.createSequentialGroup() - .addGap(12, 12, 12) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jLabel2))) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton1))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(12, 12, 12) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)))))) .addContainerGap()) ); layout.setVerticalGroup( @@ -110,10 +111,11 @@ public class AddSubscriptionForm extends javax.swing.JDialog { .addComponent(jLabel3) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jButton1) - .addComponent(jButton2) - .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1) + .addComponent(jButton2))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); diff --git a/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form new file mode 100644 index 0000000..f5189b4 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form @@ -0,0 +1,152 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java new file mode 100644 index 0000000..312b3c3 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java @@ -0,0 +1,186 @@ +/* + * AdvancedSettingsForm.java + * + * Created on July 31, 2008, 12:43 PM + */ + +package com.fourisland.instadisc; + +import com.fourisland.instadisc.Database.Wrapper; +import javax.swing.SpinnerNumberModel; + +/** + * + * @author hatkirby + */ +public class AdvancedSettingsForm extends javax.swing.JDialog { + + /** Creates new form AdvancedSettingsForm */ + public AdvancedSettingsForm(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + + SpinnerNumberModel sm = new SpinnerNumberModel(); + sm.setValue(Integer.decode(Wrapper.getConfig("itemBufferSize"))); + sm.setMaximum(100); + sm.setMinimum(1); + sm.setStepSize(1); + jSpinner1.setModel(sm); + + SpinnerNumberModel sm2 = new SpinnerNumberModel(); + sm2.setValue(Integer.decode(Wrapper.getConfig("verIDBufferSize"))); + sm2.setMaximum(10000); + sm2.setMinimum(1); + sm2.setStepSize(1); + jSpinner2.setModel(sm2); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jSpinner1 = new javax.swing.JSpinner(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jSpinner2 = new javax.swing.JSpinner(); + jLabel6 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setName("Form"); // NOI18N + + org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.fourisland.instadisc.InstaDiscApp.class).getContext().getResourceMap(AdvancedSettingsForm.class); + jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N + jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N + jLabel1.setName("jLabel1"); // NOI18N + + jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N + jLabel2.setName("jLabel2"); // NOI18N + + jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N + jLabel3.setName("jLabel3"); // NOI18N + + jSpinner1.setName("jSpinner1"); // NOI18N + + jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N + jLabel4.setName("jLabel4"); // NOI18N + + jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N + jLabel5.setName("jLabel5"); // NOI18N + + jSpinner2.setName("jSpinner2"); // NOI18N + + jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N + jLabel6.setName("jLabel6"); // NOI18N + + jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N + jButton1.setName("jButton1"); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3) + .addGap(18, 18, 18) + .addComponent(jSpinner1, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSpinner2, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)))))) + .addGroup(layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(342, Short.MAX_VALUE) + .addComponent(jButton1))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel6) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Wrapper.setConfig("itemBufferSize", ((Integer) jSpinner1.getValue()).toString()); + Wrapper.setConfig("verIDBufferSize", ((Integer) jSpinner2.getValue()).toString()); + setVisible(false); + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + AdvancedSettingsForm dialog = new AdvancedSettingsForm(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JSpinner jSpinner1; + private javax.swing.JSpinner jSpinner2; + // End of variables declaration//GEN-END:variables + +} diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java index ef1ffd4..e81049a 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java @@ -167,7 +167,8 @@ public class Step2 extends javax.swing.JDialog { Wrapper.setConfig("username", jTextField1.getText()); Wrapper.setConfig("password", md5.hash()); Wrapper.setConfig("centralServerURL", jTextField3.getText()); - Wrapper.setConfig("itemsToHold", "10"); + Wrapper.setConfig("itemBufferSize", "10"); + Wrapper.setConfig("verIDBufferSize", "100"); Wrapper.setConfig("initCheck", "done"); StepEndResults.ok = true; diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form index 7baafca..b000ed9 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form @@ -125,6 +125,9 @@ + + + diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java index 2a4481a..3c58bfc 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java @@ -227,6 +227,11 @@ public class InstaDiscView extends FrameView { jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N jMenuItem5.setName("jMenuItem5"); // NOI18N + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); jMenu1.add(jMenuItem5); menuBar.add(jMenu1); @@ -305,6 +310,11 @@ public class InstaDiscView extends FrameView { msf.setVisible(true); }//GEN-LAST:event_jMenuItem2ActionPerformed + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed + AdvancedSettingsForm asf = new AdvancedSettingsForm(new JFrame(), true); + asf.setVisible(true); + }//GEN-LAST:event_jMenuItem5ActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JList jList1; private javax.swing.JMenu jMenu1; diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Item.java b/client/trunk/src/com/fourisland/instadisc/Item/Item.java index 5ed6fe9..fa3b50c 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Item.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Item.java @@ -35,7 +35,7 @@ public class Item { xmlrpc.addParam(Integer.decode(headerMap.get("ID"))); //xmlrpc.execute(); - if (Wrapper.countItem() >= Integer.decode(Wrapper.getConfig("itemsToHold"))) + if (Wrapper.countItem() >= Integer.decode(Wrapper.getConfig("itemBufferSize"))) { Wrapper.dropFromTopItem(); } diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java index 9646397..dc4c4a7 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java @@ -31,7 +31,7 @@ public class Verification { if (Wrapper.containsOldVerID(id)) { throw new VerificationIDReusedException(); } else { - if (Wrapper.countOldVerID() == 100) { + if (Wrapper.countOldVerID() == Integer.decode(Wrapper.getConfig("verIDBufferSize"))) { Wrapper.emptyOldVerID(); } Wrapper.addOldVerID(id); diff --git a/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties b/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties index a528bf6..a783681 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/AddSubscriptionForm.properties @@ -1,7 +1,7 @@ jLabel1.text=Add a Subscription #NOI18N jLabel1.font=DejaVu Sans-Plain-18 -jLabel2.text=To recieve InstaDisc notifications, you need to subscribe
to a website's content. If a website supports InstaDisc
it should be advertising a link to an "InstaDisc Subscription
File". To subscribe to that website's content, copy the URL
into the box below. +jLabel2.text=To recieve InstaDisc notifications, you need to subscribe to a website's content. If a website supports InstaDisc it should be advertising a link to an "InstaDisc Subscription File". To subscribe to that website's content, copy the URL into the box below. jLabel3.text=Subscription File URL: jTextField1.text= jButton1.text=Done diff --git a/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties b/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties new file mode 100644 index 0000000..2f547b3 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties @@ -0,0 +1,9 @@ +jLabel1.text=Advanced Settings +#NOI18N +jLabel1.font=DejaVu Sans-Plain-18 +jLabel2.text=This section is for more advanced users who would like to
tweak their InstaDisc experience. +jLabel3.text=Item Buffer Size: +jLabel4.text=This is the number of items that you would like to keep on the main InstaDisc screen. InstaDisc only holds so many Items at once, and you can specify how much that is. +jLabel5.text=VerID Buffer Size: +jLabel6.text=If this is a higher value, less viral Items will get in, but there'd be more chance of re-contacting the server, and thus more Internet usage. +jButton1.text=Done -- cgit 1.4.1