Puck detection dialog is maximized

This commit is contained in:
gac-S_Changer
2026-03-26 09:48:50 +01:00
parent 0f7a5d803a
commit 227410da04
3 changed files with 56 additions and 35 deletions
+18 -18
View File
@@ -35,7 +35,7 @@
<Group type="102" alignment="1" attributes="0">
<Component id="panelTop" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelBottom" pref="66" max="32767" attributes="0"/>
<Component id="panelBottom" pref="49" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
</Group>
</Group>
@@ -99,7 +99,7 @@
</Group>
<EmptySpace pref="242" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="panelCover" linkSize="30" max="32767" attributes="0"/>
<Component id="panelCover" linkSize="30" pref="128" max="32767" attributes="0"/>
<Component id="panelViewType" linkSize="30" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -116,7 +116,7 @@
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelLegend" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="panelCover" linkSize="7" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="panelCover" linkSize="7" alignment="1" min="-2" pref="159" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -283,7 +283,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonSampleLoad" pref="90" max="32767" attributes="0"/>
<Component id="buttonSampleLoad" pref="106" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -331,7 +331,7 @@
<Component id="jLabel1" max="32767" attributes="0"/>
<Component id="textCoverDet" max="32767" attributes="0"/>
<Component id="jLabel2" alignment="0" max="32767" attributes="0"/>
<Component id="textCoverCache" alignment="0" pref="90" max="32767" attributes="0"/>
<Component id="textCoverCache" alignment="0" pref="106" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -340,15 +340,15 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="12" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textCoverCache" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" pref="18" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textCoverDet" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="12" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -404,12 +404,12 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="14" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonCamera" max="32767" attributes="0"/>
<Component id="buttonDrawing" pref="90" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="14" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -500,7 +500,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="progressLN2" pref="428" max="32767" attributes="0"/>
<Component id="progressLN2" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
@@ -949,7 +949,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelDetail" pref="125" max="32767" attributes="0"/>
<Component id="panelDetail" pref="142" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelDevices" min="-2" pref="280" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
@@ -1057,21 +1057,21 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="devicesPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="26" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="panelExpert" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="26" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace pref="10" max="32767" attributes="0"/>
<EmptySpace pref="8" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelExpert" max="32767" attributes="0"/>
<Component id="devicesPanel" pref="238" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="9" max="32767" attributes="0"/>
<EmptySpace pref="7" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -1102,7 +1102,7 @@
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="checkExpert" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<EmptySpace type="unrelated" pref="14" max="32767" attributes="0"/>
<Component id="buttonExpertCommands" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonRecovery" min="-2" max="-2" attributes="0"/>
@@ -1112,7 +1112,7 @@
<Component id="buttonDetectionCalibrate" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonDetectionExposure" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="8" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
+1 -1
View File
@@ -490,7 +490,7 @@ public class MainPanel extends Panel {
}
try {
ledServiceMode.setColor(Controller.getInstance().isServiceMode() ? Color.YELLOW : Color.GREEN);
ledServiceMode.setColor(Controller.getInstance().isServiceMode() ? Color.RED : Color.GREEN);
} catch (Exception ex) {
ledServiceMode.setColor(Color.BLACK);
}
@@ -6,6 +6,7 @@ import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.swing.SwingUtils;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -27,6 +28,7 @@ public class PuckLoadingDialog extends JDialog {
final boolean persist;
final boolean showBasePlate;
final boolean SET_AUTO_ASSIGN = true;
final int INDEX_USER = 0;
final int INDEX_DEWAR = 1;
@@ -140,11 +142,11 @@ public class PuckLoadingDialog extends JDialog {
Controller.getInstance().setLaserPos(loadedPuck);
} else {
Puck puck = Controller.getInstance().getFreePuck();
Controller.getInstance().setLaserPos(puck.getName());
pointPuck(puck);
}
} else {
setStatusLabel(null, -1);
Controller.getInstance().setLaserPos((Puck)null);
pointPuck(null);
}
setSugestionLabel(null, -1);
buttonSet.setEnabled(false);
@@ -153,9 +155,8 @@ public class PuckLoadingDialog extends JDialog {
}
Puck detectedPuck;
String detectedDatamatrix;
void onPuckMounted(Puck puck, String datamatrix){
Controller.getInstance().setLaserPos((Puck)null);
pointPuck(null);
if ((datamatrix != null) && (!datamatrix.isEmpty())) {
setStatusLabel("Mounted puck " + datamatrix + " at " + puck.getName(), 5000);
setSugestionLabel(null, -1);
@@ -163,17 +164,25 @@ public class PuckLoadingDialog extends JDialog {
textDetectedPuck.setText("");
detectedPuck = null;
} else {
setStatusLabel("Detected puck at " + puck.getName(), -1);
setSugestionLabel("Select the datamatrix and press 'Set'", -1);
detectedPuck = puck;
setStatusLabel("Detected puck at " + puck.getName(), -1);
detectedPuck = puck;
textDetectedPuck.setText(puck.getName());
buttonSet.setEnabled(true);
int row = table.getSelectedRow();
datamatrix = (row >= 0) ? String.valueOf(table.getValueAt(row, INDEX_DATAMATRIX)) : null;
String position = (row >= 0) ? String.valueOf(table.getValueAt(row, INDEX_POSITION)) : null;
if (SET_AUTO_ASSIGN && (datamatrix != null) && (!datamatrix.isEmpty()) && (position!=null)&& (position.isEmpty())){
onManualSetPuckLocation(datamatrix);
} else {
setSugestionLabel("Select the datamatrix and press 'Set'", -1);
buttonSet.setEnabled(true);
}
table.clearSelection();
}
update();
}
Timer timerClear;
void onPuckUnmounted(Puck puck){
if (puck == detectedPuck){
@@ -182,8 +191,10 @@ public class PuckLoadingDialog extends JDialog {
if (puck == detectedPuck){
buttonSet.setEnabled(false);
detectedPuck = null;
}
makeVisible(puck);
}
makeVisible(puck);
table.clearSelection();
pointPuck(null);
update();
}
@@ -496,7 +507,7 @@ public class PuckLoadingDialog extends JDialog {
try {
int row = table.getSelectedRow();
String datamatrix = (row >= 0) ? String.valueOf(table.getValueAt(row, INDEX_DATAMATRIX)) : null;
if (datamatrix != null) {
if ((datamatrix != null) && (!datamatrix.isEmpty())){
onManualSetPuckLocation(datamatrix);
}
} catch (Exception ex) {
@@ -507,6 +518,8 @@ public class PuckLoadingDialog extends JDialog {
private void buttonClearDatamatrixActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearDatamatrixActionPerformed
try {
Controller.getInstance().onPuckScanned(null);
table.clearSelection();
pointPuck(null);
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
@@ -516,17 +529,25 @@ public class PuckLoadingDialog extends JDialog {
try {
int row = table.getSelectedRow();
String position = (row >= 0) ? String.valueOf(table.getValueAt(row, INDEX_POSITION)) : null;
Puck puck = null;
if ((position!=null) && (!position.isBlank())){
Puck puck = Controller.getInstance().getPuck(position);
pointPuck(puck);
}
puck = Controller.getInstance().getPuck(position);
} else {
puck = Controller.getInstance().getFreePuck();
}
pointPuck(puck);
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_tableMouseReleased
private void tableKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableKeyReleased
tableMouseReleased(null);
if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
table.clearSelection();
pointPuck(null);
} else {
tableMouseReleased(null);
}
}//GEN-LAST:event_tableKeyReleased
/**