Show key store type in key store panel.
[jkeytool.git] / src / net / pterodactylus / jkeytool / gui / swing / KeyStorePanel.java
index 4496318..9367221 100644 (file)
 
 package net.pterodactylus.jkeytool.gui.swing;
 
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.security.KeyStore;
 
-import javax.swing.AbstractAction;
-import javax.swing.Action;
+import javax.swing.BorderFactory;
 import javax.swing.JPanel;
-import javax.swing.JToolBar;
+import javax.swing.JTextField;
+
+import net.pterodactylus.util.i18n.I18n;
+import net.pterodactylus.util.i18n.gui.I18nLabel;
 
 /**
  * TODO
@@ -35,26 +38,25 @@ import javax.swing.JToolBar;
  */
 public class KeyStorePanel extends JPanel {
 
+       /** The I18n container. */
+       private final I18n i18n;
+
        /** 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 i18n
+        *            The I18n container
         * @param keyStore
         *            The key store to display
         */
-       public KeyStorePanel(KeyStore keyStore) {
-               super(new BorderLayout());
+       public KeyStorePanel(I18n i18n, KeyStore keyStore) {
+               super(new GridBagLayout());
+               this.i18n = i18n;
                this.keyStore = keyStore;
-               constructActions();
                constructPanel();
        }
 
@@ -62,31 +64,23 @@ public class KeyStorePanel extends JPanel {
        // 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();
-                       }
-               };
-       }
-
+       /**
+        * Constructs the main panel.
+        */
        private void constructPanel() {
-               toolBar.add(createKeyAction);
+               setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
+               I18nLabel keyStoreTypeLabel = new I18nLabel(i18n, "jkeytool.keyStorePanel.keyStoreTypeLabel");
+               JTextField keyStoreTypeTextField = new JTextField(keyStore.getType());
+               keyStoreTypeTextField.setEditable(false);
+
+               i18n.registerI18nable(keyStoreTypeLabel);
 
-               add(toolBar, BorderLayout.PAGE_START);
+               add(keyStoreTypeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+               add(keyStoreTypeTextField, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 12, 0, 0), 0, 0));
        }
 
 }