Skip to content

Commit 4507e84

Browse files
committed
ADAP-142 added button action to undock.
1 parent dbf4dff commit 4507e84

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

src/main/java/com/openfin/desktop/demo/LayoutServiceDemo.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.openfin.desktop.DesktopStateListener;
4242
import com.openfin.desktop.RuntimeConfiguration;
4343
import com.openfin.desktop.WindowOptions;
44+
import com.openfin.desktop.channel.ChannelAction;
4445
import com.openfin.desktop.channel.ChannelClient;
4546
import com.openfin.desktop.win32.ExternalWindowObserver;
4647

@@ -238,9 +239,33 @@ public void run() {
238239
newWindow.show();
239240

240241
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+
}});
242268
} catch (DesktopException e) {
243-
// TODO Auto-generated catch block
244269
e.printStackTrace();
245270
}
246271
}

0 commit comments

Comments
 (0)