Display Dewar name in puck loading dialog.
This commit is contained in:
@@ -833,6 +833,14 @@ public class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
Map getPuckDatamatrixInfo() {
|
||||
try {
|
||||
return (Map) Context.getInstance().evalLineBackground("get_puck_datamatrix_info()");
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void askPuckDatamatrix(Puck puck) {
|
||||
if ((dialogAskPuckDatamatrix != null) && (dialogAskPuckDatamatrix.isShowing())) {
|
||||
dialogAskPuckDatamatrix.setVisible(false);
|
||||
|
||||
@@ -114,7 +114,8 @@
|
||||
<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="2" rowCount="0">
|
||||
<Table columnCount="3" rowCount="0">
|
||||
<Column editable="false" title="Dewar" type="java.lang.String"/>
|
||||
<Column editable="false" title="Datamatrix / Puck Id" type="java.lang.String"/>
|
||||
<Column editable="false" title="Puck Position" type="java.lang.String"/>
|
||||
</Table>
|
||||
|
||||
@@ -23,6 +23,9 @@ public class PuckLoadingDialog extends JDialog {
|
||||
Path dialogPersistPath;
|
||||
DefaultTableModel model;
|
||||
|
||||
final int INDEX_DEWAR = 0;
|
||||
final int INDEX_DATAMATRIX = 1;
|
||||
final int INDEX_POSITION = 2;
|
||||
/**
|
||||
* Creates new form PuckLoadingDialog
|
||||
*/
|
||||
@@ -35,7 +38,7 @@ public class PuckLoadingDialog extends JDialog {
|
||||
setStatusLabel(null,-1);
|
||||
setSugestionLabel(null,-1);
|
||||
model = (DefaultTableModel) table.getModel();
|
||||
table.getTableHeader().setFont(table.getTableHeader().getFont().deriveFont(22.0f));
|
||||
table.getTableHeader().setFont(table.getTableHeader().getFont().deriveFont(20.0f));
|
||||
panelTable.getVerticalScrollBar().setPreferredSize(new Dimension(30, 0));
|
||||
}
|
||||
|
||||
@@ -59,11 +62,9 @@ public class PuckLoadingDialog extends JDialog {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void update() {
|
||||
Map dms = Controller.getInstance().getPuckDatamatrix();
|
||||
Map dms = Controller.getInstance().getPuckDatamatrixInfo();
|
||||
if (dms == null) {
|
||||
dms = new HashMap();
|
||||
}
|
||||
@@ -72,13 +73,18 @@ public class PuckLoadingDialog extends JDialog {
|
||||
if (keys.length != model.getRowCount()){
|
||||
model.setRowCount(keys.length);
|
||||
}
|
||||
for (int i=0; i< keys.length; i++) {
|
||||
model.setValueAt(keys[i], i, 0);
|
||||
model.setValueAt(dms.get(keys[i]), i, 1);
|
||||
for (int i=0; i< keys.length; i++) {
|
||||
model.setValueAt(keys[i], i, INDEX_DATAMATRIX);
|
||||
try{
|
||||
Map info = (Map) dms.get(keys[i]);
|
||||
model.setValueAt(info.get("address"), i, INDEX_POSITION);
|
||||
model.setValueAt(info.get("dewar"), i, INDEX_DEWAR);
|
||||
} catch (Exception ex){
|
||||
model.setValueAt("Unknown", i, INDEX_POSITION);
|
||||
model.setValueAt("Unknown", i, INDEX_DEWAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void onPuckScanned(String datamatrix){
|
||||
textScannedDatamatrix.setText((datamatrix == null) ? "" : datamatrix.trim());
|
||||
@@ -184,7 +190,7 @@ public class PuckLoadingDialog extends JDialog {
|
||||
if (datamatrix!=null){
|
||||
datamatrix = datamatrix.trim();
|
||||
for (int i=0; i<model.getRowCount(); i++){
|
||||
if (datamatrix.equals(model.getValueAt(i, 0))){
|
||||
if (datamatrix.equals(model.getValueAt(i, INDEX_DATAMATRIX))){
|
||||
SwingUtils.scrollToVisible(table, i, 0);
|
||||
table.setRowSelectionInterval(i, i);
|
||||
break;
|
||||
@@ -196,7 +202,7 @@ public class PuckLoadingDialog extends JDialog {
|
||||
void makeVisible(Puck puck){
|
||||
if (puck!=null){
|
||||
for (int i=0; i<model.getRowCount(); i++){
|
||||
if (puck.getName().equals(model.getValueAt(i, 1))){
|
||||
if (puck.getName().equals(model.getValueAt(i, INDEX_POSITION))){
|
||||
SwingUtils.scrollToVisible(table, i, 0);
|
||||
table.setRowSelectionInterval(i, i);
|
||||
break;
|
||||
@@ -241,14 +247,14 @@ public class PuckLoadingDialog extends JDialog {
|
||||
|
||||
},
|
||||
new String [] {
|
||||
"Datamatrix / Puck Id", "Puck Position"
|
||||
"Dewar", "Datamatrix / Puck Id", "Puck Position"
|
||||
}
|
||||
) {
|
||||
Class[] types = new Class [] {
|
||||
java.lang.String.class, java.lang.String.class
|
||||
java.lang.String.class, java.lang.String.class, java.lang.String.class
|
||||
};
|
||||
boolean[] canEdit = new boolean [] {
|
||||
false, false
|
||||
false, false, false
|
||||
};
|
||||
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
@@ -359,7 +365,7 @@ public class PuckLoadingDialog extends JDialog {
|
||||
private void buttonSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetActionPerformed
|
||||
try {
|
||||
int row = table.getSelectedRow();
|
||||
String datamatrix = (row >= 0) ? String.valueOf(table.getValueAt(row, 0)) : null;
|
||||
String datamatrix = (row >= 0) ? String.valueOf(table.getValueAt(row, INDEX_DATAMATRIX)) : null;
|
||||
if (datamatrix != null) {
|
||||
onManualSetPuckLocation(datamatrix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user