Show key store type in key store panel.
[jkeytool.git] / src / net / pterodactylus / jkeytool / gui / swing / SwingInterface.java
index 7574e4a..165a6d6 100644 (file)
@@ -39,6 +39,7 @@ import javax.swing.JToolBar;
 import net.pterodactylus.jkeytool.core.Core;
 import net.pterodactylus.jkeytool.gui.Interface;
 import net.pterodactylus.jkeytool.main.Main;
+import net.pterodactylus.util.i18n.I18n;
 import net.pterodactylus.util.i18n.gui.I18nAction;
 import net.pterodactylus.util.i18n.gui.I18nMenu;
 import net.pterodactylus.util.swing.StatusBar;
@@ -53,6 +54,9 @@ public class SwingInterface implements Interface {
        /** The core to control. */
        private Core core;
 
+       /** The I18n container. */
+       private I18n i18n = new I18n("jkeytool", SwingInterface.class);
+
        /** The main frame. */
        private JFrame mainFrame = new JFrame("jkeytool " + Main.getVersion());
 
@@ -71,6 +75,9 @@ public class SwingInterface implements Interface {
        /** Loaded key stores and their panels. */
        private final Map<KeyStore, KeyStorePanel> keyStores = new HashMap<KeyStore, KeyStorePanel>();
 
+       /**
+        * Creates a new Swing interface.
+        */
        public SwingInterface() {
                createActions();
                createFrame();
@@ -80,9 +87,16 @@ public class SwingInterface implements Interface {
        // ACTIONS
        //
 
+       /**
+        * Creates a new key store.
+        */
        private void createKeyStore() {
+               /* TODO */
        }
 
+       /**
+        * Exits the application.
+        */
        private void quit() {
                System.exit(0);
        }
@@ -91,15 +105,18 @@ public class SwingInterface implements Interface {
        // PRIVATE METHODS
        //
 
+       /**
+        * Creates all used actions.
+        */
        private void createActions() {
-               createKeyStoreAction = new I18nAction("jkeytool.action.createKeyStore") {
+               createKeyStoreAction = new I18nAction(i18n, "jkeytool.action.createKeyStore") {
 
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
                                createKeyStore();
                        }
                };
-               quitAction = new I18nAction("jkeytool.action.quit") {
+               quitAction = new I18nAction(i18n, "jkeytool.action.quit") {
 
                        /**
                         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
@@ -111,6 +128,9 @@ public class SwingInterface implements Interface {
                };
        }
 
+       /**
+        * Creates the application main frame.
+        */
        private void createFrame() {
                mainFrame.setJMenuBar(createMenubar());
                mainFrame.getContentPane().add(createToolbar(), BorderLayout.PAGE_START);
@@ -119,6 +139,11 @@ public class SwingInterface implements Interface {
                mainFrame.pack();
        }
 
+       /**
+        * Creates the central panel of the frame.
+        *
+        * @return The central panel of the frame
+        */
        private JComponent createCenterPanel() {
                JPanel centerPanel = new JPanel(new BorderLayout());
                centerPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
@@ -128,10 +153,15 @@ public class SwingInterface implements Interface {
                return centerPanel;
        }
 
+       /**
+        * Creates the menu bar of the frame.
+        *
+        * @return The menu bar of the frame
+        */
        private JMenuBar createMenubar() {
                JMenuBar menubar = new JMenuBar();
 
-               JMenu fileMenu = new I18nMenu("jkeytool.menu.file");
+               JMenu fileMenu = new I18nMenu(i18n, "jkeytool.menu.file");
                menubar.add(fileMenu);
                fileMenu.add(createKeyStoreAction);
                fileMenu.addSeparator();
@@ -140,6 +170,11 @@ public class SwingInterface implements Interface {
                return menubar;
        }
 
+       /**
+        * Creates the tool bar of the frame.
+        *
+        * @return The tool bar of the frame
+        */
        private JToolBar createToolbar() {
                JToolBar toolbar = new JToolBar();
 
@@ -194,7 +229,7 @@ public class SwingInterface implements Interface {
         * {@inheritDoc}
         */
        public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
-               KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore);
+               KeyStorePanel keyStorePanel = new KeyStorePanel(i18n, keyStore);
                keyStores.put(keyStore, keyStorePanel);
                tabPane.addTab(keyStoreFile.getName(), keyStorePanel);
        }