2 * jkeytool - SwingInterface.java -
3 * Copyright © 2009 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.jkeytool.gui.swing;
23 import java.security.KeyStore;
24 import java.util.HashMap;
27 import javax.swing.JFrame;
29 import net.pterodactylus.jkeytool.core.Core;
30 import net.pterodactylus.jkeytool.gui.Interface;
31 import net.pterodactylus.jkeytool.main.Main;
32 import net.pterodactylus.util.swing.StatusBar;
37 * @author David Roden <droden@gmail.com>
39 public class SwingInterface implements Interface {
41 /** The core to control. */
44 /** The main frame. */
45 private JFrame mainFrame = new JFrame("jkeytool " + Main.getVersion());
47 /** The status bar. */
48 private StatusBar statusBar = new StatusBar();
50 /** Loaded key stores and their panels. */
51 private final Map<KeyStore, KeyStorePanel> keyStores = new HashMap<KeyStore, KeyStorePanel>();
53 public SwingInterface() {
61 private void createFrame() {
62 mainFrame.getContentPane().add(statusBar, BorderLayout.PAGE_END);
67 // INTERFACE Interface
71 * Sets the core to control.
76 public void setCore(Core core) {
84 mainFrame.setVisible(true);
85 statusBar.setText("jkeytool startup complete.");
86 core.loadKeyStore(new File("client.p12"));
97 // INTERFACE CoreListener
103 public void keyStoreCreated(KeyStore keyStore) {
110 public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
111 KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore);
112 keyStores.put(keyStore, keyStorePanel);
118 public void keyStoreNotCreated(String keyStoreType, Throwable reason) {
125 public void keyStoreNotLoaded(File keyStoreFile) {