Add WoT interface to main class.
[jSite.git] / src / main / java / de / todesbaum / jsite / main / Main.java
index 38a0f1c..1c6e8de 100644 (file)
@@ -55,6 +55,7 @@ import de.todesbaum.jsite.application.ProjectInserter.CheckReport;
 import de.todesbaum.jsite.application.ProjectInserter.Issue;
 import de.todesbaum.jsite.application.UpdateChecker;
 import de.todesbaum.jsite.application.UpdateListener;
+import de.todesbaum.jsite.application.WebOfTrustInterface;
 import de.todesbaum.jsite.gui.NodeManagerListener;
 import de.todesbaum.jsite.gui.NodeManagerPage;
 import de.todesbaum.jsite.gui.PreferencesPage;
@@ -90,6 +91,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /** The update checker. */
        private final UpdateChecker updateChecker;
 
+       /** The web of trust interface. */
+       private final WebOfTrustInterface webOfTrustInterface;
+
        /** The jSite icon. */
        private Icon jSiteIcon;
 
@@ -190,6 +194,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                updateChecker.addUpdateListener(this);
                updateChecker.start();
 
+               webOfTrustInterface = new WebOfTrustInterface(freenetInterface);
+               webOfTrustInterface.start();
+
                initPages();
                showPage(PageType.PAGE_PROJECTS);
        }
@@ -201,6 +208,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                for (final Locale locale : SUPPORTED_LOCALES) {
                        languageActions.put(locale, new AbstractAction(I18n.getMessage("jsite.menu.language." + locale.getLanguage()), IconLoader.loadIcon("/flag-" + locale.getLanguage() + ".png")) {
 
+                               @Override
                                @SuppressWarnings("synthetic-access")
                                public void actionPerformed(ActionEvent actionEvent) {
                                        switchLanguage(locale);
@@ -209,6 +217,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                }
                manageNodeAction = new AbstractAction(I18n.getMessage("jsite.menu.nodes.manage-nodes")) {
 
+                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
                                showPage(PageType.PAGE_NODE_MANAGER);
@@ -222,6 +231,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        /**
                         * {@inheritDoc}
                         */
+                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
                                optionsPreferences();
@@ -232,6 +242,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        /**
                         * {@inheritDoc}
                         */
+                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
                                showLatestUpdate();
@@ -239,6 +250,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                };
                aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) {
 
+                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent e) {
                                JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), getVersion().toString()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
@@ -247,6 +259,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
 
                I18nContainer.getInstance().registerRunnable(new Runnable() {
 
+                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void run() {
                                manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
@@ -298,6 +311,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
 
                I18nContainer.getInstance().registerRunnable(new Runnable() {
 
+                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void run() {
                                languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
@@ -399,7 +413,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
         * @return The supported locale that was found, or the default locale if no
         *         supported locale could be found
         */
-       private Locale findSupportedLocale(Locale forLocale) {
+       private static Locale findSupportedLocale(Locale forLocale) {
                for (Locale locale : SUPPORTED_LOCALES) {
                        if (locale.equals(forLocale)) {
                                return locale;
@@ -493,6 +507,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void valueChanged(ListSelectionEvent e) {
                JList list = (JList) e.getSource();
                int selectedRow = list.getSelectedIndex();
@@ -506,6 +521,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void wizardNextPressed(TWizard wizard) {
                String pageName = wizard.getPage().getName();
                if ("page.node-manager".equals(pageName)) {
@@ -585,6 +601,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void wizardPreviousPressed(TWizard wizard) {
                String pageName = wizard.getPage().getName();
                if ("page.project".equals(pageName) || "page.preferences".equals(pageName)) {
@@ -600,6 +617,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void wizardQuitPressed(TWizard wizard) {
                if (((ProjectPage) pages.get(PageType.PAGE_PROJECTS)).wasUriCopied() || ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).wasUriCopied()) {
                        JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.use-clipboard-now"));
@@ -635,6 +653,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void nodesUpdated(Node[] nodes) {
                nodeMenu.removeAll();
                ButtonGroup nodeButtonGroup = new ButtonGroup();
@@ -659,6 +678,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void nodeSelected(Node node) {
                for (Component menuItem : nodeMenu.getMenuComponents()) {
                        if (menuItem instanceof JMenuItem) {
@@ -678,6 +698,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void actionPerformed(ActionEvent e) {
                Object source = e.getSource();
                if (source instanceof JRadioButtonMenuItem) {
@@ -695,6 +716,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /**
         * {@inheritDoc}
         */
+       @Override
        public void foundUpdateData(Version foundVersion, long versionTimestamp) {
                logger.log(Level.FINEST, "Found version {0} from {1,date}.", new Object[] { foundVersion, versionTimestamp });
                if (foundVersion.compareTo(VERSION) > 0) {