jTextFieldServerHost.setText(ApplicationProperties.getSmtpServerHost());
jTextFieldServerPort.setText(Integer.toString(ApplicationProperties.getSmtpServerPort()));
jCheckBoxEnableRemoteConnect.setSelected(ApplicationProperties.getSmtpEnebleRemoteConnect());
+ jTextFieldConfirmTimeout.setText(Integer.toString(ApplicationProperties.getConfirmTimeout()));
jCheckBoxLdap.setSelected(ApplicationProperties.getLdap());
jTextFieldProviderUrl.setText(ApplicationProperties.getLdapProviderURL());
if ( !ret ) {
jTextField.setBackground(Color.PINK);
if ( portNumberOutOfRangeErrorDialog == null ) {
- portNumberOutOfRangeErrorDialog =
+ portNumberOutOfRangeErrorDialog =
new MessageDialogUI(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.Port_number_is_integer_from_1_to_65535."),
null, MessageDialogUI.WARNING_MODE);
} else {
}
}
+ static private MessageDialogUI timeoutRangeErrorDialog = null;
+ class TimeoutNumberInputVerifier extends InputVerifier {
+ public boolean verify(JComponent jComponent) {
+ JTextField jTextField = (JTextField) jComponent;
+ boolean ret = true;
+ String input = jTextField.getText();
+
+ try {
+ int timeout = Integer.parseInt(input);
+ checkTimeoutRange(timeout);
+ } catch (Exception e) {
+ ret = false;
+ }
+
+ if ( !ret ) {
+ jTextField.setBackground(Color.PINK);
+ if ( timeoutRangeErrorDialog == null ) {
+ timeoutRangeErrorDialog =
+ new MessageDialogUI(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.exception.Timeout_need_to_a_positive_number"),
+ null, MessageDialogUI.WARNING_MODE);
+ } else {
+ timeoutRangeErrorDialog.setVisible(true);
+ }
+ } else {
+ jTextField.setBackground(Color.WHITE);
+ }
+
+ return ret;
+ }
+ }
+
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
jTextFieldServerHost = new javax.swing.JTextField();
jTextFieldServerPort = new javax.swing.JTextField();
jCheckBoxEnableRemoteConnect = new javax.swing.JCheckBox();
+ jLabel7 = new javax.swing.JLabel();
+ jTextFieldConfirmTimeout = new javax.swing.JTextField();
jPanelLDAP = new javax.swing.JPanel();
jCheckBoxLdap = new javax.swing.JCheckBox();
jLabel4 = new javax.swing.JLabel();
jTextFieldReceiverPort.setText(bundle.getString("ApplicationUI.jTextFieldReceiverPort.text")); // NOI18N
jTextFieldReceiverPort.setToolTipText(bundle.getString("ApplicationUI.jTextFieldReceiverPort.toolTipText")); // NOI18N
jTextFieldReceiverPort.setInputVerifier(new PortNumberInputVerifier());
+ jTextFieldReceiverPort.setMinimumSize(new java.awt.Dimension(1, 19));
jTextFieldServerHost.setText(bundle.getString("ApplicationUI.jTextFieldServerHost.text")); // NOI18N
jTextFieldServerHost.setToolTipText(bundle.getString("ApplicationUI.jTextFieldServerHost.toolTipText")); // NOI18N
+ jTextFieldServerHost.setMinimumSize(new java.awt.Dimension(1, 19));
jTextFieldServerPort.setText(bundle.getString("ApplicationUI.jTextFieldServerPort.text")); // NOI18N
jTextFieldServerPort.setToolTipText(bundle.getString("ApplicationUI.jTextFieldServerPort.toolTipText")); // NOI18N
jCheckBoxEnableRemoteConnect.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBoxEnableRemoteConnect.setMargin(new java.awt.Insets(0, 0, 0, 0));
+ jLabel7.setText(bundle.getString("ApplicationUI.jLabel7.text")); // NOI18N
+
+ jTextFieldConfirmTimeout.setText(bundle.getString("ApplicationUI.jTextFieldConfirmTimeout.text")); // NOI18N
+ jTextFieldConfirmTimeout.setToolTipText(bundle.getString("ApplicationUI.jTextFieldConfirmTimeout.toolTipText")); // NOI18N
+ jTextFieldConfirmTimeout.setInputVerifier(new TimeoutNumberInputVerifier()
+ );
+ jTextFieldConfirmTimeout.setMinimumSize(new java.awt.Dimension(1, 19));
+
org.jdesktop.layout.GroupLayout jPanelMailLayout = new org.jdesktop.layout.GroupLayout(jPanelMail);
jPanelMail.setLayout(jPanelMailLayout);
jPanelMailLayout.setHorizontalGroup(
.add(jPanelMailLayout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(jTextFieldReceiverPort, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jTextFieldReceiverPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 45, Short.MAX_VALUE)
.add(jCheckBoxEnableRemoteConnect))
.add(jPanelMailLayout.createSequentialGroup()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(jTextFieldServerHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
+ .add(jTextFieldServerHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(jTextFieldServerPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 54, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
+ .add(jTextFieldServerPort, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE))
+ .add(jPanelMailLayout.createSequentialGroup()
+ .add(jLabel7)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jTextFieldConfirmTimeout, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)))
.addContainerGap())
);
.add(jLabel3)
.add(jTextFieldServerHost, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jTextFieldServerPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(58, Short.MAX_VALUE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE)
+ .add(jPanelMailLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel7)
+ .add(jTextFieldConfirmTimeout, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap())
);
jTabbedPane.addTab(bundle.getString("ApplicationUI.jPanelMail.TabConstraints.tabTitle"), jPanelMail); // NOI18N
.add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel4))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(jTextFieldAttribute, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
- .add(jTextFieldBaseDn, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
+ .add(jTextFieldAttribute, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
+ .add(jTextFieldBaseDn, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
.add(jPanelLDAPLayout.createSequentialGroup()
- .add(jTextFieldProviderUrl, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)
+ .add(jTextFieldProviderUrl, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jCheckBoxIsSjis))))
.add(jPanelLDAPLayout.createSequentialGroup()
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.add(jButtonQuit)
- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 145, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 190, Short.MAX_VALUE)
.add(jButtonOK)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButtonCancel)
throw ex;
}
boolean enableRemoteConnect = jCheckBoxEnableRemoteConnect.isSelected();
-
+ int confirmTimeout;
+ try {
+ confirmTimeout = Integer.parseInt(jTextFieldConfirmTimeout.getText());
+ checkTimeoutRange(confirmTimeout);
+ } catch (NumberFormatException nfEx) {
+ jTextFieldConfirmTimeout.setBackground(Color.PINK);
+ throw nfEx;
+ }
+
boolean enableLdap = jCheckBoxLdap.isSelected();
String ldapUrl = jTextFieldProviderUrl.getText();
String rootDn = jTextFieldBaseDn.getText();
|| !serverHost.equals(ApplicationProperties.getSmtpServerHost())
|| serverPort != ApplicationProperties.getSmtpServerPort()
|| enableRemoteConnect != ApplicationProperties.getSmtpEnebleRemoteConnect()
-
+ || confirmTimeout != ApplicationProperties.getConfirmTimeout()
+
|| enableLdap != ApplicationProperties.getLdap()
|| !ldapUrl.equals(ApplicationProperties.getLdapProviderURL())
|| !rootDn.equals(ApplicationProperties.getLdapRoot())
ApplicationProperties.setSmtpServerHost(serverHost);
ApplicationProperties.setSmtpServerPort(serverPort);
ApplicationProperties.setSmtpEnableRemoteConnect(enableRemoteConnect);
+ ApplicationProperties.setConfirmTimeout(confirmTimeout);
ApplicationProperties.setLdap(enableLdap);
ApplicationProperties.setLdapProviderURL(ldapUrl);
smtpClient.configChangeNotify();
if ( !ApplicationProperties.save() ) {
new MessageDialogUI(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.error.Fail_the_properties_file_save."), null,
- MessageDialogUI.ERROR_MODE);
+ MessageDialogUI.ERROR_MODE);
} else {
iconified();
}
}//GEN-LAST:event_jButtonOKActionPerformed
/**
+ * Time out second is need to positive number
+ */
+ private void checkTimeoutRange(final int confirmTimeout) throws NumberFormatException {
+ if ( confirmTimeout < 0 ) {
+ throw new NumberFormatException(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle").getString("ApplicationUI.exception.Timeout_need_to_a_positive_number"));
+ }
+ }
+
+ /**
* Check port number range. It is unsigned short number.
* Argument is port number.
**/
TrayIcon trayIcon = new TrayIcon(loadIconImage(),
"mdc", popup);
trayIcon.setImageAutoSize(true);
-
+
MenuItem menuItemOpen = new MenuItem("Properties...");
menuItemOpen.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
+ private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabelProgramName;
private javax.swing.JLabel jLabelProgramVersion;
private javax.swing.JLabel jLabelSfURL;
private javax.swing.JTabbedPane jTabbedPane;
private javax.swing.JTextField jTextFieldAttribute;
private javax.swing.JTextField jTextFieldBaseDn;
+ private javax.swing.JTextField jTextFieldConfirmTimeout;
private javax.swing.JTextField jTextFieldProviderUrl;
private javax.swing.JTextField jTextFieldReceiverPort;
private javax.swing.JTextField jTextFieldServerHost;