Hiding puck detection errors from users.

This commit is contained in:
gac-S_Changer
2018-09-20 18:07:39 +02:00
parent dc78eb382f
commit 90292bbba2
3 changed files with 16 additions and 13 deletions

View File

@@ -31,7 +31,7 @@
<Group type="102" alignment="1" attributes="0">
<Component id="panelTop" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelBottom" pref="75" max="32767" attributes="0"/>
<Component id="panelBottom" pref="74" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
</Group>
</Group>
@@ -882,7 +882,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelDetail" pref="106" max="32767" attributes="0"/>
<Component id="panelDetail" pref="107" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelDevices" min="-2" pref="280" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>

View File

@@ -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;
}
}

View File

@@ -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) {