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;
/** 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;
/** All lanugage menu items. */
private List<I18nAction> languageActions = new ArrayList<I18nAction>();
+ /** The “about” action. */
+ private I18nAction helpAboutAction;
+
+ /** The “add project” action. */
+ private I18nAction addProjectAction;
+
/** The list of all defined nodes. */
private List<Node> nodeList;
}
/**
+ * 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
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
//
* 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();
}
}
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();
+ }
+ };
}
/**
//
/**
+ * 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() {
I18n.setLocale(newLocale);
}
+ /**
+ * Shows the “about” dialog.
+ */
+ private void helpAbout() {
+ }
+
+ /**
+ * Adds a project.
+ */
+ private void addProject() {
+ }
+
//
// INTERFACE 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);