Update of /cvsroot/rails/18xx/rails/ui/swing/elements
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30381/rails/ui/swing/elements
Modified Files:
CheckBoxDialog.java
Added Files:
DialogOwner.java
Log Message:
Created non-modal version of CheckBoxDialog and a method to deal with such dialogs in the UI Managers.
ExchangeTokens and ReachDestination action dialogs now no longer block other windows.
Index: CheckBoxDialog.java
===================================================================
RCS file: /cvsroot/rails/18xx/rails/ui/swing/elements/CheckBoxDialog.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CheckBoxDialog.java 30 Dec 2009 19:54:31 -0000 1.3
--- CheckBoxDialog.java 7 Jan 2010 20:48:13 -0000 1.4
***************
*** 4,7 ****
--- 4,8 ----
import java.awt.*;
import java.awt.event.*;
+
import javax.swing.*;
***************
*** 16,19 ****
--- 17,22 ----
private static final long serialVersionUID = 1L;
+
+ protected DialogOwner owner = null;
GridBagConstraints gc;
JPanel optionsPane, buttonPane;
***************
*** 32,43 ****
Logger.getLogger(CheckBoxDialog.class.getPackage().getName());
! public CheckBoxDialog(JComponent owner, String title, String message,
String[] options) {
this (owner, title, message, options, null);
}
!
! public CheckBoxDialog(JComponent owner, String title, String message,
String[] options, boolean[] selectedOptions) {
! super((Frame) null, title, true); // Modal !?
this.message = message;
this.options = options;
--- 35,47 ----
Logger.getLogger(CheckBoxDialog.class.getPackage().getName());
! public CheckBoxDialog(DialogOwner owner, String title, String message,
String[] options) {
this (owner, title, message, options, null);
}
!
! public CheckBoxDialog(DialogOwner owner, String title, String message,
String[] options, boolean[] selectedOptions) {
! super((Frame) null, title, false); // Modal !?
! this.owner = owner;
this.message = message;
this.options = options;
***************
*** 53,56 ****
--- 57,61 ----
// Center on owner
+ /*
int x =
(int) owner.getLocationOnScreen().getX()
***************
*** 59,62 ****
--- 64,70 ----
(int) owner.getLocationOnScreen().getY()
+ (owner.getHeight() - getHeight()) / 2;
+ */
+ int x = 400;
+ int y = 400;
setLocation(x, y);
***************
*** 126,129 ****
--- 134,142 ----
setVisible(false);
dispose();
+ owner.dialogActionPerformed ();
+ }
+
+ public String[] getOptions () {
+ return options;
}
--- NEW FILE: DialogOwner.java ---
package rails.ui.swing.elements;
public interface DialogOwner {
public void dialogActionPerformed ();
}
|