mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-07-14 00:26:52 +02:00
Move band-offer star from wkdany column to per-band worked cells
Fixes a bad merge that had nested a method definition inside another method (broke compilation), and relocates the new-band-opportunity star so it appears on the specific band cell it applies to instead of a single generic wkdany column, since a station can offer several bands at once. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -388,8 +388,18 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSelectedBandOfferForMainView(ChatMember chatMember) {
|
/**
|
||||||
|
* Checks whether a station has known activity on the given band and that band is
|
||||||
|
* one of my own currently enabled bands, i.e. a new-band opportunity worth flagging
|
||||||
|
* with a star in that band's table cell.
|
||||||
|
*
|
||||||
|
* @param chatMember station row
|
||||||
|
* @param band band to check
|
||||||
|
* @return true if the band cell should show a star
|
||||||
|
*/
|
||||||
|
private boolean isBandOfferForMainView(ChatMember chatMember, Band band) {
|
||||||
if (chatMember == null
|
if (chatMember == null
|
||||||
|
|| band == null
|
||||||
|| chatcontroller == null
|
|| chatcontroller == null
|
||||||
|| chatcontroller.getReachabilityService() == null
|
|| chatcontroller.getReachabilityService() == null
|
||||||
|| chatMember.getCallSignRaw() == null
|
|| chatMember.getCallSignRaw() == null
|
||||||
@@ -398,7 +408,7 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
}
|
}
|
||||||
|
|
||||||
EnumSet<Band> enabledBands = chatcontroller.getReachabilityService().getEnabledStationBands();
|
EnumSet<Band> enabledBands = chatcontroller.getReachabilityService().getEnabledStationBands();
|
||||||
if (enabledBands == null || enabledBands.isEmpty()) {
|
if (enabledBands == null || !enabledBands.contains(band)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +431,7 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
List<MapCallsignRawSnapshot> snapshots = mainViewBandMarkerSnapshotBuilder.buildSnapshots(
|
List<MapCallsignRawSnapshot> snapshots = mainViewBandMarkerSnapshotBuilder.buildSnapshots(
|
||||||
variants,
|
variants,
|
||||||
null,
|
null,
|
||||||
enabledBands
|
EnumSet.of(band)
|
||||||
);
|
);
|
||||||
|
|
||||||
return snapshots.stream().anyMatch(MapCallsignRawSnapshot::offersSelectedBand);
|
return snapshots.stream().anyMatch(MapCallsignRawSnapshot::offersSelectedBand);
|
||||||
@@ -1605,7 +1615,7 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObservableValue<String> call(CellDataFeatures<ChatMember, String> cellDataFeatures) {
|
public ObservableValue<String> call(CellDataFeatures<ChatMember, String> cellDataFeatures) {
|
||||||
return new SimpleStringProperty(formatWorkedAnyGridStatusForMainView(cellDataFeatures.getValue()));
|
return new SimpleStringProperty(formatWorkedAnyGridStatus(cellDataFeatures.getValue()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
wkdAny_subcol.prefWidthProperty().bind(tbl_chatMemberTable.widthProperty().divide(14));
|
wkdAny_subcol.prefWidthProperty().bind(tbl_chatMemberTable.widthProperty().divide(14));
|
||||||
@@ -1634,30 +1644,6 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows the compact worked/grid status and explains it by tooltip.
|
|
||||||
*/
|
|
||||||
wkdAny_subcol.setCellFactory(column -> new TableCell<ChatMember, String>() {
|
|
||||||
@Override
|
|
||||||
protected void updateItem(String item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
setText(null);
|
|
||||||
setTooltip(null);
|
|
||||||
setStyle("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatMember member = getTableRow() == null ? null : getTableRow().getItem();
|
|
||||||
|
|
||||||
setText(item);
|
|
||||||
setTooltip(new Tooltip(buildWorkedAnyGridStatusTooltip(member)));
|
|
||||||
setAlignment(Pos.CENTER);
|
|
||||||
setStyle("-fx-font-weight: bold;");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
TableColumn<ChatMember, String> vhfCol_subcol = new TableColumn<ChatMember, String>("144");
|
TableColumn<ChatMember, String> vhfCol_subcol = new TableColumn<ChatMember, String>("144");
|
||||||
vhfCol_subcol
|
vhfCol_subcol
|
||||||
@@ -1669,6 +1655,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked144()) {
|
if (cellDataFeatures.getValue().isWorked144()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_144)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -1688,6 +1676,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked432()) {
|
if (cellDataFeatures.getValue().isWorked432()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_432)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -1707,6 +1697,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked1240()) {
|
if (cellDataFeatures.getValue().isWorked1240()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_1296)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -1725,6 +1717,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked2300()) {
|
if (cellDataFeatures.getValue().isWorked2300()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_2320)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -1743,6 +1737,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked3400()) {
|
if (cellDataFeatures.getValue().isWorked3400()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_3400)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -1761,6 +1757,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked5600()) {
|
if (cellDataFeatures.getValue().isWorked5600()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_5760)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -1779,6 +1777,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
|
|
||||||
if (cellDataFeatures.getValue().isWorked10G()) {
|
if (cellDataFeatures.getValue().isWorked10G()) {
|
||||||
wkd.setValue("X");
|
wkd.setValue("X");
|
||||||
|
} else if (isBandOfferForMainView(cellDataFeatures.getValue(), Band.B_10G)) {
|
||||||
|
wkd.setValue("★");
|
||||||
} else {
|
} else {
|
||||||
wkd.setValue("");
|
wkd.setValue("");
|
||||||
}
|
}
|
||||||
@@ -9687,14 +9687,6 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
return "xo";
|
return "xo";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatWorkedAnyGridStatusForMainView(ChatMember member) {
|
|
||||||
String baseStatus = formatWorkedAnyGridStatus(member);
|
|
||||||
if (member != null && !member.isWorked() && isSelectedBandOfferForMainView(member)) {
|
|
||||||
return baseStatus + " ★";
|
|
||||||
}
|
|
||||||
return baseStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callWorked) {
|
if (callWorked) {
|
||||||
return "x";
|
return "x";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user