X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FSwingInterface.java;h=0801a5165093243c37c18c368b4c6b420759885c;hb=e1e349bae97feb779fc692eb03c2fea0e0e612c9;hp=be9b22d48eb27f5fe917bd83be01859bbe21e98c;hpb=6343df567ec832112927bfd218afe6fa98fa89a6;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/SwingInterface.java b/src/net/pterodactylus/jsite/gui/SwingInterface.java index be9b22d..0801a51 100644 --- a/src/net/pterodactylus/jsite/gui/SwingInterface.java +++ b/src/net/pterodactylus/jsite/gui/SwingInterface.java @@ -49,9 +49,9 @@ import net.pterodactylus.jsite.core.Core; import net.pterodactylus.jsite.core.CoreListener; import net.pterodactylus.jsite.core.JSiteException; import net.pterodactylus.jsite.core.Node; +import net.pterodactylus.jsite.core.project.Project; import net.pterodactylus.jsite.i18n.I18n; import net.pterodactylus.jsite.i18n.gui.I18nAction; -import net.pterodactylus.jsite.project.Project; import net.pterodactylus.util.image.IconLoader; import net.pterodactylus.util.io.Closer; import net.pterodactylus.util.logging.Logging; @@ -59,7 +59,7 @@ import net.pterodactylus.util.logging.LoggingListener; /** * The Swing user interface. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public class SwingInterface implements CoreListener, LoggingListener, PropertyChangeListener { @@ -169,7 +169,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Creates a new swing interface. - * + * * @param core * The core to operate on * @param configDirectory @@ -219,7 +219,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the core that is controlled by the Swing interface. - * + * * @return The core */ Core getCore() { @@ -228,7 +228,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the main window of the Swing interface. - * + * * @return The main window */ MainWindow getMainWindow() { @@ -237,7 +237,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns whether the advanced mode is activated. - * + * * @return true if the advanced mode is activated, * false if the simple mode is activated */ @@ -247,7 +247,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “configure” action. - * + * * @return The “configure” action */ I18nAction getConfigureAction() { @@ -256,7 +256,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “import config” action. - * + * * @return The “import config” action */ I18nAction getImportConfigAction() { @@ -265,7 +265,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “quit” action. - * + * * @return The “quit” action */ I18nAction getQuitAction() { @@ -274,7 +274,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “add node” action. - * + * * @return The “add node” action */ I18nAction getAddNodeAction() { @@ -283,7 +283,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “connect to node” action for the given node. - * + * * @param node * The node go get the “connect” action for * @return The “connect to node” action @@ -294,7 +294,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “disconnect from node” action for the given node. - * + * * @param node * The node go get the “disconnect” action for * @return The “disconnect from node” action @@ -305,7 +305,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “edit node” action for the given node. - * + * * @param node * The node to edit * @return The “edit node” action @@ -316,7 +316,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “delete node” action for the given node. - * + * * @param node * The node to delete * @return The “delete node” action @@ -327,7 +327,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns all language actions. - * + * * @return All language actions */ List getLanguageActions() { @@ -336,7 +336,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “about” action. - * + * * @return The “about” action */ I18nAction getHelpAboutAction() { @@ -345,7 +345,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “add project” action. - * + * * @return The “add project” action */ I18nAction getAddProjectAction() { @@ -354,7 +354,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “clone project” action for the given project. - * + * * @param project * The project to get the “clone project” action for * @return The “clone project” action @@ -365,7 +365,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the “delete project” action for the given project. - * + * * @param project * The project to get the “delete project” action for * @return The “delete project” action @@ -376,7 +376,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns all currently configured nodes. - * + * * @return All configured nodes */ List getNodes() { @@ -385,7 +385,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns a list of all projects. - * + * * @return All projects */ List getProjects() { @@ -394,7 +394,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Returns the thread pool used for off-thread processes. - * + * * @return The thread pool */ Executor getThreadPool() { @@ -547,7 +547,8 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh }; List availableLanguages = I18n.findAvailableLanguages(); for (final Locale locale: availableLanguages) { - I18nAction languageAction = new I18nAction("general.language." + locale.getLanguage()) { + String language = locale.getLanguage(); + I18nAction languageAction = new I18nAction("general.language." + language, IconLoader.loadIcon("/flag-" + language + ".png")) { @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent e) { @@ -555,7 +556,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh } }; - if (I18n.getLocale().getLanguage().equals(locale.getLanguage())) { + if (I18n.getLocale().getLanguage().equals(language)) { languageAction.setEnabled(false); } languageActions.add(languageAction); @@ -673,7 +674,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Edits the given node. - * + * * @param node * The node to edit */ @@ -691,7 +692,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Deletes the given node. - * + * * @param node * The node to delete */ @@ -704,7 +705,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Connects to the node. - * + * * @param node * The node to connect to */ @@ -724,7 +725,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Disconnects from the node. - * + * * @param node * The node to disconnect from */ @@ -736,7 +737,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Changes the language of the interface. This method also disables the * action for the newly set language and enables all others. - * + * * @param newLocale * The new language * @param languageAction @@ -762,9 +763,8 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh private void addProject() { try { core.createProject(); - } catch (JSiteException nne1) { - /* TODO - add i18n */ - JOptionPane.showMessageDialog(mainWindow, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE); + } catch (JSiteException jse1) { + JOptionPane.showMessageDialog(mainWindow, I18n.get("mainWindow.error.notConnected.message"), I18n.get("mainWindow.error.notConnected.title"), JOptionPane.ERROR_MESSAGE); } catch (IOException e) { /* TODO - add i18n */ JOptionPane.showMessageDialog(mainWindow, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE); @@ -773,7 +773,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Clones a project. - * + * * @param project * The project to clone */ @@ -783,7 +783,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh /** * Deletes a project. - * + * * @param project * The project to delete */ @@ -1037,14 +1037,14 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh } /** - * @see net.pterodactylus.jsite.core.CoreListener#projectInsertStarted(net.pterodactylus.jsite.project.Project) + * @see net.pterodactylus.jsite.core.CoreListener#projectInsertStarted(net.pterodactylus.jsite.core.project.Project) */ public void projectInsertStarted(Project project) { mainWindow.projectInsertStarted(project); } /** - * @see net.pterodactylus.jsite.core.CoreListener#projectInsertProgressed(net.pterodactylus.jsite.project.Project, + * @see net.pterodactylus.jsite.core.CoreListener#projectInsertProgressed(net.pterodactylus.jsite.core.project.Project, * int, int, int, int, int, boolean) */ public void projectInsertProgressed(Project project, int totalBlocks, int requiredBlocks, int successfulBlocks, int failedBlocks, int fatallyFailedBlocks, boolean finalizedTotal) { @@ -1052,7 +1052,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh } /** - * @see net.pterodactylus.jsite.core.CoreListener#projectInsertGeneratedURI(net.pterodactylus.jsite.project.Project, + * @see net.pterodactylus.jsite.core.CoreListener#projectInsertGeneratedURI(net.pterodactylus.jsite.core.project.Project, * java.lang.String) */ public void projectInsertGeneratedURI(Project project, String uri) { @@ -1060,7 +1060,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh } /** - * @see net.pterodactylus.jsite.core.CoreListener#projectInsertFinished(net.pterodactylus.jsite.project.Project, + * @see net.pterodactylus.jsite.core.CoreListener#projectInsertFinished(net.pterodactylus.jsite.core.project.Project, * boolean) */ public void projectInsertFinished(Project project, boolean success) {