Skip to content

Commit 35e416e

Browse files
committed
AUT-174: updated channel example
1 parent 584761b commit 35e416e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
import com.openfin.desktop.animation.OpacityTransition;
88
import com.openfin.desktop.animation.PositionTransition;
99
import com.openfin.desktop.channel.ChannelAction;
10+
import com.openfin.desktop.channel.ChannelListener;
1011
import com.openfin.desktop.channel.ChannelProvider;
1112

13+
import com.openfin.desktop.channel.ConnectionEvent;
1214
import info.clearthought.layout.TableLayout;
1315

1416
import javax.swing.*;
@@ -422,6 +424,17 @@ public void actionPerformed(ActionEvent e) {
422424
// see below
423425
tbProvider.setEnabled(false);
424426

427+
desktopConnection.getChannel(channelName).addChannelListener(new ChannelListener() {
428+
@Override
429+
public void onChannelConnect(ConnectionEvent connectionEvent) {
430+
logger.info(String.format("provider receives channel connect event from %s ", connectionEvent.getUuid()));
431+
}
432+
@Override
433+
public void onChannelDisconnect(ConnectionEvent connectionEvent) {
434+
logger.info(String.format("provider receives channel disconnect event from %s ", connectionEvent.getUuid()));
435+
}
436+
});
437+
425438
desktopConnection.getChannel(channelName).create(new AsyncCallback<ChannelProvider>() {
426439
@Override
427440
public void onSuccess(ChannelProvider provider) {
@@ -711,7 +724,7 @@ private void createAdminApplication() throws DesktopException {
711724
updateMessagePanel("Creating InterAppBus");
712725
bus = desktopConnection.getInterApplicationBus();
713726
openfinSystem = new System(desktopConnection);
714-
updateMessagePanel("Connected to Desktop");
727+
updateMessagePanel("Connected to Runtime");
715728
setMainButtonsEnabled(true);
716729

717730
openfinSystem.addEventListener("desktop-icon-clicked", new EventListener() {

0 commit comments

Comments
 (0)