Skip to content

Commit aea6dd9

Browse files
committed
feat: plan queue controller queue item selection event
1 parent e922bc7 commit aea6dd9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/queue-server/src/main/java/org/phoebus/applications/queueserver/controller/RePlanQueueController.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.phoebus.applications.queueserver.api.StatusResponse;
77
import org.phoebus.applications.queueserver.client.RunEngineService;
88
import org.phoebus.applications.queueserver.util.StatusBus;
9+
import org.phoebus.applications.queueserver.util.QueueItemSelectionEvent;
910
import javafx.application.Platform;
1011
import javafx.beans.property.ReadOnlyObjectWrapper;
1112
import javafx.beans.property.ReadOnlyStringWrapper;
@@ -97,7 +98,11 @@ public RePlanQueueController(boolean viewOnly) {
9798

9899
table.getSelectionModel().getSelectedItems()
99100
.addListener((ListChangeListener<Row>) c -> {
100-
if (!ignoreSticky) stickySel = selectedUids();
101+
if (!ignoreSticky) {
102+
stickySel = selectedUids();
103+
// Notify plan viewer of selection change
104+
notifySelectionChange();
105+
}
101106
});
102107

103108
ChangeListener<StatusResponse> poll =
@@ -366,4 +371,17 @@ private static String fmtParams(QueueItem q) {
366371
}
367372
private record Row(String uid, String itemType, String name,
368373
String params, String user, String group) {}
374+
375+
376+
private void notifySelectionChange() {
377+
var selectedItems = table.getSelectionModel().getSelectedItems();
378+
QueueItem selectedItem = null;
379+
380+
if (selectedItems.size() == 1) {
381+
Row selectedRow = selectedItems.get(0);
382+
selectedItem = uid2item.get(selectedRow.uid());
383+
}
384+
385+
QueueItemSelectionEvent.getInstance().notifySelectionChanged(selectedItem);
386+
}
369387
}

0 commit comments

Comments
 (0)