diff --git a/src/main/java/ch/psi/mxsc/MainPanel.form b/src/main/java/ch/psi/mxsc/MainPanel.form index 082e96e..a5650fd 100644 --- a/src/main/java/ch/psi/mxsc/MainPanel.form +++ b/src/main/java/ch/psi/mxsc/MainPanel.form @@ -31,7 +31,7 @@ - + @@ -882,7 +882,7 @@ - + diff --git a/src/main/java/ch/psi/mxsc/MainPanel.java b/src/main/java/ch/psi/mxsc/MainPanel.java index 9dfe885..806e551 100644 --- a/src/main/java/ch/psi/mxsc/MainPanel.java +++ b/src/main/java/ch/psi/mxsc/MainPanel.java @@ -4,8 +4,6 @@ package ch.psi.mxsc; import ch.psi.mxsc.BasePlatePanel.SelectionMode; -import ch.psi.pshell.core.Context; -import ch.psi.pshell.core.JsonSerializer; import ch.psi.pshell.core.Plugin; import ch.psi.pshell.device.Device; import ch.psi.pshell.device.DeviceAdapter; @@ -90,11 +88,11 @@ public class MainPanel extends Panel { if (e.getValueIsAdjusting() == false) { int selection = tableSamples.getSelectedRow(); if (selection>=0){ - String add = String.valueOf(tableSamples.getModel().getValueAt(selection, 5)); + String add = String.valueOf(tableSamples.getModel().getValueAt(selection, COLUMN_PUCK_ADDRESS)); if (!add.trim().isEmpty()) { int pos = -1; try{ - pos = Integer.valueOf(String.valueOf(tableSamples.getModel().getValueAt(selection, 7))); + pos = Integer.valueOf(String.valueOf(tableSamples.getModel().getValueAt(selection, COLUMN_SAMPLE_POSITION))); } catch (Exception ex){ } String curSelection = Controller.getInstance().getCurrentSelection(); @@ -464,13 +462,16 @@ public class MainPanel extends Panel { return panelDetail.getSize(); } + final int COLUMN_PUCK_ADDRESS = 3; + final int COLUMN_SAMPLE_POSITION = 5; + void setSamplesTable(Object[][] sampleData) { tableSamples.setModel(new DefaultTableModel( sampleData, new String[]{ - "User Name", "Dewar Name", + //"User Name", "Dewar Name", "Puck Name", "Puck Type", "Puck Id", "Puck Address", - "Sample Name", "Sample Position", "Sample Status", "Mount Count" + "Sample Name", "Sample Position", "Sample Id", "Sample Status", "Mount Count" } ) { public boolean isCellEditable(int rowIndex, int columnIndex) { @@ -494,9 +495,9 @@ public class MainPanel extends Panel { } for (int i = 0; i < tableSamples.getModel().getRowCount(); i++) { - if (add.equals(tableSamples.getModel().getValueAt(i, 5))) { + if (add.equals(tableSamples.getModel().getValueAt(i, COLUMN_PUCK_ADDRESS))) { if (sample!=null){ - if (!sample.equals(tableSamples.getModel().getValueAt(i, 7))){ + if (!sample.equals(tableSamples.getModel().getValueAt(i, COLUMN_SAMPLE_POSITION))){ continue; } } diff --git a/src/main/java/ch/psi/mxsc/SampleInfo.java b/src/main/java/ch/psi/mxsc/SampleInfo.java index 6acc475..c392f13 100644 --- a/src/main/java/ch/psi/mxsc/SampleInfo.java +++ b/src/main/java/ch/psi/mxsc/SampleInfo.java @@ -21,15 +21,17 @@ public class SampleInfo extends HashMap { } Object[] getData() { - return new Object[]{getStr("userName"), getStr("dewarName"), + return new Object[]{ + //getStr("userName"), getStr("dewarName"), getStr("puckName"), getEnum("puckType", PuckType.class, PuckType.Unknown), getStr("puckBarcode"), getStr("puckAddress"), - getStr("sampleName"), getInt("samplePosition"), getEnum("sampleStatus", SampleStatus.class, SampleStatus.Unknown), getInt("sampleMountCount") + getStr("sampleName"), getInt("samplePosition"), getStr("sampleBarcode"), getEnum("sampleStatus", SampleStatus.class, SampleStatus.Unknown), getInt("sampleMountCount") }; } String getStr(String key) { - return String.valueOf(get(key)); + Object value = get(key); + return (value == null) ? "" : String.valueOf(get(key)); } int getInt(String key) {