Skip to content

Commit

Permalink
StreamPanel resolve channel names do display child panels.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgobbo committed Feb 20, 2024
1 parent 9b57944 commit 79e42aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/main/java/ch/psi/pshell/bs/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,26 @@ public static List readChannels(List<String> names, int modulo, int offset, int
}
}

public Device getChildFromChannelName(String channel) {
if (channel!=null){
for (Device dev: getChildren()){
if (dev instanceof StreamChannel){
if (channel.equals(((StreamChannel)dev).getChannelName())){
return dev;
}
}
}
for (Device dev: getChildren()){
if (dev instanceof StreamChannel){
if (channel.equals(((StreamChannel)dev).getId())){
return dev;
}
}
}
}
return null;
}

@Override
protected void doClose() throws IOException {
stop();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/psi/pshell/swing/StreamPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void plotChannel() {
String channel = getCurrentChannel();
Stream device = getDevice();
if ((device != null) && (channel != null)) {
Device child = device.getChild(channel);
Device child = device.getChildFromChannelName(channel);
showDevicePanel(child);
}
}
Expand Down

0 comments on commit 79e42aa

Please sign in to comment.