Migrate to PShell 2.0
This commit is contained in:
@@ -12,9 +12,9 @@
|
||||
<properties>
|
||||
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
<exec.appArgs>-p=ch.psi.mxsc.MainPanel -pini=true -home=D:\Dev\pshell\home -r -6d</exec.appArgs>
|
||||
<exec.appArgs>-p ch.psi.mxsc.MainPanel -u=true -home=D:\Dev\pshell\home -r 6d</exec.appArgs>
|
||||
<exec.vmArgs></exec.vmArgs>
|
||||
<exec.mainClass>ch.psi.pshell.ui.App</exec.mainClass>
|
||||
<exec.mainClass>ch.psi.pshell.workbench.App</exec.mainClass>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
@@ -31,8 +31,8 @@
|
||||
<exec.executable>java</exec.executable>
|
||||
<jpda.listen>true</jpda.listen>
|
||||
<exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
|
||||
<exec.appArgs>-p=ch.psi.mxsc.MainPanel -pini=true -home=D:\Dev\pshell\home -r -6d</exec.appArgs>
|
||||
<exec.mainClass>ch.psi.pshell.ui.App</exec.mainClass>
|
||||
<exec.appArgs>-p ch.psi.mxsc.MainPanel -u=true -home=D:\Dev\pshell\home -r 6d</exec.appArgs>
|
||||
<exec.mainClass>ch.psi.pshell.workbench.App</exec.mainClass>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
@@ -47,9 +47,9 @@
|
||||
<properties>
|
||||
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
<exec.appArgs>-p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r -6d</exec.appArgs>
|
||||
<exec.appArgs>-p ch.psi.mxsc.MainPanel -u=true -home=D:\Dev\pshell\home -r 6d</exec.appArgs>
|
||||
<exec.vmArgs></exec.vmArgs>
|
||||
<exec.mainClass>ch.psi.pshell.ui.App</exec.mainClass>
|
||||
<exec.mainClass>ch.psi.pshell.workbench.App</exec.mainClass>
|
||||
</properties>
|
||||
</action>
|
||||
</actions>
|
||||
|
||||
9
pom.xml
9
pom.xml
@@ -3,12 +3,12 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>MXSC</artifactId>
|
||||
<version>1.21.0</version>
|
||||
<version>2.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>pshell</artifactId>
|
||||
<artifactId>workbench</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -22,8 +22,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter</name>
|
||||
@@ -34,11 +33,13 @@
|
||||
<name>bintray</name>
|
||||
<url>https://dl.bintray.com/paulscherrerinstitute/hltools</url>
|
||||
</repository>
|
||||
<!--
|
||||
<repository>
|
||||
<id>imagej</id>
|
||||
<name>imagej</name>
|
||||
<url>http://maven.imagej.net/content/repositories/public</url>
|
||||
</repository>
|
||||
-->
|
||||
<repository>
|
||||
<id>libs-snapshots-local</id>
|
||||
<name>libs-snapshots-local</name>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.app.MainFrame;
|
||||
import ch.psi.pshell.imaging.Utils;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
@@ -9,8 +9,8 @@ import ch.psi.pshell.imaging.Data;
|
||||
import ch.psi.pshell.imaging.ImageListener;
|
||||
import ch.psi.pshell.imaging.Source;
|
||||
import ch.psi.pshell.swing.DevicePanel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.Point;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
||||
@@ -5,22 +5,23 @@ package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.mxsc.Puck.Detection;
|
||||
import ch.psi.mxsc.Puck.PuckType;
|
||||
import ch.psi.pshell.core.CommandInfo;
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.core.DevicePool;
|
||||
import ch.psi.pshell.core.DevicePoolListener;
|
||||
import ch.psi.pshell.core.JsonSerializer;
|
||||
import ch.psi.pshell.sequencer.CommandInfo;
|
||||
import ch.psi.pshell.framework.Context;
|
||||
import ch.psi.pshell.devices.DevicePool;
|
||||
import ch.psi.pshell.devices.DevicePoolListener;
|
||||
import ch.psi.pshell.utils.EncoderJson;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
import ch.psi.pshell.ui.App;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.Arr;
|
||||
import ch.psi.utils.Audio;
|
||||
import ch.psi.utils.Chrono;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.app.App;
|
||||
import ch.psi.pshell.framework.Panel;
|
||||
import ch.psi.pshell.framework.Setup;
|
||||
import ch.psi.pshell.sequencer.Interpreter;
|
||||
import ch.psi.pshell.utils.Arr;
|
||||
import ch.psi.pshell.utils.Audio;
|
||||
import ch.psi.pshell.utils.Chrono;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@@ -76,7 +77,7 @@ public class Controller {
|
||||
|
||||
static void createInstance(Panel mainFrame) {
|
||||
Controller.mainFrame = (MainPanel) mainFrame;
|
||||
System.setProperty(GenericDevice.PROPERTY_CONFIG_PATH, Context.getInstance().getSetup().getDevicesPath());
|
||||
//### System.setProperty(GenericDevice.PROPERTY_CONFIG_PATH, Setup.getDevicesPath());
|
||||
if (isRt()){
|
||||
instance = new ControllerRT(mainFrame);
|
||||
} else {
|
||||
@@ -89,7 +90,7 @@ public class Controller {
|
||||
Dialog
|
||||
}
|
||||
|
||||
final PuckMountMode puckMountMode = App.hasArgument("direct") ? PuckMountMode.Direct : PuckMountMode.Dialog;
|
||||
final PuckMountMode puckMountMode = App.hasAdditionalArgument("direct") ? PuckMountMode.Direct : PuckMountMode.Dialog;
|
||||
|
||||
enum PuckSensorAccess {
|
||||
RaspberryPi,
|
||||
@@ -152,7 +153,7 @@ public class Controller {
|
||||
|
||||
}
|
||||
|
||||
final DeviceListener basePlateListener = new DeviceAdapter() {
|
||||
final DeviceListener basePlateListener = new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if (value != null) {
|
||||
@@ -207,7 +208,7 @@ public class Controller {
|
||||
basePlate.addListener(basePlateListener);
|
||||
|
||||
if (puckSensorAccess == PuckSensorAccess.Esera) {
|
||||
getMainFrame().getContext().getDevicePool().addListener(new DevicePoolListener() {
|
||||
Context.getDevicePool().addListener(new DevicePoolListener() {
|
||||
@Override
|
||||
public void onDeviceAdded(GenericDevice dev) {
|
||||
if (dev.getName().equals(PUCK_ESERA_DEVICE)) {
|
||||
@@ -250,7 +251,7 @@ public class Controller {
|
||||
}
|
||||
|
||||
public Sample getMountedSample() throws Exception{
|
||||
String mountedSample = (String) Context.getInstance().evalLineBackground("get_setting('mounted_sample_position')");
|
||||
String mountedSample = (String) Context.getInterpreter().evalLineBackground("get_setting('mounted_sample_position')");
|
||||
checkMountedSampleChange(currentMountedSample, mountedSample);
|
||||
currentMountedSample = mountedSample;
|
||||
Sample sample = basePlate.getSampleByName(currentMountedSample);
|
||||
@@ -258,9 +259,9 @@ public class Controller {
|
||||
}
|
||||
|
||||
public void resetMountedSample() throws Exception{
|
||||
String mountedSample = (String) Context.getInstance().evalLineBackground("get_setting('mounted_sample_position')");
|
||||
String mountedSample = (String) Context.getInterpreter().evalLineBackground("get_setting('mounted_sample_position')");
|
||||
checkMountedSampleChange(currentMountedSample, null);
|
||||
Context.getInstance().evalLineBackground("set_setting('mounted_sample_position', None)");
|
||||
Context.getInterpreter().evalLineBackground("set_setting('mounted_sample_position', None)");
|
||||
}
|
||||
|
||||
void checkMountedSampleChange(String former, String current){
|
||||
@@ -307,7 +308,7 @@ public class Controller {
|
||||
}
|
||||
|
||||
|
||||
final DeviceListener barcodeReaderListener = new DeviceAdapter() {
|
||||
final DeviceListener barcodeReaderListener = new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if (value != null) { //Keep last value
|
||||
@@ -321,7 +322,7 @@ public class Controller {
|
||||
}
|
||||
};
|
||||
|
||||
final DeviceListener barcodeReaderPuckListener = new DeviceAdapter() {
|
||||
final DeviceListener barcodeReaderPuckListener = new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if (value != null) { //Keep last value
|
||||
@@ -331,7 +332,7 @@ public class Controller {
|
||||
}
|
||||
};
|
||||
|
||||
final DeviceListener puckDetectionListener = new DeviceAdapter() {
|
||||
final DeviceListener puckDetectionListener = new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if (value != null) { //Keep last value
|
||||
@@ -431,35 +432,43 @@ public class Controller {
|
||||
|
||||
public Boolean isLedRoomTemp() {
|
||||
try {
|
||||
return getMainFrame().eval("is_led_room_temp()", true).equals(true);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
if (getMainFrame().getState().isInitialized()){
|
||||
return getMainFrame().eval("is_led_room_temp()", true).equals(true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean isRoomTemp() {
|
||||
try {
|
||||
return getMainFrame().eval("is_room_temp()", true).equals(true);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
if (getMainFrame().getState().isInitialized()){
|
||||
return getMainFrame().eval("is_room_temp()", true).equals(true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean isServiceMode() {
|
||||
try {
|
||||
return getMainFrame().eval("is_service_mode()", true).equals(true);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
if (getMainFrame().getState().isInitialized()){
|
||||
return getMainFrame().eval("is_service_mode()", true).equals(true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Boolean isDoorClosed() {
|
||||
try {
|
||||
return getMainFrame().eval("is_door_closed()", true).equals(true);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
if (getMainFrame().getState().isInitialized()){
|
||||
return getMainFrame().eval("is_door_closed()", true).equals(true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setServiceMode(boolean value){
|
||||
@@ -528,11 +537,11 @@ public class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public void imageDetectPucks() throws Context.ContextStateException {
|
||||
public void imageDetectPucks() throws Interpreter.InterpreterStateException {
|
||||
imageDetectPucks(null, null, null);
|
||||
}
|
||||
|
||||
public void imageDetectPucks(JComponent plot, JComponent renderer, JComponent text) throws Context.ContextStateException {
|
||||
public void imageDetectPucks(JComponent plot, JComponent renderer, JComponent text) throws Interpreter.InterpreterStateException {
|
||||
Map args = new HashMap();
|
||||
args.put("PLOT", plot);
|
||||
args.put("RENDERER", renderer);
|
||||
@@ -549,7 +558,7 @@ public class Controller {
|
||||
updateView();
|
||||
}
|
||||
|
||||
public void clearImageDetection() throws Context.ContextStateException, ScriptException, IOException, InterruptedException {
|
||||
public void clearImageDetection() throws Interpreter.InterpreterStateException, ScriptException, IOException, InterruptedException {
|
||||
Map<String, List<String>> map = (Map<String, List<String>>) getMainFrame().eval("clear_detection(None)");
|
||||
setImageDetection(map);
|
||||
}
|
||||
@@ -624,11 +633,7 @@ public class Controller {
|
||||
}
|
||||
|
||||
DevicePool getDevicePool() {
|
||||
return getMainFrame().getContext().getDevicePool();
|
||||
}
|
||||
|
||||
Context getContext() {
|
||||
return getMainFrame().getContext();
|
||||
return Context.getDevicePool();
|
||||
}
|
||||
|
||||
State getState() {
|
||||
@@ -659,13 +664,13 @@ public class Controller {
|
||||
//synchronized(samplesTableLock){
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
try {
|
||||
if (Context.getInstance().getState().isInitialized()) {
|
||||
String json = (String) Context.getInstance().evalLineBackground("get_samples_info()");
|
||||
if (Context.getInterpreter().getState().isInitialized()) {
|
||||
String json = (String) Context.getInterpreter().evalLineBackground("get_samples_info()");
|
||||
if (!json.equals(samplesTableJson)) {
|
||||
samplesTableJson = json;
|
||||
|
||||
//SamplesInfo sampleInfo = (SamplesInfo) JsonSerializer.decode(json, SampleInfo.class);
|
||||
SampleInfo[] samples = (SampleInfo[]) JsonSerializer.decode(json, SampleInfo[].class);
|
||||
//SamplesInfo sampleInfo = (SamplesInfo) EncoderJson.decode(json, SampleInfo.class);
|
||||
SampleInfo[] samples = (SampleInfo[]) EncoderJson.decode(json, SampleInfo[].class);
|
||||
|
||||
Object[][] sampleData = new Object[samples.length][];
|
||||
for (int i = 0; i < samples.length; i++) {
|
||||
@@ -755,7 +760,7 @@ public class Controller {
|
||||
public void setLaserPos(String pos){
|
||||
try {
|
||||
getMainFrame().evalAsync("set_laser_pos(" + ((pos==null) ? "" : ("'" + pos + "'") ) + ")" ,true);
|
||||
} catch (Context.ContextStateException ex) {
|
||||
} catch (Interpreter.InterpreterStateException ex) {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
@@ -772,7 +777,7 @@ public class Controller {
|
||||
|
||||
void playSound(String name) {
|
||||
try {
|
||||
Audio.playFile(new File(Context.getInstance().getSetup().expandPath("{home}/sounds/" + name + ".wav")), false);
|
||||
Audio.playFile(new File(Setup.expandPath("{home}/sounds/" + name + ".wav")), false);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.FINE, null, ex);
|
||||
}
|
||||
@@ -848,7 +853,7 @@ public class Controller {
|
||||
System.out.println("Setting datamatrix '" + datamatrix + "' to puck: " + puckName);
|
||||
|
||||
try {
|
||||
Context.getInstance().evalLineBackground("set_puck_datamatrix('" + puckName + "','" + datamatrix + "')");
|
||||
Context.getInterpreter().evalLineBackground("set_puck_datamatrix('" + puckName + "','" + datamatrix + "')");
|
||||
if (puck != null) {
|
||||
puck.setId(datamatrix);
|
||||
} else {
|
||||
@@ -871,7 +876,7 @@ public class Controller {
|
||||
|
||||
Map getPuckDatamatrix() {
|
||||
try {
|
||||
return (Map) Context.getInstance().evalLineBackground("get_puck_datamatrix()");
|
||||
return (Map) Context.getInterpreter().evalLineBackground("get_puck_datamatrix()");
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
@@ -879,7 +884,7 @@ public class Controller {
|
||||
|
||||
Map getPuckDatamatrixInfo() {
|
||||
try {
|
||||
return (Map) Context.getInstance().evalLineBackground("get_puck_datamatrix_info()");
|
||||
return (Map) Context.getInterpreter().evalLineBackground("get_puck_datamatrix_info()");
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
@@ -887,7 +892,7 @@ public class Controller {
|
||||
|
||||
String getPuckFromDatamatrix(String dm){
|
||||
try {
|
||||
return (String) Context.getInstance().evalLineBackground("get_puck_from_datamatrix('" + dm + "')");
|
||||
return (String) Context.getInterpreter().evalLineBackground("get_puck_from_datamatrix('" + dm + "')");
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
@@ -984,7 +989,7 @@ public class Controller {
|
||||
|
||||
try {
|
||||
List puckInfo = (List) getMainFrame().eval("get_puck_info()", true);
|
||||
Context.getInstance().sendEvent("DewarContentUpdate", puckInfo);
|
||||
Context.getInterpreter().sendEvent("DewarContentUpdate", puckInfo);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -1065,7 +1070,7 @@ public class Controller {
|
||||
void logStateChange(State state){
|
||||
String command = "";
|
||||
if (state==State.Busy){
|
||||
CommandInfo info = Context.getInstance().getCommandManager().getCurrentCommand(true);
|
||||
CommandInfo info = Context.getInterpreter().getCommandManager().getCurrentCommand(true);
|
||||
if (info != null){
|
||||
command = (info.script != null) ? info.script : info.command;
|
||||
}
|
||||
@@ -1076,7 +1081,7 @@ public class Controller {
|
||||
public void logEvent(String... event){
|
||||
try{
|
||||
long now = System.currentTimeMillis();
|
||||
Path path = Paths.get(Context.getInstance().getSetup().getOutputPath(), "events", Chrono.getTimeStr(now,"YYYYMMdd") + ".txt");
|
||||
Path path = Paths.get(Setup.getOutputPath(), "events", Chrono.getTimeStr(now,"YYYYMMdd") + ".txt");
|
||||
path.toFile().getParentFile().mkdirs();
|
||||
|
||||
String[] data = new String[]{
|
||||
|
||||
@@ -3,13 +3,13 @@ package ch.psi.mxsc;
|
||||
|
||||
import static ch.psi.mxsc.Controller.NUMBER_OF_PUCKS;
|
||||
import static ch.psi.mxsc.Controller.instance;
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.framework.Context;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.pshell.framework.Panel;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ControllerRT extends Controller{
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
if ((state == State.Ready)&&(former==State.Initializing)) {
|
||||
PuckDetection puckDetection = this.getContext().getDevicePool().getByName("puckDetection", PuckDetection.class);
|
||||
PuckDetection puckDetection = this.Context.getDevicePool().getByName("puckDetection", PuckDetection.class);
|
||||
if (puckDetection!=null){
|
||||
getMainFrame().removeDevice(puckDetection, true);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class ControllerRT extends Controller{
|
||||
public Boolean isRoomTempEnabled() {
|
||||
return false;
|
||||
}
|
||||
final DeviceListener basePlateListener = new DeviceAdapter() {
|
||||
final DeviceListener basePlateListener = new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if (value != null) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.core.DevicePoolListener;
|
||||
import ch.psi.pshell.devices.DevicePoolListener;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
import ch.psi.pshell.swing.DevicePanel;
|
||||
import ch.psi.pshell.swing.Led;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.swing.MonitoredPanel;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.Color;
|
||||
import java.awt.Window;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
return new GenericDevice[]{robot, barcode_reader, barcode_reader_puck, wago, laser, puck_detection, sm};
|
||||
}
|
||||
|
||||
final DeviceAdapter deviceListener = new DeviceAdapter() {
|
||||
final DeviceListener deviceListener = new DeviceListener() {
|
||||
@Override
|
||||
public void onStateChanged(Device device, State state, State former) {
|
||||
update();
|
||||
@@ -128,10 +129,10 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
DevicePanel showDevicePanel(String device){
|
||||
MonitoredPanel showDevicePanel(String device){
|
||||
if (isActive()){
|
||||
try{
|
||||
DevicePanel ret = Controller.getInstance().getMainFrame().showDevicePanel(device);
|
||||
MonitoredPanel ret = Controller.getInstance().getMainFrame().showDevicePanel(device);
|
||||
Controller.getInstance().getMainFrame().onExpertCommand(SwingUtils.getWindow(ret));
|
||||
return ret;
|
||||
} catch (Exception ex) {
|
||||
@@ -408,9 +409,9 @@ public class DevicesPanel extends javax.swing.JPanel {
|
||||
}//GEN-LAST:event_labelWagoMouseClicked
|
||||
|
||||
private void labelReaderMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelReaderMouseClicked
|
||||
DevicePanel dp1 = showDevicePanel("barcode_reader");
|
||||
MonitoredPanel dp1 = showDevicePanel("barcode_reader");
|
||||
if (Controller.getInstance().getDevicePool().getByName("barcode_reader_puck")!=null){
|
||||
DevicePanel dp2 = showDevicePanel("barcode_reader_puck");
|
||||
MonitoredPanel dp2 = showDevicePanel("barcode_reader_puck");
|
||||
if ((dp1!=null)&& (dp2!=null)){
|
||||
Window parent = ((Window )dp2.getTopLevelAncestor());
|
||||
parent.setLocation(parent.getX()+80, parent.getY()+40);
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import static ch.psi.mxsc.Controller.NUMBER_OF_PUCKS;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.utils.State;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class EseraDetection implements AutoCloseable{
|
||||
final Device device;
|
||||
|
||||
public EseraDetection(Device device){
|
||||
this.device = device;
|
||||
if (device!=null){
|
||||
device.addListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DeviceAdapter listener = new DeviceAdapter(){
|
||||
@Override
|
||||
public void onStateChanged(Device device, State state, State former) {
|
||||
if (!state.isInitialized()){
|
||||
Controller.getInstance().clearPuckStates();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if ((value == null) || !(value instanceof List)){
|
||||
Controller.getInstance().clearPuckStates();
|
||||
} else {
|
||||
List l = (List)value;
|
||||
PuckState[] puckState = Controller.getInstance().getPuckStates();
|
||||
for (int i=0; i<NUMBER_OF_PUCKS; i++ ){
|
||||
try{
|
||||
List det = (List) l.get(i);
|
||||
puckState[i].set((det.get(0).equals(0)) ? 1 : 0, (det.get(1).equals(0)) ? 1 : 0);
|
||||
} catch (Exception ex){
|
||||
puckState[i].clear();
|
||||
}
|
||||
}
|
||||
Controller.getInstance().updateView();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (device!=null){
|
||||
device.removeListener(listener);
|
||||
}
|
||||
Controller.getInstance().clearPuckStates();
|
||||
}
|
||||
}
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import static ch.psi.mxsc.Controller.NUMBER_OF_PUCKS;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class EseraDetection implements AutoCloseable{
|
||||
final Device device;
|
||||
|
||||
public EseraDetection(Device device){
|
||||
this.device = device;
|
||||
if (device!=null){
|
||||
device.addListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DeviceListener listener = new DeviceListener(){
|
||||
@Override
|
||||
public void onStateChanged(Device device, State state, State former) {
|
||||
if (!state.isInitialized()){
|
||||
Controller.getInstance().clearPuckStates();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if ((value == null) || !(value instanceof List)){
|
||||
Controller.getInstance().clearPuckStates();
|
||||
} else {
|
||||
List l = (List)value;
|
||||
PuckState[] puckState = Controller.getInstance().getPuckStates();
|
||||
for (int i=0; i<NUMBER_OF_PUCKS; i++ ){
|
||||
try{
|
||||
List det = (List) l.get(i);
|
||||
puckState[i].set((det.get(0).equals(0)) ? 1 : 0, (det.get(1).equals(0)) ? 1 : 0);
|
||||
} catch (Exception ex){
|
||||
puckState[i].clear();
|
||||
}
|
||||
}
|
||||
Controller.getInstance().updateView();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (device!=null){
|
||||
device.removeListener(listener);
|
||||
}
|
||||
Controller.getInstance().clearPuckStates();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.mxsc.BasePlatePanel.SelectionMode;
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.core.Plugin;
|
||||
import ch.psi.pshell.framework.Context;
|
||||
import ch.psi.pshell.plugin.Plugin;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.device.DeviceAdapter;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.DeviceBase;
|
||||
import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
@@ -16,16 +16,17 @@ import ch.psi.pshell.imaging.Renderer;
|
||||
import ch.psi.pshell.imaging.RendererMode;
|
||||
import ch.psi.pshell.imaging.Source;
|
||||
import ch.psi.pshell.scripting.ViewPreference;
|
||||
import ch.psi.pshell.ui.App;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.pshell.ui.StatusBar;
|
||||
import ch.psi.utils.Chrono;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.Document;
|
||||
import ch.psi.utils.swing.DocumentListener;
|
||||
import ch.psi.utils.swing.Editor;
|
||||
import ch.psi.utils.swing.JsonTableEditor;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.framework.App;
|
||||
import ch.psi.pshell.framework.Panel;
|
||||
import ch.psi.pshell.framework.Setup;
|
||||
import ch.psi.pshell.framework.StatusBar;
|
||||
import ch.psi.pshell.utils.Chrono;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import ch.psi.pshell.swing.Document;
|
||||
import ch.psi.pshell.swing.DocumentListener;
|
||||
import ch.psi.pshell.swing.Editor;
|
||||
import ch.psi.pshell.swing.JsonTableEditor;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
@@ -89,18 +90,18 @@ public class MainPanel extends Panel {
|
||||
rt
|
||||
}
|
||||
public static final BasePlateLayout BASE_PLATE_LAYOUT =
|
||||
App.hasArgument("sf") ? BasePlateLayout.sf :
|
||||
( App.hasArgument("6d") ? BasePlateLayout.x06da :
|
||||
( App.hasArgument("rt") ? BasePlateLayout.rt : BasePlateLayout.normal)
|
||||
App.hasAdditionalArgument("sf") ? BasePlateLayout.sf :
|
||||
( App.hasAdditionalArgument("6d") ? BasePlateLayout.x06da :
|
||||
( App.hasAdditionalArgument("rt") ? BasePlateLayout.rt : BasePlateLayout.normal)
|
||||
);
|
||||
|
||||
public static boolean isRt(){
|
||||
return App.hasArgument("rt");
|
||||
return App.hasAdditionalArgument("rt");
|
||||
}
|
||||
|
||||
public MainPanel() {
|
||||
initComponents();
|
||||
getContext().getPluginManager().addDynamicClass(PuckDetection.class);
|
||||
Context.getPluginManager().addDynamicClass(PuckDetection.class);
|
||||
Controller.createInstance(this);
|
||||
basePlatePanel.setMode(BasePlatePanel.Mode.single);
|
||||
setExpertMode(false);
|
||||
@@ -285,7 +286,7 @@ public class MainPanel extends Panel {
|
||||
|
||||
@Override
|
||||
protected void onLoaded() {
|
||||
if (App.isDetached()) {
|
||||
if (Setup.isDetached()) {
|
||||
Image img = new ImageIcon(this.getClass().getResource("/apple_transparent_white_100x50.png")).getImage();
|
||||
SwingUtils.getWindow(this).setIconImage(img);
|
||||
}
|
||||
@@ -365,7 +366,7 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
try {
|
||||
devicesPanel.initialize();
|
||||
((Device) getDevice("dewar_level")).addListener(new DeviceAdapter() {
|
||||
((Device) getDevice("dewar_level")).addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateLevel(value);
|
||||
@@ -373,7 +374,7 @@ public class MainPanel extends Panel {
|
||||
});
|
||||
updateLevel(((Device) getDevice("dewar_level")).take());
|
||||
|
||||
((Device) getDevice("air_pressure_ok")).addListener(new DeviceAdapter() {
|
||||
((Device) getDevice("air_pressure_ok")).addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateAirPressure(value);
|
||||
@@ -381,7 +382,7 @@ public class MainPanel extends Panel {
|
||||
});
|
||||
updateAirPressure(((Device) getDevice("air_pressure_ok")).take());
|
||||
|
||||
((Device) getDevice("n2_pressure_ok")).addListener(new DeviceAdapter() {
|
||||
((Device) getDevice("n2_pressure_ok")).addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateN2Pressure(value);
|
||||
@@ -389,7 +390,7 @@ public class MainPanel extends Panel {
|
||||
});
|
||||
updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take());
|
||||
|
||||
((Device) getDevice("feedback_local_safety")).addListener(new DeviceAdapter() {
|
||||
((Device) getDevice("feedback_local_safety")).addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateLocalSafety(value);
|
||||
@@ -399,7 +400,7 @@ public class MainPanel extends Panel {
|
||||
|
||||
updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take());
|
||||
|
||||
((Device) getDevice("gripper_dryer")).addListener(new DeviceAdapter() {
|
||||
((Device) getDevice("gripper_dryer")).addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateDryer(value);
|
||||
@@ -408,7 +409,7 @@ public class MainPanel extends Panel {
|
||||
updateDryer(((Device) getDevice("gripper_dryer")).take());
|
||||
|
||||
Device feedback_psys_safety = ((Device) getDevice("feedback_psys_safety"));
|
||||
feedback_psys_safety.addListener(new DeviceAdapter() {
|
||||
feedback_psys_safety.addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
doorsHaveOpened = Boolean.FALSE.equals(value);
|
||||
@@ -417,7 +418,7 @@ public class MainPanel extends Panel {
|
||||
});
|
||||
feedback_psys_safety.request();
|
||||
updatePsysSafety(((Device) getDevice("feedback_psys_safety")).take());
|
||||
((Device) getDevice("robot")).addListener(new DeviceAdapter() {
|
||||
((Device) getDevice("robot")).addListener(new DeviceListener() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateMode(value);
|
||||
@@ -522,7 +523,7 @@ public class MainPanel extends Panel {
|
||||
void setStatus(String status) {
|
||||
String current = current = (statusBar==null) ? this.status : statusBar.getStatusLabel().getText();
|
||||
if (!status.equals(current)) {
|
||||
getContext().setPreference(ViewPreference.STATUS, status);
|
||||
Context.getInterpreter().setPreference(ViewPreference.STATUS, status);
|
||||
}
|
||||
this.status = status;
|
||||
}
|
||||
@@ -856,7 +857,7 @@ public class MainPanel extends Panel {
|
||||
// buttonDrawing.setSelected(false);
|
||||
// updateViewType();
|
||||
} else {
|
||||
checkService.setSelected( Controller.getInstance().isServiceMode());
|
||||
checkService.setSelected( Boolean.TRUE.equals(Controller.getInstance().isServiceMode()));
|
||||
}
|
||||
if (current != expert) {
|
||||
onModeChange(expert);
|
||||
@@ -870,11 +871,11 @@ public class MainPanel extends Panel {
|
||||
|
||||
Panel showCommandsPanel() {
|
||||
if (commandsPlugin != null) {
|
||||
getContext().getPluginManager().unloadPlugin(commandsPlugin);
|
||||
Context.getPluginManager().unloadPlugin(commandsPlugin);
|
||||
}
|
||||
commandsPlugin = getContext().getPluginManager().loadPlugin(getContext().getSetup().expandPath("{plugins}/Commands.java"));
|
||||
commandsPlugin = Context.getPluginManager().loadPlugin(Setup.expandPath("{plugins}/Commands.java"));
|
||||
((Panel) commandsPlugin).setDetached(true, getTopLevel());
|
||||
getContext().getPluginManager().initializePlugin(commandsPlugin);
|
||||
Context.getPluginManager().initializePlugin(commandsPlugin);
|
||||
return ((Panel) commandsPlugin);
|
||||
}
|
||||
|
||||
@@ -882,11 +883,11 @@ public class MainPanel extends Panel {
|
||||
|
||||
Panel showRecoveryPanel() {
|
||||
if (recoveryPlugin != null) {
|
||||
getContext().getPluginManager().unloadPlugin(recoveryPlugin);
|
||||
Context.getPluginManager().unloadPlugin(recoveryPlugin);
|
||||
}
|
||||
recoveryPlugin = getContext().getPluginManager().loadPlugin(getContext().getSetup().expandPath("{plugins}/Recovery.java"));
|
||||
recoveryPlugin = Context.getPluginManager().loadPlugin(Setup.expandPath("{plugins}/Recovery.java"));
|
||||
((Panel) recoveryPlugin).setDetached(true, getTopLevel());
|
||||
getContext().getPluginManager().initializePlugin(recoveryPlugin);
|
||||
Context.getPluginManager().initializePlugin(recoveryPlugin);
|
||||
return ((Panel) recoveryPlugin);
|
||||
}
|
||||
|
||||
@@ -1036,7 +1037,7 @@ public class MainPanel extends Panel {
|
||||
|
||||
JsonTableEditor openSamplesInfo(){
|
||||
try{
|
||||
String file = getContext().getSetup().expandPath("{context}/samples_info.json");
|
||||
String file = Setup.expandPath("{context}/samples_info.json");
|
||||
if (getView()!=null){
|
||||
for (Editor ed : getView().getEditors()) {
|
||||
if (ed instanceof JsonTableEditor) {
|
||||
@@ -1117,7 +1118,7 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
}
|
||||
|
||||
final DeviceListener cover_detection_listener = new DeviceAdapter() {
|
||||
final DeviceListener cover_detection_listener = new DeviceListener() {
|
||||
@Override
|
||||
public void onCacheChanged(Device device, Object value, Object former, long timestamp, boolean valueChange) {
|
||||
Point mm = null;
|
||||
|
||||
@@ -1,92 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.mxsc.BasePlatePanel;
|
||||
import ch.psi.mxsc.Controller;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MainPanelTest extends Panel {
|
||||
/** Creates new form Panel */
|
||||
|
||||
public MainPanelTest() {
|
||||
initComponents();
|
||||
SwingUtils.setEnumCombo(comboMode, BasePlatePanel.Mode.class);
|
||||
comboMode.setSelectedItem(basePlatePanel.getMode());
|
||||
setPersistedComponents(new Component[]{comboMode});
|
||||
Controller.createInstance(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
Controller.getInstance().onInitialize(runCount);
|
||||
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
|
||||
}
|
||||
|
||||
|
||||
/** 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 regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
|
||||
comboMode = new javax.swing.JComboBox<>();
|
||||
|
||||
comboMode.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
comboMode.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboModeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout basePlatePanelLayout = new javax.swing.GroupLayout(basePlatePanel);
|
||||
basePlatePanel.setLayout(basePlatePanelLayout);
|
||||
basePlatePanelLayout.setHorizontalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
.addGap(0, 386, Short.MAX_VALUE)
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
basePlatePanelLayout.setVerticalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(basePlatePanelLayout.createSequentialGroup()
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 280, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void comboModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModeActionPerformed
|
||||
basePlatePanel.setMode((BasePlatePanel.Mode) comboMode.getSelectedItem());
|
||||
}//GEN-LAST:event_comboModeActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private ch.psi.mxsc.BasePlatePanel basePlatePanel;
|
||||
private javax.swing.JComboBox<String> comboMode;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.mxsc.BasePlatePanel;
|
||||
import ch.psi.mxsc.Controller;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.framework.Panel;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MainPanelTest extends Panel {
|
||||
/** Creates new form Panel */
|
||||
|
||||
public MainPanelTest() {
|
||||
initComponents();
|
||||
SwingUtils.setEnumCombo(comboMode, BasePlatePanel.Mode.class);
|
||||
comboMode.setSelectedItem(basePlatePanel.getMode());
|
||||
setPersistedComponents(new Component[]{comboMode});
|
||||
Controller.createInstance(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
Controller.getInstance().onInitialize(runCount);
|
||||
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
|
||||
}
|
||||
|
||||
|
||||
/** 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 regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
|
||||
comboMode = new javax.swing.JComboBox<>();
|
||||
|
||||
comboMode.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
comboMode.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboModeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout basePlatePanelLayout = new javax.swing.GroupLayout(basePlatePanel);
|
||||
basePlatePanel.setLayout(basePlatePanelLayout);
|
||||
basePlatePanelLayout.setHorizontalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
.addGap(0, 386, Short.MAX_VALUE)
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
basePlatePanelLayout.setVerticalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(basePlatePanelLayout.createSequentialGroup()
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 280, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void comboModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModeActionPerformed
|
||||
basePlatePanel.setMode((BasePlatePanel.Mode) comboMode.getSelectedItem());
|
||||
}//GEN-LAST:event_comboModeActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private ch.psi.mxsc.BasePlatePanel basePlatePanel;
|
||||
private javax.swing.JComboBox<String> comboMode;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
|
||||
import ch.psi.utils.swing.StandardDialog;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.swing.StandardDialog;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.core.JsonSerializer;
|
||||
import ch.psi.pshell.utils.EncoderJson;
|
||||
import ch.psi.pshell.device.DeviceBase;
|
||||
import ch.psi.pshell.device.ReadonlyAsyncRegisterBase;
|
||||
import ch.psi.pshell.device.ReadonlyRegisterBase;
|
||||
import ch.psi.utils.Chrono;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.Threading;
|
||||
import ch.psi.pshell.utils.Chrono;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import ch.psi.pshell.utils.Threading;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@@ -162,7 +162,7 @@ public class PuckDetection extends DeviceBase {
|
||||
void processMessage(String str) {
|
||||
try {
|
||||
//System.out.println(str);
|
||||
List<List> detection = (List) JsonSerializer.decode(str, List.class);
|
||||
List<List> detection = (List) EncoderJson.decode(str, List.class);
|
||||
|
||||
int address = 1;
|
||||
for (List<List> bus : detection) {
|
||||
|
||||
@@ -3,8 +3,8 @@ package ch.psi.mxsc;
|
||||
import ch.psi.mxsc.Puck.PuckType;
|
||||
import ch.psi.pshell.imaging.DimensionDouble;
|
||||
import ch.psi.pshell.imaging.PointDouble;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.app.MainFrame;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.framework.Context;
|
||||
import ch.psi.pshell.swing.DataPanel;
|
||||
import ch.psi.utils.swing.MainFrame;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.app.MainFrame;
|
||||
import ch.psi.pshell.framework.Setup;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.Dimension;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -37,7 +38,7 @@ public class PuckLoadingDialog extends JDialog {
|
||||
this.load = load;
|
||||
this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
|
||||
this.setName("PuckLoadingDialog");
|
||||
dialogPersistPath = Paths.get(Context.getInstance().getSetup().getContextPath(), getClass().getSimpleName());
|
||||
dialogPersistPath = Paths.get(Setup.getContextPath(), getClass().getSimpleName());
|
||||
setStatusLabel(null,-1);
|
||||
setSugestionLabel(null,-1);
|
||||
model = (DefaultTableModel) table.getModel();
|
||||
|
||||
@@ -5,7 +5,7 @@ package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.swing.DevicePanel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
|
||||
Reference in New Issue
Block a user