Add key store panel when a key store is loaded.
[jkeytool.git] / src / net / pterodactylus / jkeytool / gui / swing / SwingInterface.java
index 39506e1..95c8f90 100644 (file)
@@ -21,9 +21,14 @@ package net.pterodactylus.jkeytool.gui.swing;
 
 import java.io.File;
 import java.security.KeyStore;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.JFrame;
 
 import net.pterodactylus.jkeytool.core.Core;
 import net.pterodactylus.jkeytool.gui.Interface;
+import net.pterodactylus.jkeytool.main.Main;
 
 /**
  * TODO
@@ -35,6 +40,12 @@ public class SwingInterface implements Interface {
        /** The core to control. */
        private Core core;
 
+       /** The main frame. */
+       private JFrame mainFrame = new JFrame("jkeytool " + Main.getVersion());
+
+       /** Loaded key stores and their panels. */
+       private final Map<KeyStore, KeyStorePanel> keyStores = new HashMap<KeyStore, KeyStorePanel>();
+
        //
        // INTERFACE Interface
        //
@@ -53,7 +64,8 @@ public class SwingInterface implements Interface {
         * {@inheritDoc}
         */
        public void start() {
-               /* TODO */
+               mainFrame.setVisible(true);
+               core.loadKeyStore(new File("client.p12"));
        }
 
        /**
@@ -78,7 +90,9 @@ public class SwingInterface implements Interface {
         * {@inheritDoc}
         */
        public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
-               /* TODO */
+               KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore);
+               keyStores.put(keyStore, keyStorePanel);
+               mainFrame.getContentPane().add(keyStorePanel);
        }
 
        /**