Commit c9a54f9b authored by Marian Dovgialo's avatar Marian Dovgialo

#45813 Worker with busydialog for starting signal recording (videoEEG takes a while to start)

parent 7c6bd94a
......@@ -69,13 +69,9 @@ public void actionPerformed(ActionEvent ev) {
return;
}
try {
monitorSignalDocument.startMonitorRecording();
} catch (OpenbciCommunicationException ex) {
ex.showErrorDialog(_("Failed to start recording"));
logger.error("Failed to start recording", ex);
}
}
StartMonitorRecordingWorker saving_worker = new StartMonitorRecordingWorker(null, monitorSignalDocument);
saving_worker.execute(); }
}
/**
......
package org.signalml.app.action.document.monitor;
import static org.signalml.app.util.i18n.SvarogI18n._;
import static org.signalml.app.util.i18n.SvarogI18n._R;
import java.awt.Container;
import org.apache.log4j.Logger;
import org.signalml.app.document.MonitorSignalDocument;
import org.signalml.app.worker.SwingWorkerWithBusyDialog;
import org.signalml.app.worker.monitor.exceptions.OpenbciCommunicationException;
/**
*
* @author Marian Dovgialo
*/
public class StartMonitorRecordingWorker extends SwingWorkerWithBusyDialog<Void, Void> {
MonitorSignalDocument monitorSignalDocument;
protected static final Logger logger = Logger.getLogger(StartMonitorRecordingWorker.class);
public StartMonitorRecordingWorker(Container parentContainer, MonitorSignalDocument monitorSignalDocument) {
super(parentContainer);
this.monitorSignalDocument = monitorSignalDocument;
getBusyDialog().setText(_("Starting saving."));
getBusyDialog().setCancellable(false);
}
@Override
protected Void doInBackground() throws Exception {
showBusyDialog();
try {
monitorSignalDocument.startMonitorRecording();
}
catch (OpenbciCommunicationException ex) {
ex.showErrorDialog(_("Failed to start recording"));
logger.error("Failed to start recording", ex);
}
return null;
}
}
......@@ -164,17 +164,6 @@ public void validatePanel(Object model, ValidationErrors errors) {
if (getVideoStreamSelectionPanel().getSelectedVideoStream() == null) {
errors.addError(_("Please select a video stream to be recorded"));
}
else{
VideoStreamSpecification stream = getVideoStreamSelectionPanel().getSelectedVideoStream();
VideoStreamManager vsm = new VideoStreamManager();
try {
vsm.replace(stream);
} catch (OpenbciCommunicationException ex) {
errors.addError(ex.getMessage());
}
vsm.free();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment