Null ID for absent pucks

This commit is contained in:
gac-S_Changer
2025-07-15 14:17:24 +02:00
parent 3141f7bcb0
commit 5f19b8ac42

View File

@@ -548,6 +548,13 @@ public class MainPanel extends Panel {
}
void updateLevel(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateLevel(value);
});
return;
}
if ((value == null) || !(value instanceof Number)) {
progressLN2.setIndeterminate(true);
} else {
@@ -558,6 +565,13 @@ public class MainPanel extends Panel {
}
void updateAirPressure(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateAirPressure(value);
});
return;
}
if ((value == null) || !(value instanceof Boolean)) {
ledAirPressure.setColor(Color.BLACK);
} else if ((Boolean) value) {
@@ -568,6 +582,12 @@ public class MainPanel extends Panel {
}
void updateN2Pressure(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateN2Pressure(value);
});
return;
}
if ((value == null) || !(value instanceof Boolean)) {
ledN2Pressure.setColor(Color.BLACK);
} else if ((Boolean) value) {
@@ -578,6 +598,12 @@ public class MainPanel extends Panel {
}
void updateLocalSafety(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateLocalSafety(value);
});
return;
}
if ((value == null) || !(value instanceof Boolean)) {
ledLocalSafety.setColor(Color.BLACK);
} else if ((Boolean) value) {
@@ -588,6 +614,12 @@ public class MainPanel extends Panel {
}
void updateDryer(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateDryer(value);
});
return;
}
if ((value == null) || !(value instanceof Boolean)) {
ledDryer.setColor(Color.BLACK);
} else if ((Boolean) value) {
@@ -606,6 +638,13 @@ public class MainPanel extends Panel {
}
void updateButtonState(){
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateButtonState();
});
return;
}
boolean doors_open = !Boolean.TRUE.equals(Controller.getInstance().isDoorClosed());
boolean cover_pos_detected = isCoverPosDetected();
buttonSampleLoad.setEnabled(doors_open && !cover_pos_detected && getState().isInitialized());
@@ -613,6 +652,14 @@ public class MainPanel extends Panel {
buttonDrawing.setEnabled(getState().isInitialized());
}
void updatePsysSafety(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updatePsysSafety(value);
});
return;
}
if ((value == null) || !(value instanceof Boolean)) {
ledPsysSafety.setColor(Color.BLACK);
} else if (Boolean.TRUE.equals(manualMode)) {
@@ -633,6 +680,13 @@ public class MainPanel extends Panel {
}
void updateMode(Object value) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateMode(value);
});
return;
}
if ((value != null) && (value instanceof Map)) {
manualMode = "manual".equals(String.valueOf(((Map) value).get("mode")));
ledManualMode.setColor(manualMode ? Color.YELLOW : Color.GREEN);
@@ -645,6 +699,12 @@ public class MainPanel extends Panel {
}
void updateCameraView() {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateCameraView();
});
return;
}
try{
//if (buttonCamera.isSelected()){
int center_x = ((Number)this.eval("cover_detection.config.center_x", true)).intValue();
@@ -731,6 +791,12 @@ public class MainPanel extends Panel {
WaterLevelPanel waterLevelPanel;
void updateViewMode() {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
updateViewMode();
});
return;
}
try {
if (btViewDewar.isSelected() != viewDewar) {
viewDewar = btViewDewar.isSelected();
@@ -758,7 +824,13 @@ public class MainPanel extends Panel {
}
volatile boolean updating;
void setExpertMode(boolean expert) {
void setExpertMode(boolean expert) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
setExpertMode(expert);
});
return;
}
try{
updating = true;
boolean current = buttonExpertCommands.isVisible();
@@ -848,6 +920,12 @@ public class MainPanel extends Panel {
final int COLUMN_SAMPLE_POSITION = 5;
void setSamplesTable(Object[][] sampleData) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
setSamplesTable(sampleData);
});
return;
}
tableSamples.setModel(new DefaultTableModel(
sampleData,
new String[]{
@@ -901,10 +979,22 @@ public class MainPanel extends Panel {
}
public void setPuckDatamatrix(String datamatrix) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
setPuckDatamatrix(datamatrix);
});
return;
}
textPuckDatamatrix.setText((datamatrix == null) ? "" : String.valueOf(datamatrix));
}
public void setSampleDatamatrix(String datamatrix) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(()->{
setSampleDatamatrix(datamatrix);
});
return;
}
textSampleDatamatrix.setText((datamatrix == null) ? "" : String.valueOf(datamatrix));
}