From 652ea5352e17a44cb0a2b109712e4be4d3ed7ea6 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Wed, 25 Mar 2026 10:17:11 +0100 Subject: [PATCH] Puck detection dialog is maximized --- src/main/java/ch/psi/mxsc/Controller.java | 17 +++++-- .../java/ch/psi/mxsc/PuckLoadingDialog.java | 48 ++++++++++--------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/main/java/ch/psi/mxsc/Controller.java b/src/main/java/ch/psi/mxsc/Controller.java index fdfee91..d1c3dcb 100644 --- a/src/main/java/ch/psi/mxsc/Controller.java +++ b/src/main/java/ch/psi/mxsc/Controller.java @@ -57,6 +57,7 @@ import javax.swing.table.DefaultTableModel; */ public class Controller { + final boolean DIALOG_PUCK_LOAD_SHOW_BASEPLATE = true; static Controller instance; final BasePlate basePlate; RoomTemperatureBasePlate roomTemperatureBasePlate; @@ -735,13 +736,23 @@ public class Controller { if ( hasLoadDialog()) { if (puckLoading) { showDialogPuckLoading(); - mainFrame.setViewDesign(); + if (!DIALOG_PUCK_LOAD_SHOW_BASEPLATE){ + mainFrame.setViewDesign(); + } } else { hideDialogPuckLoading(); - mainFrame.setViewCamera(); + if (!DIALOG_PUCK_LOAD_SHOW_BASEPLATE){ + mainFrame.setViewCamera(); + } } } } + } else { + if (puckLoading) { + if ((dialogPuckLoading != null) && (dialogPuckLoading.isVisible())) { + dialogPuckLoading.restore(); + } + } } } @@ -854,7 +865,7 @@ public class Controller { if ((dialogPuckLoading != null) && (dialogPuckLoading.isVisible())) { return; } - dialogPuckLoading = new PuckLoadingDialog(mainFrame.getTopLevel(), false, false, true); + dialogPuckLoading = new PuckLoadingDialog(mainFrame.getTopLevel(), false, false, DIALOG_PUCK_LOAD_SHOW_BASEPLATE); dialogPuckLoading.setVisible(true); checkPuckDetectionEnabling(); diff --git a/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java b/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java index 58f02d8..28ba0e2 100644 --- a/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java +++ b/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java @@ -53,16 +53,7 @@ public class PuckLoadingDialog extends JDialog { if (!showBasePlate){ splitPanel.setDividerLocation(0); } - if (!showBasePlate && !persist){ - Rectangle bounds = parent.getBounds(); - int width = bounds.width / 3; - int height = bounds.height; - int x = bounds.x + bounds.width - width; - int y = bounds.y; - setBounds(x, y, width, height); - } else { - setLocationRelativeTo(parent); - } + setLocationRelativeTo(parent); } public BasePlatePanel getBasePlatePanel(){ @@ -84,23 +75,34 @@ public class PuckLoadingDialog extends JDialog { super.setVisible(visible); if ( visible){ - if (persist){ - try { - MainFrame.restore(PuckLoadingDialog.this, dialogPersistPath); - } catch (Exception ex) { - Logger.getLogger(DataPanel.class.getName()).log(Level.WARNING, null, ex); - } - } else { - if(showBasePlate){ - Rectangle bounds = getParent().getBounds(); - setSize(new Dimension(bounds.width * 3 / 4, bounds.height * 3 / 4)); - setLocationRelativeTo(getParent()); - } - } + restore(); update(); } } } + + public void restore(){ + if (persist){ + try { + MainFrame.restore(PuckLoadingDialog.this, dialogPersistPath); + } catch (Exception ex) { + Logger.getLogger(DataPanel.class.getName()).log(Level.WARNING, null, ex); + } + } else { + Rectangle bounds = getParent().getBounds(); + if(showBasePlate){ + //setSize(new Dimension(bounds.width * 3 / 4, bounds.height * 3 / 4)); + //setLocationRelativeTo(getParent()); + setBounds(bounds); + } else { + int width = bounds.width / 3; + int height = bounds.height; + int x = bounds.x + bounds.width - width; + int y = bounds.y; + setBounds(x, y, width, height); + } + } + } void update() { Map dms = Controller.getInstance().getPuckDatamatrixInfo();