Author: jflesch
Date: 2007-06-02 15:06:52 +0000 (Sat, 02 Jun 2007)
New Revision: 13464

Modified:
   trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java
   trunk/apps/Thaw/src/thaw/gui/Table.java
   trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
Log:
Thaw can now display in red the keys (CHK@) in the indexes who are/will become 
obsolete

Modified: trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java  2007-06-02 12:50:14 UTC 
(rev 13463)
+++ trunk/apps/Thaw/src/thaw/fcp/FreenetURIHelper.java  2007-06-02 15:06:52 UTC 
(rev 13464)
@@ -335,5 +335,29 @@

                return false;
        }
+
+
+
+       public static boolean isObsolete(String key) {
+
+               if (key.startsWith("KSK"))
+                       return false;
+
+               if (key.startsWith("SSK") || key.startsWith("USK")) {
+                       if (key.indexOf("AQABAAE") > 0)
+                               return true;
+
+                       return false;
+               }
+
+               if (key.startsWith("CHK")) {
+                       if (key.indexOf(",AAE") > 0)
+                               return true;
+
+                       return false;
+               }
+
+               return true;
+       }
 }


Modified: trunk/apps/Thaw/src/thaw/gui/Table.java
===================================================================
--- trunk/apps/Thaw/src/thaw/gui/Table.java     2007-06-02 12:50:14 UTC (rev 
13463)
+++ trunk/apps/Thaw/src/thaw/gui/Table.java     2007-06-02 15:06:52 UTC (rev 
13464)
@@ -23,6 +23,7 @@
 import thaw.core.Config;
 import thaw.core.I18n;

+import thaw.fcp.FreenetURIHelper;
 import thaw.fcp.FCPTransferQuery;
 import thaw.fcp.FCPClientPut;
 import thaw.fcp.FCPClientGet;
@@ -42,7 +43,9 @@
        private boolean hasChanged = false;
        private Thread savingThread;

+       private int columnWithKeys = -1;

+
        public Table(Config config, String prefix) {
                super();
                setDefaultRenderer();
@@ -99,7 +102,11 @@
                setAsListener();
        }

+       public void specifyColumnWithKeys(int c) {
+               columnWithKeys = c;
+       }

+
        public void setDefaultRenderer() {
                setDefaultRenderer(getColumnClass(0), new DefaultRenderer());
        }
@@ -217,6 +224,16 @@
                                else
                                        cell.setBackground(softGray);
                        }
+
+                       cell.setForeground(Color.BLACK);
+
+
+                       if (column == columnWithKeys && value instanceof 
String) {
+                               String key = (String)value;
+                               if (FreenetURIHelper.isObsolete(key))
+                                       cell.setForeground(Color.RED);
+                       }
+
                        return cell;
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java       2007-06-02 
12:50:14 UTC (rev 13463)
+++ trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java       2007-06-02 
15:06:52 UTC (rev 13464)
@@ -44,7 +44,7 @@

        private final JPanel panel;

-       private final JTable table;
+       private final Table table;
        private FileListModel fileListModel;

        private FileList fileList;
@@ -90,7 +90,7 @@
                //table = new JTable(fileListModel);
                table.setShowGrid(false);
                table.setIntercellSpacing(new java.awt.Dimension(0, 0));
-
+               table.specifyColumnWithKeys(2);
                table.addMouseListener(this);

                final JTableHeader header = table.getTableHeader();

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-06-02 12:50:14 UTC 
(rev 13463)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-06-02 15:06:52 UTC 
(rev 13464)
@@ -402,7 +402,7 @@


        public boolean isObsolete() {
-               return (getPublicKey().indexOf("AQABAAE") > 0);
+               return FreenetURIHelper.isObsolete(getPublicKey());
        }

        public int getRevision() {


Reply via email to