Fix panel update if invalid values

This commit is contained in:
gac-iss
2021-10-26 10:46:35 +02:00
parent e364032902
commit 98f9bfd929
3 changed files with 81 additions and 58 deletions

View File

@@ -1,49 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath;C:\Users\gac-ISS\Dev\pshell\bin\pshell-1.14.0-fat.jar --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ch.psi.pshell.ui.App -home=C:\Users\gac-ISS\Dev\pshell\home -pini</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>../../home</exec.workingdir>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath;C:\Users\gac-ISS\Dev\pshell\bin\pshell-1.14.0-fat.jar --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ch.psi.pshell.ui.App -home=C:\Users\gac-ISS\Dev\pshell\home -pini</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.workingdir>../../home</exec.workingdir>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath;C:\Users\gac-ISS\Dev\pshell\bin\pshell-1.14.0-fat.jar --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ch.psi.pshell.ui.App -home=C:\Users\gac-ISS\Dev\pshell\home -pini</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>../../home</exec.workingdir>
</properties>
</action>
</actions>
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>;C:\Users\gac-ISS\Dev\pshell\bin\pshell-1.17.0-fat.jar --add-opens java.base/jdk.internal.loader=ALL-UNNAMED -classpath %classpath ch.psi.pshell.ui.App -home=C:\Users\gac-ISS\Dev\pshell\home -pini</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>../../home</exec.workingdir>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} ;C:\Users\gac-ISS\Dev\pshell\bin\pshell-1.17.0-fat.jar --add-opens java.base/jdk.internal.loader=ALL-UNNAMED -classpath %classpath ch.psi.pshell.ui.App -home=C:\Users\gac-ISS\Dev\pshell\home -pini</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.workingdir>../../home</exec.workingdir>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>;C:\Users\gac-ISS\Dev\pshell\bin\pshell-1.17.0-fat.jar --add-opens java.base/jdk.internal.loader=ALL-UNNAMED -classpath %classpath ch.psi.pshell.ui.App -home=C:\Users\gac-ISS\Dev\pshell\home -pini</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>../../home</exec.workingdir>
</properties>
</action>
</actions>

View File

@@ -40,7 +40,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pshell</artifactId>
<version>1.14.0</version>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>

View File

@@ -1,5 +1,6 @@
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceBase.DeviceInvalidParameterException;
import ch.psi.pshell.device.DeviceListener;
@@ -166,6 +167,7 @@ public final class ScientaPanel extends DevicePanel {
Scienta.AcquisitionMode acquisitionMode;
Scienta.EnergyMode energyMode;
Scienta.DetectorMode detectorMode;
Integer pass;
double low;
double center;
double high;
@@ -173,8 +175,7 @@ public final class ScientaPanel extends DevicePanel {
//int frames;
double time;
double size;
int slices;
int pass;
int slices;
int iterations;
int current;
@@ -188,13 +189,35 @@ public final class ScientaPanel extends DevicePanel {
dd.spectrum = getDevice().getSpectrum().getValue();
dd.lensMode = getDevice().getLensMode();
dd.elementSet = getDevice().getElementSet();
try{
dd.lensMode = getDevice().getLensMode();
} catch (DeviceInvalidParameterException ex){
dd.lensMode = null;
}
try{
dd.elementSet = getDevice().getElementSet();
} catch (DeviceInvalidParameterException ex){
dd.elementSet = null;
} try{
dd.acquisitionMode = getDevice().getAcquisitionMode();
dd.energyMode = getDevice().getEnergyMode();
dd.detectorMode = getDevice().getDetectorMode();
dd.pass = getDevice().getPassEnergy();
} catch (DeviceInvalidParameterException ex){
dd.acquisitionMode = null;
}
try{
dd.energyMode = getDevice().getEnergyMode();
} catch (DeviceInvalidParameterException ex){
dd.energyMode = null;
}
try{
dd.detectorMode = getDevice().getDetectorMode();
} catch (DeviceInvalidParameterException ex){
dd.detectorMode = null;
}
try{
dd.pass = getDevice().getPassEnergy();
} catch (DeviceInvalidParameterException ex){
dd.pass = null;
}
dd.low = getDevice().getLowEnergy().getValue();
dd.center = getDevice().getCenterEnergy().getValue();
dd.high = getDevice().getHighEnergy().getValue();