PuckLoadingDialog options

This commit is contained in:
gac-S_Changer
2026-03-23 13:37:17 +01:00
parent 66ff31be8a
commit b9ca25e91d
4 changed files with 417 additions and 275 deletions
@@ -90,6 +90,7 @@ public class BasePlatePanel extends DevicePanel {
public enum Mode {
single,
pucks,
horizontal,
vertical,
overlapped,
@@ -180,6 +181,11 @@ public class BasePlatePanel extends DevicePanel {
puckPlotRect = null;
basePlateGraphics.draw(g2d, platePlotRect, (img==null), false, true, DrawMode.center, img);
break;
case pucks:
platePlotRect = plotRect;
puckPlotRect = null;
basePlateGraphics.draw(g2d, platePlotRect, false, false, true, DrawMode.center, null);
break;
case horizontal:
platePlotRect = new Rectangle(plotRect.x, plotRect.y, plotRect.width / 2, plotRect.height);
basePlateGraphics.draw(g2d, platePlotRect, false, true, true, DrawMode.fill, null);
+6 -2
View File
@@ -25,7 +25,9 @@ import ch.psi.pshell.swing.SwingUtils;
import ch.psi.pshell.utils.State.StateException;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
@@ -844,6 +846,9 @@ public class Controller {
laserPos = pos;
getMainFrame().evalAsync("set_laser_pos(" + ((pos==null) ? "" : ("'" + pos + "'") ) + ")" ,true);
getMainFrame().basePlatePanel.pointPuck((pos==null) ? null : basePlate.getPuckByName(pos));
if ((dialogPuckLoading != null) && (dialogPuckLoading.isVisible()) && dialogPuckLoading.getBasePlatePanel()!=null) {
dialogPuckLoading.getBasePlatePanel().pointPuck((pos==null) ? null : basePlate.getPuckByName(pos));
}
} catch (StateException ex) {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -1083,8 +1088,7 @@ public class Controller {
if ((dialogPuckLoading != null) && (dialogPuckLoading.isVisible())) {
return;
}
dialogPuckLoading = new PuckLoadingDialog(mainFrame.getTopLevel(), false);
dialogPuckLoading.setLocationRelativeTo(mainFrame);
dialogPuckLoading = new PuckLoadingDialog(mainFrame.getTopLevel(), false, false, true);
dialogPuckLoading.setVisible(true);
checkPuckDetectionEnabling();
+230 -174
View File
@@ -23,194 +23,250 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonSet" min="-2" pref="201" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="labelSuggestion" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonClearDatamatrix" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel2" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="textDetectedPuck" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="panelTable" pref="531" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="splitPanel" pref="1100" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="labelStatus" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="labelSuggestion" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" linkSize="2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="buttonClearDatamatrix" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<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="235" 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"/>
<Component id="labelStatus" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="splitPanel" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Container class="javax.swing.JSplitPane" name="splitPanel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="18" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Scanned Datamatrix:"/>
<Property name="dividerLocation" type="int" value="500"/>
<Property name="dividerSize" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textScannedDatamatrix">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Container class="javax.swing.JScrollPane" name="panelTable">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="autoCreateRowSorter" type="boolean" value="true"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="0">
<Column editable="false" title="User" type="java.lang.String"/>
<Column editable="false" title="Dewar" type="java.lang.String"/>
<Column editable="false" title="Puck Id/Datamatrix" type="java.lang.String"/>
<Column editable="false" title="Puck Position" type="java.lang.String"/>
</Table>
</Property>
<Property name="rowHeight" type="int" value="40"/>
<Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
<JTableSelectionModel selectionMode="0"/>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tableMouseReleased"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonSet" min="-2" pref="201" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="labelSuggestion" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonClearDatamatrix" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="textDetectedPuck" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="panelTable" pref="0" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<Component id="labelStatus" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="labelSuggestion" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" linkSize="2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="buttonClearDatamatrix" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<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"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="buttonSet" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelStatus" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<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"/>
</Property>
<Property name="text" type="java.lang.String" value="Set"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSetActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="textDetectedPuck">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<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"/>
</Property>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearDatamatrixActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="textScannedDatamatrix">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Container class="javax.swing.JScrollPane" name="panelTable">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="autoCreateRowSorter" type="boolean" value="true"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="0">
<Column editable="false" title="User" type="java.lang.String"/>
<Column editable="false" title="Dewar" type="java.lang.String"/>
<Column editable="false" title="Puck Id/Datamatrix" type="java.lang.String"/>
<Column editable="false" title="Puck Position" type="java.lang.String"/>
</Table>
</Property>
<Property name="rowHeight" type="int" value="40"/>
<Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
<JTableSelectionModel selectionMode="0"/>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tableMouseReleased"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="labelStatus">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="24" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Waiting for Puck Detection"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
</Component>
<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"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Scanned Datamatrix:"/>
</Properties>
</Component>
<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"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Scan, Insert or Remove Pucks"/>
</Properties>
</Component>
<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"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Detected Puck:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="ch.psi.mxsc.BasePlatePanel" name="basePlatePanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="500" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="600" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
<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"/>
</Property>
<Property name="text" type="java.lang.String" value="Set"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSetActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<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"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Scan, Insert or Remove Pucks"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelStatus">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="24" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Waiting for Puck Detection"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
</Component>
<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"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Detected Puck:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textDetectedPuck">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<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"/>
</Property>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearDatamatrixActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
+175 -99
View File
@@ -5,6 +5,7 @@ import ch.psi.pshell.app.MainFrame;
import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.swing.SwingUtils;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@@ -20,8 +21,11 @@ import javax.swing.table.DefaultTableModel;
*
*/
public class PuckLoadingDialog extends JDialog {
Path dialogPersistPath;
DefaultTableModel model;
final Path dialogPersistPath;
final DefaultTableModel model;
final boolean persist;
final boolean showBasePlate;
final int INDEX_USER = 0;
final int INDEX_DEWAR = 1;
@@ -30,38 +34,72 @@ public class PuckLoadingDialog extends JDialog {
/**
* Creates new form PuckLoadingDialog
*/
public PuckLoadingDialog(java.awt.Frame parent, boolean modal) {
public PuckLoadingDialog(java.awt.Frame parent, boolean modal, boolean persist, boolean showBasePlate ) {
super(parent, "Puck Loading", modal);
initComponents();
this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
this.setName("PuckLoadingDialog");
dialogPersistPath = Paths.get(Setup.getContextPath(), getClass().getSimpleName());
this.persist=persist;
this.showBasePlate=showBasePlate;
setStatusLabel(null,-1);
setSugestionLabel(null,-1);
model = (DefaultTableModel) table.getModel();
table.getTableHeader().setFont(table.getTableHeader().getFont().deriveFont(16.0f));
panelTable.getVerticalScrollBar().setPreferredSize(new Dimension(30, 0));
panelTable.getVerticalScrollBar().setPreferredSize(new Dimension(30, 0));
basePlatePanel.setMode(BasePlatePanel.Mode.pucks);
basePlatePanel.setSelectionMode(BasePlatePanel.SelectionMode.Pucks);
basePlatePanel.setDevice(Controller.getInstance().basePlate);
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);
}
}
public BasePlatePanel getBasePlatePanel(){
return showBasePlate ? basePlatePanel : null;
}
@Override
public void setVisible(boolean value){
boolean visible = isVisible();
if (visible && !value){
try {
MainFrame.save(PuckLoadingDialog.this, dialogPersistPath);
} catch (Exception ex) {
Logger.getLogger(DataPanel.class.getName()).log(Level.WARNING, null, ex);
}
}
super.setVisible(value);
if (!visible && value){
try {
MainFrame.restore(PuckLoadingDialog.this, dialogPersistPath);
} catch (Exception ex) {
Logger.getLogger(DataPanel.class.getName()).log(Level.WARNING, null, ex);
}
update();
}
public void setVisible(boolean visible){
if (visible != isVisible()){
if (!visible){
if (persist) {
try {
MainFrame.save(PuckLoadingDialog.this, dialogPersistPath);
} catch (Exception ex) {
Logger.getLogger(DataPanel.class.getName()).log(Level.WARNING, null, ex);
}
}
}
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());
}
}
update();
}
}
}
void update() {
@@ -231,22 +269,45 @@ public class PuckLoadingDialog extends JDialog {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
splitPanel = new javax.swing.JSplitPane();
jPanel1 = new javax.swing.JPanel();
buttonSet = new javax.swing.JButton();
textDetectedPuck = new javax.swing.JTextField();
buttonClearDatamatrix = new javax.swing.JButton();
textScannedDatamatrix = new javax.swing.JTextField();
panelTable = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
buttonSet = new javax.swing.JButton();
labelSuggestion = new javax.swing.JLabel();
labelStatus = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
labelSuggestion = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
textDetectedPuck = new javax.swing.JTextField();
buttonClearDatamatrix = new javax.swing.JButton();
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Scanned Datamatrix:");
splitPanel.setDividerLocation(500);
splitPanel.setDividerSize(0);
buttonSet.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
buttonSet.setText("Set");
buttonSet.setEnabled(false);
buttonSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSetActionPerformed(evt);
}
});
textDetectedPuck.setEditable(false);
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.setText("Clear");
buttonClearDatamatrix.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonClearDatamatrixActionPerformed(evt);
}
});
textScannedDatamatrix.setEditable(false);
textScannedDatamatrix.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
@@ -287,96 +348,108 @@ public class PuckLoadingDialog extends JDialog {
});
panelTable.setViewportView(table);
buttonSet.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
buttonSet.setText("Set");
buttonSet.setEnabled(false);
buttonSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSetActionPerformed(evt);
}
});
labelSuggestion.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
labelSuggestion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelSuggestion.setText("Scan, Insert or Remove Pucks");
labelStatus.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
labelStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelStatus.setText("Waiting for Puck Detection");
labelStatus.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Scanned Datamatrix:");
labelSuggestion.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // 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.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Detected Puck:");
textDetectedPuck.setEditable(false);
textDetectedPuck.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
textDetectedPuck.setHorizontalAlignment(javax.swing.JTextField.CENTER);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonSet, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(labelSuggestion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textScannedDatamatrix)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonClearDatamatrix))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textDetectedPuck))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(panelTable, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGap(14, 14, 14))
.addComponent(labelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
buttonClearDatamatrix.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
buttonClearDatamatrix.setText("Clear");
buttonClearDatamatrix.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonClearDatamatrixActionPerformed(evt);
}
});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(labelSuggestion)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textScannedDatamatrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(buttonClearDatamatrix))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.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)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSet)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelStatus)
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonClearDatamatrix, textScannedDatamatrix});
splitPanel.setRightComponent(jPanel1);
javax.swing.GroupLayout basePlatePanelLayout = new javax.swing.GroupLayout(basePlatePanel);
basePlatePanel.setLayout(basePlatePanelLayout);
basePlatePanelLayout.setHorizontalGroup(
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 500, Short.MAX_VALUE)
);
basePlatePanelLayout.setVerticalGroup(
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 600, Short.MAX_VALUE)
);
splitPanel.setLeftComponent(basePlatePanel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonSet, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(labelSuggestion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textScannedDatamatrix)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonClearDatamatrix))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textDetectedPuck))
.addGroup(layout.createSequentialGroup()
.addComponent(panelTable, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
.addGap(14, 14, 14)))
.addComponent(splitPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 1100, Short.MAX_VALUE)
.addContainerGap())
.addComponent(labelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(labelSuggestion)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textScannedDatamatrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(buttonClearDatamatrix))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.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, 235, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSet)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelStatus))
.addComponent(splitPanel)
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonClearDatamatrix, textScannedDatamatrix});
pack();
}// </editor-fold>//GEN-END:initComponents
@@ -447,7 +520,7 @@ public class PuckLoadingDialog extends JDialog {
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
PuckLoadingDialog dialog = new PuckLoadingDialog(new javax.swing.JFrame(), true);
PuckLoadingDialog dialog = new PuckLoadingDialog(new javax.swing.JFrame(), true, false, true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
@@ -460,13 +533,16 @@ public class PuckLoadingDialog extends JDialog {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private ch.psi.mxsc.BasePlatePanel basePlatePanel;
private javax.swing.JButton buttonClearDatamatrix;
javax.swing.JButton buttonSet;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel labelStatus;
private javax.swing.JLabel labelSuggestion;
private javax.swing.JScrollPane panelTable;
private javax.swing.JSplitPane splitPanel;
javax.swing.JTable table;
javax.swing.JTextField textDetectedPuck;
javax.swing.JTextField textScannedDatamatrix;