Puck detection dialog is maximized

This commit is contained in:
gac-S_Changer
2026-03-25 11:02:53 +01:00
parent 652ea5352e
commit a31418e0bf
3 changed files with 23 additions and 13 deletions

View File

@@ -58,6 +58,8 @@ import javax.swing.table.DefaultTableModel;
public class Controller {
final boolean DIALOG_PUCK_LOAD_SHOW_BASEPLATE = true;
final int REMOVE_PUCK_TIMEOUT = 20000;
static Controller instance;
final BasePlate basePlate;
RoomTemperatureBasePlate roomTemperatureBasePlate;
@@ -923,9 +925,15 @@ public class Controller {
playSound("mounted");
logPuckDetectionChange(puck, true);
onPuckScanned(null);
//If no new puck is scanned and detected mounted in the same place of the last unmount,
//considers the detection is flickering (up to a timeout)
if ((datamatrix==null) || (datamatrix.isBlank())){
if (puck == removedPuck){
datamatrix = insertedPuckDatamatrix;
if ((System.currentTimeMillis() - removeTimestamp) < REMOVE_PUCK_TIMEOUT){
datamatrix = insertedPuckDatamatrix;
}
} else {
removedPuck = null;
}
}
@@ -945,6 +953,7 @@ public class Controller {
removedPuck = null;
}
long removeTimestamp;
//Called when a puck is detected removed from the the dewar
public void onPuckUnmounted(Puck puck) {
Logger.getLogger(Controller.class.getName()).info("Unmounted puck: " + puck.getName());
@@ -956,6 +965,7 @@ public class Controller {
dialogPuckLoading.onPuckUnmounted(puck);
}
removedPuck = puck;
removeTimestamp = System.currentTimeMillis();
}
public boolean hasLoadDialog(){

View File

@@ -104,7 +104,7 @@
<Component id="textDetectedPuck" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="panelTable" pref="349" max="32767" attributes="0"/>
<Component id="panelTable" pref="338" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="buttonSet" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@@ -118,7 +118,7 @@
<Component class="javax.swing.JButton" name="buttonSet">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="24" style="0"/>
<Font name="Lucida Grande" size="28" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Set"/>
<Property name="enabled" type="boolean" value="false"/>
@@ -145,7 +145,7 @@
<Component class="javax.swing.JButton" name="buttonClearDatamatrix">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
<Font name="Tahoma" size="24" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
@@ -220,7 +220,7 @@
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="18" style="0"/>
<Font name="Lucida Grande" size="24" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Scanned Datamatrix:"/>
@@ -229,7 +229,7 @@
<Component class="javax.swing.JLabel" name="labelSuggestion">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="24" style="0"/>
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Scan, Insert or Remove Pucks"/>
@@ -238,7 +238,7 @@
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="18" style="0"/>
<Font name="Lucida Grande" size="24" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Detected Puck:"/>

View File

@@ -290,7 +290,7 @@ public class PuckLoadingDialog extends JDialog {
splitPanel.setDividerLocation(500);
splitPanel.setDividerSize(0);
buttonSet.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
buttonSet.setFont(new java.awt.Font("Lucida Grande", 0, 28)); // NOI18N
buttonSet.setText("Set");
buttonSet.setEnabled(false);
buttonSet.addActionListener(new java.awt.event.ActionListener() {
@@ -303,7 +303,7 @@ public class PuckLoadingDialog extends JDialog {
textDetectedPuck.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
textDetectedPuck.setHorizontalAlignment(javax.swing.JTextField.CENTER);
buttonClearDatamatrix.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
buttonClearDatamatrix.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
buttonClearDatamatrix.setText("Clear");
buttonClearDatamatrix.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -355,15 +355,15 @@ public class PuckLoadingDialog extends JDialog {
labelStatus.setText("Waiting for Puck Detection");
labelStatus.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Scanned Datamatrix:");
labelSuggestion.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
labelSuggestion.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
labelSuggestion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelSuggestion.setText("Scan, Insert or Remove Pucks");
jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Detected Puck:");
@@ -414,7 +414,7 @@ public class PuckLoadingDialog extends JDialog {
.addComponent(jLabel2)
.addComponent(textDetectedPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelTable, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
.addComponent(panelTable, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSet)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)