From b8f8c23bed246d27c1ea0a53db92a1f33de1174c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 7 Apr 2008 07:01:43 +0000 Subject: [PATCH] add actions for "jsite" and "about" menus git-svn-id: http://trooper/svn/projects/jSite/trunk@625 c3eda9e8-030b-0410-8277-bc7414b0a119 --- .../pterodactylus/jsite/gui/SwingInterface.java | 153 ++++++++++++++++++++- 1 file changed, 151 insertions(+), 2 deletions(-) diff --git a/src/net/pterodactylus/jsite/gui/SwingInterface.java b/src/net/pterodactylus/jsite/gui/SwingInterface.java index 1210a49..54dec0d 100644 --- a/src/net/pterodactylus/jsite/gui/SwingInterface.java +++ b/src/net/pterodactylus/jsite/gui/SwingInterface.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; +import javax.swing.JOptionPane; + import net.pterodactylus.jsite.core.Core; import net.pterodactylus.jsite.core.CoreListener; import net.pterodactylus.jsite.core.Node; @@ -44,6 +46,15 @@ public class SwingInterface implements CoreListener { /** The main window. */ private MainWindow mainWindow; + /** The “configure” action. */ + private I18nAction configureAction; + + /** The “import config” action. */ + private I18nAction importConfigAction; + + /** The “quit” action. */ + private I18nAction quitAction; + /** The “manage nodes” action. */ private I18nAction manageNodesAction; @@ -59,6 +70,12 @@ public class SwingInterface implements CoreListener { /** All lanugage menu items. */ private List languageActions = new ArrayList(); + /** The “about” action. */ + private I18nAction helpAboutAction; + + /** The “add project” action. */ + private I18nAction addProjectAction; + /** The list of all defined nodes. */ private List nodeList; @@ -98,6 +115,33 @@ public class SwingInterface implements CoreListener { } /** + * Returns the “configure” action. + * + * @return The “configure” action + */ + I18nAction getConfigureAction() { + return configureAction; + } + + /** + * Returns the “import config” action. + * + * @return The “import config” action + */ + I18nAction getImportConfigAction() { + return importConfigAction; + } + + /** + * Returns the “quit” action. + * + * @return The “quit” action + */ + I18nAction getQuitAction() { + return quitAction; + } + + /** * Returns the “manage nodes” action. * * @return The “manage nodes” action @@ -133,6 +177,24 @@ public class SwingInterface implements CoreListener { return languageActions; } + /** + * Returns the “about” action. + * + * @return The “about” action + */ + I18nAction getHelpAboutAction() { + return helpAboutAction; + } + + /** + * Returns the “add project” action. + * + * @return The “add project” action + */ + I18nAction getAddProjectAction() { + return addProjectAction; + } + // // ACTIONS // @@ -156,20 +218,50 @@ public class SwingInterface implements CoreListener { * Initializes all actions. */ private void initActions() { + configureAction = new I18nAction("mainWindow.menu.jSite.configure") { + + /** + * {@inheritDoc} + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + configure(); + } + }; + importConfigAction = new I18nAction("mainWindow.menu.jSite.importConfig") { + + /** + * {@inheritDoc} + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + importConfig(); + } + }; + quitAction = new I18nAction("mainWindow.menu.jSite.quit") { + + /** + * {@inheritDoc} + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + quit(); + } + }; manageNodesAction = new I18nAction("mainWindow.menu.node.item.manageNodes") { /** * {@inheritDoc} */ @SuppressWarnings("synthetic-access") - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent actionEvent) { manageNodes(); } }; nodeConnectAction = new I18nAction("mainWindow.menu.node.item.connect", false) { @SuppressWarnings("synthetic-access") - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent actionEvent) { nodeConnect(); } @@ -199,7 +291,26 @@ public class SwingInterface implements CoreListener { } languageActions.add(languageAction); } + helpAboutAction = new I18nAction("mainWindow.menu.help.item.about") { + /** + * {@inheritDoc} + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + helpAbout(); + } + }; + addProjectAction = new I18nAction("mainWindow.button.addProject") { + + /** + * {@inheritDoc} + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + addProject(); + } + }; } /** @@ -214,6 +325,25 @@ public class SwingInterface implements CoreListener { // /** + * Shows the configuration dialog. + */ + private void configure() { + } + + /** + * Imports old jSite configuration. + */ + private void importConfig() { + } + + /** + * Quits jSite. + */ + private void quit() { + System.exit(0); + } + + /** * Pops up the “manage nodes” dialog. */ private void manageNodes() { @@ -250,6 +380,18 @@ public class SwingInterface implements CoreListener { I18n.setLocale(newLocale); } + /** + * Shows the “about” dialog. + */ + private void helpAbout() { + } + + /** + * Adds a project. + */ + private void addProject() { + } + // // INTERFACE CoreListener // @@ -257,6 +399,13 @@ public class SwingInterface implements CoreListener { /** * {@inheritDoc} */ + public void loadingProjectsFailed(String directory) { + JOptionPane.showMessageDialog(mainWindow, I18n.get("mainWindow.error.projectLoadingFailed.message", directory), I18n.get("mainWindow.error.projectLoadingFailed.title"), JOptionPane.ERROR_MESSAGE); + } + + /** + * {@inheritDoc} + */ public void coreLoaded() { this.nodeList = core.getNodes(); manageNodesDialog.setNodeList(nodeList); -- 2.7.4