Search in sources :

Example 1 with OpenAction

use of org.kse.gui.actions.OpenAction in project keystore-explorer by kaikramer.

the class JQuickStartPane method initComponents.

private void initComponents() {
    jqslHeading = new JQuickStartLabel(res.getString("JQuickStartPane.jqslHeading.text"));
    jqslHeading.setForeground(TEXT_COLOR);
    jqslHeading.setFont(jqslHeading.getFont().deriveFont(20f));
    Toolkit toolKit = Toolkit.getDefaultToolkit();
    ImageIcon newImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbNewKeyStore.image"))));
    ImageIcon newImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbNewKeyStore.rollover.image"))));
    jqsbNewKeyStore = new JQuickStartButton(new NewAction(kseFrame), res.getString("JQuickStartPane.jqsbNewKeyStore.text"), newImage, newImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbNewKeyStore.setOpaque(false);
    ImageIcon openImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenKeyStore.image"))));
    ImageIcon openImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenKeyStore.rollover.image"))));
    jqsbOpenKeyStore = new JQuickStartButton(new OpenAction(kseFrame), res.getString("JQuickStartPane.jqsbOpenKeyStore.text"), openImage, openImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbOpenKeyStore.setOpaque(false);
    ImageIcon openDefaultImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenDefaultKeyStore.image"))));
    ImageIcon openDefaultImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenDefaultKeyStore.rollover.image"))));
    jqsbOpenDefaultKeyStore = new JQuickStartButton(new OpenDefaultAction(kseFrame), res.getString("JQuickStartPane.jqsbOpenDefaultKeyStore.text"), openDefaultImage, openDefaultImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbOpenDefaultKeyStore.setOpaque(false);
    ImageIcon openCaCertificatesImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenCaCertificatesKeyStore.image"))));
    ImageIcon openCaCertificatesImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenCaCertificatesKeyStore.rollover.image"))));
    jqsbOpenCaCertificatesKeyStore = new JQuickStartButton(new OpenCaCertificatesAction(kseFrame), res.getString("JQuickStartPane.jqsbOpenCaCertificatesKeyStore.text"), openCaCertificatesImage, openCaCertificatesImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbOpenCaCertificatesKeyStore.setOpaque(false);
    ImageIcon examineCertificateImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbExamineCertificate.image"))));
    ImageIcon examineCertificateImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbExamineCertificate.rollover.image"))));
    jqsbExamineCertificate = new JQuickStartButton(new ExamineFileAction(kseFrame), res.getString("JQuickStartPane.jqsbExamineCertificate.text"), examineCertificateImage, examineCertificateImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbExamineCertificate.setOpaque(false);
    ImageIcon helpImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbHelp.image"))));
    ImageIcon helpImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbHelp.rollover.image"))));
    jqsbHelp = new JQuickStartButton(new HelpAction(kseFrame), res.getString("JQuickStartPane.jqsbHelp.text"), helpImage, helpImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbHelp.setOpaque(false);
    GridBagConstraints gbc_jqslHeading = new GridBagConstraints();
    gbc_jqslHeading.gridheight = 1;
    gbc_jqslHeading.gridwidth = 3;
    gbc_jqslHeading.gridx = 0;
    gbc_jqslHeading.gridy = 0;
    gbc_jqslHeading.insets = new Insets(0, 0, 20, 0);
    GridBagConstraints gbc_jqsbNewKeyStore = new GridBagConstraints();
    gbc_jqsbNewKeyStore.gridheight = 1;
    gbc_jqsbNewKeyStore.gridwidth = 1;
    gbc_jqsbNewKeyStore.gridx = 0;
    gbc_jqsbNewKeyStore.gridy = 1;
    gbc_jqsbNewKeyStore.insets = new Insets(0, 0, 10, 10);
    GridBagConstraints gbc_jqsbOpenKeyStore = new GridBagConstraints();
    gbc_jqsbOpenKeyStore.gridheight = 1;
    gbc_jqsbOpenKeyStore.gridwidth = 1;
    gbc_jqsbOpenKeyStore.gridx = 1;
    gbc_jqsbOpenKeyStore.gridy = 1;
    gbc_jqsbOpenKeyStore.insets = new Insets(0, 10, 10, 10);
    GridBagConstraints gbc_jqsbOpenDefaultKeyStore = new GridBagConstraints();
    gbc_jqsbOpenDefaultKeyStore.gridheight = 1;
    gbc_jqsbOpenDefaultKeyStore.gridwidth = 1;
    gbc_jqsbOpenDefaultKeyStore.gridx = 2;
    gbc_jqsbOpenDefaultKeyStore.gridy = 1;
    gbc_jqsbOpenDefaultKeyStore.insets = new Insets(0, 10, 10, 10);
    GridBagConstraints gbc_jqsbOpenCaCertificatesKeyStore = new GridBagConstraints();
    gbc_jqsbOpenCaCertificatesKeyStore.gridheight = 1;
    gbc_jqsbOpenCaCertificatesKeyStore.gridwidth = 1;
    gbc_jqsbOpenCaCertificatesKeyStore.gridx = 0;
    gbc_jqsbOpenCaCertificatesKeyStore.gridy = 2;
    gbc_jqsbOpenCaCertificatesKeyStore.insets = new Insets(10, 0, 0, 10);
    GridBagConstraints gbc_jqsbExamineCertificate = new GridBagConstraints();
    gbc_jqsbExamineCertificate.gridheight = 1;
    gbc_jqsbExamineCertificate.gridwidth = 1;
    gbc_jqsbExamineCertificate.gridx = 1;
    gbc_jqsbExamineCertificate.gridy = 2;
    gbc_jqsbExamineCertificate.insets = new Insets(10, 10, 0, 10);
    GridBagConstraints gbc_jqsbHelp = new GridBagConstraints();
    gbc_jqsbHelp.gridheight = 1;
    gbc_jqsbHelp.gridwidth = 1;
    gbc_jqsbHelp.gridx = 2;
    gbc_jqsbHelp.gridy = 2;
    gbc_jqsbHelp.insets = new Insets(10, 10, 0, 0);
    jpQuickStart = new JPanel(new GridBagLayout());
    jpQuickStart.setOpaque(false);
    jpQuickStart.add(jqslHeading, gbc_jqslHeading);
    jpQuickStart.add(jqsbNewKeyStore, gbc_jqsbNewKeyStore);
    jpQuickStart.add(jqsbOpenKeyStore, gbc_jqsbOpenKeyStore);
    jpQuickStart.add(jqsbOpenDefaultKeyStore, gbc_jqsbOpenDefaultKeyStore);
    jpQuickStart.add(jqsbOpenCaCertificatesKeyStore, gbc_jqsbOpenCaCertificatesKeyStore);
    jpQuickStart.add(jqsbExamineCertificate, gbc_jqsbExamineCertificate);
    jpQuickStart.add(jqsbHelp, gbc_jqsbHelp);
    // Put in panel to prevent resize of controls and center them
    // horizontally
    jpNonResizeCenterHorizontally = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
    jpNonResizeCenterHorizontally.setOpaque(false);
    jpNonResizeCenterHorizontally.add(jpQuickStart);
    // Set pane's layout to center controls vertically
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(Box.createVerticalGlue());
    add(jpNonResizeCenterHorizontally);
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) HelpAction(org.kse.gui.actions.HelpAction) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) ExamineFileAction(org.kse.gui.actions.ExamineFileAction) GridBagLayout(java.awt.GridBagLayout) BoxLayout(javax.swing.BoxLayout) OpenCaCertificatesAction(org.kse.gui.actions.OpenCaCertificatesAction) OpenAction(org.kse.gui.actions.OpenAction) OpenDefaultAction(org.kse.gui.actions.OpenDefaultAction) Toolkit(java.awt.Toolkit) NewAction(org.kse.gui.actions.NewAction)

Example 2 with OpenAction

use of org.kse.gui.actions.OpenAction in project keystore-explorer by kaikramer.

the class DExamineSsl method initComponents.

private void initComponents() {
    jlSslHost = new JLabel(res.getString("DExamineSsl.jlSslHost.text"));
    jcbSslHost = new JComboBox<String>();
    jcbSslHost.setEditable(true);
    jcbSslHost.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    jcbSslHost.setToolTipText(res.getString("DExamineSsl.jtfSslHost.tooltip"));
    jcbSslHost.setModel(new DefaultComboBoxModel<String>(getSslHosts()));
    jlSslPort = new JLabel(res.getString("DExamineSsl.jlSslPort.text"));
    jcbSslPort = new JComboBox<String>();
    jcbSslPort.setEditable(true);
    jcbSslPort.setToolTipText(res.getString("DExamineSsl.jtfSslPort.tooltip"));
    jcbSslPort.setModel(new DefaultComboBoxModel<String>(getSslPorts()));
    jcbClientAuth = new JCheckBox(res.getString("DExamineSsl.jlEnableClientAuth.text"));
    jcbKeyStore = new JComboBox<KeyStoreHistory>(getKeystoreNames());
    jcbKeyStore.setToolTipText(res.getString("DExamineSsl.jcbKeyStore.tooltip"));
    jbLoadKeystore = new JButton();
    jbLoadKeystore.setIcon(new ImageIcon(getClass().getResource(res.getString("DExamineSsl.jbOpen.image"))));
    jbLoadKeystore.setToolTipText(res.getString("DExamineSsl.jbLoadKeystore.tooltip"));
    jbOK = new JButton(res.getString("DExamineSsl.jbOK.text"));
    jbCancel = new JButton(res.getString("DExamineSsl.jbCancel.text"));
    jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
    jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel);
    Container pane = getContentPane();
    pane.setLayout(new MigLayout("insets dialog, fill", "[para]unrel[right]unrel[]", "[]unrel[]"));
    MiGUtil.addSeparator(pane, res.getString("DExamineSsl.jlConnSettings.text"));
    pane.add(jlSslHost, "skip");
    pane.add(jcbSslHost, "sgx, wrap");
    pane.add(jlSslPort, "skip");
    pane.add(jcbSslPort, "sgx, wrap para");
    MiGUtil.addSeparator(pane, res.getString("DExamineSsl.jlClientAuth.text"));
    pane.add(jcbClientAuth, "left, spanx, wrap");
    pane.add(new JLabel(res.getString("DExamineSsl.jlKeyStore.text")), "skip");
    pane.add(jcbKeyStore, "sgx");
    pane.add(jbLoadKeystore, "wrap para");
    pane.add(new JSeparator(), "spanx, growx, wrap para");
    pane.add(jpButtons, "right, spanx");
    jcbClientAuth.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            updateClientAuthComponents();
        }
    });
    jbLoadKeystore.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            OpenAction openAction = new OpenAction(kseFrame);
            openAction.actionPerformed(evt);
            updateClientAuthComponents();
        }
    });
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    updateClientAuthComponents();
    setResizable(false);
    getRootPane().setDefaultButton(jbOK);
    pack();
}
Also used : ImageIcon(javax.swing.ImageIcon) KeyStoreHistory(org.kse.utilities.history.KeyStoreHistory) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) MigLayout(net.miginfocom.swing.MigLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) ActionEvent(java.awt.event.ActionEvent) JSeparator(javax.swing.JSeparator) JCheckBox(javax.swing.JCheckBox) Container(java.awt.Container) OpenAction(org.kse.gui.actions.OpenAction) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) AbstractAction(javax.swing.AbstractAction)

Example 3 with OpenAction

use of org.kse.gui.actions.OpenAction in project keystore-explorer by kaikramer.

the class MacOsIntegration method invoke.

@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if ("openFiles".equals(method.getName())) {
        if (args[0] != null) {
            Object files = args[0].getClass().getMethod("getFiles").invoke(args[0]);
            if (files instanceof List) {
                OpenAction openAction = new OpenAction(kseFrame);
                for (File file : (List<File>) files) {
                    openAction.openKeyStore(file);
                }
            }
        }
    } else if ("handleQuitRequestWith".equals(method.getName())) {
        ExitAction exitAction = new ExitAction(kseFrame);
        exitAction.exitApplication();
        // If we have returned from the above call the user has decied not to quit
        if (args[1] != null) {
            args[1].getClass().getDeclaredMethod("cancelQuit").invoke(args[1]);
        }
    } else if ("handleAbout".equals(method.getName())) {
        AboutAction aboutAction = new AboutAction(kseFrame);
        aboutAction.showAbout();
    } else if ("handlePreferences".equals(method.getName())) {
        PreferencesAction preferencesAction = new PreferencesAction(kseFrame);
        preferencesAction.showPreferences();
    }
    return null;
}
Also used : PreferencesAction(org.kse.gui.actions.PreferencesAction) OpenAction(org.kse.gui.actions.OpenAction) ExitAction(org.kse.gui.actions.ExitAction) AboutAction(org.kse.gui.actions.AboutAction) List(java.util.List) File(java.io.File)

Example 4 with OpenAction

use of org.kse.gui.actions.OpenAction in project keystore-explorer by kaikramer.

the class RecentKeyStoreFileActionListener method actionPerformed.

/**
 * Action to perform to open the KeyStore file in response to an
 * ActionEvent.
 *
 * @param evt
 *            Action event
 */
@Override
public void actionPerformed(ActionEvent evt) {
    kseFrame.setDefaultStatusBarText();
    if (!recentFile.isFile()) {
        // File does not exist - invalidate it to remove it from the recent
        // files menu
        JMenuItemRecentFile jmiRecentFile = (JMenuItemRecentFile) evt.getSource();
        JMenuRecentFiles jmRecentFiles = jmiRecentFile.getRecentFilesMenu();
        jmRecentFiles.invalidate(jmiRecentFile);
        JOptionPane.showMessageDialog(kseFrame.getUnderlyingFrame(), MessageFormat.format(res.getString("RecentKeyStoreFileActionListener.NotFile.message"), recentFile), res.getString("RecentKeyStoreFileActionListener.OpenKeyStore.Title"), JOptionPane.WARNING_MESSAGE);
        return;
    }
    OpenAction openAction = new OpenAction(kseFrame);
    openAction.openKeyStore(recentFile);
}
Also used : OpenAction(org.kse.gui.actions.OpenAction)

Aggregations

OpenAction (org.kse.gui.actions.OpenAction)4 ImageIcon (javax.swing.ImageIcon)2 Container (java.awt.Container)1 FlowLayout (java.awt.FlowLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Toolkit (java.awt.Toolkit)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 File (java.io.File)1 List (java.util.List)1 AbstractAction (javax.swing.AbstractAction)1 BoxLayout (javax.swing.BoxLayout)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1