Parent window parameter != null will make EvAClient not exit the VM on closing. (MK rev. 224)

This commit is contained in:
Marcel Kronfeld
2008-12-08 14:38:55 +00:00
parent cb8af51be6
commit c76f046faf

View File

@@ -18,6 +18,7 @@ import java.awt.Dimension;
import java.awt.Event; import java.awt.Event;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@@ -164,6 +165,15 @@ public class EvAClient implements RemoteStateListener, Serializable {
* *
*/ */
public EvAClient(final String hostName) { public EvAClient(final String hostName) {
this(hostName, null);
}
/**
* Constructor of GUI of EvA2.
* Works as client for the EvA2 server.
*
*/
public EvAClient(final String hostName, final Window parent) {
final SplashScreen fSplashScreen = new SplashScreen(EvAInfo.splashLocation); final SplashScreen fSplashScreen = new SplashScreen(EvAInfo.splashLocation);
// preload some classes (into system cache) in a parallel thread // preload some classes (into system cache) in a parallel thread
@@ -179,7 +189,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
SwingUtilities.invokeLater( new Runnable() { SwingUtilities.invokeLater( new Runnable() {
public void run(){ public void run(){
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
init(hostName); // this takes a bit init(hostName, parent); // this takes a bit
long wait = System.currentTimeMillis() - startTime; long wait = System.currentTimeMillis() - startTime;
try { try {
// if splashScreenTime has not passed, sleep some more // if splashScreenTime has not passed, sleep some more
@@ -199,7 +209,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
/** /**
* *
*/ */
private void init(String hostName) { private void init(String hostName, final Window parent) {
//EVA_EDITOR_PROPERTIES //EVA_EDITOR_PROPERTIES
useDefaultModule = getProperty("DefaultModule"); useDefaultModule = getProperty("DefaultModule");
@@ -249,7 +259,9 @@ public class EvAClient implements RemoteStateListener, Serializable {
Set<String> keys = System.getenv().keySet(); Set<String> keys = System.getenv().keySet();
if (keys.contains("MATLAB")) { if (keys.contains("MATLAB")) {
System.out.println("Seems like Ive been started from Matlab: not killing JVM"); System.out.println("Seems like Ive been started from Matlab: not killing JVM");
} else System.exit(1); } else {
if (parent == null) System.exit(1);
}
} }
}); });
@@ -282,7 +294,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
if (TRACE) { if (TRACE) {
System.out.println(EVAHELP.getSystemPropertyString()); System.out.println(EVAHELP.getSystemPropertyString());
} }
EvAClient Client = new EvAClient((args.length == 1) ? args[0] : null); EvAClient Client = new EvAClient((args.length == 1) ? args[0] : null, null);
} }