[Webfunds-commits] java/webfunds/client/contracts ContractBrowser.java ContractChooser.java

Ian Grigg iang@cypherpunks.ai
Fri, 13 Apr 2001 13:38:57 -0400 (AST)


iang        01/04/13 13:38:57

  Modified:    webfunds/client/contracts ContractBrowser.java
                        ContractChooser.java
  Log:
  1. Fixed ContractBrowser to display fill contract with Sig! and
  also to show duff contracts in RED.  (ContractChooser does former.)
  2. Uses Log throughout.

Revision  Changes    Path
1.4       +39 -11    java/webfunds/client/contracts/ContractBrowser.java

Index: ContractBrowser.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/ContractBrowser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContractBrowser.java	2001/03/17 22:09:58	1.3
+++ ContractBrowser.java	2001/04/13 17:38:57	1.4
@@ -1,5 +1,5 @@
 /*
- * $Id: ContractBrowser.java,v 1.3 2001/03/17 22:09:58 iang Exp $
+ * $Id: ContractBrowser.java,v 1.4 2001/04/13 17:38:57 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -386,25 +386,53 @@
 
     private void showContract(Contract contract)
     {
-        if (contract == null)
+        if (contract == null)    // this should not happen
         {
-            ui.errorMessage("Couldn't open contract");
+            ui.errorMessage("Could not open contract");
+            text.setText("");
             return;
         }
 
+        text.setBackground(Color.white);
+
+        try {
+            text.setText(contract.getContentsWithSignature());
+        }
+        catch (IOException e)   
+        {
+            e.printStackTrace();
+            ui.errorMessage("Error in contract contents?");
+            return ;
+        }
+
+        boolean good = false;
         try
         {
-            text.setText(contract.getContents());
-            textscroll.getViewport().setViewPosition( new Point(1,1) );
-            if (contract.verifyContract())
-                ui.infoMessage("This contract is signed properly");
-            else
-                ui.errorMessage("This contract is NOT signed properly");
+            good = contract.verifyContract();
         }
-        catch(Exception e)
+        catch (ContractException e)
         {
             e.printStackTrace();
-            ui.errorMessage("Error while opening contract");
+            text.setBackground(Color.red);
+            ui.errorMessage("Error while Verifying contract !?!");
+            return ;
+        }
+
+        String proper   = " contract is signed by the following (chain of) keys:\n\n";
+        String failed   = " contract is NOT signed properly:\n\n";
+        String partials = "\n\nShows partial chain only!";
+
+        String sigType = contract.getSignatureTypeString();
+
+        String chain = contract.getChainOfSignatures();
+        textscroll.getViewport().setViewPosition( new Point(1,1) );
+
+        if (good)
+            ui.infoMessage("This " + sigType + proper + chain);
+        else
+        {
+            text.setBackground(Color.red);
+            ui.errorMessage("This " + sigType + failed + chain + partials);
         }
     }
 



1.2       +1 -1      java/webfunds/client/contracts/ContractChooser.java

Index: ContractChooser.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/contracts/ContractChooser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContractChooser.java	2000/03/29 03:48:23	1.1
+++ ContractChooser.java	2001/04/13 17:38:57	1.2
@@ -96,7 +96,7 @@
                         if(sel==null) // no contract selected
                             txt = "<No contract selected>";
                         else
-                            txt = sel.getContents();
+                            txt = sel.getContentsWithSignature();
 
                         contractText.setText(txt);
                     }