Improve puck loading management
This commit is contained in:
@@ -22,7 +22,6 @@ import javax.swing.table.DefaultTableModel;
|
||||
public class PuckLoadingDialog extends JDialog {
|
||||
Path dialogPersistPath;
|
||||
DefaultTableModel model;
|
||||
final boolean load;
|
||||
|
||||
final int INDEX_USER = 0;
|
||||
final int INDEX_DEWAR = 1;
|
||||
@@ -31,10 +30,9 @@ public class PuckLoadingDialog extends JDialog {
|
||||
/**
|
||||
* Creates new form PuckLoadingDialog
|
||||
*/
|
||||
public PuckLoadingDialog(java.awt.Frame parent, boolean load, boolean modal) {
|
||||
super(parent, load ? "Puck Loading" : "Puck Unloading", modal);
|
||||
public PuckLoadingDialog(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, "Puck Loading", modal);
|
||||
initComponents();
|
||||
this.load = load;
|
||||
this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
|
||||
this.setName("PuckLoadingDialog");
|
||||
dialogPersistPath = Paths.get(Setup.getContextPath(), getClass().getSimpleName());
|
||||
@@ -282,6 +280,11 @@ public class PuckLoadingDialog extends JDialog {
|
||||
table.setRowHeight(40);
|
||||
table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
table.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
||||
tableMouseReleased(evt);
|
||||
}
|
||||
});
|
||||
panelTable.setViewportView(table);
|
||||
|
||||
buttonSet.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
|
||||
@@ -397,6 +400,23 @@ public class PuckLoadingDialog extends JDialog {
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearDatamatrixActionPerformed
|
||||
|
||||
private void tableMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseReleased
|
||||
try {
|
||||
int row = table.getSelectedRow();
|
||||
String position = (row >= 0) ? String.valueOf(table.getValueAt(row, INDEX_POSITION)) : null;
|
||||
if ((position!=null) && (!position.isBlank())){
|
||||
Puck puck = Controller.getInstance().getPuck(position);
|
||||
if (puck!=null) {
|
||||
Controller.getInstance().setLaserPos(puck);
|
||||
} else {
|
||||
Controller.getInstance().setLaserPos((Puck)null);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}//GEN-LAST:event_tableMouseReleased
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
@@ -427,7 +447,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, true);
|
||||
PuckLoadingDialog dialog = new PuckLoadingDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
|
||||
Reference in New Issue
Block a user