[no commit message]

This commit is contained in:
darksnake 2015-12-22 14:19:17 +03:00
parent 9721b173c5
commit 829d48b625
4 changed files with 34 additions and 25 deletions

View File

@ -72,14 +72,6 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader<Env
*/ */
public static final String HV_FRAGMENT_NAME = "voltage"; public static final String HV_FRAGMENT_NAME = "voltage";
// private static final DefaultEnvelopeReader newFormat = new DefaultEnvelopeReader() {
//
// @Override
// protected byte[] separator() {
// return "\r\n\r\n\r".getBytes(); //To change body of generated methods, choose Tools | Templates.
// }
//
// };
public static NumassDataLoader fromLocalDir(Storage storage, File directory) throws IOException { public static NumassDataLoader fromLocalDir(Storage storage, File directory) throws IOException {
return fromDir(storage, new DefaultLocalFileProvider().findLocalFile(directory), null); return fromDir(storage, new DefaultLocalFileProvider().findLocalFile(directory), null);
} }

View File

@ -66,7 +66,7 @@ public class NumassStorage extends FileStorage {
Meta meta = new MetaBuilder("storage") Meta meta = new MetaBuilder("storage")
.setValue("type", "file.numass") .setValue("type", "file.numass")
.setValue("readOnly", readOnly) .setValue("readOnly", readOnly)
.setValue("monitor", true); .setValue("monitor", false);
return new NumassStorage(VFSUtils.getLocalFile(dir), meta); return new NumassStorage(VFSUtils.getLocalFile(dir), meta);
} catch (FileSystemException ex) { } catch (FileSystemException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);

View File

@ -73,6 +73,7 @@ public class MainViewerController implements Initializable, ProgressUpdateCallba
private Button loadDirectoryButton; private Button loadDirectoryButton;
//controllers //controllers
@FXML
private MspViewController mspController; private MspViewController mspController;
//main pane views //main pane views
@ -116,6 +117,8 @@ public class MainViewerController implements Initializable, ProgressUpdateCallba
slider.setAimContentVisible(t1); slider.setAimContentVisible(t1);
}); });
slider.setAimContentVisible(false); slider.setAimContentVisible(false);
loadRemoteButton.setDisable(true);
} }
@FXML @FXML
@ -162,6 +165,7 @@ public class MainViewerController implements Initializable, ProgressUpdateCallba
public void setRootStorage(NumassStorage root) { public void setRootStorage(NumassStorage root) {
fillNumassStorageData(root); fillNumassStorageData(root);
if (mspController != null) { if (mspController != null) {
mspController.setCallback(this);
mspController.fillMspData(root); mspController.fillMspData(root);
} else { } else {
mspTab.getContent().setVisible(false); mspTab.getContent().setVisible(false);

View File

@ -49,6 +49,7 @@ import org.jfree.chart.renderer.xy.XYStepRenderer;
import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection; import org.jfree.data.xy.XYSeriesCollection;
import org.slf4j.LoggerFactory;
/** /**
* FXML Controller class * FXML Controller class
@ -137,8 +138,16 @@ public class MspViewController implements Initializable {
} }
} }
XYSeriesCollection mspSeriesCollection = new XYSeriesCollection(); XYSeriesCollection mspSeriesCollection = new XYSeriesCollection();
for (XYSeries ser : series.values()) { List<String> names = new ArrayList<>(series.keySet());
mspSeriesCollection.addSeries(ser); names.sort((String o1, String o2) -> {
try {
return Integer.valueOf(o1).compareTo(Integer.valueOf(o2));
} catch (Exception ex) {
return 0;
}
});
for (String name : names) {
mspSeriesCollection.addSeries(series.get(name));
} }
updateMspPane(mspSeriesCollection); updateMspPane(mspSeriesCollection);
} catch (StorageException ex) { } catch (StorageException ex) {
@ -152,7 +161,8 @@ public class MspViewController implements Initializable {
DataPoint last = null; DataPoint last = null;
for (String loaderName : storage.loaders().keySet()) { for (String loaderName : storage.loaders().keySet()) {
if (loaderName.startsWith("msp")) { if (loaderName.startsWith("msp")) {
PointLoader mspLoader = (PointLoader) storage.getLoader(loaderName); try (PointLoader mspLoader = (PointLoader) storage.getLoader(loaderName)) {
mspLoader.open();
updateProgress("Loading mass spectrometer data from " + mspLoader.getName()); updateProgress("Loading mass spectrometer data from " + mspLoader.getName());
updateProgress(-1); updateProgress(-1);
for (DataPoint dp : mspLoader.asDataSet()) { for (DataPoint dp : mspLoader.asDataSet()) {
@ -162,14 +172,17 @@ public class MspViewController implements Initializable {
if (last != null) { if (last != null) {
mspData.add(terminatorPoint(last)); mspData.add(terminatorPoint(last));
} }
} catch (Exception ex) {
LoggerFactory.getLogger(getClass()).error("Can't read msp loader data", ex);
} }
} }
for (String shelfName : storage.shelves().keySet()) {
mspData.addAll(getMspData(storage.getShelf(shelfName)));
} }
// for (String shelfName : storage.shelves().keySet()) {
// mspData.addAll(getMspData(storage.getShelf(shelfName)));
// }
updateProgress("Loading msp data finished"); updateProgress("Loading msp data finished");
updateProgress(1); updateProgress(0);
return mspData; return mspData;
} }
@ -190,7 +203,7 @@ public class MspViewController implements Initializable {
} }
/** /**
* Create a NaN value point to terminate msp series * Create a null value point to terminate msp series
* *
* @param last * @param last
* @return * @return