|
41 | 41 | import com.openfin.desktop.DesktopStateListener; |
42 | 42 | import com.openfin.desktop.RuntimeConfiguration; |
43 | 43 | import com.openfin.desktop.WindowOptions; |
| 44 | +import com.openfin.desktop.channel.ChannelAction; |
44 | 45 | import com.openfin.desktop.channel.ChannelClient; |
45 | 46 | import com.openfin.desktop.win32.ExternalWindowObserver; |
46 | 47 |
|
@@ -238,9 +239,33 @@ public void run() { |
238 | 239 | newWindow.show(); |
239 | 240 |
|
240 | 241 | try { |
241 | | - new ExternalWindowObserver(desktopConnection.getPort(), appUuid, windowName, newWindow, null); |
| 242 | + new ExternalWindowObserver(desktopConnection.getPort(), appUuid, windowName, newWindow, new AckListener() { |
| 243 | + |
| 244 | + @Override |
| 245 | + public void onSuccess(Ack ack) { |
| 246 | + ExternalWindowObserver observer = (ExternalWindowObserver) ack.getSource(); |
| 247 | + observer.getDesktopConnection().getChannel().connect("of-layouts-service-v1", |
| 248 | + new AsyncCallback<ChannelClient>() { |
| 249 | + @Override |
| 250 | + public void onSuccess(ChannelClient client) { |
| 251 | + undock.setOnAction(new EventHandler<javafx.event.ActionEvent>() { |
| 252 | + @Override |
| 253 | + public void handle(javafx.event.ActionEvent e) { |
| 254 | + JSONObject payload = new JSONObject(); |
| 255 | + payload.put("uuid", appUuid); |
| 256 | + payload.put("name", windowName); |
| 257 | + client.dispatch("UNDOCK-WINDOW", payload, null); |
| 258 | + } |
| 259 | + }); |
| 260 | + } |
| 261 | + }); |
| 262 | + } |
| 263 | + |
| 264 | + @Override |
| 265 | + public void onError(Ack ack) { |
| 266 | + |
| 267 | + }}); |
242 | 268 | } catch (DesktopException e) { |
243 | | - // TODO Auto-generated catch block |
244 | 269 | e.printStackTrace(); |
245 | 270 | } |
246 | 271 | } |
|
0 commit comments