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;
private static final Logger logger = Logger.getLogger(Main.class.getName());
/** The version. */
- private static final Version VERSION = new Version(0, 10);
+ private static final Version VERSION = new Version(0, 11, 1);
/** The configuration. */
private Configuration configuration;
/** The update checker. */
private final UpdateChecker updateChecker;
+ /** The web of trust interface. */
+ private final WebOfTrustInterface webOfTrustInterface;
+
/** The jSite icon. */
private Icon jSiteIcon;
}
/** The supported locales. */
- private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH };
+ private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH, new Locale("pl") };
/** The actions that switch the language. */
private Map<Locale, Action> languageActions = new HashMap<Locale, Action>();
updateChecker.addUpdateListener(this);
updateChecker.start();
+ webOfTrustInterface = new WebOfTrustInterface(freenetInterface);
+ webOfTrustInterface.start();
+
initPages();
showPage(PageType.PAGE_PROJECTS);
}
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);
}
manageNodeAction = new AbstractAction(I18n.getMessage("jsite.menu.nodes.manage-nodes")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
showPage(PageType.PAGE_NODE_MANAGER);
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
optionsPreferences();
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
showLatestUpdate();
};
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);
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
projectPage.setName("page.project");
projectPage.setProjects(configuration.getProjects());
projectPage.setFreenetInterface(freenetInterface);
+ projectPage.setWebOfTrustInterface(webOfTrustInterface);
projectPage.addListSelectionListener(this);
pages.put(PageType.PAGE_PROJECTS, projectPage);
* @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;
}
}
+ /**
+ * Quits jSite, stopping all background services.
+ */
+ private void quit() {
+ updateChecker.stop();
+ webOfTrustInterface.stop();
+ System.exit(0);
+ }
+
//
// INTERFACE ListSelectionListener
//
/**
* {@inheritDoc}
*/
+ @Override
public void valueChanged(ListSelectionEvent e) {
JList list = (JList) e.getSource();
int selectedRow = list.getSelectedIndex();
/**
* {@inheritDoc}
*/
+ @Override
public void wizardNextPressed(TWizard wizard) {
String pageName = wizard.getPage().getName();
if ("page.node-manager".equals(pageName)) {
/**
* {@inheritDoc}
*/
+ @Override
public void wizardPreviousPressed(TWizard wizard) {
String pageName = wizard.getPage().getName();
if ("page.project".equals(pageName) || "page.preferences".equals(pageName)) {
/**
* {@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"));
int overwriteConfigurationAnswer = JOptionPane.showConfirmDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.quit.overwrite-configuration"), configuration.getConfigurationLocator().getFile(configuration.getConfigurationDirectory())), I18n.getMessage("jsite.quit.overwrite-configuration.title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (overwriteConfigurationAnswer == JOptionPane.YES_OPTION) {
if (saveConfiguration()) {
- System.exit(0);
+ quit();
}
} else if (overwriteConfigurationAnswer == JOptionPane.CANCEL_OPTION) {
return;
}
if (overwriteConfigurationAnswer == JOptionPane.NO_OPTION) {
- System.exit(0);
+ quit();
}
} else {
if (saveConfiguration()) {
- System.exit(0);
+ quit();
}
}
if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.config-not-saved"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
- System.exit(0);
+ quit();
}
}
}
/**
* {@inheritDoc}
*/
+ @Override
public void nodesUpdated(Node[] nodes) {
nodeMenu.removeAll();
ButtonGroup nodeButtonGroup = new ButtonGroup();
/**
* {@inheritDoc}
*/
+ @Override
public void nodeSelected(Node node) {
for (Component menuItem : nodeMenu.getMenuComponents()) {
if (menuItem instanceof JMenuItem) {
/**
* {@inheritDoc}
*/
+ @Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source instanceof JRadioButtonMenuItem) {
/**
* {@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) {