Puck detection dialog is maximized
This commit is contained in:
@@ -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.MouseEvent;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
@@ -248,6 +249,32 @@ public class PuckLoadingDialog extends JDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
void pointPuck(Puck puck){
|
||||
if (puck!=null) {
|
||||
Controller.getInstance().setLaserPos(puck);
|
||||
} else {
|
||||
Controller.getInstance().setLaserPos((Puck)null);
|
||||
}
|
||||
}
|
||||
|
||||
void onSelected(Puck puck){
|
||||
try {
|
||||
pointPuck(puck);
|
||||
for (int row=0; row< model.getRowCount(); row++){
|
||||
String position = String.valueOf(table.getValueAt(row, INDEX_POSITION));
|
||||
if ((position!=null) && (!position.isBlank())){
|
||||
Puck p = Controller.getInstance().getPuck(position);
|
||||
if (puck.equals(p)){
|
||||
table.setRowSelectionInterval(row, row);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.clearSelection();
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}
|
||||
|
||||
void makeVisible(Puck puck){
|
||||
if (puck!=null){
|
||||
@@ -283,7 +310,11 @@ public class PuckLoadingDialog extends JDialog {
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
labelSuggestion = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel(){
|
||||
void onPuckPressed(MouseEvent e, Puck puck){
|
||||
onSelected(puck);
|
||||
}
|
||||
};
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
@@ -487,11 +518,7 @@ public class PuckLoadingDialog extends JDialog {
|
||||
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);
|
||||
}
|
||||
pointPuck(puck);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
|
||||
Reference in New Issue
Block a user