Search in sources :

Example 16 with JCheckBox

use of javax.swing.JCheckBox in project zaproxy by zaproxy.

the class OptionsApiPanel method getChkSecureOnly.

private JCheckBox getChkSecureOnly() {
    if (chkSecureOnly == null) {
        chkSecureOnly = new JCheckBox();
        chkSecureOnly.setText(Constant.messages.getString("api.options.secure"));
        chkSecureOnly.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        chkSecureOnly.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
    }
    return chkSecureOnly;
}
Also used : JCheckBox(javax.swing.JCheckBox)

Example 17 with JCheckBox

use of javax.swing.JCheckBox in project zaproxy by zaproxy.

the class OptionsApiPanel method getDisableKey.

private JCheckBox getDisableKey() {
    if (disableKey == null) {
        disableKey = new JCheckBox();
        disableKey.setText(Constant.messages.getString("api.options.disableKey"));
        disableKey.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        disableKey.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        disableKey.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                getKeyField().setEnabled(!disableKey.isSelected());
                getGenerateKeyButton().setEnabled(!disableKey.isSelected());
                if (!disableKey.isSelected()) {
                    // Repopulate the previously used value
                    getKeyField().setText(Model.getSingleton().getOptionsParam().getApiParam().getRealKey());
                }
            }
        });
    }
    return disableKey;
}
Also used : JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 18 with JCheckBox

use of javax.swing.JCheckBox in project zaproxy by zaproxy.

the class OptionsApiPanel method getReportPermErrors.

private JCheckBox getReportPermErrors() {
    if (reportPermErrors == null) {
        reportPermErrors = new JCheckBox();
        reportPermErrors.setText(Constant.messages.getString("api.options.reportPermErrors"));
        reportPermErrors.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        reportPermErrors.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
    }
    return reportPermErrors;
}
Also used : JCheckBox(javax.swing.JCheckBox)

Example 19 with JCheckBox

use of javax.swing.JCheckBox in project zaproxy by zaproxy.

the class OptionsApiPanel method getNoKeyForSafeOps.

private JCheckBox getNoKeyForSafeOps() {
    if (noKeyForSafeOps == null) {
        noKeyForSafeOps = new JCheckBox();
        noKeyForSafeOps.setText(Constant.messages.getString("api.options.noKeyForSafeOps"));
        noKeyForSafeOps.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        noKeyForSafeOps.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
    }
    return noKeyForSafeOps;
}
Also used : JCheckBox(javax.swing.JCheckBox)

Example 20 with JCheckBox

use of javax.swing.JCheckBox in project zaproxy by zaproxy.

the class ExtensionAutoUpdate method alertIfOutOfDate.

private void alertIfOutOfDate(boolean alwaysPrompt) {
    final OptionsParamCheckForUpdates options = getModel().getOptionsParam().getCheckForUpdatesParam();
    Date today = new Date();
    Date releaseCreated = Constant.getReleaseCreateDate();
    Date lastInstallWarning = options.getDayLastInstallWarned();
    int result = -1;
    logger.debug("Install created " + releaseCreated);
    if (releaseCreated != null) {
        // Should only be null for dev builds
        int daysOld = dayDiff(today, releaseCreated);
        logger.debug("Install is " + daysOld + " days old");
        if (daysOld > 365) {
            // Oh no, its more than a year old!
            boolean setCfuOnStart = false;
            if (alwaysPrompt || lastInstallWarning == null || dayDiff(today, lastInstallWarning) > 30) {
                JCheckBox cfuOnStart = new JCheckBox(Constant.messages.getString("cfu.label.cfuonstart"));
                cfuOnStart.setSelected(true);
                String msg = Constant.messages.getString("cfu.label.oldzap");
                result = View.getSingleton().showYesNoDialog(View.getSingleton().getMainFrame(), new Object[] { msg, cfuOnStart });
                setCfuOnStart = cfuOnStart.isSelected();
            }
            options.setDayLastInstallWarned();
            if (result == JOptionPane.OK_OPTION) {
                if (setCfuOnStart) {
                    options.setCheckOnStart(true);
                }
                getAddOnsDialog().setVisible(true);
                getAddOnsDialog().checkForUpdates();
            } else if (!oldZapAlertAdded) {
                JButton button = new JButton(Constant.messages.getString("cfu.label.outofdatezap"));
                button.setIcon(new ImageIcon(// Alert triangle
                ExtensionAutoUpdate.class.getResource("/resource/icon/16/050.png")));
                button.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        alertIfOutOfDate(true);
                    }
                });
                View.getSingleton().getMainFrame().getMainFooterPanel().addFooterToolbarLeftComponent(button);
                oldZapAlertAdded = true;
            }
            return;
        }
    }
    Date lastChecked = options.getDayLastChecked();
    Date lastUpdateWarning = options.getDayLastUpdateWarned();
    Date installDate = Constant.getInstallDate();
    if (installDate == null || dayDiff(today, installDate) < 90) {
    // Dont warn if installed in the last 3 months
    } else if (lastChecked == null || dayDiff(today, lastChecked) > 90) {
        // Not checked for updates in 3 months :(
        boolean setCfuOnStart = false;
        if (alwaysPrompt || lastUpdateWarning == null || dayDiff(today, lastUpdateWarning) > 30) {
            JCheckBox cfuOnStart = new JCheckBox(Constant.messages.getString("cfu.label.cfuonstart"));
            cfuOnStart.setSelected(true);
            String msg = Constant.messages.getString("cfu.label.norecentcfu");
            result = View.getSingleton().showYesNoDialog(View.getSingleton().getMainFrame(), new Object[] { msg, cfuOnStart });
            setCfuOnStart = cfuOnStart.isSelected();
        }
        options.setDayLastUpdateWarned();
        if (result == JOptionPane.OK_OPTION) {
            if (setCfuOnStart) {
                options.setCheckOnStart(true);
            }
            getAddOnsDialog().setVisible(true);
            getAddOnsDialog().checkForUpdates();
            if (noCfuAlertAdded) {
                View.getSingleton().getMainFrame().getMainFooterPanel().removeFooterToolbarLeftComponent(getOutOfDateButton());
            }
        } else if (!noCfuAlertAdded) {
            View.getSingleton().getMainFrame().getMainFooterPanel().addFooterToolbarLeftComponent(getOutOfDateButton());
            noCfuAlertAdded = true;
        }
    }
}
Also used : JCheckBox(javax.swing.JCheckBox) ImageIcon(javax.swing.ImageIcon) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Date(java.util.Date)

Aggregations

JCheckBox (javax.swing.JCheckBox)372 JPanel (javax.swing.JPanel)146 JLabel (javax.swing.JLabel)112 JButton (javax.swing.JButton)92 ActionEvent (java.awt.event.ActionEvent)71 ActionListener (java.awt.event.ActionListener)66 JTextField (javax.swing.JTextField)57 BorderLayout (java.awt.BorderLayout)52 GridBagConstraints (java.awt.GridBagConstraints)42 BoxLayout (javax.swing.BoxLayout)42 GridBagLayout (java.awt.GridBagLayout)39 Dimension (java.awt.Dimension)33 FlowLayout (java.awt.FlowLayout)31 Insets (java.awt.Insets)31 JScrollPane (javax.swing.JScrollPane)30 JRadioButton (javax.swing.JRadioButton)29 ItemEvent (java.awt.event.ItemEvent)26 ButtonGroup (javax.swing.ButtonGroup)25 ItemListener (java.awt.event.ItemListener)23 JComboBox (javax.swing.JComboBox)23