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;
}
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;
}
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;
}
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;
}
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;
}
}
}
Aggregations