From c40d5d94ec9d014a8ef0fa83112cbcc2458d0e95 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:27:24 +0000 Subject: [PATCH] Add selected-band marker to main station table --- .../view/Kst4ContestApplication.java | 61 +++++++++++++++++-- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/src/main/java/kst4contest/view/Kst4ContestApplication.java b/src/main/java/kst4contest/view/Kst4ContestApplication.java index 02755bc7..385ed4b6 100644 --- a/src/main/java/kst4contest/view/Kst4ContestApplication.java +++ b/src/main/java/kst4contest/view/Kst4ContestApplication.java @@ -64,6 +64,8 @@ import javafx.scene.shape.Polygon; import javafx.stage.Screen; import kst4contest.utils.ApplicationFileUtils; +import kst4contest.view.map.MapCallsignRawSnapshot; +import kst4contest.view.map.MapCallsignRawSnapshotBuilder; import kst4contest.view.map.StationMapBridge; import kst4contest.view.map.StationMapView; import kst4contest.view.map.OfflineDemImportService; @@ -94,6 +96,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL private final Tooltip tipSkedWarnIndicator = new Tooltip(); private Timeline skedWarnBlinkTimeline; + private final MapCallsignRawSnapshotBuilder mainViewBandMarkerSnapshotBuilder = new MapCallsignRawSnapshotBuilder(); + // Timeline: show at most N priority markers per minute bucket (minute 0/1 often has many planes) private static final int TIMELINE_PRIORITY_MARKERS_PER_MINUTE = 2; @@ -384,6 +388,45 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL return sb.toString(); } + private boolean isSelectedBandOfferForMainView(ChatMember chatMember) { + if (chatMember == null + || chatcontroller == null + || chatcontroller.getReachabilityService() == null + || chatMember.getCallSignRaw() == null + || chatMember.getCallSignRaw().isBlank()) { + return false; + } + + EnumSet enabledBands = chatcontroller.getReachabilityService().getEnabledStationBands(); + if (enabledBands == null || enabledBands.isEmpty()) { + return false; + } + + List variants = new ArrayList<>(); + synchronized (chatcontroller.getLst_chatMemberList()) { + for (ChatMember variant : chatcontroller.getLst_chatMemberList()) { + if (variant == null || variant.getCallSignRaw() == null) { + continue; + } + if (variant.getCallSignRaw().equalsIgnoreCase(chatMember.getCallSignRaw())) { + variants.add(variant); + } + } + } + + if (variants.isEmpty()) { + variants = List.of(chatMember); + } + + List snapshots = mainViewBandMarkerSnapshotBuilder.buildSnapshots( + variants, + null, + enabledBands + ); + + return snapshots.stream().anyMatch(MapCallsignRawSnapshot::offersSelectedBand); + } + private String bandToHumanLabel(kst4contest.model.Band b) { // Human-friendly labels for VHF/UHF/microwave contesting return switch (b) { @@ -1135,14 +1178,22 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL public ObservableValue call(CellDataFeatures cellDataFeatures) { SimpleStringProperty callsgn = new SimpleStringProperty(); - if (cellDataFeatures.getValue().getState() == 1) { - callsgn.setValue("(" + cellDataFeatures.getValue().getCallSign() + ")"); //away user - } else { + ChatMember member = cellDataFeatures.getValue(); + String baseCallsign; - callsgn.setValue(cellDataFeatures.getValue().getCallSign()); + if (member.getState() == 1) { + baseCallsign = "(" + member.getCallSign() + ")"; //away user + } else { + baseCallsign = member.getCallSign(); } -// System.out.println(cellDataFeatures.getValue().getCallSign() + " / " + cellDataFeatures.getValue().getState()+ " <<<<<<<<<<<<<<<<<< state "); + if (isSelectedBandOfferForMainView(member)) { + baseCallsign += " ★"; + } + + callsgn.setValue(baseCallsign); + +// System.out.println(member.getCallSign() + " / " + member.getState()+ " <<<<<<<<<<<<<<<<<< state "); return callsgn; }