X-Git-Url: https://git.pterodactylus.net/?p=jkeytool.git;a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjkeytool%2Fgui%2Fswing%2FSwingInterface.java;h=3190c2a426aba61306f88a3f6eb09c7f010664fa;hp=388846d75724142cef087a82cdc594e599c2c5fd;hb=5e44623aa5fadee1d0c4f605aebee442330e1ae5;hpb=8aa34340dda1029328137a73e42fe37995665869 diff --git a/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java b/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java index 388846d..3190c2a 100644 --- a/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java +++ b/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java @@ -21,8 +21,15 @@ 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; +import net.pterodactylus.util.swing.StatusBar; /** * TODO @@ -31,14 +38,58 @@ import net.pterodactylus.jkeytool.gui.Interface; */ public class SwingInterface implements Interface { + /** The core to control. */ + private Core core; + + /** The main frame. */ + private JFrame mainFrame = new JFrame("jkeytool " + Main.getVersion()); + + /** The status bar. */ + private StatusBar statusBar = new StatusBar(); + + /** Loaded key stores and their panels. */ + private final Map keyStores = new HashMap(); + + public SwingInterface() { + createFrame(); + } + + // + // PRIVATE METHODS + // + + private void createFrame() { + mainFrame.getContentPane().add(statusBar, BorderLayout.PAGE_END); + mainFrame.pack(); + } + // // INTERFACE Interface // /** + * Sets the core to control. + * + * @param core + * The core to control + */ + public void setCore(Core core) { + this.core = core; + } + + /** * {@inheritDoc} */ public void start() { + mainFrame.setVisible(true); + statusBar.setText("jkeytool startup complete."); + core.loadKeyStore(new File("client.p12")); + } + + /** + * {@inheritDoc} + */ + public void stop() { /* TODO */ } @@ -57,7 +108,8 @@ public class SwingInterface implements Interface { * {@inheritDoc} */ public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) { - /* TODO */ + KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore); + keyStores.put(keyStore, keyStorePanel); } /**