Support: Error message dialog.
Support: Port number range checking on setup window.
Support: I18N on Setup/Confirm windows.
<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="0"/>
- <Property name="title" type="java.lang.String" value="Mail Destination Confirm Properties"/>
+ <Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.title" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="jTabbedPane" alignment="0" max="32767" attributes="0"/>
+ <Component id="jTabbedPane" alignment="0" pref="400" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonQuit" linkSize="1" min="-2" max="-2" attributes="0"/>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Mail">
- <Property name="tabTitle" type="java.lang.String" value="Mail"/>
+ <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jPanelMail.TabConstraints.tabTitle" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
- <Property name="text" type="java.lang.String" value="Receiver Port:"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabel1.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
- <Property name="text" type="java.lang.String" value="Mail Server:"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabel2.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
- <Property name="text" type="java.lang.String" value="Port:"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabel3.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldReceiverPort">
<Properties>
- <Property name="text" type="java.lang.String" value="8725"/>
- <Property name="toolTipText" type="java.lang.String" value="Mail Destination Confirmer SMTP port number."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldReceiverPort.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldReceiverPort.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="inputVerifier" type="javax.swing.InputVerifier" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="new PortNumberInputVerifier()" type="code"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldServerHost">
<Properties>
- <Property name="text" type="java.lang.String" value="mail"/>
- <Property name="toolTipText" type="java.lang.String" value="Mail server host name or IP address."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldServerHost.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldServerHost.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldServerPort">
<Properties>
- <Property name="text" type="java.lang.String" value="25"/>
- <Property name="toolTipText" type="java.lang.String" value="Mail server port number."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldServerPort.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldServerPort.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="inputVerifier" type="javax.swing.InputVerifier" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="new PortNumberInputVerifier()" type="code"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBoxEnableRemoteConnect">
<Properties>
- <Property name="text" type="java.lang.String" value="Enable remote connect"/>
- <Property name="toolTipText" type="java.lang.String" value="Enable remote machine access this service. (Usually: disable)"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jCheckBoxEnableRemoteConnect.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jCheckBoxEnableRemoteConnect.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="LDAP">
- <Property name="tabTitle" type="java.lang.String" value="LDAP"/>
+ <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jPanelLDAP.TabConstraints.tabTitle" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="jCheckBoxLdap">
<Properties>
- <Property name="text" type="java.lang.String" value="Enable LDAP search"/>
- <Property name="toolTipText" type="java.lang.String" value="Enable LDAP configration."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jCheckBoxLdap.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jCheckBoxLdap.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
- <Property name="text" type="java.lang.String" value="URL:"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabel4.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
- <Property name="text" type="java.lang.String" value="Root DN:"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabel5.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
- <Property name="text" type="java.lang.String" value="Attribute:"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jLabel6.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldProviderUrl">
<Properties>
- <Property name="text" type="java.lang.String" value="ldap://localhost:389/"/>
- <Property name="toolTipText" type="java.lang.String" value="LDAP server URL."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldProviderUrl.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldProviderUrl.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldBaseDn">
<Properties>
- <Property name="text" type="java.lang.String" value="C=JP"/>
- <Property name="toolTipText" type="java.lang.String" value="LDAP search start DN."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldBaseDn.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldBaseDn.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldAttribute">
<Properties>
- <Property name="text" type="java.lang.String" value="cn"/>
- <Property name="toolTipText" type="java.lang.String" value="Display Attribuite. Example: cn title;lang-ja-jp"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldAttribute.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jTextFieldAttribute.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBoxIsSjis">
<Properties>
- <Property name="text" type="java.lang.String" value="Force SJIS"/>
- <Property name="toolTipText" type="java.lang.String" value="Check this, when LDAP server use Shift JIS on network."/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jCheckBoxIsSjis.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jCheckBoxIsSjis.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="0" left="0" right="0" top="0"/>
</Container>
<Component class="javax.swing.JButton" name="jButtonOK">
<Properties>
- <Property name="text" type="java.lang.String" value="OK"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jButtonOK.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jButtonOK.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
</Component>
<Component class="javax.swing.JButton" name="jButtonCancel">
<Properties>
- <Property name="text" type="java.lang.String" value="Cancel"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jButtonCancel.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jButtonCancel.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonCancelActionPerformed"/>
</Component>
<Component class="javax.swing.JButton" name="jButtonQuit">
<Properties>
- <Property name="text" type="java.lang.String" value="Quit"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jButtonQuit.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ApplicationUI.jButtonQuit.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonQuitActionPerformed"/>
package org.jent.checksmtp;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import javax.swing.InputVerifier;
+import javax.swing.JComponent;
import javax.swing.JFrame;
+import javax.swing.JTextField;
/**
*
public ApplicationUI() {
initComponents();
+ //set Focus
+ jButtonOK.requestFocusInWindow();
+ //getRootPane().setDefaultButton(jButtonOK);
+
resetDisplay();
}
}
+ static private MessageDialogUI portNumberOutOfRangeErrorDialog = null;
+ class PortNumberInputVerifier extends InputVerifier {
+ public boolean verify(JComponent jComponent) {
+ JTextField jTextField = (JTextField) jComponent;
+ boolean ret = true;
+ String input = jTextField.getText();
+
+ try {
+ int port = Integer.parseInt(input);
+ checkPortRange(port);
+ } catch (Exception e) {
+ ret = false;
+ }
+
+ if ( !ret ) {
+ jTextField.setBackground(Color.PINK);
+ if ( portNumberOutOfRangeErrorDialog == null ) {
+ portNumberOutOfRangeErrorDialog =
+ new MessageDialogUI("Port number is integer from 1 to 65535.",
+ null, MessageDialogUI.WARNING_MODE);
+ } else {
+ portNumberOutOfRangeErrorDialog.setVisible(true);
+ }
+ } else {
+ jTextField.setBackground(Color.WHITE);
+ }
+
+ return ret;
+ }
+ }
/** This method is called from within the constructor to
* initialize the form.
jButtonQuit = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
- setTitle("Mail Destination Confirm Properties");
+ java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle"); // NOI18N
+ setTitle(bundle.getString("ApplicationUI.title")); // NOI18N
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowDeiconified(java.awt.event.WindowEvent evt) {
formWindowDeiconified(evt);
}
});
- jLabel1.setText("Receiver Port:");
+ jLabel1.setText(bundle.getString("ApplicationUI.jLabel1.text")); // NOI18N
- jLabel2.setText("Mail Server:");
+ jLabel2.setText(bundle.getString("ApplicationUI.jLabel2.text")); // NOI18N
- jLabel3.setText("Port:");
+ jLabel3.setText(bundle.getString("ApplicationUI.jLabel3.text")); // NOI18N
- jTextFieldReceiverPort.setText("8725");
- jTextFieldReceiverPort.setToolTipText("Mail Destination Confirmer SMTP port number.");
+ jTextFieldReceiverPort.setText(bundle.getString("ApplicationUI.jTextFieldReceiverPort.text")); // NOI18N
+ jTextFieldReceiverPort.setToolTipText(bundle.getString("ApplicationUI.jTextFieldReceiverPort.toolTipText")); // NOI18N
+ jTextFieldReceiverPort.setInputVerifier(new PortNumberInputVerifier());
- jTextFieldServerHost.setText("mail");
- jTextFieldServerHost.setToolTipText("Mail server host name or IP address.");
+ jTextFieldServerHost.setText(bundle.getString("ApplicationUI.jTextFieldServerHost.text")); // NOI18N
+ jTextFieldServerHost.setToolTipText(bundle.getString("ApplicationUI.jTextFieldServerHost.toolTipText")); // NOI18N
- jTextFieldServerPort.setText("25");
- jTextFieldServerPort.setToolTipText("Mail server port number.");
+ jTextFieldServerPort.setText(bundle.getString("ApplicationUI.jTextFieldServerPort.text")); // NOI18N
+ jTextFieldServerPort.setToolTipText(bundle.getString("ApplicationUI.jTextFieldServerPort.toolTipText")); // NOI18N
+ jTextFieldServerPort.setInputVerifier(new PortNumberInputVerifier());
- jCheckBoxEnableRemoteConnect.setText("Enable remote connect");
- jCheckBoxEnableRemoteConnect.setToolTipText("Enable remote machine access this service. (Usually: disable)");
+ jCheckBoxEnableRemoteConnect.setText(bundle.getString("ApplicationUI.jCheckBoxEnableRemoteConnect.text")); // NOI18N
+ jCheckBoxEnableRemoteConnect.setToolTipText(bundle.getString("ApplicationUI.jCheckBoxEnableRemoteConnect.toolTipText")); // NOI18N
jCheckBoxEnableRemoteConnect.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBoxEnableRemoteConnect.setMargin(new java.awt.Insets(0, 0, 0, 0));
.add(jTextFieldServerPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap(74, Short.MAX_VALUE))
);
- jTabbedPane.addTab("Mail", jPanelMail);
+ jTabbedPane.addTab(bundle.getString("ApplicationUI.jPanelMail.TabConstraints.tabTitle"), jPanelMail); // NOI18N
- jCheckBoxLdap.setText("Enable LDAP search");
- jCheckBoxLdap.setToolTipText("Enable LDAP configration.");
+ jCheckBoxLdap.setText(bundle.getString("ApplicationUI.jCheckBoxLdap.text")); // NOI18N
+ jCheckBoxLdap.setToolTipText(bundle.getString("ApplicationUI.jCheckBoxLdap.toolTipText")); // NOI18N
jCheckBoxLdap.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBoxLdap.setMargin(new java.awt.Insets(0, 0, 0, 0));
jCheckBoxLdap.addChangeListener(new javax.swing.event.ChangeListener() {
}
});
- jLabel4.setText("URL:");
+ jLabel4.setText(bundle.getString("ApplicationUI.jLabel4.text")); // NOI18N
- jLabel5.setText("Root DN:");
+ jLabel5.setText(bundle.getString("ApplicationUI.jLabel5.text")); // NOI18N
- jLabel6.setText("Attribute:");
+ jLabel6.setText(bundle.getString("ApplicationUI.jLabel6.text")); // NOI18N
- jTextFieldProviderUrl.setText("ldap://localhost:389/");
- jTextFieldProviderUrl.setToolTipText("LDAP server URL.");
+ jTextFieldProviderUrl.setText(bundle.getString("ApplicationUI.jTextFieldProviderUrl.text")); // NOI18N
+ jTextFieldProviderUrl.setToolTipText(bundle.getString("ApplicationUI.jTextFieldProviderUrl.toolTipText")); // NOI18N
jTextFieldProviderUrl.setEnabled(false);
- jTextFieldBaseDn.setText("C=JP");
- jTextFieldBaseDn.setToolTipText("LDAP search start DN.");
+ jTextFieldBaseDn.setText(bundle.getString("ApplicationUI.jTextFieldBaseDn.text")); // NOI18N
+ jTextFieldBaseDn.setToolTipText(bundle.getString("ApplicationUI.jTextFieldBaseDn.toolTipText")); // NOI18N
jTextFieldBaseDn.setEnabled(false);
- jTextFieldAttribute.setText("cn");
- jTextFieldAttribute.setToolTipText("Display Attribuite. Example: cn title;lang-ja-jp");
+ jTextFieldAttribute.setText(bundle.getString("ApplicationUI.jTextFieldAttribute.text")); // NOI18N
+ jTextFieldAttribute.setToolTipText(bundle.getString("ApplicationUI.jTextFieldAttribute.toolTipText")); // NOI18N
jTextFieldAttribute.setEnabled(false);
- jCheckBoxIsSjis.setText("Force SJIS");
- jCheckBoxIsSjis.setToolTipText("Check this, when LDAP server use Shift JIS on network.");
+ jCheckBoxIsSjis.setText(bundle.getString("ApplicationUI.jCheckBoxIsSjis.text")); // NOI18N
+ jCheckBoxIsSjis.setToolTipText(bundle.getString("ApplicationUI.jCheckBoxIsSjis.toolTipText")); // NOI18N
jCheckBoxIsSjis.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBoxIsSjis.setEnabled(false);
jCheckBoxIsSjis.setMargin(new java.awt.Insets(0, 0, 0, 0));
.add(jTextFieldAttribute, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap(28, Short.MAX_VALUE))
);
- jTabbedPane.addTab("LDAP", jPanelLDAP);
+ jTabbedPane.addTab(bundle.getString("ApplicationUI.jPanelLDAP.TabConstraints.tabTitle"), jPanelLDAP); // NOI18N
- jButtonOK.setText("OK");
+ jButtonOK.setText(bundle.getString("ApplicationUI.jButtonOK.text")); // NOI18N
+ jButtonOK.setToolTipText(bundle.getString("ApplicationUI.jButtonOK.toolTipText")); // NOI18N
jButtonOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonOKActionPerformed(evt);
}
});
- jButtonCancel.setText("Cancel");
+ jButtonCancel.setText(bundle.getString("ApplicationUI.jButtonCancel.text")); // NOI18N
+ jButtonCancel.setToolTipText(bundle.getString("ApplicationUI.jButtonCancel.toolTipText")); // NOI18N
jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCancelActionPerformed(evt);
}
});
- jButtonQuit.setText("Quit");
+ jButtonQuit.setText(bundle.getString("ApplicationUI.jButtonQuit.text")); // NOI18N
+ jButtonQuit.setToolTipText(bundle.getString("ApplicationUI.jButtonQuit.toolTipText")); // NOI18N
jButtonQuit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonQuitActionPerformed(evt);
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(jTabbedPane)
+ .add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.add(jButtonQuit)
);
pack();
}// </editor-fold>//GEN-END:initComponents
-
+
private void formWindowDeiconified(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowDeiconified
setTitle("Mail Destination Confirm Properties");
+ jButtonOK.requestFocusInWindow();
}//GEN-LAST:event_formWindowDeiconified
-
+
private void formWindowIconified(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowIconified
setTitle("mdc");
}//GEN-LAST:event_formWindowIconified
-
+
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
int port;
try {
port = Integer.parseInt(jTextFieldReceiverPort.getText());
+ checkPortRange(port);
} catch (NumberFormatException ex) {
- ex.printStackTrace();
- port = ApplicationProperties.getSmtpPort(); //last saved value.
- jTextFieldReceiverPort.setText(Integer.toString(port));
+ jTextFieldReceiverPort.setBackground(Color.PINK);
+ throw ex;
}
String serverHost = jTextFieldServerHost.getText();
int serverPort;
try {
serverPort = Integer.parseInt(jTextFieldServerPort.getText());
+ checkPortRange(serverPort);
} catch (NumberFormatException ex) {
- ex.printStackTrace();
- serverPort = ApplicationProperties.getSmtpServerPort(); //last saved value.
- jTextFieldServerPort.setText(Integer.toString(serverPort));
+ jTextFieldServerPort.setBackground(Color.PINK);
+ throw ex;
}
boolean enableRemoteConnect = jCheckBoxEnableRemoteConnect.isSelected();
smtpClient.configChangeNotify();
if ( !ApplicationProperties.save() ) {
- //TODO: Display Save error Dialog.
+ new MessageDialogUI("Fail the properties file save.", null,
+ MessageDialogUI.ERROR_MODE);
+ } else {
+ iconified();
}
+ } else {
+ iconified();
}
- iconified();
-
}//GEN-LAST:event_jButtonOKActionPerformed
+
+ /**
+ * Check port number range. It is unsigned short number.
+ * Argument is port number.
+ **/
+ private void checkPortRange(final int port) {
+ if ( port <= 0 || port > 65535 ) {
+ throw new NumberFormatException("Out of range.");
+ }
+ }
private void jButtonQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonQuitActionPerformed
System.exit(0);
}//GEN-LAST:event_jButtonQuitActionPerformed
private void jCheckBoxLdapStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jCheckBoxLdapStateChanged
-// TODO add your handling code here:
boolean check = jCheckBoxLdap.isSelected();
jTextFieldProviderUrl.setEnabled(check);
jTextFieldBaseDn.setEnabled(check);
}//GEN-LAST:event_jCheckBoxLdapStateChanged
private void jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
-// TODO add your handling code here:
//this.setVisible(false);
resetDisplay();
+ if ( portNumberOutOfRangeErrorDialog != null && portNumberOutOfRangeErrorDialog.isVisible() ) {
+ portNumberOutOfRangeErrorDialog.dispose();
+ }
iconified();
}//GEN-LAST:event_jButtonCancelActionPerformed
//Unexpect logic. Because this method call from pushed "OK" button.
x = getX();
y = getY();
- }
+ }
int h = this.getHeight();
int w = this.getWidth();
boolean modified = false;
tray.add(trayIcon);
useSystemTray = true;
}
- */
- } catch (ClassNotFoundException ex) {
- // Do not support SystemTray on this VM.
+ */
+ } catch (ClassNotFoundException ex) {
+ // Do not support SystemTray on this VM.
+ }
+ return useSystemTray;
}
- return useSystemTray;
-}
-
-private void iconified() {
- if ( useSystemTray ) {
- this.setVisible(false);
- } else {
- this.setExtendedState(ICONIFIED);
+
+ private void iconified() {
+ if ( useSystemTray ) {
+ this.setVisible(false);
+ } else {
+ this.setExtendedState(ICONIFIED);
+ }
}
-}
-
-/**
- * @param args the command line arguments
- */
-public static void main(String args[]) {
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
/* TKYN OLD
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
e.printStackTrace();
}
*/
-
- //TKYN ORIGNAL BLOCK
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- ApplicationUI applicationUI = new ApplicationUI();
- applicationUI.setVisible(true);
-
- applicationUI.useSystemTray = applicationUI.initSystemTray();
-
- //If exsist configuration file, iconise at start up.
- if ( ApplicationProperties.isFileLoaded() ) {
- int x = ApplicationProperties.getConfigDialogPosX();
- int y = ApplicationProperties.getConfigDialogPosY();
- int w = ApplicationProperties.getConfigDialogPosW();
- int h = ApplicationProperties.getConfigDialogPosH();
+
+ //TKYN ORIGNAL BLOCK
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ ApplicationUI applicationUI = new ApplicationUI();
+ applicationUI.setVisible(true);
- if ( x > screenSize.width ) {
- x = screenSize.width - w;
- if ( x < 0 ) { x = 0; };
- }
- if ( y > screenSize.height ) {
- y = screenSize.height - h;
- if ( y < 0 ) { y = 0; };
- }
- applicationUI.setBounds(x, y, w, h);
- applicationUI.iconified();
- } else {
- //No Configuration file.
- Dimension frameSize = ApplicationProperties.getConfigurationDialogSize();
- if (frameSize.height > screenSize.height) {
- frameSize.height = screenSize.height;
- }
- if (frameSize.width > screenSize.width) {
- frameSize.width = screenSize.width;
- }
+ applicationUI.useSystemTray = applicationUI.initSystemTray();
- applicationUI.setBounds(
- (screenSize.width - frameSize.width) / 2,
- (screenSize.height - frameSize.height) / 2,
- frameSize.width, frameSize.height );
+ //If exsist configuration file, iconise at start up.
+ if ( ApplicationProperties.isFileLoaded() ) {
+ int x = ApplicationProperties.getConfigDialogPosX();
+ int y = ApplicationProperties.getConfigDialogPosY();
+ int w = ApplicationProperties.getConfigDialogPosW();
+ int h = ApplicationProperties.getConfigDialogPosH();
+
+ if ( x > screenSize.width ) {
+ x = screenSize.width - w;
+ if ( x < 0 ) { x = 0; };
+ }
+ if ( y > screenSize.height ) {
+ y = screenSize.height - h;
+ if ( y < 0 ) { y = 0; };
+ }
+ applicationUI.setBounds(x, y, w, h);
+ applicationUI.iconified();
+ } else {
+ //No Configuration file.
+ Dimension frameSize = ApplicationProperties.getConfigurationDialogSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+
+ applicationUI.setBounds(
+ (screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2,
+ frameSize.width, frameSize.height );
+ }
}
- }
- });
+ });
+
+ smtpClient = new SMTPclient();
+ }
+ private static SMTPclient smtpClient = null;
+ private boolean useSystemTray = false;
- smtpClient = new SMTPclient();
-}
-private static SMTPclient smtpClient = null;
-private boolean useSystemTray = false;
-
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonCancel;
private javax.swing.JButton jButtonOK;
--- /dev/null
+# Sample ResourceBundle properties file\r
+\r
+ApplicationUI.jPanelMail.TabConstraints.tabTitle=Mail\r
+\r
+ApplicationUI.jCheckBoxLdap.toolTipText=Enable LDAP configration.\r
+\r
+ApplicationUI.jCheckBoxLdap.text=Enable LDAP search\r
+\r
+ApplicationUI.jTextFieldServerHost.toolTipText=Mail server host name or IP address.\r
+\r
+ApplicationUI.jTextFieldServerHost.text=mail\r
+\r
+ApplicationUI.jCheckBoxIsSjis.toolTipText=Check this, when LDAP server use Shift JIS on network.\r
+\r
+ApplicationUI.jCheckBoxIsSjis.text=Force SJIS\r
+\r
+ApplicationUI.jLabel1.text=Receiver Port\:\r
+\r
+ApplicationUI.jPanelLDAP.TabConstraints.tabTitle=LDAP\r
+\r
+ApplicationUI.jTextFieldServerPort.toolTipText=Mail server port number.\r
+\r
+ApplicationUI.jTextFieldServerPort.text=25\r
+\r
+ApplicationUI.jLabel6.text=Attribute\:\r
+\r
+ApplicationUI.jButtonQuit.text=Quit\r
+\r
+ApplicationUI.jLabel4.text=URL\:\r
+\r
+ApplicationUI.jTextFieldProviderUrl.toolTipText=LDAP server URL.\r
+\r
+ApplicationUI.jTextFieldProviderUrl.text=ldap\://localhost\:389/\r
+\r
+ApplicationUI.jLabel2.text=Mail Server\:\r
+\r
+ApplicationUI.jCheckBoxEnableRemoteConnect.toolTipText=Enable remote machine access this service. (Usually\: disable)\r
+\r
+ApplicationUI.jCheckBoxEnableRemoteConnect.text=Enable remote connect\r
+\r
+ApplicationUI.jButtonCancel.text=Cancel\r
+\r
+ApplicationUI.jLabel3.text=Port\:\r
+\r
+ApplicationUI.title=Mail Destination Confirm Properties\r
+\r
+ApplicationUI.jLabel5.text=Root DN\:\r
+\r
+ApplicationUI.jTextFieldBaseDn.toolTipText=LDAP search start DN.\r
+\r
+ApplicationUI.jTextFieldBaseDn.text=C\=JP\r
+\r
+ApplicationUI.jButtonOK.text=OK\r
+\r
+ApplicationUI.jTextFieldAttribute.toolTipText=Display Attribuite. Example\: cn title;lang-ja-jp\r
+\r
+ApplicationUI.jTextFieldAttribute.text=cn\r
+\r
+ApplicationUI.jTextFieldReceiverPort.toolTipText=Mail Destination Confirmer SMTP port number.\r
+\r
+ApplicationUI.jTextFieldReceiverPort.text=8725\r
+\r
+MessageDialogUI.jButtonDetail.text=Detail<<\r
+MessageDialogUI.jButtonOK.text=Close\r
+\r
+MessageDialogUI.title=Message - mdc\r
+\r
+MessageDialogUI.jTextAreaStack.text=This is Stack Trace aria.\r
+\r
+MessageDialogUI.jTextAreaMessage.text=System Fatal Error was ocurred.\r
+\r
+ToListUI.title=Confirm Distination Address\r
+\r
+ToListUI.jButtonCancel.text=Cancel\r
+\r
+ToListUI.jButtonOK.text=OK\r
+\r
+MessageDialogUI.jButtonDetail.text.open=Detail>>\r
+\r
+MessageDialogUI.title.Error_mdc=Error - mdc\r
+\r
+MessageDialogUI.title.Warning_mdc=Warning - mdc\r
+\r
+MessageDialogUI.title.Information_mdc=Information - mdc\r
+\r
+ApplicationUI.jButtonQuit.toolTipText=Stop mdc program.\r
+\r
+ApplicationUI.jButtonOK.toolTipText=\r
+\r
+ApplicationUI.jButtonCancel.toolTipText=\r
--- /dev/null
+# Sample ResourceBundle properties file\r
+\r
+ApplicationUI.jPanelMail.TabConstraints.tabTitle=\u30E1\u30FC\u30EB\r
+\r
+ApplicationUI.jCheckBoxLdap.toolTipText=\u30C1\u30A7\u30C3\u30AF\u3059\u308B\u3068LDAP\u306E\u8A2D\u5B9A\u304C\u6709\u52B9\u306B\u306A\u308B\u3002\r
+\r
+ApplicationUI.jCheckBoxLdap.text=LDAP\u691C\u7D22\r
+\r
+ApplicationUI.jTextFieldServerHost.toolTipText=\u30E1\u30FC\u30EB\u30B5\u30FC\u30D0\u306E\u30DB\u30B9\u30C8\u540D\u304BIP\u30A2\u30C9\u30EC\u30B9\r
+\r
+ApplicationUI.jTextFieldServerHost.text=mail\r
+\r
+ApplicationUI.jCheckBoxIsSjis.toolTipText=\u30C1\u30A7\u30C3\u30AF\u3059\u308B\u3068\u5F37\u5236\u7684\u306BLDAP\u30B5\u30FC\u30D0\u3068\u306E\u901A\u4FE1\u3092Shift JIS\u3067\u884C\u3046\u3002\r
+\r
+ApplicationUI.jCheckBoxIsSjis.text=SJIS\u3067\u901A\u4FE1\r
+\r
+ApplicationUI.jLabel1.text=\u53D7\u4FE1\u30DD\u30FC\u30C8\:\r
+\r
+ApplicationUI.jPanelLDAP.TabConstraints.tabTitle=LDAP\r
+\r
+ApplicationUI.jTextFieldServerPort.toolTipText=\u30E1\u30FC\u30EB\u30B5\u30FC\u30D0\u306E\u30DD\u30FC\u30C8\u756A\u53F7\r
+\r
+ApplicationUI.jTextFieldServerPort.text=25\r
+\r
+ApplicationUI.jLabel6.text=LDAP\u5C5E\u6027\:\r
+\r
+ApplicationUI.jButtonQuit.text=\u7D42\u4E86\r
+\r
+ApplicationUI.jLabel4.text=URL\:\r
+\r
+ApplicationUI.jTextFieldProviderUrl.toolTipText=LDAP\u30B5\u30FC\u30D0\u306EURL\r
+\r
+ApplicationUI.jTextFieldProviderUrl.text=ldap\://localhost\:389/\r
+\r
+ApplicationUI.jLabel2.text=\u30E1\u30FC\u30EB\u30B5\u30FC\u30D0\:\r
+\r
+ApplicationUI.jCheckBoxEnableRemoteConnect.toolTipText=\u30C1\u30A7\u30C3\u30AF\u3059\u308B\u3068\u30EA\u30E2\u30FC\u30C8\u304B\u3089\u306E\u63A5\u7D9A\u3092\u8A31\u53EF\u3059\u308B\u3002(\u901A\u5E38\u306F\u30C1\u30A7\u30C3\u30AF\u3057\u306A\u3044)\r
+\r
+ApplicationUI.jCheckBoxEnableRemoteConnect.text=\u30EA\u30E2\u30FC\u30C8\u63A5\u7D9A\u8A31\u53EF\r
+\r
+ApplicationUI.jButtonCancel.text=\u4E2D\u6B62\r
+\r
+ApplicationUI.jLabel3.text=\u53D7\u4FE1\u30DD\u30FC\u30C8\:\r
+\r
+ApplicationUI.title=\u30E1\u30FC\u30EB\u9001\u4FE1\u5148\u78BA\u8A8D\u30D7\u30ED\u30B0\u30E9\u30E0\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\r
+\r
+ApplicationUI.jLabel5.text=Root DN\:\r
+\r
+ApplicationUI.jTextFieldBaseDn.toolTipText=LDAP\u3067\u691C\u7D22\u3092\u958B\u59CB\u3059\u308BDN\r
+\r
+ApplicationUI.jTextFieldBaseDn.text=C\=JP\r
+\r
+ApplicationUI.jButtonOK.text=OK\r
+\r
+ApplicationUI.jTextFieldAttribute.toolTipText=\u8868\u793A\u3059\u308BLDAP\u5C5E\u6027 \u4F8B\: cn title;lang-ja-jp\r
+\r
+ApplicationUI.jTextFieldAttribute.text=cn\r
+\r
+ApplicationUI.jTextFieldReceiverPort.toolTipText=\u30E1\u30FC\u30EB\u9001\u4FE1\u5148\u78BA\u8A8D\u30D7\u30ED\u30B0\u30E9\u30E0\u304C\u5F85\u3061\u3046\u3051\u3059\u308B\u30DD\u30FC\u30C8\u756A\u53F7\r
+\r
+ApplicationUI.jTextFieldReceiverPort.text=8725\r
+\r
+MessageDialogUI.jButtonDetail.text=\u8A73\u7D30<<\r
+\r
+ToListUI.title=\u30E1\u30FC\u30EB\u9001\u4FE1\u5148\u78BA\u8A8D\r
+\r
+ToListUI.jButtonCancel.text=\u4E2D\u6B62\r
+\r
+ToListUI.jButtonOK.text=\u9001\u4FE1\r
+\r
+MessageDialogUI.jButtonOK.text=\u9589\u3058\u308B\r
+\r
+MessageDialogUI.jButtonDetail.text.open=\u8A73\u7D30>>\r
+\r
+MessageDialogUI.title.Error_mdc=\u30A8\u30E9\u30FC \u30E1\u30FC\u30EB\u9001\u4FE1\u5148\u78BA\u8A8D\u30D7\u30ED\u30B0\u30E9\u30E0\r
+\r
+MessageDialogUI.title.Information_mdc=\u60C5\u5831 \u30E1\u30FC\u30EB\u9001\u4FE1\u5148\u78BA\u8A8D\u30D7\u30ED\u30B0\u30E9\u30E0\r
+\r
+MessageDialogUI.title.Warning_mdc=\u8B66\u544A \u30E1\u30FC\u30EB\u9001\u4FE1\u5148\u30D7\u30ED\u30B0\u30E9\u30E0\r
+ApplicationUI.jButtonQuit.toolTipText=\u30D7\u30ED\u30B0\u30E9\u30E0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002\r
+\r
+ApplicationUI.jButtonOK.toolTipText=\u8A2D\u5B9A\u3092\u6709\u52B9\u306B\u3057\u307E\u3059\u3002\r
+\r
+ApplicationUI.jButtonCancel.toolTipText=\u4ECA\u56DE\u306E\u8A2D\u5B9A\u3092\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3059\u3002\r
public class LDAPSearch {
static private InitialDirContext ctx = null;
static private String lastProviderUrl = null;
-
+ static private MessageDialogUI initErrorDialog = null;
+
private LDAPSearch() {
}
ctx = new InitialDirContext(env);
} catch (NamingException e) {
- System.err.println("LDAPSearch init error.");
+ String errorMessage = "LDAPSearch init error.";
+ System.err.println(errorMessage);
lastProviderUrl = null;
e.printStackTrace();
+ displayErrorDialog(errorMessage, e);
}
}
}
}
+
+ /**
+ * Display error dialog and devide too many LDAP error dialogs.
+ */
+ private static void displayErrorDialog(final String errorMessage, final Exception e) {
+ if ( initErrorDialog == null || !initErrorDialog.isVisible() ) {
+ //Not displaying on screen.
+ initErrorDialog = new MessageDialogUI(errorMessage, e,
+ MessageDialogUI.ERROR_MODE);
+ }
+ }
/**
* LDAP connection close.
}
catch (NamingException e)
{
- System.err.println("LDAPSearch init error.");
- e.printStackTrace();
+ System.err.println("Ignore LDAPSearch close error.");
+ //e.printStackTrace();
}
}
System.out.println("LDAP Search Name Not Found.");
//IGNORE Exception
} catch (NamingException e) {
- System.err.println("LDAP Search Error.");
+ String errorMessage = "LDAP Search Error.";
+ System.err.println(errorMessage);
e.printStackTrace();
//ctx reflesh
close();
- } catch (UnsupportedEncodingException ueEx) {
+ displayErrorDialog(errorMessage, e);
+ } catch (UnsupportedEncodingException ueEx) { //Unexpected.
UnsupportedEncodingException e = ueEx;
System.err.println("LDAP SJIS Error.");
e.printStackTrace();
} catch (NullPointerException npEx) { //for failsafe.
+ String errorMessage = "LDAP Unexpected Error.";
NullPointerException e = npEx;
- System.err.println("LDAP Unexpected Error.");
+ System.err.println(errorMessage);
e.printStackTrace();
+ displayErrorDialog(errorMessage, e);
}
return ans;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="MessageDialogUI.title" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jScrollPaneStack" alignment="0" pref="398" max="32767" attributes="0"/>
+ <Group type="102" alignment="1" attributes="0">
+ <Component id="jButtonDetail" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="238" max="32767" attributes="0"/>
+ <Component id="jButtonOK" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jScrollPane1" alignment="0" pref="398" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jButtonOK" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jButtonDetail" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
+ <Component id="jScrollPaneStack" pref="176" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="jTextAreaMessage">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="lineWrap" type="boolean" value="true"/>
+ <Property name="rows" type="int" value="3"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="MessageDialogUI.jTextAreaMessage.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ <Property name="focusable" type="boolean" value="false"/>
+ <Property name="requestFocusEnabled" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="jButtonOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="MessageDialogUI.jButtonOK.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButtonDetail">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="MessageDialogUI.jButtonDetail.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonDetailActionPerformed"/>
+ </Events>
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="jScrollPaneStack">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="jTextAreaStack">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="rows" type="int" value="5"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="MessageDialogUI.jTextAreaStack.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
--- /dev/null
+/*
+ * MessageDialogUI.java
+ *
+ * Created on 2007/08/14, 14:31
+ */
+
+package org.jent.checksmtp;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.swing.JFrame;
+
+/**
+ *
+ * @author tkyn
+ */
+public class MessageDialogUI extends javax.swing.JFrame {
+ static final int ERROR_MODE = 0;
+ static final int WARNING_MODE = 1;
+ static final int INFORMATION_MODE = 2;
+
+ static final String MSG_DETAIL_OPEN = java.util.ResourceBundle
+ .getBundle("org/jent/checksmtp/Bundle")
+ .getString("MessageDialogUI.jButtonDetail.text.open");
+ static final String MSG_DETAIL_CLOSE = java.util.ResourceBundle
+ .getBundle("org/jent/checksmtp/Bundle")
+ .getString("MessageDialogUI.jButtonDetail.text");
+
+ static private boolean detailOpen = true;
+
+ public boolean setDetailOpen(boolean flg) {
+ boolean old = detailOpen;
+ detailOpen = flg;
+ return old;
+ }
+
+ /* Not use yet.
+ public String setMessage(String newMessage) {
+ String oldMessage = jTextAreaMessage.getText();
+ jTextAreaMessage.setText(newMessage);
+ return oldMessage;
+ }
+ */
+
+ /** Creates new form MessageDialogUI */
+ public MessageDialogUI(String message, Throwable ex, int mode) {
+ super(); //paranoia statement.
+
+ initComponents();
+
+ //move to Forcus
+ jButtonOK.requestFocusInWindow();
+ //getRootPane().setDefaultButton(jButtonOK);
+
+ jTextAreaMessage.setText(message); //NEEDCARE null string.
+ if ( ex == null ) {
+ jButtonDetail.setEnabled(false);
+ jButtonDetail.setText(MSG_DETAIL_OPEN);
+ jScrollPaneStack.setVisible(false);
+ pack();
+ } else {
+ StringWriter stackTraceMessageWriter = new StringWriter();
+ ex.printStackTrace(new PrintWriter(stackTraceMessageWriter));
+ stackTraceMessageWriter.flush();
+ jTextAreaStack.setText(stackTraceMessageWriter.toString());
+
+ if (!detailOpen) {
+ jButtonDetail.setText(MSG_DETAIL_OPEN);
+ jScrollPaneStack.setVisible(false);
+ pack();
+ }
+ }
+ switch (mode) {
+ case ERROR_MODE:
+ setTitle(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle")
+ .getString("MessageDialogUI.title.Error_mdc"));
+ break;
+ case WARNING_MODE:
+ setTitle(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle")
+ .getString("MessageDialogUI.title.Warning_mdc"));
+ break;
+ case INFORMATION_MODE:
+ setTitle(java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle")
+ .getString("MessageDialogUI.title.Information_mdc"));
+ break;
+ //Default is "Message - mdc"
+ }
+
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = getSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+ this.setBounds(
+ (screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2,
+ frameSize.width, frameSize.height );
+
+ setVisible(true);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jPanel1 = new javax.swing.JPanel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTextAreaMessage = new javax.swing.JTextArea();
+ jButtonOK = new javax.swing.JButton();
+ jButtonDetail = new javax.swing.JButton();
+ jScrollPaneStack = new javax.swing.JScrollPane();
+ jTextAreaStack = new javax.swing.JTextArea();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle"); // NOI18N
+ setTitle(bundle.getString("MessageDialogUI.title")); // NOI18N
+ jTextAreaMessage.setColumns(20);
+ jTextAreaMessage.setEditable(false);
+ jTextAreaMessage.setLineWrap(true);
+ jTextAreaMessage.setRows(3);
+ jTextAreaMessage.setText(bundle.getString("MessageDialogUI.jTextAreaMessage.text")); // NOI18N
+ jTextAreaMessage.setFocusable(false);
+ jTextAreaMessage.setRequestFocusEnabled(false);
+ jScrollPane1.setViewportView(jTextAreaMessage);
+
+ jButtonOK.setText(bundle.getString("MessageDialogUI.jButtonOK.text")); // NOI18N
+ jButtonOK.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonOKActionPerformed(evt);
+ }
+ });
+
+ jButtonDetail.setText(bundle.getString("MessageDialogUI.jButtonDetail.text")); // NOI18N
+ jButtonDetail.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonDetailActionPerformed(evt);
+ }
+ });
+
+ jTextAreaStack.setColumns(20);
+ jTextAreaStack.setEditable(false);
+ jTextAreaStack.setRows(5);
+ jTextAreaStack.setText(bundle.getString("MessageDialogUI.jTextAreaStack.text")); // NOI18N
+ jScrollPaneStack.setViewportView(jTextAreaStack);
+
+ org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPaneStack, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
+ .add(jPanel1Layout.createSequentialGroup()
+ .add(jButtonDetail)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 238, Short.MAX_VALUE)
+ .add(jButtonOK))
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jButtonOK)
+ .add(jButtonDetail))
+ .add(18, 18, 18)
+ .add(jScrollPaneStack, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void jButtonDetailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDetailActionPerformed
+ if( detailOpen ) {
+ jScrollPaneStack.setVisible(false);
+ jButtonDetail.setText(MSG_DETAIL_OPEN);
+ detailOpen = false;
+ } else {
+ jScrollPaneStack.setVisible(true);
+ jButtonDetail.setText(MSG_DETAIL_CLOSE);
+ detailOpen = true;
+ }
+ pack();
+ }//GEN-LAST:event_jButtonDetailActionPerformed
+
+ private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
+ dispose();
+ }//GEN-LAST:event_jButtonOKActionPerformed
+
+ /**
+ * @param args the command line arguments
+ *
+ * public static void main(String args[]) {
+ * java.awt.EventQueue.invokeLater(new Runnable() {
+ * public void run() {
+ * new MessageDialogUI().setVisible(true);
+ * }
+ * });
+ * }
+ */
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButtonDetail;
+ private javax.swing.JButton jButtonOK;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JScrollPane jScrollPaneStack;
+ private javax.swing.JTextArea jTextAreaMessage;
+ private javax.swing.JTextArea jTextAreaStack;
+ // End of variables declaration//GEN-END:variables
+
+}
client.close();
client = null;
} catch (IOException e) {
- System.err.println("Execption occurred in Processer.");
- //TODO: Display error Dialog.
- e.printStackTrace();
+ String errorMessage = "Execption occurred at starting SMTP thread.";
+ System.err.println(errorMessage);
+ new MessageDialogUI(errorMessage, e, MessageDialogUI.ERROR_MODE);
+ } catch (RuntimeException runEx) {
+ new MessageDialogUI("Runtime Exception occurred in SMTP parse",
+ runEx, MessageDialogUI.ERROR_MODE);
} finally {
//for failsafe Socket close.
if (server != null) {
}
}
} catch (IOException e) {
- e.printStackTrace();
+ String errorMessage = "Error occurred in SMTP parse.";
+ System.err.println(errorMessage);
+ new MessageDialogUI(errorMessage, e, MessageDialogUI.ERROR_MODE);
+ } catch (RuntimeException runEx) {
+ new MessageDialogUI("Runtime Exception occurred in SMTP parse",
+ runEx, MessageDialogUI.ERROR_MODE);
}
System.out.println("End of Session.");
private boolean isConfigChange = false;
private boolean fatalError = false;
private Thread serviceThread = null;
-
- public SMTPclient() {
+
+ public SMTPclient() {
startServiceThread();
- }
-
+ }
+
private void startServiceThread() {
if ( serviceThread !=null && serviceThread.isAlive() ) {
//Still service thread was working.
serviceThread = new Thread(this);
serviceThread.start();
}
-
+
public void configChangeNotify() {
isConfigChange = true;
- if ( serviceThread !=null && !serviceThread.isAlive() ) {
+ if ( serviceThread !=null && !serviceThread.isAlive() ) {
startServiceThread();
}
}
+
+ public void run() {
+ while (!fatalError) {
+ ServerSocket server = null;
- public void run() {
- while (!fatalError) {
- ServerSocket server = null;
-
- try {
- // Server Port
- int serverport = ApplicationProperties.getSmtpPort();
- System.err.println("Open SMTP waiting port. " + serverport);
-
- try {
- if ( ApplicationProperties.getSmtpEnebleRemoteConnect() ) {
- System.out.println("Enable remote connection.");
- server = new ServerSocket(serverport, 10); //TODO: Backlog Configuable
- } else {
- server = new ServerSocket(serverport, 10, //TODO: Backlog Configuable
- InetAddress.getByAddress(
- new byte[] { 127, 0, 0, 1 }));
- }
- } catch (IOException e) {
- fatalError = true;
- System.err.println("Fatal Error Occurred. Stop service.");
- //TODO: Display error dialog.
- e.printStackTrace(); //Unexpected!!
- break;
- } catch (IllegalArgumentException iaEx) {
- //Port value out of range
- fatalError = true;
- System.err.println("Faital Error Occurted(" + iaEx.getMessage() + "). Stop service." );
- //TODO: Display error dialog.
- iaEx.printStackTrace();
- break;
- }
-
- acceptWait:
- while (true) {
- // Wait connect from mail client
- server.setSoTimeout(1000); //TODO: Configuable accept wait time.
- Socket client;
- try {
- client = server.accept();
- } catch (SocketTimeoutException ex) {
- //Check interupt
- if ( isConfigChange ) {
- System.err.println("Configuration change restart service.");
- isConfigChange = false;
- server.close();
- break; // renew ServerSocket
- }
- continue;
- }
- System.err.println("Accept new STMP socket.");
- Processer processer = new Processer(client);
- Thread clientThread = new Thread(processer);
- clientThread.start();
- }
- } catch (IOException e) {
- e.printStackTrace();
- System.err.println("Continure waiting SMTP client.");
-
- try {
- server.close();
- } catch (IOException ioe) {
- //IGNORE close Exception
- }
- } catch (RuntimeException rEx) {
- fatalError = true;
- System.err.println("Runtime Exception was occurred.");
- rEx.printStackTrace();
- //TODO: Display error dialog.
- break;
- }
+ try {
+ // Server Port
+ int serverport = ApplicationProperties.getSmtpPort();
+ System.err.println("Open SMTP waiting port. " + serverport);
+
+ try {
+ if ( ApplicationProperties.getSmtpEnebleRemoteConnect() ) {
+ System.out.println("Enable remote connection.");
+ server = new ServerSocket(serverport, 10); //TODO: Backlog Configuable
+ } else {
+ server = new ServerSocket(serverport, 10, //TODO: Backlog Configuable
+ InetAddress.getByAddress(
+ new byte[] { 127, 0, 0, 1 }));
+ }
+ } catch (IOException e) {
+ fatalError = true;
+ String errorMessage = "Fatal Error Occurred. Stop service.";
+ System.err.println(errorMessage);
+ new MessageDialogUI(errorMessage, e, MessageDialogUI.ERROR_MODE);
+ break;
+ } catch (IllegalArgumentException iaEx) {
+ //Port value out of range
+ fatalError = true;
+ String errorMessage = "Argument Error Occurted(" + iaEx.getMessage() +
+ "). Stop service.";
+ System.err.println(errorMessage);
+ new MessageDialogUI(errorMessage, iaEx, MessageDialogUI.ERROR_MODE);
+ break;
}
- if ( !fatalError ) {
- //Servce stop by non fatal error. Unexpected.
- //TODO: Display stop service dialog.
- System.err.println("Stoped service.");
+
+ acceptWait:
+ while (true) {
+ // Wait connect from mail client
+ server.setSoTimeout(1000); //TODO: Configuable accept wait time.
+ Socket client;
+ try {
+ client = server.accept();
+ } catch (SocketTimeoutException ex) {
+ //Check interupt
+ if ( isConfigChange ) {
+ System.err.println("Configuration change restart service.");
+ isConfigChange = false;
+ server.close();
+ break; // renew ServerSocket
+ }
+ continue;
+ }
+ System.err.println("Accept new STMP socket.");
+ Processer processer = new Processer(client);
+ Thread clientThread = new Thread(processer);
+ clientThread.start();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.err.println("Continure waiting SMTP client.");
+
+ try {
+ server.close();
+ } catch (IOException ioe) {
+ //IGNORE close Exception
}
+ } catch (RuntimeException rEx) {
+ fatalError = true;
+ String errorMessage = "Runtime Exception was occurred. Stop service.";
+ System.err.println(errorMessage);
+ new MessageDialogUI(errorMessage, rEx, MessageDialogUI.ERROR_MODE);
+ break;
+ }
}
+ if ( !fatalError ) {
+ //Servce stop by non fatal error. Unexpected.
+ String errorMessage = "Unexpected service stoping ocurreed. Stoped service.";
+ System.err.println(errorMessage);
+ new MessageDialogUI(errorMessage, null, MessageDialogUI.ERROR_MODE);
+ }
+ }
}
<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
- <Property name="title" type="java.lang.String" value="Confirm Distination Address"/>
+ <Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ToListUI.title" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
</Container>
<Component class="javax.swing.JButton" name="jButtonOK">
<Properties>
- <Property name="text" type="java.lang.String" value="OK"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ToListUI.jButtonOK.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
</Component>
<Component class="javax.swing.JButton" name="jButtonCancel">
<Properties>
- <Property name="text" type="java.lang.String" value="Cancel"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/jent/checksmtp/Bundle.properties" key="ToListUI.jButtonCancel.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonCancelActionPerformed"/>
private ResultNotify resultNotify = null;
/** Creates new form ToListUI */
- public ToListUI() {
- initComponents();
- }
-
public ToListUI(ResultNotify processer, List toList) {
- this(); //TODO: test dould call...
+ super(); //paranoia statement.
+ initComponents();
+
+ jButtonCancel.requestFocusInWindow();
+ //getRootPane().setDefaultButton(jButtonOK);
+
this.toList = toList;
this.resultNotify = processer;
jButtonCancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- setTitle("Confirm Distination Address");
+ java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/jent/checksmtp/Bundle"); // NOI18N
+ setTitle(bundle.getString("ToListUI.title")); // NOI18N
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
});
jScrollPane1.setViewportView(jList1);
- jButtonOK.setText("OK");
+ jButtonOK.setText(bundle.getString("ToListUI.jButtonOK.text")); // NOI18N
jButtonOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonOKActionPerformed(evt);
}
});
- jButtonCancel.setText("Cancel");
+ jButtonCancel.setText(bundle.getString("ToListUI.jButtonCancel.text")); // NOI18N
jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCancelActionPerformed(evt);
ApplicationProperties.setConfirmDialogPosH(h);
ApplicationProperties.setConfirmDialogPosW(w);
if ( !ApplicationProperties.save() ) {
- //TODO: save error dialog.
+ new MessageDialogUI("Fail the properties file of dialog potition save.",
+ null, MessageDialogUI.ERROR_MODE);
}
}
return modified;
--- /dev/null
+/*
+ * MessageDialogUITest.java
+ * JUnit based test
+ *
+ * Created on 2007/08/14, 15:22
+ */
+
+package org.jent.checksmtp;
+
+import junit.framework.*;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ *
+ * @author tkyn
+ */
+public class MessageDialogUITest extends TestCase {
+
+ public MessageDialogUITest(String testName) {
+ super(testName);
+ }
+
+ //Detail Open/Close それぞれの時のダイアログの大きさ
+ static int openUiHeight = -1;
+ static int closeUiHeight = -1;
+
+ private void setupStaticVar() {
+ if ( openUiHeight > 0 ) { //正数が入っていたら既に設定済みだと思う。
+ return;
+ }
+
+ //まずは、Detail Open/Close時のダイアログの高さを保存しておく、
+ //このテストを一番最初に実行する必要がある。
+ Exception ex = new Exception();
+ MessageDialogUI openUi = new MessageDialogUI("Detail Open/Close test", ex, 0);
+ openUi.setDetailOpen(true);
+
+ openUi.setDetailOpen(false); //This method effort for Class variable.
+ MessageDialogUI closeUi = new MessageDialogUI("Detail Open/Close test", ex, 0);
+
+ openUiHeight = openUi.getHeight();
+ closeUiHeight = closeUi.getHeight();
+
+ openUi.dispose();
+ closeUi.dispose();
+
+ openUi.setDetailOpen(true);
+ }
+
+ protected void setUp() throws Exception {
+ System.out.println("setup()");
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ private void sleep(long millsec) {
+ try {
+ Thread.sleep(millsec);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ private void wait(MessageDialogUI ui) {
+ System.out.print("Wait 30s:");
+ for(int i=0;i<30;i++) {
+ sleep(1000);
+ System.out.print(".");
+ if ( !ui.isVisible() ) {
+ break;
+ }
+ }
+ System.out.println(" OK");
+ if ( ui.isVisible() ) {
+ ui.dispose();
+ fail("Forget human check. This unit test need to human decide.");
+ }
+ }
+
+ public void testDetailOpenClose() {
+ setupStaticVar();
+
+ //取得したダイアログの高さの確認
+ if ( openUiHeight == 0 || closeUiHeight == 0 ) {
+ fail("Dialog Height is wrong");
+ }
+ if ( openUiHeight <= closeUiHeight ) {
+ fail("Detail Open/Close no diffrent.");
+ }
+ }
+
+ public void testErrorAndException() {
+ //setupStaticVar();
+ MessageDialogUI ui = new MessageDialogUI("Check Title `Error` and Exception, Push OK",
+ new Exception("TEST Exception"), MessageDialogUI.ERROR_MODE);
+ if ( ui.getHeight() <= closeUiHeight || ui.getHeight() > openUiHeight ) {
+ fail("Dialog height is wrong.");
+ }
+ if ( ui.getTitle().indexOf("Error") < 0 ) {
+ fail("Dialog title is wrong.");
+ }
+ wait(ui);
+ }
+
+
+ public void testInfoNoException() {
+ //setupStaticVar();
+ MessageDialogUI ui = new MessageDialogUI("Check Title 'Information' and no Exception, Push OK",
+ null, MessageDialogUI.INFORMATION_MODE);
+ if ( ui.getHeight() >= openUiHeight || ui.getHeight() < closeUiHeight ) {
+ fail("Dialog height is wrong.");
+ }
+ if ( ui.getTitle().indexOf("Information") < 0 ) {
+ fail("Dialog title is wrong.");
+ }
+ wait(ui);
+ }
+
+ public void testWarningNoException() {
+ //setupStaticVar();
+ MessageDialogUI ui = new MessageDialogUI("Check Title `Warning` and no Exception, Push OK",
+ null, MessageDialogUI.WARNING_MODE);
+ if ( ui.getHeight() >= openUiHeight || ui.getHeight() < closeUiHeight ) {
+ fail("Dialog height is wrong.");
+ }
+ if ( ui.getTitle().indexOf("Warning") < 0 ) {
+ fail("Dialog title is wrong.");
+ }
+ wait(ui);
+ }
+
+}