Author: jflesch
Date: 2008-02-17 20:54:35 +0000 (Sun, 17 Feb 2008)
New Revision: 18026

Added:
   trunk/apps/Thaw/src/thaw/plugins/WebOfTrustViewer.java
Log:
Forgot a file ....

Added: trunk/apps/Thaw/src/thaw/plugins/WebOfTrustViewer.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/WebOfTrustViewer.java                      
        (rev 0)
+++ trunk/apps/Thaw/src/thaw/plugins/WebOfTrustViewer.java      2008-02-17 
20:54:35 UTC (rev 18026)
@@ -0,0 +1,93 @@
+package thaw.plugins;
+
+import javax.swing.ImageIcon;
+
+import thaw.core.Core;
+import thaw.core.I18n;
+import thaw.core.Logger;
+import thaw.core.Plugin;
+
+import thaw.plugins.webOfTrust.*;
+
+public class WebOfTrustViewer implements Plugin {
+       private Core core;
+       private Hsqldb db;
+       private WebOfTrust wot;
+
+       private WebOfTrustTab wotTab;
+       
+       public WebOfTrustViewer() {
+               
+       }
+
+       public ImageIcon getIcon() {
+               return thaw.gui.IconBox.trust;
+       }
+
+       public String getNameForUser() {
+               return I18n.getMessage("thaw.plugin.wot.viewer");
+       }
+
+       public boolean run(Core core) {
+               this.core = core;
+
+               /* Hsqldb */
+               if(core.getPluginManager().getPlugin("thaw.plugins.Hsqldb") == 
null) {
+                       Logger.info(this, "Loading Hsqldb plugin");
+
+                       
if(core.getPluginManager().loadPlugin("thaw.plugins.Hsqldb") == null
+                          || 
!core.getPluginManager().runPlugin("thaw.plugins.Hsqldb")) {
+                               Logger.error(this, "Unable to load 
thaw.plugins.Hsqldb !");
+                               return false;
+                       }
+               }
+
+               db = 
(Hsqldb)core.getPluginManager().getPlugin("thaw.plugins.Hsqldb");
+               db.registerChild(this);
+               
+               /* wot */
+               if(core.getPluginManager().getPlugin("thaw.plugins.WebOfTrust") 
== null) {
+                       Logger.info(this, "Loading WoT plugin");
+
+                       
if(core.getPluginManager().loadPlugin("thaw.plugins.WebOfTrust") == null
+                          || 
!core.getPluginManager().runPlugin("thaw.plugins.WebOfTrust")) {
+                               Logger.error(this, "Unable to load 
thaw.plugins.WebOfTrust !");
+                               return false;
+                       }
+               }
+
+               wot = 
(WebOfTrust)core.getPluginManager().getPlugin("thaw.plugins.WebOfTrust");
+               wot.registerChild(this);
+               
+               /* GUI */
+               
+               if (core.getConfig().getValue("wotActivated") == null
+                               || 
Boolean.valueOf(core.getConfig().getValue("wotActivated")).booleanValue()) {
+                       
+                               wotTab = new WebOfTrustTab(db, 
core.getConfig());
+
+                               
core.getMainWindow().addTab(I18n.getMessage("thaw.plugin.wot"),
+                                                           
thaw.gui.IconBox.trust,
+                                                           wotTab.getPanel());
+
+                               core.getMainWindow().getMainFrame().validate();
+
+                               wotTab.loadState();
+               }
+               
+               return true;
+       }
+
+       public void stop() {
+               if (wotTab != null) {
+                       core.getMainWindow().removeTab(wotTab.getPanel());
+                       wotTab = null;
+               }
+               
+               if (wot != null)
+                       wot.unregisterChild(this);
+               if (db != null)
+                       db.unregisterChild(this);
+               }
+
+}


Reply via email to