[Webfunds-commits] java/webfunds/client/contracts/wizard KeyPanel.java ContractEdit.java ContractFile.java FinishEnd.java FinishSig.java KeyContract.java KeyServer.java KeyTop.java Wizard.java WizardData.java WizardPanel.java

Edwin Woudt edwin@cypherpunks.ai
Tue, 15 Aug 2000 19:22:37 -0400 (AST)


edwin       00/08/15 19:22:36

  Modified:    webfunds/client/contracts/wizard ContractEdit.java
                        ContractFile.java FinishEnd.java FinishSig.java
                        KeyContract.java KeyServer.java KeyTop.java
                        Wizard.java WizardData.java WizardPanel.java
  Added:       webfunds/client/contracts/wizard KeyPanel.java
  Log:
  Fix line endings
  Moving from laptop to desktop
  WIP on fixing bugs in sign contract wizard

Revision  Changes    Path
1.2       +100 -100  java/webfunds/client/contracts/wizard/ContractEdit.java

Index: ContractEdit.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/ContractEdit.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContractEdit.java	2000/08/08 14:56:52	1.1
+++ ContractEdit.java	2000/08/15 23:22:34	1.2
@@ -1,101 +1,101 @@
-/*
- * $Id: ContractEdit.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import java.awt.*;
-import javax.swing.*;
-
-
-/**
- * Panel that allows the user to do final adjustments to the panel.
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class ContractEdit extends WizardPanel {
-
-    
-    public JEditorPane editor;
-
-    WizardData data;
-    
-
-    public ContractEdit(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.
-        JLabel     lab;
-
-
-        // 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 = 1;
-        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("Edit the contract"); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-        
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 1;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In this step you can make any final adjustments to "+
-                         "the contract."+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-
-        
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 0;
-        c.weighty    = 1;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.BOTH;
-        c.anchor     = GridBagConstraints.CENTER;
-        c.insets     = new Insets(5, 5, 5, 5);
-        editor = new JEditorPane();
-        JScrollPane scroll = new JScrollPane(editor);
-        gridbag.setConstraints(scroll,c); add(scroll);
-        
-    }
-    
-    
-    public void enter() {
-        editor.setText(data.getUnsignedContract());
-    }
-    
-    public boolean leave() {
-        return next();
-    }
-
-    public boolean next() {
-        data.setUnsignedContract(editor.getText());
-        return true;
-    }
-
-
+/*
+ * $Id: ContractEdit.java,v 1.2 2000/08/15 23:22:34 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import java.awt.*;
+import javax.swing.*;
+
+
+/**
+ * Panel that allows the user to do final adjustments to the panel.
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class ContractEdit extends WizardPanel {
+
+    
+    public JEditorPane editor;
+
+    WizardData data;
+    
+
+    public ContractEdit(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.
+        JLabel     lab;
+
+
+        // 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 = 1;
+        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("Edit the contract"); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+        
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 1;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In this step you can make any final adjustments to "+
+                         "the contract."+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+
+        
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 0;
+        c.weighty    = 1;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.BOTH;
+        c.anchor     = GridBagConstraints.CENTER;
+        c.insets     = new Insets(5, 5, 5, 5);
+        editor = new JEditorPane();
+        JScrollPane scroll = new JScrollPane(editor);
+        gridbag.setConstraints(scroll,c); add(scroll);
+        
+    }
+    
+    
+    public void enter() {
+        editor.setText(data.getUnsignedContract());
+    }
+    
+    public boolean leave() {
+        return next();
+    }
+
+    public boolean next() {
+        data.setUnsignedContract(editor.getText());
+        return true;
+    }
+
+
 }



1.2       +186 -186  java/webfunds/client/contracts/wizard/ContractFile.java

Index: ContractFile.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/ContractFile.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContractFile.java	2000/08/08 14:56:52	1.1
+++ ContractFile.java	2000/08/15 23:22:34	1.2
@@ -1,187 +1,187 @@
-/*
- * $Id: ContractFile.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-
-/**
- * Panel that asks for the filename of the contract.
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class ContractFile extends WizardPanel 
-                          implements ActionListener {
-
-    JTextField txtFile;
-    String oldFile = "";
-    
-    WizardData data;
-    
-
-    public ContractFile(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;
-
-
-        // 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("Read the contract file"); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-        
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 1;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In this step you will choose the basic contract "+
-                         "that you want signed. Choose Browse to search for a "+
-                         "contract file. You will be able to make adjustments "+
-                         "to the contract in the next screen. Skip this step "+
-                         "if you want to copy/paste the contract without "+
-                         "using a file."+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-
-        
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.EAST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        txtFile = new JTextField("");
-        gridbag.setConstraints(txtFile,c); add(txtFile);
-
-
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 1;
-        c.weighty    = 0;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        but = new JButton("Browse"); 
-        but.addActionListener(this);
-        but.setActionCommand("browse");
-        gridbag.setConstraints(but,c); add(but);
-        
-
-        // Filler, makes sure the whole thing is aligned to the top
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 3;      c.gridx     = 0;
-        c.weighty    = 1;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.CENTER;
-        c.insets     = new Insets(5, 5, 5, 5);
-        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);
-            
-            if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
-              
-                try {
-                    txtFile.setText(fc.getSelectedFile().getCanonicalPath());
-                } catch (IOException ioe) { }
-                            
-            }
-                      
-        }
-      
-    }
-    
-
-    public void enter() {
-        oldFile = txtFile.getText();
-    }
-    
-    public boolean leave() {
-        if (txtFile.getText() != oldFile) {
-            return next();   // load the file
-        } else {
-            return true;
-        }
-    }
-
-    public boolean next() {
-        if (!txtFile.getText().equals("")) {
-            try {
-                FileInputStream fis = new FileInputStream(txtFile.getText());
-                DataInputStream dis = new DataInputStream(fis);
-                
-                byte[] contr = new byte[fis.available()];
-                dis.readFully(contr);
-                
-                String s = new String(contr,"ISO8859-1");
-                data.setUnsignedContract(s);
-                
-                return true;
-            } catch (IOException ioe) {
-                String s;
-                if (ioe instanceof FileNotFoundException) {
-                    s = "File not found";
-                } else {
-                    s = ioe.toString();
-                }
-                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
-                                            "Error", JOptionPane.ERROR_MESSAGE);
-                return false;
-            }
-        } else {
-            data.setUnsignedContract("");
-            return true;
-        }
-    }
-
-
+/*
+ * $Id: ContractFile.java,v 1.2 2000/08/15 23:22:34 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+
+/**
+ * Panel that asks for the filename of the contract.
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class ContractFile extends WizardPanel 
+                          implements ActionListener {
+
+    JTextField txtFile;
+    String oldFile = "";
+    
+    WizardData data;
+    
+
+    public ContractFile(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;
+
+
+        // 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("Read the contract file"); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+        
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 1;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In this step you will choose the basic contract "+
+                         "that you want signed. Choose Browse to search for a "+
+                         "contract file. You will be able to make adjustments "+
+                         "to the contract in the next screen. Skip this step "+
+                         "if you want to copy/paste the contract without "+
+                         "using a file."+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+
+        
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.EAST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        txtFile = new JTextField("");
+        gridbag.setConstraints(txtFile,c); add(txtFile);
+
+
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 1;
+        c.weighty    = 0;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        but = new JButton("Browse"); 
+        but.addActionListener(this);
+        but.setActionCommand("browse");
+        gridbag.setConstraints(but,c); add(but);
+        
+
+        // Filler, makes sure the whole thing is aligned to the top
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 3;      c.gridx     = 0;
+        c.weighty    = 1;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.CENTER;
+        c.insets     = new Insets(5, 5, 5, 5);
+        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);
+            
+            if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
+              
+                try {
+                    txtFile.setText(fc.getSelectedFile().getCanonicalPath());
+                } catch (IOException ioe) { }
+                            
+            }
+                      
+        }
+      
+    }
+    
+
+    public void enter() {
+        oldFile = txtFile.getText();
+    }
+    
+    public boolean leave() {
+        if (txtFile.getText() != oldFile) {
+            return next();   // load the file
+        } else {
+            return true;
+        }
+    }
+
+    public boolean next() {
+        if (!txtFile.getText().equals("")) {
+            try {
+                FileInputStream fis = new FileInputStream(txtFile.getText());
+                DataInputStream dis = new DataInputStream(fis);
+                
+                byte[] contr = new byte[fis.available()];
+                dis.readFully(contr);
+                
+                String s = new String(contr,"ISO8859-1");
+                data.setUnsignedContract(s);
+                
+                return true;
+            } catch (IOException ioe) {
+                String s;
+                if (ioe instanceof FileNotFoundException) {
+                    s = "File not found";
+                } else {
+                    s = ioe.toString();
+                }
+                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
+                                            "Error", JOptionPane.ERROR_MESSAGE);
+                return false;
+            }
+        } else {
+            data.setUnsignedContract("");
+            return true;
+        }
+    }
+
+
 }



1.2       +105 -105  java/webfunds/client/contracts/wizard/FinishEnd.java

Index: FinishEnd.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/FinishEnd.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FinishEnd.java	2000/08/08 14:56:52	1.1
+++ FinishEnd.java	2000/08/15 23:22:34	1.2
@@ -1,106 +1,106 @@
-/*
- * $Id: FinishEnd.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import java.io.IOException;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-
-/**
- * Final 'congratulations' panel.
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class FinishEnd extends WizardPanel {
-
-
-    WizardData data;
-        
-    
-    public FinishEnd(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.
-        JLabel     lab;
-
-
-        // 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 = 1;
-        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("Congratulations"); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-        
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 1;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "You now have a signed contract. "+
-                         "The next steps now are to load WebFunds and check "+
-                         "whether it accepts the contract and you can do a "+
-                         "zero spend to yourself. If it doesn't: correct the "+
-                         "errors and run this wizard again. If it does: good "+
-                         "luck with your new contract. "+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-
-        
-        // Filler, makes sure the whole thing is aligned to the top
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 0;
-        c.weighty    = 1;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.CENTER;
-        c.insets     = new Insets(5, 5, 5, 5);
-        lab = new JLabel(""); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-    }
-    
-
-    public void enter() {
-        // do nothing
-    }
-    
-    public boolean leave() {
-        // do nothing
-        return true;
-    }
-
-    public boolean next() {
-        return true;
-    }
-
-
+/*
+ * $Id: FinishEnd.java,v 1.2 2000/08/15 23:22:34 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import java.io.IOException;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+
+/**
+ * Final 'congratulations' panel.
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class FinishEnd extends WizardPanel {
+
+
+    WizardData data;
+        
+    
+    public FinishEnd(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.
+        JLabel     lab;
+
+
+        // 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 = 1;
+        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("Congratulations"); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+        
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 1;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "You now have a signed contract. "+
+                         "The next steps now are to load WebFunds and check "+
+                         "whether it accepts the contract and you can do a "+
+                         "zero spend to yourself. If it doesn't: correct the "+
+                         "errors and run this wizard again. If it does: good "+
+                         "luck with your new contract. "+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+
+        
+        // Filler, makes sure the whole thing is aligned to the top
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 0;
+        c.weighty    = 1;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.CENTER;
+        c.insets     = new Insets(5, 5, 5, 5);
+        lab = new JLabel(""); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+    }
+    
+
+    public void enter() {
+        // do nothing
+    }
+    
+    public boolean leave() {
+        // do nothing
+        return true;
+    }
+
+    public boolean next() {
+        return true;
+    }
+
+
 }



1.3       +8 -9      java/webfunds/client/contracts/wizard/FinishSig.java

Index: FinishSig.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/FinishSig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FinishSig.java	2000/08/11 21:31:27	1.2
+++ FinishSig.java	2000/08/15 23:22:34	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id: FinishSig.java,v 1.2 2000/08/11 21:31:27 edwin Exp $
+ * $Id: FinishSig.java,v 1.3 2000/08/15 23:22:34 edwin Exp $
  *
  * Copyright (c) Systemics Inc 2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -32,7 +32,7 @@
  * Panel that does the actual signing.
  *
  * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
  */
 
 public class FinishSig extends WizardPanel 
@@ -216,9 +216,14 @@
             PGPSecretKey skey = new PGPSecretKey();
             try {
                 skey.readKey(dis);
+            } catch (PGPException pe) {
+                error("Error parsing contract",pe);
+                return false;
+            }
+            try {
                 skey.decrypt(txtPass.getText());
             } catch (PGPException pe) {
-                error("Error parsing contract key",pe);
+                error("Wrong passphrase", pe);
                 return false;
             }
         
@@ -261,10 +266,4 @@
     }
     
     
-    private void error(String message, Exception e) {
-        e.printStackTrace();
-        JOptionPane.showMessageDialog(this, message, "Error", 
-                                      JOptionPane.ERROR_MESSAGE);
-    }
-
 }



1.2       +301 -301  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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KeyContract.java	2000/08/08 14:56:52	1.1
+++ KeyContract.java	2000/08/15 23:22:34	1.2
@@ -1,302 +1,302 @@
-/*
- * $Id: KeyContract.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-
-/**
- * Panel that asks for the contract key
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class KeyContract extends WizardPanel 
-                         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;
-
-
-        // 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 contract 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;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In this step you will choose the PGP key that will "+
-                         "sign this contract. If you don't have one yet, then "+
-                         "you should create one with your favourite PGP "+
-                         "implementation. "+
-                         "Make sure it is a DH/DSS or DSA/ElGamal key and "+
-                         "that it is signed by the top-level issuer key. "+
-                         "</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, 5, 5);
-        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;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.EAST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        txtFile = new JTextField("");
-        gridbag.setConstraints(txtFile,c); add(txtFile);
-
-
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 3;      c.gridx     = 1;
-        c.weighty    = 0;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        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(5, 5, 5, 5);
-        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;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.EAST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        txtFile2 = new JTextField("");
-        gridbag.setConstraints(txtFile2,c); add(txtFile2);
-
-
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 5;      c.gridx     = 1;
-        c.weighty    = 0;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        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, 5, 5);
-        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;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In PGPKeys, click with the right mouse button on "+
-                         "key and select the 'Export' option. You will have "+
-                         "to do this two times, once with and once without "+
-                         "the private (secret) part of the key."+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-
-        // Filler, makes sure the whole thing is aligned to the top
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 8;      c.gridx     = 0;
-        c.weighty    = 1;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.CENTER;
-        c.insets     = new Insets(5, 5, 5, 5);
-        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);
-            
-            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);
-            
-            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() != oldFile) {
-            return next();   // load the file
-        } else {
-            return true;
-        }
-    }
-
-    public boolean next() {
-
-        if (!txtFile.getText().equals("")) {
-            try {
-                FileInputStream fis = new FileInputStream(txtFile.getText());
-                DataInputStream dis = new DataInputStream(fis);
-                
-                byte[] contr = new byte[fis.available()];
-                dis.readFully(contr);
-                
-                String s = new String(contr,"ISO8859-1");
-                data.setPublicContractKey(s);
-                
-            } catch (IOException ioe) {
-                String s;
-                if (ioe instanceof FileNotFoundException) {
-                    s = "File not found";
-                } else {
-                    s = ioe.toString();
-                }
-                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
-                                            "Error", JOptionPane.ERROR_MESSAGE);
-                return false;
-            }
-        } else {
-            data.setPublicContractKey("");
-            return false;
-        }
-
-        if (!txtFile2.getText().equals("")) {
-            try {
-                FileInputStream fis = new FileInputStream(txtFile2.getText());
-                DataInputStream dis = new DataInputStream(fis);
-                
-                byte[] contr = new byte[fis.available()];
-                dis.readFully(contr);
-                
-                String s = new String(contr,"ISO8859-1");
-                data.setSecretContractKey(s);
-                
-                return true;
-            } catch (IOException ioe) {
-                String s;
-                if (ioe instanceof FileNotFoundException) {
-                    s = "File not found";
-                } else {
-                    s = ioe.toString();
-                }
-                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
-                                            "Error", JOptionPane.ERROR_MESSAGE);
-                return false;
-            }
-        } else {
-            data.setSecretContractKey("");
-            return false;
-        }
-
-    }
-
-
+/*
+ * $Id: KeyContract.java,v 1.2 2000/08/15 23:22:34 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+
+/**
+ * Panel that asks for the contract key
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class KeyContract extends KeyPanel 
+                         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;
+
+
+        // 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 contract 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;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In this step you will choose the PGP key that will "+
+                         "sign this contract. If you don't have one yet, then "+
+                         "you should create one with your favourite PGP "+
+                         "implementation. "+
+                         "Make sure it is a DH/DSS or DSA/ElGamal key and "+
+                         "that it is signed by the top-level issuer key. "+
+                         "</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, 5, 5);
+        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;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.EAST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        txtFile = new JTextField("");
+        gridbag.setConstraints(txtFile,c); add(txtFile);
+
+
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 3;      c.gridx     = 1;
+        c.weighty    = 0;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        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(5, 5, 5, 5);
+        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;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.EAST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        txtFile2 = new JTextField("");
+        gridbag.setConstraints(txtFile2,c); add(txtFile2);
+
+
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 5;      c.gridx     = 1;
+        c.weighty    = 0;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        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, 5, 5);
+        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;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In PGPKeys, click with the right mouse button on "+
+                         "key and select the 'Export' option. You will have "+
+                         "to do this two times, once with and once without "+
+                         "the private (secret) part of the key."+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+
+        // Filler, makes sure the whole thing is aligned to the top
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 8;      c.gridx     = 0;
+        c.weighty    = 1;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.CENTER;
+        c.insets     = new Insets(5, 5, 5, 5);
+        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);
+            
+            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);
+            
+            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() != oldFile) {
+            return next();   // load the file
+        } else {
+            return true;
+        }
+    }
+
+    public boolean next() {
+
+        if (!txtFile.getText().equals("")) {
+            try {
+                FileInputStream fis = new FileInputStream(txtFile.getText());
+                DataInputStream dis = new DataInputStream(fis);
+                
+                byte[] contr = new byte[fis.available()];
+                dis.readFully(contr);
+                
+                String s = new String(contr,"ISO8859-1");
+                data.setPublicContractKey(s);
+                
+            } catch (IOException ioe) {
+                String s;
+                if (ioe instanceof FileNotFoundException) {
+                    s = "File not found";
+                } else {
+                    s = ioe.toString();
+                }
+                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
+                                            "Error", JOptionPane.ERROR_MESSAGE);
+                return false;
+            }
+        } else {
+            data.setPublicContractKey("");
+            return false;
+        }
+
+        if (!txtFile2.getText().equals("")) {
+            try {
+                FileInputStream fis = new FileInputStream(txtFile2.getText());
+                DataInputStream dis = new DataInputStream(fis);
+                
+                byte[] contr = new byte[fis.available()];
+                dis.readFully(contr);
+                
+                String s = new String(contr,"ISO8859-1");
+                data.setSecretContractKey(s);
+                
+                return true;
+            } catch (IOException ioe) {
+                String s;
+                if (ioe instanceof FileNotFoundException) {
+                    s = "File not found";
+                } else {
+                    s = ioe.toString();
+                }
+                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
+                                            "Error", JOptionPane.ERROR_MESSAGE);
+                return false;
+            }
+        } else {
+            data.setSecretContractKey("");
+            return false;
+        }
+
+    }
+
+
 }



1.2       +183 -183  java/webfunds/client/contracts/wizard/KeyServer.java

Index: KeyServer.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/KeyServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KeyServer.java	2000/08/08 14:56:52	1.1
+++ KeyServer.java	2000/08/15 23:22:34	1.2
@@ -1,184 +1,184 @@
-/*
- * $Id: KeyServer.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-
-/**
- * Panel that asks for the server certification key
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class KeyServer extends WizardPanel 
-                       implements ActionListener {
-
-    JTextField txtFile;
-    String oldFile = "";
-    
-    WizardData data;
-    
-    
-    public KeyServer(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;
-
-
-        // 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 transaction server 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;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In this step you will choose the server's PGP Key. "+
-                         "You should have obtained it from your server "+
-                         "operator. "+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-
-        
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.EAST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        txtFile = new JTextField("");
-        gridbag.setConstraints(txtFile,c); add(txtFile);
-
-
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 1;
-        c.weighty    = 0;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        but = new JButton("Browse"); 
-        but.addActionListener(this);
-        but.setActionCommand("browse");
-        gridbag.setConstraints(but,c); add(but);
-        
-        
-        // Filler, makes sure the whole thing is aligned to the top
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 5;      c.gridx     = 0;
-        c.weighty    = 1;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.CENTER;
-        c.insets     = new Insets(5, 5, 5, 5);
-        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);
-            
-            if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
-              
-                try {
-                    txtFile.setText(fc.getSelectedFile().getCanonicalPath());
-                } catch (IOException ioe) { }
-                            
-            }
-                      
-        }
-      
-    }
-    
-
-    public void enter() {
-        oldFile = txtFile.getText();
-    }
-    
-    public boolean leave() {
-        if (txtFile.getText() != oldFile) {
-            return next();   // load the file
-        } else {
-            return true;
-        }
-    }
-
-    public boolean next() {
-        if (!txtFile.getText().equals("")) {
-            try {
-                FileInputStream fis = new FileInputStream(txtFile.getText());
-                DataInputStream dis = new DataInputStream(fis);
-                
-                byte[] contr = new byte[fis.available()];
-                dis.readFully(contr);
-                
-                String s = new String(contr,"ISO8859-1");
-                data.setServerKey(s);
-                
-                return true;
-            } catch (IOException ioe) {
-                String s;
-                if (ioe instanceof FileNotFoundException) {
-                    s = "File not found";
-                } else {
-                    s = ioe.toString();
-                }
-                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
-                                            "Error", JOptionPane.ERROR_MESSAGE);
-                return false;
-            }
-        } else {
-            data.setUnsignedContract("");
-            return true;
-        }
-    }
-
-
+/*
+ * $Id: KeyServer.java,v 1.2 2000/08/15 23:22:34 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+
+/**
+ * Panel that asks for the server certification key
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class KeyServer extends KeyPanel 
+                       implements ActionListener {
+
+    JTextField txtFile;
+    String oldFile = "";
+    
+    WizardData data;
+    
+    
+    public KeyServer(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;
+
+
+        // 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 transaction server 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;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In this step you will choose the server's PGP Key. "+
+                         "You should have obtained it from your server "+
+                         "operator. "+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+
+        
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.EAST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        txtFile = new JTextField("");
+        gridbag.setConstraints(txtFile,c); add(txtFile);
+
+
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 1;
+        c.weighty    = 0;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        but = new JButton("Browse"); 
+        but.addActionListener(this);
+        but.setActionCommand("browse");
+        gridbag.setConstraints(but,c); add(but);
+        
+        
+        // Filler, makes sure the whole thing is aligned to the top
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 5;      c.gridx     = 0;
+        c.weighty    = 1;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.CENTER;
+        c.insets     = new Insets(5, 5, 5, 5);
+        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);
+            
+            if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
+              
+                try {
+                    txtFile.setText(fc.getSelectedFile().getCanonicalPath());
+                } catch (IOException ioe) { }
+                            
+            }
+                      
+        }
+      
+    }
+    
+
+    public void enter() {
+        oldFile = txtFile.getText();
+    }
+    
+    public boolean leave() {
+        if (txtFile.getText() != oldFile) {
+            return next();   // load the file
+        } else {
+            return true;
+        }
+    }
+
+    public boolean next() {
+        if (!txtFile.getText().equals("")) {
+            try {
+                FileInputStream fis = new FileInputStream(txtFile.getText());
+                DataInputStream dis = new DataInputStream(fis);
+                
+                byte[] contr = new byte[fis.available()];
+                dis.readFully(contr);
+                
+                String s = new String(contr,"ISO8859-1");
+                data.setServerKey(s);
+                
+                return true;
+            } catch (IOException ioe) {
+                String s;
+                if (ioe instanceof FileNotFoundException) {
+                    s = "File not found";
+                } else {
+                    s = ioe.toString();
+                }
+                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
+                                            "Error", JOptionPane.ERROR_MESSAGE);
+                return false;
+            }
+        } else {
+            data.setUnsignedContract("");
+            return true;
+        }
+    }
+
+
 }



1.2       +188 -207  java/webfunds/client/contracts/wizard/KeyTop.java

Index: KeyTop.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/KeyTop.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KeyTop.java	2000/08/08 14:56:52	1.1
+++ KeyTop.java	2000/08/15 23:22:34	1.2
@@ -1,208 +1,189 @@
-/*
- * $Id: KeyTop.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-
-/**
- * Panel that asks for the toplevel certification key
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class KeyTop extends WizardPanel 
-                    implements ActionListener {
-
-    JTextField txtFile;
-    String oldFile = "";
-    
-    WizardData data;
-    
-    
-    public KeyTop(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;
-
-
-        // 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 top-level issuer 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;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In this step you will choose the top-level issuer "+
-                         "PGP key. If you don't have one yet, then you should "+
-                         "create one with your favourite PGP implementation. "+
-                         "Make sure it is a DH/DSS or DSA/ElGamal key."+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-
-        
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.EAST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        txtFile = new JTextField("");
-        gridbag.setConstraints(txtFile,c); add(txtFile);
-
-
-        c.gridheight = 1;      c.gridwidth = 1;
-        c.gridy      = 2;      c.gridx     = 1;
-        c.weighty    = 0;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 5, 5);
-        but = new JButton("Browse"); 
-        but.addActionListener(this);
-        but.setActionCommand("browse");
-        gridbag.setConstraints(but,c); add(but);
-        
-        
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 3;      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("Export instructions for PGP 6.5 on Windows:"); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-        
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 4;      c.gridx     = 0;
-        c.weighty    = 0;      c.weightx   = 1;
-        c.fill       = GridBagConstraints.HORIZONTAL;
-        c.anchor     = GridBagConstraints.WEST;
-        c.insets     = new Insets(5, 5, 15, 5);
-        lab = new JLabel("<html><font size='-1'><b>"+
-                         "In PGPKeys, click with the right mouse button on "+
-                         "key and select the 'Export' option. Be sure NOT to "+
-                         "include the private key. "+
-                         "</b></font></html>"); 
-        gridbag.setConstraints(lab,c); add(lab);
-        
-
-        // Filler, makes sure the whole thing is aligned to the top
-        c.gridheight = 1;      c.gridwidth = 2;
-        c.gridy      = 5;      c.gridx     = 0;
-        c.weighty    = 1;      c.weightx   = 0;
-        c.fill       = GridBagConstraints.NONE;
-        c.anchor     = GridBagConstraints.CENTER;
-        c.insets     = new Insets(5, 5, 5, 5);
-        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);
-            
-            if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
-              
-                try {
-                    txtFile.setText(fc.getSelectedFile().getCanonicalPath());
-                } catch (IOException ioe) { }
-                            
-            }
-                      
-        }
-      
-    }
-    
-
-    public void enter() {
-        oldFile = txtFile.getText();
-    }
-    
-    public boolean leave() {
-        if (txtFile.getText() != oldFile) {
-            return next();   // load the file
-        } else {
-            return true;
-        }
-    }
-
-    public boolean next() {
-        if (!txtFile.getText().equals("")) {
-            try {
-                FileInputStream fis = new FileInputStream(txtFile.getText());
-                DataInputStream dis = new DataInputStream(fis);
-                
-                byte[] contr = new byte[fis.available()];
-                dis.readFully(contr);
-                
-                String s = new String(contr,"ISO8859-1");
-                data.setTopLevelKey(s);
-                
-                return true;
-            } catch (IOException ioe) {
-                String s;
-                if (ioe instanceof FileNotFoundException) {
-                    s = "File not found";
-                } else {
-                    s = ioe.toString();
-                }
-                JOptionPane.showMessageDialog(this, "Error opening file: "+s, 
-                                            "Error", JOptionPane.ERROR_MESSAGE);
-                return false;            }
-        } else {
-            data.setUnsignedContract("");
-            return true;
-        }
-    }
-
-
+/*
+ * $Id: KeyTop.java,v 1.2 2000/08/15 23:22:34 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import java.io.IOException;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+
+/**
+ * Panel that asks for the toplevel certification key
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class KeyTop extends KeyPanel 
+                    implements ActionListener {
+
+    JTextField txtFile;
+    String oldFile = "";
+    
+    WizardData data;
+    
+    
+    public KeyTop(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;
+
+
+        // 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 top-level issuer 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;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In this step you will choose the top-level issuer "+
+                         "PGP key. If you don't have one yet, then you should "+
+                         "create one with your favourite PGP implementation. "+
+                         "Make sure it is a DH/DSS or DSA/ElGamal key."+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+
+        
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.EAST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        txtFile = new JTextField("");
+        gridbag.setConstraints(txtFile,c); add(txtFile);
+
+
+        c.gridheight = 1;      c.gridwidth = 1;
+        c.gridy      = 2;      c.gridx     = 1;
+        c.weighty    = 0;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 5, 5);
+        but = new JButton("Browse"); 
+        but.addActionListener(this);
+        but.setActionCommand("browse");
+        gridbag.setConstraints(but,c); add(but);
+        
+        
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 3;      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("Export instructions for PGP 6.5 on Windows:"); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+        
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 4;      c.gridx     = 0;
+        c.weighty    = 0;      c.weightx   = 1;
+        c.fill       = GridBagConstraints.HORIZONTAL;
+        c.anchor     = GridBagConstraints.WEST;
+        c.insets     = new Insets(5, 5, 15, 5);
+        lab = new JLabel("<html><font size='-1'><b>"+
+                         "In PGPKeys, click with the right mouse button on "+
+                         "key and select the 'Export' option. Be sure NOT to "+
+                         "include the private key. "+
+                         "</b></font></html>"); 
+        gridbag.setConstraints(lab,c); add(lab);
+        
+
+        // Filler, makes sure the whole thing is aligned to the top
+        c.gridheight = 1;      c.gridwidth = 2;
+        c.gridy      = 5;      c.gridx     = 0;
+        c.weighty    = 1;      c.weightx   = 0;
+        c.fill       = GridBagConstraints.NONE;
+        c.anchor     = GridBagConstraints.CENTER;
+        c.insets     = new Insets(5, 5, 5, 5);
+        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);
+            
+            if (fc.showOpenDialog(this) == fc.APPROVE_OPTION) {
+              
+                try {
+                    txtFile.setText(fc.getSelectedFile().getCanonicalPath());
+                } catch (IOException ioe) { }
+                            
+            }
+                      
+        }
+      
+    }
+    
+
+    public void enter() {
+        oldFile = txtFile.getText();
+    }
+    
+    public boolean leave() {
+        if (txtFile.getText() != oldFile) {
+            return next();   // load the file
+        } else {
+            return true;
+        }
+    }
+
+    public boolean next() {
+        
+        String key = loadAndCheckKey(txtFile.getText());
+
+        if (key != null) {
+            data.setTopLevelKey(key);
+            return true;
+        } else {
+            return false;
+        }
+
+    }
+
+
 }



1.3       +18 -8     java/webfunds/client/contracts/wizard/Wizard.java

Index: Wizard.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/Wizard.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Wizard.java	2000/08/14 21:59:02	1.2
+++ Wizard.java	2000/08/15 23:22:34	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id: Wizard.java,v 1.2 2000/08/14 21:59:02 iang Exp $
+ * $Id: Wizard.java,v 1.3 2000/08/15 23:22:34 edwin Exp $
  *
  * Copyright (c) Systemics Inc 2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -20,7 +20,7 @@
  * Main class for the wizard
  *
  * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
  */
 
 public class Wizard extends JPanel 
@@ -330,23 +330,33 @@
                 TreePath[] ps = {path};
                 int[] rows = mapper.getRowsForPaths(ps);
 
+                boolean succeed = true;
                 if (!data.getInvalid(rows[0])) {
-                    super.setSelectionPaths(ps);
+                    int wizardPrevPrevAct = wizardPrevAct;
                     wizardPrevAct = wizardActive;
                     wizardActive = rows[0];
                     if (wizardPrevAct != -1) {
-                        wizardPanels[wizardPrevAct].setVisible(false);
                         if (usedNext) {
-                            wizardPanels[wizardPrevAct].next();
+                            succeed = wizardPanels[wizardPrevAct].next();
                             usedNext = false;
                         } else {
                             wizardPanels[wizardPrevAct].leave();
                         }
                     }
-                    wizardPanels[wizardActive].setVisible(true);
-                    wizardPanels[wizardActive].enter();
-                }
 
+                    if (! succeed) {
+                        wizardActive = wizardPrevAct;
+                        wizardPrevAct = wizardPrevPrevAct;
+                    } else {
+                        super.setSelectionPaths(ps);
+                        if (wizardPrevAct != -1) {
+                            wizardPanels[wizardPrevAct].setVisible(false);
+                        }
+                        wizardPanels[wizardActive].setVisible(true);
+                        wizardPanels[wizardActive].enter();
+                    }
+                }
+                
             }
             
         }



1.2       +56 -56    java/webfunds/client/contracts/wizard/WizardData.java

Index: WizardData.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/wizard/WizardData.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WizardData.java	2000/08/08 14:56:52	1.1
+++ WizardData.java	2000/08/15 23:22:35	1.2
@@ -1,57 +1,57 @@
-/*
- * $Id: WizardData.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-/**
- * Contains most of data for the wizard.
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-public class WizardData {
-
- 
-    private String unsignedContract  = "";
-    private String toplevelKey       = "";
-    private String publiccontractKey = "";
-    private String secretcontractKey = "";
-    private String serverKey         = "";
-    private String signedContract    = "";
-    
-    
-    public String getUnsignedContract  () { return unsignedContract;  }
-    public String getTopLevelKey       () { return toplevelKey;       }
-    public String getPublicContractKey () { return publiccontractKey; }
-    public String getSecretContractKey () { return secretcontractKey; }
-    public String getServerKey         () { return serverKey;         }
-    public String getSignedContract    () { return signedContract;    }
-
-    public void setUnsignedContract  (String x) { unsignedContract  = x; }
-    public void setTopLevelKey       (String x) { toplevelKey       = x; }
-    public void setPublicContractKey (String x) { publiccontractKey = x; }
-    public void setSecretContractKey (String x) { secretcontractKey = x; }
-    public void setServerKey         (String x) { serverKey         = x; }
-    public void setSignedContract    (String x) { signedContract    = x; }
-
-
-    private boolean[] invalid   = { false, false, false,
-                                    false, false, false, false, 
-                                    false, false, false };
-    private boolean[] completed = { false, false, false,
-                                    false, false, false, false,
-                                    false, false, false };
-                            
-    public void setInvalid  (int row, boolean value) { invalid  [row] = value; }
-    public void setCompleted(int row, boolean value) { completed[row] = value; }
-
-    public boolean getInvalid   (int row) { return invalid  [row]; }
-    public boolean getCompleted (int row) { return completed[row]; }
-
+/*
+ * $Id: WizardData.java,v 1.2 2000/08/15 23:22:35 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+/**
+ * Contains most of data for the wizard.
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+public class WizardData {
+
+ 
+    private String unsignedContract  = "";
+    private String toplevelKey       = "";
+    private String publiccontractKey = "";
+    private String secretcontractKey = "";
+    private String serverKey         = "";
+    private String signedContract    = "";
+    
+    
+    public String getUnsignedContract  () { return unsignedContract;  }
+    public String getTopLevelKey       () { return toplevelKey;       }
+    public String getPublicContractKey () { return publiccontractKey; }
+    public String getSecretContractKey () { return secretcontractKey; }
+    public String getServerKey         () { return serverKey;         }
+    public String getSignedContract    () { return signedContract;    }
+
+    public void setUnsignedContract  (String x) { unsignedContract  = x; }
+    public void setTopLevelKey       (String x) { toplevelKey       = x; }
+    public void setPublicContractKey (String x) { publiccontractKey = x; }
+    public void setSecretContractKey (String x) { secretcontractKey = x; }
+    public void setServerKey         (String x) { serverKey         = x; }
+    public void setSignedContract    (String x) { signedContract    = x; }
+
+
+    private boolean[] invalid   = { false, false, false,
+                                    false, false, false, false, 
+                                    false, false, false };
+    private boolean[] completed = { false, false, false,
+                                    false, false, false, false,
+                                    false, false, false };
+                            
+    public void setInvalid  (int row, boolean value) { invalid  [row] = value; }
+    public void setCompleted(int row, boolean value) { completed[row] = value; }
+
+    public boolean getInvalid   (int row) { return invalid  [row]; }
+    public boolean getCompleted (int row) { return completed[row]; }
+
 }



1.2       +59 -43    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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WizardPanel.java	2000/08/08 14:56:52	1.1
+++ WizardPanel.java	2000/08/15 23:22:35	1.2
@@ -1,44 +1,60 @@
-/*
- * $Id: WizardPanel.java,v 1.1 2000/08/08 14:56:52 edwin Exp $
- *
- * Copyright (c) Systemics Inc 2000 on behalf of
- * the WebFunds Development Team.  All Rights Reserved.
- */
-
-package webfunds.client.contracts.wizard;
-
-
-import javax.swing.*;
-
-
-/**
- * Abstract superclass for all panels in a wizard.
- *
- * @author Edwin Woudt <edwin@webfunds.org>
- * @version $Revision: 1.1 $
- */
-
-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.
-     */
-    public abstract boolean next();
-
-   
+/*
+ * $Id: WizardPanel.java,v 1.2 2000/08/15 23:22:35 edwin Exp $
+ *
+ * Copyright (c) Systemics Inc 2000 on behalf of
+ * the WebFunds Development Team.  All Rights Reserved.
+ */
+
+package webfunds.client.contracts.wizard;
+
+
+import javax.swing.*;
+
+
+/**
+ * Abstract superclass for all panels in a wizard.
+ *
+ * @author Edwin Woudt <edwin@webfunds.org>
+ * @version $Revision: 1.2 $
+ */
+
+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.
+     */
+    public abstract boolean next();
+
+    /**
+     * Convenience method that displays an error message and prints the
+     * exception on the console.
+     *
+     * @param message a descriptive message that will be displayed in the popup
+     *        box.
+     * @param e the exception corresponding to this error, will be displayed
+     *        on the console. If no exception is available, then a 'null' can
+     *        be provided.
+     */
+    protected void error(String message, Exception e) {
+        System.out.println("ERROR: "+message);
+        if (e != null) { e.printStackTrace(); }
+        JOptionPane.showMessageDialog(this, message, "Error", 
+                                      JOptionPane.ERROR_MESSAGE);
+    }
+   
 }



1.1                  java/webfunds/client/contracts/wizard/KeyPanel.java

Index: KeyPanel.java
===================================================================
/*
 * $Id: KeyPanel.java,v 1.1 2000/08/15 23:22:34 edwin Exp $
 *
 * Copyright (c) Systemics Inc 2000 on behalf of
 * the WebFunds Development Team.  All Rights Reserved.
 */

package webfunds.client.contracts.wizard;


import cryptix.openpgp.PGPException;
import cryptix.openpgp.PGPKeyFactory;
import cryptix.openpgp.PGPSecretKey;

import cryptix.openpgp.util.PGPArmoury;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.util.Vector;


/**
 * Abstract superclass for all panels in a wizard.
 *
 * @author Edwin Woudt <edwin@webfunds.org>
 * @version $Revision: 1.1 $
 */

public abstract class KeyPanel extends WizardPanel {
  
    protected String loadAndCheckKey(String filename) {
        
        if (!filename.equals("")) {
            
            // read file
            String key;
            try {
                FileInputStream fis = new FileInputStream(filename);
                DataInputStream dis = new DataInputStream(fis);
                
                byte[] contr = new byte[fis.available()];
                dis.readFully(contr);
                
                key = new String(contr,"ISO8859-1");
            } catch (IOException ioe) {
                String s;
                if (ioe instanceof FileNotFoundException) {
                    s = "File not found";
                } else {
                    s = ioe.toString();
                }
                error("Error opening file: "+s, ioe);
                return null;
            }
            
            // check key
            PGPArmoury akey;
            try {
                akey = new PGPArmoury(key);
            } catch (IllegalArgumentException iae) {
                error("Invalid key, not armoured?",iae);
                return null;
            }
        
            // get the unarmoured secret key
            PGPKeyFactory factory = new PGPKeyFactory();
            try {
                Vector keys = factory.decodeKeys(akey.getPayload());
                if (keys.size() > 1) {
                    error("More than one key found in input file", null);
                    return null;
                } else if (keys.size() < 1) {
                    error("No key found in input file", null);         
                    return null;
                } else if (keys.elementAt(0) instanceof PGPSecretKey) {
                    error("Secret key found, public key expected", null);
                    return null;
                }
            } catch (PGPException pe) {
                error("Error parsing input file, "+pe, pe);
                return null;
            }
                
            // everything ok
            return key;

        } else {
            error("Please specify a key", null);
            return null;
        }
    }
     
}