Better order of fields in sample table.
This commit is contained in:
@@ -45,7 +45,7 @@ public class MainPanel extends Panel {
|
||||
Boolean manualMode;
|
||||
Boolean roomTemperature;
|
||||
Boolean puckLoading;
|
||||
|
||||
|
||||
public final String PUCK_LOADING_STATUS = "Puck loading";
|
||||
|
||||
public MainPanel() {
|
||||
@@ -55,31 +55,31 @@ public class MainPanel extends Panel {
|
||||
basePlatePanel.setMode(BasePlatePanel.Mode.single);
|
||||
setExpertMode(false);
|
||||
setDefaultDetail();
|
||||
|
||||
|
||||
int row = 0;
|
||||
for (String segment : new String[]{"A", "B", "C", "D", "E", "F"}){
|
||||
for (int puck=1; puck<=5; puck++){
|
||||
tablePucks.getModel().setValueAt(segment+puck, row++, 0);
|
||||
for (String segment : new String[]{"A", "B", "C", "D", "E", "F"}) {
|
||||
for (int puck = 1; puck <= 5; puck++) {
|
||||
tablePucks.getModel().setValueAt(segment + puck, row++, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tablePucks.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
try{
|
||||
try {
|
||||
String add = String.valueOf(tablePucks.getModel().getValueAt(tablePucks.getSelectedRow(), 0));
|
||||
String cur = Controller.getInstance().getCurrentSelection();
|
||||
if (cur!=null){
|
||||
cur = cur.substring(0,2);
|
||||
if (cur != null) {
|
||||
cur = cur.substring(0, 2);
|
||||
}
|
||||
if (!add.equals(cur)){
|
||||
if (!add.equals(cur)) {
|
||||
Puck puck = Controller.getInstance().getPuck(add);
|
||||
Controller.getInstance().selectPuck(puck);
|
||||
}
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class MainPanel extends Panel {
|
||||
public void onInitialize(int runCount) {
|
||||
stopTimer();
|
||||
Controller.getInstance().onInitialize(runCount);
|
||||
if (basePlatePanel.getDevice() != (Device) getDevice("BasePlate")){
|
||||
if (basePlatePanel.getDevice() != (Device) getDevice("BasePlate")) {
|
||||
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
|
||||
}
|
||||
try {
|
||||
@@ -110,9 +110,8 @@ public class MainPanel extends Panel {
|
||||
});
|
||||
updateLevel(((Device) getDevice("dewar_level")).take());
|
||||
|
||||
|
||||
((Device) getDevice("air_pressure_ok")).addListener(new DeviceAdapter() {
|
||||
@Override
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateAirPressure(value);
|
||||
}
|
||||
@@ -140,20 +139,21 @@ public class MainPanel extends Panel {
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updatePsysSafety(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
updatePsysSafety(((Device) getDevice("feedback_psys_safety")).take());
|
||||
((Device) getDevice("robot")).addListener(new DeviceAdapter() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateMode(value);
|
||||
}
|
||||
|
||||
public void onStateChanged(Device device, State state, State former) {
|
||||
if (!state.isNormal()){
|
||||
if (!state.isNormal()) {
|
||||
updateMode(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
updateMode(((Device) getDevice("robot")).take());
|
||||
}
|
||||
});
|
||||
updateMode(((Device) getDevice("robot")).take());
|
||||
} catch (Exception ex) {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -165,50 +165,48 @@ public class MainPanel extends Panel {
|
||||
refreshSamplesTable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
Controller.getInstance().onStateChange(state, former);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onTimer() {
|
||||
devicesPanel.update();
|
||||
try {
|
||||
roomTemperature = Controller.getInstance().isRoomTemp();
|
||||
ledRoomTemperature.setColor( roomTemperature ? Color.YELLOW : Color.GREEN);
|
||||
ledRoomTemperature.setColor(roomTemperature ? Color.YELLOW : Color.GREEN);
|
||||
labelRoomTemperature.setText(roomTemperature ? "Room Temperature" : "Cryo Operation");
|
||||
try {
|
||||
ledHeaterOk.setColor(roomTemperature ? Color.GREEN :( ((Double)panelHeaterTemp.getDevice().take())<20.0 ? Color.RED : Color.GREEN));
|
||||
ledHeaterOk.setColor(roomTemperature ? Color.GREEN : (((Double) panelHeaterTemp.getDevice().take()) < 20.0 ? Color.RED : Color.GREEN));
|
||||
} catch (Exception ex) {
|
||||
ledHeaterOk.setColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
roomTemperature = null;
|
||||
roomTemperature = null;
|
||||
ledRoomTemperature.setColor(Color.BLACK);
|
||||
labelRoomTemperature.setText("Room Temperature");
|
||||
}
|
||||
Controller.getInstance().onTimer();
|
||||
if (getState()==State.Ready){
|
||||
if (Boolean.TRUE.equals(puckLoading)){
|
||||
if (getState() == State.Ready) {
|
||||
if (Boolean.TRUE.equals(puckLoading)) {
|
||||
getView().getStatusBar().setStatusMessage(PUCK_LOADING_STATUS);
|
||||
} else {
|
||||
if (PUCK_LOADING_STATUS.equals(getView().getStatusBar().getStatusLabel().getText())){
|
||||
if (PUCK_LOADING_STATUS.equals(getView().getStatusBar().getStatusLabel().getText())) {
|
||||
getView().getStatusBar().setApplicationState(getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void refresh(){
|
||||
|
||||
void refresh() {
|
||||
repaint();
|
||||
for (Puck p : Controller.getInstance().basePlate.getPucks()) {
|
||||
int index = p.getUserIndex();
|
||||
tablePucks.getModel().setValueAt(p.getStatus(), index, 1);
|
||||
tablePucks.getModel().setValueAt(p.getId(), index, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateLevel(Object value) {
|
||||
@@ -254,27 +252,27 @@ public class MainPanel extends Panel {
|
||||
void updatePsysSafety(Object value) {
|
||||
if ((value == null) || !(value instanceof Boolean)) {
|
||||
ledPsysSafety.setColor(Color.BLACK);
|
||||
} else if ( Boolean.TRUE.equals(manualMode)){
|
||||
ledPsysSafety.setColor(Color.YELLOW);
|
||||
} else if (Boolean.TRUE.equals(manualMode)) {
|
||||
ledPsysSafety.setColor(Color.YELLOW);
|
||||
} else if ((Boolean) value) {
|
||||
ledPsysSafety.setColor(Color.GREEN);
|
||||
} else {
|
||||
ledPsysSafety.setColor(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updateMode(Object value) {
|
||||
if ((value!=null) && (value instanceof Map)){
|
||||
manualMode = "manual".equals(String.valueOf(((Map)value).get("mode")));
|
||||
ledManualMode.setColor( manualMode ? Color.YELLOW : Color.GREEN);
|
||||
labelManualMode.setText(manualMode ? "Manual Mode" : "Remote Mode");
|
||||
if ((value != null) && (value instanceof Map)) {
|
||||
manualMode = "manual".equals(String.valueOf(((Map) value).get("mode")));
|
||||
ledManualMode.setColor(manualMode ? Color.YELLOW : Color.GREEN);
|
||||
labelManualMode.setText(manualMode ? "Manual Mode" : "Remote Mode");
|
||||
updatePsysSafety(((Device) getDevice("feedback_psys_safety")).take());
|
||||
} else {
|
||||
ledManualMode.setColor( Color.BLACK);
|
||||
labelManualMode.setText("Unknown Mode");
|
||||
ledManualMode.setColor(Color.BLACK);
|
||||
labelManualMode.setText("Unknown Mode");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updateCameraView() {
|
||||
Source source = buttonCamera.isSelected() ? (Source) this.getDevice("img") : null;
|
||||
basePlatePanel.setCameraView(source);
|
||||
@@ -346,7 +344,7 @@ public class MainPanel extends Panel {
|
||||
((GroupLayout) panelTop.getLayout()).replace(basePlatePanel, roomTempPanel);
|
||||
if (waterLevelPanel == null) {
|
||||
waterLevelPanel = new WaterLevelPanel();
|
||||
}
|
||||
}
|
||||
waterLevelPanel.setPreferredSize(panelLN2Level.getPreferredSize());
|
||||
((GroupLayout) panelTop.getLayout()).replace(panelLN2Level, waterLevelPanel);
|
||||
}
|
||||
@@ -385,8 +383,8 @@ public class MainPanel extends Panel {
|
||||
getContext().getPluginManager().unloadPlugin(commandsPlugin);
|
||||
}
|
||||
commandsPlugin = getContext().getPluginManager().loadPlugin(getContext().getSetup().expandPath("{plugins}/Commands.java"));
|
||||
((Panel)commandsPlugin).setDetached(true, getTopLevel());
|
||||
getContext().getPluginManager().initializePlugin(commandsPlugin);
|
||||
((Panel) commandsPlugin).setDetached(true, getTopLevel());
|
||||
getContext().getPluginManager().initializePlugin(commandsPlugin);
|
||||
}
|
||||
|
||||
Plugin recoveryPlugin;
|
||||
@@ -396,9 +394,9 @@ public class MainPanel extends Panel {
|
||||
getContext().getPluginManager().unloadPlugin(recoveryPlugin);
|
||||
}
|
||||
recoveryPlugin = getContext().getPluginManager().loadPlugin(getContext().getSetup().expandPath("{plugins}/Recovery.java"));
|
||||
((Panel)recoveryPlugin).setDetached(true, getTopLevel());
|
||||
getContext().getPluginManager().initializePlugin(recoveryPlugin);
|
||||
|
||||
((Panel) recoveryPlugin).setDetached(true, getTopLevel());
|
||||
getContext().getPluginManager().initializePlugin(recoveryPlugin);
|
||||
|
||||
}
|
||||
|
||||
void setDefaultDetail() {
|
||||
@@ -427,10 +425,11 @@ public class MainPanel extends Panel {
|
||||
return panelDetail.getSize();
|
||||
}
|
||||
|
||||
|
||||
String[] HEADER = new String[]{"Puck Address", "Mount Count", "User Name", "Puck Name", "Sample Status",
|
||||
"Sample Name", "Sample Position", "Puck Barcode", "Dewar Name", "Puck Type"};
|
||||
|
||||
String[] HEADER = new String[]{
|
||||
"User Name", "Dewar Name",
|
||||
"Puck Name", "Puck Address", "Puck Barcode", "Puck Type",
|
||||
"Sample Name", "Sample Position", "Sample Status", "Mount Count"
|
||||
};
|
||||
|
||||
void refreshSamplesTable() {
|
||||
try {
|
||||
@@ -440,15 +439,19 @@ public class MainPanel extends Panel {
|
||||
SampleInfo[] samples = (SampleInfo[]) JsonSerializer.decode(json, SampleInfo[].class);
|
||||
|
||||
Object[][] sampleData = new Object[samples.length][];
|
||||
for (int i=0; i< samples.length; i++) {
|
||||
for (int i = 0; i < samples.length; i++) {
|
||||
sampleData[i] = samples[i].getData();
|
||||
}
|
||||
|
||||
|
||||
tableSamples.setModel(new DefaultTableModel(
|
||||
sampleData,
|
||||
HEADER
|
||||
));
|
||||
) {
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
clearSamplesTable();
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
@@ -460,16 +463,20 @@ public class MainPanel extends Panel {
|
||||
tableSamples.setModel(new DefaultTableModel(
|
||||
new Object[][]{},
|
||||
HEADER
|
||||
));
|
||||
}
|
||||
|
||||
) {
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void onSelectionChanged(String segment, Integer puck, Integer sample){
|
||||
if (segment != null){
|
||||
void onSelectionChanged(String segment, Integer puck, Integer sample) {
|
||||
if (segment != null) {
|
||||
String add = segment + String.valueOf(puck);
|
||||
for (int i=0; i<tablePucks.getModel().getRowCount(); i++){
|
||||
if (tablePucks.getModel().getValueAt(i, 0).equals(add)){
|
||||
if (tablePucks.getSelectedRow()!=i){
|
||||
for (int i = 0; i < tablePucks.getModel().getRowCount(); i++) {
|
||||
if (tablePucks.getModel().getValueAt(i, 0).equals(add)) {
|
||||
if (tablePucks.getSelectedRow() != i) {
|
||||
tablePucks.setRowSelectionInterval(i, i);
|
||||
SwingUtils.scrollToVisible(tablePucks, i, 0);
|
||||
}
|
||||
@@ -478,26 +485,25 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPuckDatamatrix(String datamatrix){
|
||||
textPuckDatamatrix.setText((datamatrix==null) ? "" : String.valueOf(datamatrix));
|
||||
}
|
||||
|
||||
public void setSampleDatamatrix(String datamatrix){
|
||||
textSampleDatamatrix.setText((datamatrix==null) ? "" : String.valueOf(datamatrix));
|
||||
|
||||
public void setPuckDatamatrix(String datamatrix) {
|
||||
textPuckDatamatrix.setText((datamatrix == null) ? "" : String.valueOf(datamatrix));
|
||||
}
|
||||
|
||||
public String getPuckDatamatrix(){
|
||||
public void setSampleDatamatrix(String datamatrix) {
|
||||
textSampleDatamatrix.setText((datamatrix == null) ? "" : String.valueOf(datamatrix));
|
||||
}
|
||||
|
||||
public String getPuckDatamatrix() {
|
||||
String ret = textPuckDatamatrix.getText();
|
||||
return (ret != null) ? ret.trim() : "";
|
||||
}
|
||||
|
||||
public String getSampleDatamatrix(){
|
||||
|
||||
public String getSampleDatamatrix() {
|
||||
String ret = textSampleDatamatrix.getText();
|
||||
return (ret != null) ? ret.trim() : "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
@@ -1474,14 +1480,14 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearDetActionPerformed
|
||||
|
||||
|
||||
|
||||
private void checkExpertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkExpertActionPerformed
|
||||
if (checkExpert.isSelected()){
|
||||
if (checkExpert.isSelected()) {
|
||||
PasswordDialog dlg = new PasswordDialog(getTopLevel(), true, 1234);
|
||||
dlg.setResizable(false);
|
||||
dlg.setLocationRelativeTo(getTopLevel());
|
||||
dlg.setVisible(true);
|
||||
if (dlg.getResult() == false){
|
||||
if (dlg.getResult() == false) {
|
||||
checkExpert.setSelected(false);
|
||||
return;
|
||||
}
|
||||
@@ -1496,15 +1502,15 @@ public class MainPanel extends Panel {
|
||||
|
||||
private void btViewDewarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btViewDewarActionPerformed
|
||||
btViewRT.setSelected(!btViewDewar.isSelected());
|
||||
if (btViewRT.isSelected()){
|
||||
if (btViewRT.isSelected()) {
|
||||
setDefaultDetail();
|
||||
}
|
||||
}
|
||||
updateViewMode();
|
||||
}//GEN-LAST:event_btViewDewarActionPerformed
|
||||
|
||||
private void btViewRTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btViewRTActionPerformed
|
||||
btViewDewar.setSelected(!btViewRT.isSelected());
|
||||
if (btViewRT.isSelected()){
|
||||
if (btViewRT.isSelected()) {
|
||||
setDefaultDetail();
|
||||
}
|
||||
updateViewMode();
|
||||
|
||||
@@ -21,9 +21,11 @@ public class SampleInfo extends HashMap {
|
||||
}
|
||||
|
||||
Object[] getData() {
|
||||
return new Object[]{getStr("puckAddress"), getInt("sampleMountCount"), getStr("userName"), getStr("puckName"),
|
||||
getEnum("sampleStatus", SampleStatus.class, SampleStatus.Unknown), getStr("sampleName"), getInt("samplePosition"),
|
||||
getStr("puckBarcode"), getStr("dewarName"), getEnum("puckType", PuckType.class, PuckType.Unknown)};
|
||||
return new Object[]{getStr("userName"), getStr("dewarName"),
|
||||
getStr("puckName"), getStr("puckAddress"), getStr("puckBarcode"), getEnum("puckType", PuckType.class, PuckType.Unknown),
|
||||
getStr("sampleName"), getInt("samplePosition"), getEnum("sampleStatus", SampleStatus.class, SampleStatus.Unknown), getInt("sampleMountCount")
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
String getStr(String key) {
|
||||
|
||||
Reference in New Issue
Block a user