[mdc-cvs 83] CVS update: BetaProject/src/org/jent/checksmtp

Zurück zum Archiv-Index

Takuya Ono takuy****@users*****
2007年 8月 23日 (木) 05:33:30 JST


Index: BetaProject/src/org/jent/checksmtp/ToListUI.java
diff -u BetaProject/src/org/jent/checksmtp/ToListUI.java:1.8 BetaProject/src/org/jent/checksmtp/ToListUI.java:1.9
--- BetaProject/src/org/jent/checksmtp/ToListUI.java:1.8	Tue Aug 21 00:04:21 2007
+++ BetaProject/src/org/jent/checksmtp/ToListUI.java	Thu Aug 23 05:33:30 2007
@@ -74,15 +74,20 @@
     //Auto confirm timer
     int timeOut = ApplicationProperties.getConfirmTimeout();
     if ( timeOut > 0 ) {
-      TimerTask task = new TimerTask() {
-        public void run() {
-          jButtonOKActionPerformed(null);
-        }
-      };
-      confirmTimer.schedule(task, timeOut * 1000L);
+      confirmTimer.schedule(confirmTimeoutTimerTask, timeOut * 1000L);
+    }
+  }
+  private void cancelConfirmTimeoutTimerTask() {
+    if ( !confirmTimeoutTimerTask.cancel() ) {
+      System.err.println("Already do task?");
     }
   }
   private static Timer confirmTimer = new Timer();
+  private TimerTask confirmTimeoutTimerTask = new TimerTask() {
+    public void run() {
+      jButtonOKActionPerformed(null);
+    }
+  };
   
   
   /** This method is called from within the constructor to
@@ -173,11 +178,13 @@
   }// </editor-fold>//GEN-END:initComponents
   
   private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
+    cancelConfirmTimeoutTimerTask();
     restorePosition();
     resultNotify.sayNG();
   }//GEN-LAST:event_formWindowClosing
-  
+ 
   private void jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
+    cancelConfirmTimeoutTimerTask();
     restorePosition();
     resultNotify.sayNG();
     this.dispose();
@@ -185,13 +192,21 @@
   
   private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
     //push OK
-    restorePosition();
-    resultNotify.sayOK();
-    this.dispose();
+    //if ( isVisible() ) {  //Care after dialog closing, confirm time out occurred.  -> use cancelTimerTask.
+      restorePosition();
+      resultNotify.sayOK();
+      this.dispose();
+    //}
   }//GEN-LAST:event_jButtonOKActionPerformed
   
   private boolean restorePosition() {
-    Point locationPoint = getLocationOnScreen();  //TODO: IllegalComponentStateException
+    Point locationPoint;
+    if ( isVisible() ) {
+      locationPoint = getLocationOnScreen();  //TODO: IllegalComponentStateException
+    } else {
+      locationPoint = new Point(ApplicationProperties.getConfirmDialogPosX(),
+              ApplicationProperties.getConfirmDialogPosY());
+    }
     int x = locationPoint.x;
     int y = locationPoint.y;
     int h = this.getHeight();


mdc-cvs メーリングリストの案内
Zurück zum Archiv-Index