// Path: src/main/java/com/cipherdyne/utils/InternationalizationHelper.java
// public class InternationalizationHelper {
// 
//     static private ResourceBundle messages;
//     private static final Logger LOGGER = LogManager.getLogger(InternationalizationHelper.class.getName());
//     private static InternationalizationHelper instance = null;
// 
//     /**
//      * Hidden constructor
//      *
//      * @param language
//      * @param country
//      */
//     private InternationalizationHelper(final String language, final String country) {
// 
//         messages = ResourceBundle.getBundle("messages", new Locale(language, country));
//     }
// 
//     public static String getMessage(final String i18nKey) {
// 
//         String translation = i18nKey;
// 
//         if (instance == null) {
//             instance = new InternationalizationHelper("en", "EN");
//         }
// 
//         try {
//             translation = messages.getString(i18nKey);
//         } catch (final MissingResourceException e) {
//             LOGGER.warn("No translation found for key " + i18nKey);
//         }
// 
//         return translation;
//     }
// 
//     public static String getMessageOrNull(final String i18nKey) {
// 
//         String translation = null;
// 
//         if (instance == null) {
//             instance = new InternationalizationHelper("en", "EN");
//         }
// 
//         try {
//             translation = messages.getString(i18nKey);
//         } catch (final MissingResourceException e) {
// 
//         }
// 
//         return translation;
//     }
// 
//     public static void configure(final String locale) {
//         String[] localeArray = locale.split("_");
//         instance = new InternationalizationHelper(localeArray[0], localeArray[1]);
//     }
// }
// 
// Path: src/main/java/com/cipherdyne/gui/components/JFwknopTextField.java
// public class JFwknopTextField extends JTextField implements IFwknopVariable {
// 
//     private static final long serialVersionUID = 1L;
//     private final String defaultVal;
// 
//     public JFwknopTextField(final String val) {
//         super(val);
//         this.defaultVal = val;
//         this.addFocusListener(new FocusListener() {
//             @Override
//             public void focusGained(FocusEvent e) {
//             }
// 
//             @Override
//             public void focusLost(FocusEvent e) {
//                 if (((JFwknopTextField) e.getSource()).getText().equals(StringUtils.EMPTY)) {
//                     setDefaultValue();
//                 }
//             }
//         });
//     }
// 
//     @Override
//     public void setDefaultValue() {
//         this.setText(this.defaultVal);
//     }
// 
//     @Override
//     public boolean isDefault() {
//         boolean def = false;
//         if (this.defaultVal.equals(this.getText())) {
//             def = true;
//         }
// 
//         return def;
//     }
// }


import com.cipherdyne.utils.InternationalizationHelper;
import com.cipherdyne.gui.components.JFwknopTextField;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;
/* 
 * JFwknop is developed primarily by the people listed in the file 'AUTHORS'.
 * Copyright (C) 2016 JFwknop developers and contributors.
 *
 * 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 com.cipherdyne.gui.gpg;


/**
 *
 * @author franck
 */
public class GpgKeySettingsView extends JDialog {
    
    private final JFwknopTextField userId;
    private final JFwknopTextField passphrase;
    private final JButton btnSubmit;
    
    public GpgKeySettingsView(JFrame parentWindow) {
        super(parentWindow, InternationalizationHelper.getMessage("i18n.key.creation"), true);

        this.userId = new JFwknopTextField("<user_id>");
        this.passphrase = new JFwknopTextField("<passphrase>");
        this.btnSubmit = new JButton(InternationalizationHelper.getMessage("i18n.key.create"));
        
        this.setLayout(new MigLayout("inset 20, gap 0, flowx, wrap 2", "[120!][200!]", ""));
        this.add(new JLabel(InternationalizationHelper.getMessage("i18n.user.id")), "growx");
        this.add(this.userId, "growx");
        this.add(new JLabel(InternationalizationHelper.getMessage("i18n.key.passphrase")), "growx");
        this.add(this.passphrase, "growx");
        this.add(this.btnSubmit, "growx, span 2");
        
        this.pack();
    }
    
// Path: src/main/java/com/cipherdyne/utils/InternationalizationHelper.java
// public class InternationalizationHelper {
// 
//     static private ResourceBundle messages;
//     private static final Logger LOGGER = LogManager.getLogger(InternationalizationHelper.class.getName());
//     private static InternationalizationHelper instance = null;
// 
//     /**
//      * Hidden constructor
//      *
//      * @param language
//      * @param country
//      */
//     private InternationalizationHelper(final String language, final String country) {
// 
//         messages = ResourceBundle.getBundle("messages", new Locale(language, country));
//     }
// 
//     public static String getMessage(final String i18nKey) {
// 
//         String translation = i18nKey;
// 
//         if (instance == null) {
//             instance = new InternationalizationHelper("en", "EN");
//         }
// 
//         try {
//             translation = messages.getString(i18nKey);
//         } catch (final MissingResourceException e) {
//             LOGGER.warn("No translation found for key " + i18nKey);
//         }
// 
//         return translation;
//     }
// 
//     public static String getMessageOrNull(final String i18nKey) {
// 
//         String translation = null;
// 
//         if (instance == null) {
//             instance = new InternationalizationHelper("en", "EN");
//         }
// 
//         try {
//             translation = messages.getString(i18nKey);
//         } catch (final MissingResourceException e) {
// 
//         }
// 
//         return translation;
//     }
// 
//     public static void configure(final String locale) {
//         String[] localeArray = locale.split("_");
//         instance = new InternationalizationHelper(localeArray[0], localeArray[1]);
//     }
// }
// 
// Path: src/main/java/com/cipherdyne/gui/components/JFwknopTextField.java
// public class JFwknopTextField extends JTextField implements IFwknopVariable {
// 
//     private static final long serialVersionUID = 1L;
//     private final String defaultVal;
// 
//     public JFwknopTextField(final String val) {
//         super(val);
//         this.defaultVal = val;
//         this.addFocusListener(new FocusListener() {
//             @Override
//             public void focusGained(FocusEvent e) {
//             }
// 
//             @Override
//             public void focusLost(FocusEvent e) {
//                 if (((JFwknopTextField) e.getSource()).getText().equals(StringUtils.EMPTY)) {
//                     setDefaultValue();
//                 }
//             }
//         });
//     }
// 
//     @Override
//     public void setDefaultValue() {
//         this.setText(this.defaultVal);
//     }
// 
//     @Override
//     public boolean isDefault() {
//         boolean def = false;
//         if (this.defaultVal.equals(this.getText())) {
//             def = true;
//         }
// 
//         return def;
//     }
// }


// Path: src/main/java/com/cipherdyne/gui/gpg/GpgKeySettingsView.java
import com.cipherdyne.utils.InternationalizationHelper;
import com.cipherdyne.gui.components.JFwknopTextField;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;

/* 
 * JFwknop is developed primarily by the people listed in the file 'AUTHORS'.
 * Copyright (C) 2016 JFwknop developers and contributors.
 *
 * 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 com.cipherdyne.gui.gpg;


/**
 *
 * @author franck
 */
public class GpgKeySettingsView extends JDialog {
    
    private final JFwknopTextField userId;
    private final JFwknopTextField passphrase;
    private final JButton btnSubmit;
    
    public GpgKeySettingsView(JFrame parentWindow) {
        super(parentWindow, InternationalizationHelper.getMessage("i18n.key.creation"), true);

        this.userId = new JFwknopTextField("<user_id>");
        this.passphrase = new JFwknopTextField("<passphrase>");
        this.btnSubmit = new JButton(InternationalizationHelper.getMessage("i18n.key.create"));
        
        this.setLayout(new MigLayout("inset 20, gap 0, flowx, wrap 2", "[120!][200!]", ""));
        this.add(new JLabel(InternationalizationHelper.getMessage("i18n.user.id")), "growx");
        this.add(this.userId, "growx");
        this.add(new JLabel(InternationalizationHelper.getMessage("i18n.key.passphrase")), "growx");
        this.add(this.passphrase, "growx");
        this.add(this.btnSubmit, "growx, span 2");
        
        this.pack();
    }
    
    public JFwknopTextField getUserId() {