diff --git a/nbactions.xml b/nbactions.xml
index 5a494b4..2e53b1a 100644
--- a/nbactions.xml
+++ b/nbactions.xml
@@ -12,9 +12,9 @@
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
java
- -p=ch.psi.mxsc.MainPanel -pini=true -home=D:\Dev\pshell\home -r -6d
+ -p ch.psi.mxsc.MainPanel -u=true -home=D:\Dev\pshell\home -r 6d
- ch.psi.pshell.ui.App
+ ch.psi.pshell.workbench.App
@@ -31,8 +31,8 @@
java
true
-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}
- -p=ch.psi.mxsc.MainPanel -pini=true -home=D:\Dev\pshell\home -r -6d
- ch.psi.pshell.ui.App
+ -p ch.psi.mxsc.MainPanel -u=true -home=D:\Dev\pshell\home -r 6d
+ ch.psi.pshell.workbench.App
@@ -47,9 +47,9 @@
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
java
- -p=ch.psi.mxsc.MainPanel -home=C:\dev\pshell\home -r -6d
+ -p ch.psi.mxsc.MainPanel -u=true -home=D:\Dev\pshell\home -r 6d
- ch.psi.pshell.ui.App
+ ch.psi.pshell.workbench.App
diff --git a/pom.xml b/pom.xml
index 127b26b..4fd1d5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,12 +3,12 @@
4.0.0
ch.psi
MXSC
- 1.21.0
+ 2.0.0
jar
${project.groupId}
- pshell
+ workbench
${project.version}
@@ -22,8 +22,7 @@
11
11
-
-
+
jcenter
jcenter
@@ -34,11 +33,13 @@
bintray
https://dl.bintray.com/paulscherrerinstitute/hltools
+
libs-snapshots-local
libs-snapshots-local
diff --git a/src/main/java/ch/psi/mxsc/BasePlateGraphics.java b/src/main/java/ch/psi/mxsc/BasePlateGraphics.java
index a87f4bb..439c592 100644
--- a/src/main/java/ch/psi/mxsc/BasePlateGraphics.java
+++ b/src/main/java/ch/psi/mxsc/BasePlateGraphics.java
@@ -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;
diff --git a/src/main/java/ch/psi/mxsc/BasePlatePanel.java b/src/main/java/ch/psi/mxsc/BasePlatePanel.java
index 99e6ebb..78a66af 100644
--- a/src/main/java/ch/psi/mxsc/BasePlatePanel.java
+++ b/src/main/java/ch/psi/mxsc/BasePlatePanel.java
@@ -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;
diff --git a/src/main/java/ch/psi/mxsc/Controller.java b/src/main/java/ch/psi/mxsc/Controller.java
index 855a993..d7b954f 100644
--- a/src/main/java/ch/psi/mxsc/Controller.java
+++ b/src/main/java/ch/psi/mxsc/Controller.java
@@ -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> map = (Map>) 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[]{
diff --git a/src/main/java/ch/psi/mxsc/ControllerRT.java b/src/main/java/ch/psi/mxsc/ControllerRT.java
index ea0f09a..025a9fe 100644
--- a/src/main/java/ch/psi/mxsc/ControllerRT.java
+++ b/src/main/java/ch/psi/mxsc/ControllerRT.java
@@ -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) {
diff --git a/src/main/java/ch/psi/mxsc/DevicesPanel.java b/src/main/java/ch/psi/mxsc/DevicesPanel.java
index 5745e53..cde3c3a 100644
--- a/src/main/java/ch/psi/mxsc/DevicesPanel.java
+++ b/src/main/java/ch/psi/mxsc/DevicesPanel.java
@@ -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);
diff --git a/src/main/java/ch/psi/mxsc/EseraDetection.java b/src/main/java/ch/psi/mxsc/EseraDetection.java
index 0a5a155..6d513d3 100644
--- a/src/main/java/ch/psi/mxsc/EseraDetection.java
+++ b/src/main/java/ch/psi/mxsc/EseraDetection.java
@@ -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//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)
- );
- }// //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 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")
+ // //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)
+ );
+ }// //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 comboMode;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/src/main/java/ch/psi/mxsc/PasswordDialog.java b/src/main/java/ch/psi/mxsc/PasswordDialog.java
index 3042782..b08b391 100644
--- a/src/main/java/ch/psi/mxsc/PasswordDialog.java
+++ b/src/main/java/ch/psi/mxsc/PasswordDialog.java
@@ -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;
diff --git a/src/main/java/ch/psi/mxsc/PuckDetection.java b/src/main/java/ch/psi/mxsc/PuckDetection.java
index f8cd195..9167a1c 100644
--- a/src/main/java/ch/psi/mxsc/PuckDetection.java
+++ b/src/main/java/ch/psi/mxsc/PuckDetection.java
@@ -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 detection = (List) JsonSerializer.decode(str, List.class);
+ List detection = (List) EncoderJson.decode(str, List.class);
int address = 1;
for (List bus : detection) {
diff --git a/src/main/java/ch/psi/mxsc/PuckGraphics.java b/src/main/java/ch/psi/mxsc/PuckGraphics.java
index 441c2e4..139d032 100644
--- a/src/main/java/ch/psi/mxsc/PuckGraphics.java
+++ b/src/main/java/ch/psi/mxsc/PuckGraphics.java
@@ -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;
diff --git a/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java b/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java
index f92a82e..1655a21 100644
--- a/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java
+++ b/src/main/java/ch/psi/mxsc/PuckLoadingDialog.java
@@ -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();
diff --git a/src/main/java/ch/psi/mxsc/PuckPanel.java b/src/main/java/ch/psi/mxsc/PuckPanel.java
index 850b065..5e63473 100644
--- a/src/main/java/ch/psi/mxsc/PuckPanel.java
+++ b/src/main/java/ch/psi/mxsc/PuckPanel.java
@@ -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;
diff --git a/src/main/java/ch/psi/mxsc/SampleGraphics.java b/src/main/java/ch/psi/mxsc/SampleGraphics.java
index 393a7c0..b84a2f5 100644
--- a/src/main/java/ch/psi/mxsc/SampleGraphics.java
+++ b/src/main/java/ch/psi/mxsc/SampleGraphics.java
@@ -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;