make the GUI update its texts when a new language is chosen
[jSite2.git] / src / net / pterodactylus / jsite / gui / SwingInterface.java
index fab1bc9..4a0c97f 100644 (file)
@@ -22,8 +22,6 @@ package net.pterodactylus.jsite.gui;
 import java.awt.event.ActionEvent;
 import java.util.List;
 
-import javax.swing.Action;
-
 import net.pterodactylus.jsite.core.Core;
 import net.pterodactylus.jsite.core.CoreListener;
 import net.pterodactylus.jsite.core.Node;
@@ -43,13 +41,13 @@ public class SwingInterface implements CoreListener {
        private MainWindow mainWindow;
 
        /** The “manage nodes” action. */
-       private Action manageNodesAction;
+       private I18nAction manageNodesAction;
 
        /** The “connect to node” action. */
-       private Action nodeConnectAction;
+       private I18nAction nodeConnectAction;
 
        /** The “disconnect from node” action. */
-       private Action nodeDisconnectAction;
+       private I18nAction nodeDisconnectAction;
 
        /** The node manager dialog. */
        private ManageNodesDialog manageNodesDialog;
@@ -57,9 +55,6 @@ public class SwingInterface implements CoreListener {
        /** The list of all defined nodes. */
        private List<Node> nodeList;
 
-       /** The current default node. */
-       private Node defaultNode;
-
        /**
         * Creates a new swing interface.
         * 
@@ -77,11 +72,29 @@ public class SwingInterface implements CoreListener {
        //
 
        /**
+        * Returns the core that is controlled by the Swing interface.
+        * 
+        * @return The core
+        */
+       Core getCore() {
+               return core;
+       }
+
+       /**
+        * Returns the main window of the Swing interface.
+        * 
+        * @return The main window
+        */
+       MainWindow getMainWindow() {
+               return mainWindow;
+       }
+
+       /**
         * Returns the “manage nodes” action.
         * 
         * @return The “manage nodes” action
         */
-       public Action getManageNodesAction() {
+       I18nAction getManageNodesAction() {
                return manageNodesAction;
        }
 
@@ -90,7 +103,7 @@ public class SwingInterface implements CoreListener {
         * 
         * @return The “connect to node” action
         */
-       public Action getNodeConnectAction() {
+       I18nAction getNodeConnectAction() {
                return nodeConnectAction;
        }
 
@@ -99,7 +112,7 @@ public class SwingInterface implements CoreListener {
         * 
         * @return The “disconnect from node” action
         */
-       public Action getNodeDisconnectAction() {
+       I18nAction getNodeDisconnectAction() {
                return nodeDisconnectAction;
        }
 
@@ -160,21 +173,22 @@ public class SwingInterface implements CoreListener {
         * Initializes all child dialogs.
         */
        private void initDialogs() {
-               manageNodesDialog = new ManageNodesDialog(mainWindow);
+               manageNodesDialog = new ManageNodesDialog(this);
        }
 
        /**
         * Pops up the “manage nodes” dialog.
         */
        private void manageNodes() {
+               manageNodesDialog.setNodeList(nodeList);
                manageNodesDialog.setVisible(true);
+               nodeList = manageNodesDialog.getNodeList();
        }
 
        /**
         * Connects to the node.
         */
        private void nodeConnect() {
-               core.connectToNode(null); // FIXME
        }
 
        /**
@@ -191,10 +205,8 @@ public class SwingInterface implements CoreListener {
         * {@inheritDoc}
         */
        public void coreLoaded() {
-               this.nodeList = core.getNodeList();
-               this.defaultNode = core.getDefaultNode();
+               this.nodeList = core.getNodes();
                manageNodesDialog.setNodeList(nodeList);
-               manageNodesDialog.setDefaultNode(defaultNode);
                mainWindow.setVisible(true);
                mainWindow.setStatusBarText("Core loaded.");
        }