[Webfunds-commits] java/webfunds/client/contracts/wizard KeyContract.java WizardPanel.java

Ian Grigg iang@cypherpunks.ai
Tue, 5 Sep 2000 15:37:11 -0400 (AST)


iang        00/09/05 15:37:11

  Modified:    webfunds/client/contracts/wizard KeyContract.java
                        WizardPanel.java
  Log:
  blanks only

Revision  Changes    Path
1.15      +79 -79    java/webfunds/client/contracts/wizard/KeyContract.java

Index: KeyContract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/KeyContract.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- KeyContract.java	2000/08/28 18:23:30	1.14
+++ KeyContract.java	2000/09/05 19:37:11	1.15
@@ -1,5 +1,5 @@
 /*
- * $Id: KeyContract.java,v 1.14 2000/08/28 18:23:30 edwin Exp $
+ * $Id: KeyContract.java,v 1.15 2000/09/05 19:37:11 iang Exp $
  *
  * Copyright (c) Systemics Inc 2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -26,52 +26,52 @@
  * Panel that asks for the contract key
  *
  * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
  */
 
-public class KeyContract extends SignContractWizardPanel 
+public class KeyContract extends SignContractWizardPanel
                          implements ActionListener {
 
     JTextField txtFile;
     JTextField txtFile2;
     String oldFile = "";
-    
+
     WizardData data;
-    
-    
+
+
     public KeyContract(WizardData data) {
-      
+
         this.data = data;
-      
+
         // GridBagLayout is the most flexible (also the most difficult
         // to use) LayoutManager.
         GridBagLayout gridbag = new GridBagLayout();
         GridBagConstraints c = new GridBagConstraints();
 
         setLayout(gridbag);
-        
-        
+
+
         // Define some components we'll use later on.
         JButton    but;
         JLabel     lab;
 
         final String tag = webfunds.ricardian.Contract.USERID_CONTRACT;
 
-        // Ok, this is where the real dirty work starts. Do not attempt 
-        // to change it, unless you understand the GridBagLayout and 
-        // GridBagConstraints, because in case you don't the result 
+        // Ok, this is where the real dirty work starts. Do not attempt
+        // to change it, unless you understand the GridBagLayout and
+        // GridBagConstraints, because in case you don't the result
         // will probably be a real f*ck up of the layout.
-        
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 0;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 0;
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(5, 5, 5, 5);
-        lab = new JLabel("Select the " + tag + " signing PGP key."); 
+        lab = new JLabel("Select the " + tag + " signing PGP key.");
         gridbag.setConstraints(lab,c); add(lab);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 1;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 1;
@@ -82,20 +82,20 @@
                   "Select the file containing your "+
                   tag +
                   " key for signing this contract." +
-                  "</b></font></html>"); 
+                  "</b></font></html>");
         gridbag.setConstraints(lab,c); add(lab);
 
-        
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 2;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 0;
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(5, 5, 0, 5);
-        lab = new JLabel("The public key:"); 
+        lab = new JLabel("The public key:");
         gridbag.setConstraints(lab,c); add(lab);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 1;
         c.gridy      = 3;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 1;
@@ -112,22 +112,22 @@
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(0, 5, 5, 5);
-        but = new JButton("Browse"); 
+        but = new JButton("Browse");
         but.addActionListener(this);
         but.setActionCommand("browse");
         gridbag.setConstraints(but,c); add(but);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 4;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 0;
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(0, 5, 0, 5);
-        lab = new JLabel("The secret key:"); 
+        lab = new JLabel("The secret key:");
         gridbag.setConstraints(lab,c); add(lab);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 1;
         c.gridy      = 5;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 1;
@@ -144,22 +144,22 @@
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(0, 5, 5, 5);
-        but = new JButton("Browse"); 
+        but = new JButton("Browse");
         but.addActionListener(this);
         but.setActionCommand("browse2");
         gridbag.setConstraints(but,c); add(but);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 6;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 0;
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(5, 5, 3, 5);
-        lab = new JLabel("Export instructions for PGP 6.5 on Windows:"); 
+        lab = new JLabel("Export instructions for PGP 6.5 on Windows:");
         gridbag.setConstraints(lab,c); add(lab);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 7;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 1;
@@ -172,9 +172,9 @@
                   " key and select 'Export'. "+
                   "Do this once <i>with</i> and once <i>without</i> "+
                   "the private (secret) part of the key."+
-                  "</b></font></html>"); 
+                  "</b></font></html>");
         gridbag.setConstraints(lab,c); add(lab);
-        
+
 
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 8;      c.gridx     = 0;
@@ -182,10 +182,10 @@
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(5, 5, 3, 5);
-        lab = new JLabel("Export instructions for GnuPG:"); 
+        lab = new JLabel("Export instructions for GnuPG:");
         gridbag.setConstraints(lab,c); add(lab);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 9;      c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 1;
@@ -199,20 +199,20 @@
                   "Secret key: 'gpg -a --export-secret-key \"" +
                   tag +
                   "\" > skey.asc' "+
-                  "</b></font></html>"); 
+                  "</b></font></html>");
         gridbag.setConstraints(lab,c); add(lab);
-        
 
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 10;     c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 0;
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.WEST;
         c.insets     = new Insets(5, 5, 3, 5);
-        lab = new JLabel("Creating your OpenPGP " + tag + " key:"); 
+        lab = new JLabel("Creating your OpenPGP " + tag + " key:");
         gridbag.setConstraints(lab,c); add(lab);
-        
-        
+
+
         c.gridheight = 1;      c.gridwidth = 2;
         c.gridy      = 11;     c.gridx     = 0;
         c.weighty    = 0;      c.weightx   = 1;
@@ -227,7 +227,7 @@
                   " Sign the key with your "+
                   webfunds.ricardian.Contract.USERID_TOP_LEVEL +
                   " key."+
-                  "</b></font></html>"); 
+                  "</b></font></html>");
         gridbag.setConstraints(lab,c); add(lab);
 
 
@@ -238,59 +238,59 @@
         c.fill       = GridBagConstraints.NONE;
         c.anchor     = GridBagConstraints.CENTER;
         c.insets     = new Insets(0, 5, 0, 5);
-        lab = new JLabel(""); 
+        lab = new JLabel("");
         gridbag.setConstraints(lab,c); add(lab);
-        
+
     }
-    
-    
+
+
     public void actionPerformed(java.awt.event.ActionEvent e) {
-      
+
         if (e.getActionCommand().equals("browse")) {
-          
+
             JFileChooser fc = new JFileChooser();
-            
+
             fc.setDialogTitle("Open Contract");
             fc.setDialogType(fc.OPEN_DIALOG);
             fc.setFileSelectionMode(fc.FILES_ONLY);
             fc.setCurrentDirectory(new File(System.getProperty("user.dir")));
-            
+
             if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
-              
+
                 try {
                     txtFile.setText(fc.getSelectedFile().getCanonicalPath());
                 } catch (IOException ioe) { }
-                            
+
             }
-                      
+
         }
-      
+
         if (e.getActionCommand().equals("browse2")) {
-          
+
             JFileChooser fc = new JFileChooser();
-            
+
             fc.setDialogTitle("Open Contract");
             fc.setDialogType(fc.OPEN_DIALOG);
             fc.setFileSelectionMode(fc.FILES_ONLY);
             fc.setCurrentDirectory(new File(System.getProperty("user.dir")));
-            
+
             if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
-              
+
                 try {
                     txtFile2.setText(fc.getSelectedFile().getCanonicalPath());
                 } catch (IOException ioe) { }
-                            
+
             }
-                      
+
         }
-      
+
     }
-    
 
+
     public void enter() {
         oldFile = txtFile.getText();
     }
-    
+
     public boolean leave() {
         if (! txtFile.getText().equals(oldFile)) {
             return next();   // load the file
@@ -301,7 +301,7 @@
 
     public boolean next() {
 
-        
+
         String fileName = txtFile.getText();
         // have we already got it?
         String existing = data.getPublicContractKey();
@@ -314,13 +314,13 @@
         }
 
         String publicString;
-        
+
         if (fileName.length() != 0)        // got a name, try for a key
         {
             publicString = loadStringFromFile(fileName, "contract public key");
             if (publicString == null)
                 return false;
-    
+
             String topLevelKey = data.getTopLevelKey();
             if (topLevelKey.length() == 0)
             {
@@ -335,18 +335,18 @@
             publicString = checkPublicContractKey(publicString, topLevelKey);
             if (publicString == null)
                 return false;
-    
+
             //  ok, so a good key, should we override and use it?
-            if ( alreadyGotAKey 
+            if ( alreadyGotAKey
                        && !confirm("Override existing public contract key?") ) {
                 publicString = existing;
             }
 
         } else {
 
-            // no filename given, use existing key        
+            // no filename given, use existing key
             publicString = existing;
-            
+
         }
 
 
@@ -355,23 +355,23 @@
         existing = data.getSecretContractKey();
         if (fileName.length() == 0 && existing.length() > 0)
             return true;
-         
+
         /*
          *  This one is a bit different.
          */
-        String secretString = loadStringFromFile(fileName, 
+        String secretString = loadStringFromFile(fileName,
                                                  "contract secret key");
         if (secretString == null)
             return false;
+
 
-        
         if (existing.length() > 0)         // there was a key there before
         {
             if (!confirm("override existing contract secret key?"))
                 secretString = existing;
         }
-                                              
 
+
         // convert to keys for checking
         PGPSecretKey seckey;
         try {
@@ -396,8 +396,8 @@
             error("Secret key does not match public key.");
             return false;
         }
-        
-        
+
+
 
         data.setPublicContractKey(publicString);
         data.setSecretContractKey(secretString);



1.9       +12 -12    java/webfunds/client/contracts/wizard/WizardPanel.java

Index: WizardPanel.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/WizardPanel.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WizardPanel.java	2000/08/28 13:37:13	1.8
+++ WizardPanel.java	2000/09/05 19:37:11	1.9
@@ -1,5 +1,5 @@
 /*
- * $Id: WizardPanel.java,v 1.8 2000/08/28 13:37:13 edwin Exp $
+ * $Id: WizardPanel.java,v 1.9 2000/09/05 19:37:11 iang Exp $
  *
  * Copyright (c) Systemics Inc 2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -14,25 +14,25 @@
  * Abstract superclass for all panels in a wizard.
  *
  * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
  */
 
 public abstract class WizardPanel extends JPanel {
 
 
-    /** 
+    /**
      * Called by Wizard.java when entering this page
      */
     public abstract void enter();
-  
-    /** 
+
+    /**
      * Called by Wizard.java when leaving this page when not using next.
      *
      * @return false when leaving this panel is not permitted, true otherwise.
      */
     public abstract boolean leave();
 
-    /** 
+    /**
      * Called by Wizard.java when leaving this page by using next
      *
      * @return false when leaving this panel is not permitted, true otherwise.
@@ -47,10 +47,10 @@
      */
     protected void error(String message) {
         System.err.println("ERROR: "+message);
-        JOptionPane.showMessageDialog(this, message, "Error", 
+        JOptionPane.showMessageDialog(this, message, "Error",
                                       JOptionPane.ERROR_MESSAGE);
     }
- 
+
     /**
      * Convenience method that displays an error message and exception.
      *
@@ -66,10 +66,10 @@
     protected void error(String message, Exception e) {
         System.err.println("ERROR: "+message);
         if (e != null) { e.printStackTrace(); message += "\n\n\""+e+"\""; }
-        JOptionPane.showMessageDialog(this, message, "Error", 
+        JOptionPane.showMessageDialog(this, message, "Error",
                                       JOptionPane.ERROR_MESSAGE);
     }
- 
+
     /**
      * Convenience method that displays an yes/no dialog box with the given
      * message.
@@ -79,10 +79,10 @@
      * @return true if Yes is selected by the user, false otherwise
      */
     protected boolean confirm(String message) {
-        int result = JOptionPane.showConfirmDialog(this, message, "Confirm", 
+        int result = JOptionPane.showConfirmDialog(this, message, "Confirm",
                        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
         return (result == JOptionPane.YES_OPTION);
     }
- 
+
 
 }