|
8 | 8 | import java.awt.event.WindowAdapter; |
9 | 9 | import java.awt.event.WindowEvent; |
10 | 10 | import java.io.IOException; |
| 11 | +import java.lang.System; |
11 | 12 | import java.util.*; |
12 | 13 | import java.util.concurrent.CountDownLatch; |
13 | 14 |
|
|
18 | 19 | import javax.swing.JPanel; |
19 | 20 | import javax.swing.SwingUtilities; |
20 | 21 |
|
| 22 | +import com.openfin.desktop.*; |
21 | 23 | import org.json.JSONArray; |
22 | 24 | import org.json.JSONObject; |
23 | 25 |
|
24 | | -import com.openfin.desktop.Ack; |
25 | | -import com.openfin.desktop.AckListener; |
26 | | -import com.openfin.desktop.Application; |
27 | | -import com.openfin.desktop.ApplicationOptions; |
28 | | -import com.openfin.desktop.AsyncCallback; |
29 | | -import com.openfin.desktop.DesktopConnection; |
30 | | -import com.openfin.desktop.DesktopException; |
31 | | -import com.openfin.desktop.DesktopIOException; |
32 | | -import com.openfin.desktop.DesktopStateListener; |
33 | | -import com.openfin.desktop.RuntimeConfiguration; |
34 | | -import com.openfin.desktop.WindowOptions; |
35 | 26 | import com.openfin.desktop.channel.ChannelClient; |
36 | 27 | import com.openfin.desktop.win32.ExternalWindowObserver; |
37 | 28 |
|
@@ -82,7 +73,10 @@ public void windowClosing(WindowEvent we) { |
82 | 73 | frame.cleanup(); |
83 | 74 | }); |
84 | 75 | application.close(); |
85 | | - Thread.sleep(2000); |
| 76 | + Thread.sleep(1000); |
| 77 | + OpenFinRuntime runtime = new OpenFinRuntime(desktopConnection); |
| 78 | + runtime.exit(); |
| 79 | + Thread.sleep(1000); |
86 | 80 | java.lang.System.exit(0); |
87 | 81 | } |
88 | 82 | catch (Exception de) { |
@@ -131,6 +125,10 @@ public void actionPerformed(ActionEvent e) { |
131 | 125 |
|
132 | 126 | void launchOpenfin() throws DesktopException, DesktopIOException, IOException, InterruptedException { |
133 | 127 | RuntimeConfiguration config = new RuntimeConfiguration(); |
| 128 | + String rvm = System.getProperty("com.openfin.demo.layout.rvm"); |
| 129 | + if (rvm != null) { |
| 130 | + config.setLaunchRVMPath(rvm); |
| 131 | + } |
134 | 132 | config.setRuntimeVersion("stable"); |
135 | 133 | config.setAdditionalRuntimeArguments("--v=1 --remote-debugging-port=9090 "); |
136 | 134 | serviceConfig = new JSONArray(); |
@@ -185,7 +183,7 @@ public void onError(Ack ack) { |
185 | 183 | } |
186 | 184 |
|
187 | 185 | void createJavaWindow() throws DesktopException { |
188 | | - String windowName = UUID.randomUUID().toString(); |
| 186 | + String windowName = "Java-" + UUID.randomUUID().toString(); |
189 | 187 | LayoutFrame frame = new LayoutFrame(this.desktopConnection, appUuid, windowName); |
190 | 188 | this.childFrames.put(windowName, frame); |
191 | 189 | frame.addWindowListener(this.childFrameCleanListener); |
|
0 commit comments