OSDN Git Service

FALESAFE: The result is not OK, it mean NG.
authortakuya-o <takuya-o>
Sat, 5 Nov 2005 21:10:48 +0000 (21:10 +0000)
committertakuya-o <takuya-o>
Sat, 5 Nov 2005 21:10:48 +0000 (21:10 +0000)
MOD Use ResultNotify interface.
ADD: Swing border layout. It enable to change size at address list on Dialog.

BetaProject.jpr
src/org/jent/checksmtp/Processer.java
src/org/jent/checksmtp/ToListDialog.java

index c36f2b5..302d168 100644 (file)
       </list>
    </hash>
    <hash n="oracle.jdevimpl.config.JProjectLibraries">
+      <list n="exportedReferences">
+         <hash>
+            <value n="id" v="JDeveloper Runtime"/>
+            <value n="isJDK" v="false"/>
+         </hash>
+         <hash>
+            <value n="id" v="JUnit Runtime"/>
+            <value n="isJDK" v="false"/>
+         </hash>
+      </list>
       <hash n="jdkReference">
          <url n="id" path="../../../system/oracle.jdeveloper.10.1.3.34.12/1.5.0_05.jdk"/>
          <value n="isJDK" v="true"/>
          <value n="jdkVersion" v="1.5.0_05"/>
       </hash>
+      <list n="libraryReferences">
+         <hash>
+            <value n="id" v="JDeveloper Runtime"/>
+            <value n="isJDK" v="false"/>
+         </hash>
+         <hash>
+            <value n="id" v="JUnit Runtime"/>
+            <value n="isJDK" v="false"/>
+         </hash>
+      </list>
    </hash>
    <hash n="oracle.jdevimpl.config.JProjectPaths">
       <url n="outputDirectory" path="classes/"/>
index ec9f84f..0174a89 100644 (file)
@@ -19,7 +19,7 @@ import java.util.ListIterator;
 import java.util.regex.Pattern;
 
 
-public class Processer implements Runnable {
+public class Processer implements Runnable, ResultNotify {
   private Socket client;
 
   //Conform status.
@@ -237,7 +237,7 @@ public class Processer implements Runnable {
                 }
               }
 
-              if (result == RESULT_NG) {
+              if (result != RESULT_OK ) {
                 System.out.println("CANCEL sending mail.");
                 serverWriter.println(COMMAND_RESET);
                 line = serverReader.readLine(); //Server MUST retrun "250 OK"
index dbf63e3..24e60e7 100644 (file)
@@ -1,27 +1,36 @@
 package org.jent.checksmtp;
 
+import java.awt.BorderLayout;
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 
 import java.util.ArrayList;
 
+import javax.swing.BorderFactory;
 import javax.swing.JButton;
 import javax.swing.JDialog;
 import javax.swing.JList;
+import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 
 
 public class ToListDialog extends JDialog {
-  private JButton jButton1 = new JButton();
-  private JButton jButton2 = new JButton();
+  private JButton jButtonOK = new JButton();
+  private JButton jButtonCANCEL = new JButton();
   private JList jList1 = new JList();
   private JScrollPane scrollPane = new JScrollPane(); //add
   private ArrayList toList = null;
-  private Processer processer = null;
+  private ResultNotify resultNotify = null;
+
+  private JPanel bottonPanel = new JPanel();
+
+
+  private BorderLayout borderLayout1 = new BorderLayout();
 
   public ToListDialog() {
       this(null, "", false);
@@ -37,10 +46,10 @@ public class ToListDialog extends JDialog {
       }
   }
 
-  public ToListDialog(Processer processer, ArrayList toList) {
+  public ToListDialog(ResultNotify processer, ArrayList toList) {
       this(null, "TO Check", false);
       this.toList = toList;
-      this.processer = processer;
+      this.resultNotify = processer;
 
       if (toList != null) {
           jList1.setListData(toList.toArray());
@@ -53,53 +62,55 @@ public class ToListDialog extends JDialog {
   }
 
   private void jbInit() throws Exception {
-    jButton2.addActionListener(new ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        jButton2_actionPerformed(e);
-      }
-    });
     this.setSize(new Dimension(584, 300));
-    this.getContentPane().setLayout(null);
+    this.getContentPane().setLayout(borderLayout1);
     this.setTitle("Conform Mail Destination");
-    this.addWindowListener(new java.awt.event.WindowAdapter() {
+    this.addWindowListener(new WindowAdapter() {
       public void windowClosing(WindowEvent e) {
         this_windowClosing(e);
       }
     });
-    jButton1.setText("OK");
-    jButton1.setBounds(new Rectangle(100, 240, 140, 25));
-    jButton1.addActionListener(new ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        jButton1_actionPerformed(e);
-      }
-    });
-    jButton2.setText("CANCEL");
-    jButton2.setBounds(new Rectangle(325, 240, 145, 25));
+
     jList1.setBounds(new Rectangle(25, 25, 455, 200));
     jList1.setSize(new Dimension(500, 200));
     jList1.setToolTipText("null");
     jList1.setValueIsAdjusting(true);
-    scrollPane.setBounds(new Rectangle(10, 5, 555, 225));
+    scrollPane.setAutoscrolls(true);
     scrollPane.getViewport().setView(jList1); //add
-
-    //this.getContentPane().add(jList1, null);
-    this.getContentPane().add(scrollPane, null);
-    this.getContentPane().add(jButton2, null);
-    this.getContentPane().add(jButton1, null);
+    
+    jButtonOK.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        jButton1_actionPerformed(e);
+      }
+    });
+    jButtonCANCEL.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        jButton2_actionPerformed(e);
+      }
+    });
+    jButtonOK.setText("OK");
+    jButtonCANCEL.setText("CANCEL");
+   
+    bottonPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
+    bottonPanel.add(jButtonCANCEL, null);
+    bottonPanel.add(jButtonOK, null);
+
+    this.getContentPane().add(bottonPanel, BorderLayout.SOUTH);
+    this.getContentPane().add(scrollPane, BorderLayout.CENTER);
   }
 
   private void jButton1_actionPerformed(ActionEvent e) {
     //push OK
-    processer.sayOK();
+    resultNotify.sayOK();
     this.dispose();
   }
 
   private void jButton2_actionPerformed(ActionEvent e) {
-    processer.sayNG();
+    resultNotify.sayNG();
     this.dispose();
   }
 
   private void this_windowClosing(WindowEvent e) {
-    processer.sayNG();
+    resultNotify.sayNG();
   }
 }