Add key store panel when a key store is loaded.
[jkeytool.git] / src / net / pterodactylus / jkeytool / gui / swing / KeyStorePanel.java
diff --git a/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java b/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java
new file mode 100644 (file)
index 0000000..4496318
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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);
+       }
+
+}