This commit is contained in:
@@ -5,8 +5,11 @@
|
|||||||
package ch.psi.mxsc;
|
package ch.psi.mxsc;
|
||||||
|
|
||||||
import ch.psi.pshell.device.Device;
|
import ch.psi.pshell.device.Device;
|
||||||
|
import ch.psi.pshell.device.DeviceAdapter;
|
||||||
|
import ch.psi.pshell.device.DeviceListener;
|
||||||
import ch.psi.pshell.imaging.Source;
|
import ch.psi.pshell.imaging.Source;
|
||||||
import ch.psi.pshell.ui.Panel;
|
import ch.psi.pshell.ui.Panel;
|
||||||
|
import ch.psi.utils.State;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
@@ -30,6 +33,24 @@ public class MainPanel extends Panel {
|
|||||||
Controller.getInstance().onInitialize(runCount);
|
Controller.getInstance().onInitialize(runCount);
|
||||||
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
|
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
|
||||||
basePlatePanel.getDevice().setSelectable(false);
|
basePlatePanel.getDevice().setSelectable(false);
|
||||||
|
((Device) getDevice("dewar_level")).addListener(new DeviceAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onValueChanged(Device device, Object value, Object former) {
|
||||||
|
updateLevel(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateLevel(((Device) getDevice("dewar_level")).take());
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateLevel(Object value){
|
||||||
|
if ((value == null) || !(value instanceof Number)){
|
||||||
|
progressLN2.setIndeterminate(true);
|
||||||
|
} else {
|
||||||
|
progressLN2.setIndeterminate(false);
|
||||||
|
double val = ((Number)value).doubleValue() * 10.0;
|
||||||
|
val = Math.min(Math.max((int)(val *10), 0), 1000);
|
||||||
|
progressLN2.setValue(Math.min(Math.max((int)val, 0), 1000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user