--- /dev/null
+/*
+ * jkeytool - KeyStorePanel.java -
+ * Copyright © 2009 David Roden
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.pterodactylus.jkeytool.gui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.security.KeyStore;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JPanel;
+import javax.swing.JToolBar;
+
+/**
+ * TODO
+ *
+ * @author David Roden <droden@gmail.com>
+ */
+public class KeyStorePanel extends JPanel {
+
+ /** The displayed key store. */
+ private final KeyStore keyStore;
+
+ /** The tool bar. */
+ private final JToolBar toolBar = new JToolBar();
+
+ /** The action to create a new key. */
+ private Action createKeyAction;
+
+ /**
+ * Creates a new key store panel that displays and controls the given key
+ * store.
+ *
+ * @param keyStore
+ * The key store to display
+ */
+ public KeyStorePanel(KeyStore keyStore) {
+ super(new BorderLayout());
+ this.keyStore = keyStore;
+ constructActions();
+ constructPanel();
+ }
+
+ //
+ // PRIVATE ACTIONS
+ //
+
+ private void createKey() {
+
+ }
+
+ //
+ // PRIVATE METHODS
+ //
+
+ private void constructActions() {
+ createKeyAction = new AbstractAction("Create Key") {
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("synthetic-access")
+ public void actionPerformed(ActionEvent actionEvent) {
+ createKey();
+ }
+ };
+ }
+
+ private void constructPanel() {
+ toolBar.add(createKeyAction);
+
+ add(toolBar, BorderLayout.PAGE_START);
+ }
+
+}
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
/** 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
//
* {@inheritDoc}
*/
public void start() {
- /* TODO */
+ mainFrame.setVisible(true);
+ core.loadKeyStore(new File("client.p12"));
}
/**
* {@inheritDoc}
*/
public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
- /* TODO */
+ KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore);
+ keyStores.put(keyStore, keyStorePanel);
+ mainFrame.getContentPane().add(keyStorePanel);
}
/**