Included config, properties and app settings editors to Plugin interface

This commit is contained in:
2018-08-15 17:54:06 +02:00
parent 047fad02d8
commit f5737189be
5 changed files with 512 additions and 274 deletions

View File

@@ -0,0 +1,49 @@
package ch.psi.mxsc;
import java.util.HashMap;
/**
*
*/
public class SampleInfo extends HashMap {
public enum PuckType {
Unipuck,
MiniSpine,
Unknown
}
public enum SampleStatus {
Mounted,
HasBeenMounted,
Present,
Unknown
}
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)};
}
String getStr(String key) {
return String.valueOf(get(key));
}
int getInt(String key) {
try {
return Integer.valueOf((String) get(key));
} catch (Exception ex) {
return -1;
}
}
Object getEnum(String key, Class cls, Object def) {
try {
return Enum.valueOf(cls, getStr(key));
} catch (Exception ex) {
return def;
}
}
}