diff --git a/src/Array/StreamerDialog.java b/src/Array/StreamerDialog.java index e629b142..73a81469 100644 --- a/src/Array/StreamerDialog.java +++ b/src/Array/StreamerDialog.java @@ -259,6 +259,7 @@ public class StreamerDialog extends PamDialog { // } singleInstance.currentArray = currentArray; singleInstance.defaultStreamer = streamer;//.clone(); +// singleInstance.st singleInstance.setParams(); singleInstance.setVisible(true); return singleInstance.defaultStreamer; @@ -549,6 +550,17 @@ public class StreamerDialog extends PamDialog { pack(); } } + + try { + OriginSettings os = defaultStreamer.getOriginSettings(currentOriginMethod.getClass()); + if (os != null) { + currentOriginMethod.setOriginSettings(os); + } + } + catch (Exception e) { + // will throw if it tries to set the wrong type of settings. + } + enableControls(); } diff --git a/src/clickDetector/ClickDataBlock.java b/src/clickDetector/ClickDataBlock.java index e00c42ce..5536aa79 100644 --- a/src/clickDetector/ClickDataBlock.java +++ b/src/clickDetector/ClickDataBlock.java @@ -3,6 +3,8 @@ package clickDetector; import java.util.ListIterator; import pamScrollSystem.ViewLoadObserver; +import tethys.TethysControl; +import tethys.pamdata.TethysDataProvider; import tethys.species.DataBlockSpeciesManager; //import staticLocaliser.StaticLocaliserControl; //import staticLocaliser.StaticLocaliserProvider; @@ -14,6 +16,7 @@ import binaryFileStorage.BinaryStore; import clickDetector.ClickClassifiers.ClickBlockSpeciesManager; import clickDetector.dataSelector.ClickDataSelectCreator; import clickDetector.offlineFuncs.OfflineClickLogging; +import clickDetector.tethys.ClickTethysDataProvider; import clickDetector.toad.ClickTOADCalculator; import dataMap.OfflineDataMap; import fftManager.fftorganiser.FFTDataOrganiser; @@ -26,6 +29,8 @@ import PamUtils.PamUtils; import PamView.GroupedDataSource; import PamView.GroupedSourceParameters; import PamguardMVC.AcousticDataBlock; +import PamguardMVC.DataAutomation; +import PamguardMVC.DataAutomationInfo; import PamguardMVC.FFTDataHolderBlock; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -69,6 +74,8 @@ public class ClickDataBlock extends AcousticDataBlock implement private ClickTOADCalculator clickTOADCalculator; + private ClickTethysDataProvider clickTethysDataProvider; + /** * Click detector loading has to be a bit different to normal - first * data are loaded from the binary store, then a subset of these data @@ -316,5 +323,18 @@ public class ClickDataBlock extends AcousticDataBlock implement return clickBlockSpeciesManager; } + @Override + public TethysDataProvider getTethysDataProvider(TethysControl tethysControl) { + if (clickTethysDataProvider == null) { + clickTethysDataProvider = new ClickTethysDataProvider(tethysControl, this); + } + return clickTethysDataProvider; + } + + @Override + public DataAutomationInfo getDataAutomationInfo() { + return new DataAutomationInfo(DataAutomation.AUTOMATIC); + } + } diff --git a/src/clickDetector/offlineFuncs/OfflineEventDataBlock.java b/src/clickDetector/offlineFuncs/OfflineEventDataBlock.java index 4af5872b..afc60ec7 100644 --- a/src/clickDetector/offlineFuncs/OfflineEventDataBlock.java +++ b/src/clickDetector/offlineFuncs/OfflineEventDataBlock.java @@ -16,6 +16,10 @@ import PamController.PamViewParameters; import PamUtils.PamCalendar; import PamView.symbol.StandardSymbolManager; import pamScrollSystem.ViewLoadObserver; +import tethys.TethysControl; +import tethys.pamdata.TethysDataProvider; +import tethys.species.DataBlockSpeciesManager; +import clickDetector.ClickDetection; //import staticLocaliser.StaticLocaliserControl; //import staticLocaliser.StaticLocaliserProvider; //import staticLocaliser.panels.AbstractLocaliserControl; @@ -23,7 +27,12 @@ import pamScrollSystem.ViewLoadObserver; import clickDetector.ClickDetector; import clickDetector.ClickTrainDetection; import clickDetector.dataSelector.ClickTrainDataSelectorCreator; +import clickDetector.tethys.ClickEventSpeciesManager; +import clickDetector.tethys.ClickEventTethysDataProvider; +import clickDetector.tethys.ClickTethysDataProvider; import dataMap.OfflineDataMap; +import PamguardMVC.DataAutomation; +import PamguardMVC.DataAutomationInfo; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.dataOffline.OfflineDataLoadInfo; @@ -49,6 +58,8 @@ public class OfflineEventDataBlock extends SuperDetDataBlock getDatablockSpeciesManager() { + if (eventSpeciesManager == null) { + eventSpeciesManager = new ClickEventSpeciesManager(clickDetector, this); + } + return eventSpeciesManager; + } + + @Override + public TethysDataProvider getTethysDataProvider(TethysControl tethysControl) { + if (eventTethysDataProvider == null) { + eventTethysDataProvider = new ClickEventTethysDataProvider(tethysControl, this); + } + return eventTethysDataProvider; + } + + @Override + public DataAutomationInfo getDataAutomationInfo() { + return new DataAutomationInfo(DataAutomation.MANUALANDAUTOMATIC); + } + } diff --git a/src/clickDetector/tethys/ClickEventSpeciesManager.java b/src/clickDetector/tethys/ClickEventSpeciesManager.java new file mode 100644 index 00000000..1e16a4b1 --- /dev/null +++ b/src/clickDetector/tethys/ClickEventSpeciesManager.java @@ -0,0 +1,53 @@ +package clickDetector.tethys; + +import java.util.Vector; + +import PamguardMVC.PamDataUnit; +import clickDetector.ClickControl; +import clickDetector.ClickDetector; +import clickDetector.offlineFuncs.ClicksOffline; +import clickDetector.offlineFuncs.OfflineEventDataBlock; +import clickDetector.offlineFuncs.OfflineEventDataUnit; +import generalDatabase.lookupTables.LookUpTables; +import generalDatabase.lookupTables.LookupItem; +import generalDatabase.lookupTables.LookupList; +import tethys.species.DataBlockSpeciesCodes; +import tethys.species.DataBlockSpeciesManager; + +public class ClickEventSpeciesManager extends DataBlockSpeciesManager { + + private OfflineEventDataBlock eventDataBlock; + private ClickDetector clickDetector; + private ClickControl clickControl; + private ClicksOffline clicksOffline; + + public ClickEventSpeciesManager(ClickDetector clickDetector, OfflineEventDataBlock eventDataBlock) { + super(eventDataBlock); + this.clickDetector = clickDetector; + this.eventDataBlock = eventDataBlock; + clickControl = clickDetector.getClickControl(); + clicksOffline = clickControl.getClicksOffline(); + } + + @Override + public DataBlockSpeciesCodes getSpeciesCodes() { + LookupList lutList = LookUpTables.getLookUpTables().getLookupList(ClicksOffline.ClickTypeLookupName); + if (lutList == null || lutList.getLutList().size() == 0) { + return new DataBlockSpeciesCodes("Unknown"); + } + Vector spList = lutList.getLutList(); + String[] spNames = new String[spList.size()]; + int i = 0; + for (LookupItem lItem : spList) { + spNames[i++] = lItem.getCode(); + } + return new DataBlockSpeciesCodes("Unknown", spNames); + } + + @Override + public String getSpeciesCode(PamDataUnit dataUnit) { + OfflineEventDataUnit eventDataUnit = (OfflineEventDataUnit) dataUnit; + return eventDataUnit.getEventType(); + } + +} diff --git a/src/clickDetector/tethys/ClickEventTethysDataProvider.java b/src/clickDetector/tethys/ClickEventTethysDataProvider.java new file mode 100644 index 00000000..bbc5d1fd --- /dev/null +++ b/src/clickDetector/tethys/ClickEventTethysDataProvider.java @@ -0,0 +1,72 @@ +package clickDetector.tethys; + +import java.math.BigInteger; + +import PamguardMVC.PamDataUnit; +import clickDetector.offlineFuncs.OfflineEventDataBlock; +import clickDetector.offlineFuncs.OfflineEventDataUnit; +import nilus.Detection; +import nilus.GranularityEnumType; +import nilus.Detection.Parameters; +import nilus.Detection.Parameters.UserDefined; +import tethys.TethysControl; +import tethys.output.StreamExportParams; +import tethys.output.TethysExportParams; +import tethys.pamdata.AutoTethysProvider; +import tethys.swing.export.ExportWizardCard; +import tethys.swing.export.GranularityCard; + +public class ClickEventTethysDataProvider extends AutoTethysProvider { + + private OfflineEventDataBlock eventDataBlock; + + public ClickEventTethysDataProvider(TethysControl tethysControl, OfflineEventDataBlock eventDataBlock) { + super(tethysControl, eventDataBlock); + this.eventDataBlock = eventDataBlock; + } + + @Override + public GranularityEnumType[] getAllowedGranularities() { + GranularityEnumType[] allowed = {GranularityEnumType.GROUPED}; + return allowed; + } + @Override + public Detection createDetection(PamDataUnit dataUnit, TethysExportParams tethysExportParams, + StreamExportParams streamExportParams) { + Detection detection = super.createDetection(dataUnit, tethysExportParams, streamExportParams); + if (detection == null) { + return null; + } + OfflineEventDataUnit eventDataUnit = (OfflineEventDataUnit) dataUnit; + detection.setCount(BigInteger.valueOf(eventDataUnit.getSubDetectionsCount())); + String comment = eventDataUnit.getComment(); + if (comment != null && comment.length() > 0) { + detection.setComment(comment); + } + Parameters params = detection.getParameters(); + addUserNumber(params, "MinNumber", eventDataUnit.getMinNumber()); + addUserNumber(params, "BestNumber", eventDataUnit.getBestNumber()); + addUserNumber(params, "MaxNumber", eventDataUnit.getMaxNumber()); + + + return detection; + } + + private void addUserNumber(Parameters params, String numName, Short number) { + if (number == null) { + return; + } + addUserDefined(params, numName, number.toString()); + } + + @Override + public boolean wantExportDialogCard(ExportWizardCard wizPanel) { + if (wizPanel.getClass() == GranularityCard.class) { + return false; + } + else { + return true; + } + } + +} diff --git a/src/clickDetector/tethys/ClickTethysDataProvider.java b/src/clickDetector/tethys/ClickTethysDataProvider.java new file mode 100644 index 00000000..44e1c8c8 --- /dev/null +++ b/src/clickDetector/tethys/ClickTethysDataProvider.java @@ -0,0 +1,22 @@ +package clickDetector.tethys; + +import clickDetector.ClickDataBlock; +import nilus.GranularityEnumType; +import tethys.TethysControl; +import tethys.pamdata.AutoTethysProvider; + +public class ClickTethysDataProvider extends AutoTethysProvider { + + private ClickDataBlock clickDataBlock; + + public ClickTethysDataProvider(TethysControl tethysControl, ClickDataBlock clickDataBlock) { + super(tethysControl, clickDataBlock); + this.clickDataBlock = clickDataBlock; + } + + @Override + public GranularityEnumType[] getAllowedGranularities() { + return GranularityEnumType.values(); // everything ! + } + +} diff --git a/src/generalDatabase/SQLTypes.java b/src/generalDatabase/SQLTypes.java index a81edd89..fd8ccb56 100644 --- a/src/generalDatabase/SQLTypes.java +++ b/src/generalDatabase/SQLTypes.java @@ -387,6 +387,7 @@ public class SQLTypes { return timestamp.getTime() + tz.getOffset(timestamp.getTime()); } else if (timeValue instanceof String) { + timeValue = ((String) timeValue).replace("'", ""); return PamCalendar.millisFromDateString((String) timeValue, false); } if (timeValue instanceof Long) { diff --git a/src/tethys/deployment/DeploymentHandler.java b/src/tethys/deployment/DeploymentHandler.java index 0d910f87..10f95acf 100644 --- a/src/tethys/deployment/DeploymentHandler.java +++ b/src/tethys/deployment/DeploymentHandler.java @@ -2,6 +2,7 @@ package tethys.deployment; import java.math.BigInteger; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -302,7 +303,7 @@ public class DeploymentHandler implements TethysStateObserver { // do the lot, whatever ... selectedDeployments = getDeploymentOverview().getRecordingPeriods(); int freeId = getTethysControl().getDeploymentHandler().getFirstFreeDeploymentId(); - RecordingPeriod onePeriod = new RecordingPeriod(selectedDeployments.get(freeId).getRecordStart(), + RecordingPeriod onePeriod = new RecordingPeriod(selectedDeployments.get(0).getRecordStart(), selectedDeployments.get(selectedDeployments.size()-1).getRecordStop()); Deployment deployment = createDeploymentDocument(freeId, onePeriod); // fill in a few things from here @@ -487,7 +488,15 @@ public class DeploymentHandler implements TethysStateObserver { ons[i] = tempPeriods.get(i).getDuration()/1000.; gaps[i] = (tempPeriods.get(i+1).getRecordStart()-tempPeriods.get(i).getRecordStop())/1000.; } - // now look at how consistent those values are + /* now look at how consistent those values are + * But some data gets messed by small gaps, so want to + * remove outliers and concentrate on say 80% of the data. + */ + ons = getDistributionCentre(ons, 80); + gaps = getDistributionCentre(gaps, 80); + Arrays.sort(gaps); + + STD std = new STD(); double onsMean = std.getMean(ons); double onsSTD = std.getSTD(ons); @@ -497,6 +506,27 @@ public class DeploymentHandler implements TethysStateObserver { DutyCycleInfo cycleInfo = new DutyCycleInfo(dutyCycle, onsMean, gapsMean, tempPeriods.size()); return cycleInfo; } + + /** + * Get the central part of a distribution without any outliers so + * that we can get a better assessment of duty cycle. + * @param data unsorted distribution data. + * @param percent percentage to include (half this removed from top and bottom) + * @return + */ + private double[] getDistributionCentre(double[] data, double percent) { + if (data == null) { + return null; + } + Arrays.sort(data); + int nRem = (int) Math.round(data.length * (100-percent)/200); + int newLen = data.length-nRem*2; + double[] subdata = Arrays.copyOfRange(data, nRem, data.length-2*nRem); + if (subdata.length < 2) { + return data; + } + return subdata; + } private ArrayList extractTimesFromStatus(ArrayList allStatusData) { ArrayList tempPeriods = new ArrayList<>(); diff --git a/src/tethys/detection/DetectionsHandler.java b/src/tethys/detection/DetectionsHandler.java index 9d0fbb10..a28ce7e3 100644 --- a/src/tethys/detection/DetectionsHandler.java +++ b/src/tethys/detection/DetectionsHandler.java @@ -14,6 +14,8 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamProcess; import PamguardMVC.dataSelector.DataSelector; +import PamguardMVC.superdet.SuperDetDataBlock; +import PamguardMVC.superdet.SuperDetDataBlock.ViewerLoadPolicy; import dataMap.OfflineDataMap; import dataMap.OfflineDataMapPoint; import nilus.AlgorithmType; @@ -25,6 +27,7 @@ import nilus.DetectionEffort; import nilus.DetectionEffortKind; import nilus.DetectionGroup; import nilus.Detections; +import nilus.GranularityEnumType; import nilus.Helper; import tethys.TethysControl; import tethys.TethysTimeFuncs; @@ -337,12 +340,42 @@ public class DetectionsHandler { * @param exportWorkerCard */ public void startExportThread(PamDataBlock pamDataBlock, StreamExportParams streamExportParams, DetectionExportObserver exportObserver) { + checkGranularity(pamDataBlock, streamExportParams); tethysControl.getTethysExportParams().setStreamParams(pamDataBlock, streamExportParams); activeExport = true; exportWorker = new ExportWorker(pamDataBlock, streamExportParams, exportObserver); exportWorker.execute(); } + /** + * Fudge because some outputs don't show the granularity card, but need to + * make sure that it's set to the correct only option .. + * @param pamDataBlock + * @param streamExportParams + */ + private void checkGranularity(PamDataBlock pamDataBlock, StreamExportParams streamExportParams) { + if (streamExportParams == null) { + return; + } + TethysDataProvider tethysProvider = pamDataBlock.getTethysDataProvider(tethysControl); + if (tethysProvider == null) return; + GranularityEnumType[] allowed = tethysProvider.getAllowedGranularities(); + if (allowed == null || allowed.length == 0) { + return; + } + for (int i = 0; i < allowed.length; i++) { + if (allowed[i] == streamExportParams.granularity) { + return; // matches allowed value, so OK + } + } + /* + * if we get here, it's all wrong, so set to the first allowed value + * which will be the only one if the card wasn't shown + */ + streamExportParams.granularity = allowed[0]; + } + + public void cancelExport() { activeExport = false; } @@ -382,6 +415,14 @@ public class DetectionsHandler { int exportCount = 0; long lastUnitTime = 0; DetectionExportProgress prog; + ViewerLoadPolicy viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL; + if (dataBlock instanceof SuperDetDataBlock) { + SuperDetDataBlock superDataBlock = (SuperDetDataBlock) dataBlock; + viewerLoadPolicy = superDataBlock.getViewerLoadPolicy(); + } + if (viewerLoadPolicy == null) { + viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL; + } GranularityHandler granularityHandler = GranularityHandler.getHandler(streamExportParams.granularity, tethysControl, dataBlock, exportParams, streamExportParams); for (PDeployment deployment : deployments) { int documentCount = 0; @@ -392,6 +433,7 @@ public class DetectionsHandler { // export everything in that deployment. // need to loop through all map points in this interval. List mapPoints = dataMap.getMapPoints(); + for (OfflineDataMapPoint mapPoint : mapPoints) { if (!activeExport) { prog = new DetectionExportProgress(deployment, null, @@ -418,6 +460,12 @@ public class DetectionsHandler { if (dets != null) { exportCount+=dets.length; documentCount+=dets.length; + + if (exportCount % 100 == 0) { + prog = new DetectionExportProgress(deployment, null, + lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_COUNTING); + exportObserver.update(prog); + } } // Detection det = dataProvider.createDetection(dataUnit, exportParams, streamExportParams); // exportCount++; @@ -429,6 +477,10 @@ public class DetectionsHandler { prog = new DetectionExportProgress(deployment, null, lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_COUNTING); exportObserver.update(prog); + + if (viewerLoadPolicy == ViewerLoadPolicy.LOAD_ALWAYS_EVERYTHING) { + break; + } // if (documentCount > 500000 && mapPoint != dataMap.getLastMapPoint()) { // prog = new DetectionExportProgress(deployment, currentDetections, @@ -480,11 +532,19 @@ public class DetectionsHandler { int exportCount = 0; long lastUnitTime = 0; DetectionExportProgress prog; + ViewerLoadPolicy viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL; + if (dataBlock instanceof SuperDetDataBlock) { + SuperDetDataBlock superDataBlock = (SuperDetDataBlock) dataBlock; + viewerLoadPolicy = superDataBlock.getViewerLoadPolicy(); + } + if (viewerLoadPolicy == null) { + viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL; + } GranularityHandler granularityHandler = GranularityHandler.getHandler(streamExportParams.granularity, tethysControl, dataBlock, exportParams, streamExportParams); for (PDeployment deployment : deployments) { int documentCount = 0; prog = new DetectionExportProgress(deployment, null, - lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_GATHERING); + lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_COUNTING); exportObserver.update(prog); granularityHandler.prepare(deployment.getAudioStart()); // export everything in that deployment. @@ -523,10 +583,11 @@ public class DetectionsHandler { onEffort.getDetection().add(dets[dd]); } } -// Detection det = dataProvider.createDetection(dataUnit, exportParams, streamExportParams); -// exportCount++; -// documentCount++; -// onEffort.getDetection().add(det); + if (exportCount % 100 == 0) { + prog = new DetectionExportProgress(deployment, null, + lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_GATHERING); + exportObserver.update(prog); + } lastUnitTime = dataUnit.getTimeMilliseconds(); } @@ -546,6 +607,10 @@ public class DetectionsHandler { } currentDetections = null; } + + if (viewerLoadPolicy == ViewerLoadPolicy.LOAD_ALWAYS_EVERYTHING) { + break; + } } diff --git a/src/tethys/detection/GroupedGranularityHandler.java b/src/tethys/detection/GroupedGranularityHandler.java index 298913a3..93dbbd99 100644 --- a/src/tethys/detection/GroupedGranularityHandler.java +++ b/src/tethys/detection/GroupedGranularityHandler.java @@ -7,30 +7,26 @@ import tethys.TethysControl; import tethys.output.StreamExportParams; import tethys.output.TethysExportParams; -public class GroupedGranularityHandler extends GranularityHandler { +public class GroupedGranularityHandler extends CallGranularityHandler { public GroupedGranularityHandler(TethysControl tethysControl, PamDataBlock dataBlock, TethysExportParams tethysExportParams, StreamExportParams streamExportParams) { super(tethysControl, dataBlock, tethysExportParams, streamExportParams); - // TODO Auto-generated constructor stub } @Override public void prepare(long timeMillis) { - // TODO Auto-generated method stub - + super.prepare(timeMillis); } @Override public Detection[] addDataUnit(PamDataUnit dataUnit) { - // TODO Auto-generated method stub - return null; + return super.addDataUnit(dataUnit); } @Override public Detection[] cleanup(long timeMillis) { - // TODO Auto-generated method stub - return null; + return super.cleanup(timeMillis); } } diff --git a/src/tethys/output/TethysExportParams.java b/src/tethys/output/TethysExportParams.java index 7e93fe16..89d9a43f 100644 --- a/src/tethys/output/TethysExportParams.java +++ b/src/tethys/output/TethysExportParams.java @@ -17,7 +17,7 @@ public class TethysExportParams implements Serializable, Cloneable{ public static final long serialVersionUID = 1L; /* - * Need to add lots of other parameters here, such as the connection detils + * Need to add lots of other parameters here, such as the connection details * for the tethys database. */ public String serverName = "http://localhost"; diff --git a/src/tethys/output/swing/TethysExportDialog.java b/src/tethys/output/swing/TethysExportDialog.java index da63db50..91302405 100644 --- a/src/tethys/output/swing/TethysExportDialog.java +++ b/src/tethys/output/swing/TethysExportDialog.java @@ -63,8 +63,8 @@ public class TethysExportDialog extends PamDialog { setResizable(true); } - - public static TethysExportParams showDialog(Window parentFrame, TethysControl tethysControl) { + @Deprecated + private static TethysExportParams showDialog(Window parentFrame, TethysControl tethysControl) { if (singleInstance == null || singleInstance.getOwner() != parentFrame || singleInstance.tethysControl != tethysControl) { singleInstance = new TethysExportDialog(parentFrame, tethysControl); } diff --git a/src/tethys/pamdata/AutoTethysProvider.java b/src/tethys/pamdata/AutoTethysProvider.java index bda6fa70..81c95644 100644 --- a/src/tethys/pamdata/AutoTethysProvider.java +++ b/src/tethys/pamdata/AutoTethysProvider.java @@ -350,7 +350,7 @@ abstract public class AutoTethysProvider implements TethysDataProvider { nilus.Detection.Parameters detParams = new nilus.Detection.Parameters(); detection.setParameters(detParams); double[] freqs = dataUnit.getFrequency(); - if (freqs != null) { + if (freqs != null && freqs[1] != 0) { detParams.setMinFreqHz(freqs[0]); detParams.setMaxFreqHz(freqs[1]); } @@ -366,11 +366,14 @@ abstract public class AutoTethysProvider implements TethysDataProvider { el.setAttribute("BinaryFile", fileInf.getShortFileName(2048)); el.setAttribute("FileIndex", Long.valueOf(fileInf.getIndexInFile()).toString()); } + if (dataUnit.getDatabaseIndex() >= 0) { + addUserDefined(detParams, "DatabaseId", String.format("%d", dataUnit.getDatabaseIndex())); + } return detection; } - private Element addUserDefined(Parameters parameters, String parameterName, String parameterValue) { + public Element addUserDefined(Parameters parameters, String parameterName, String parameterValue) { UserDefined userDefined = parameters.getUserDefined(); if (userDefined == null) { userDefined = new UserDefined(); diff --git a/src/tethys/swing/DatablockSynchPanel.java b/src/tethys/swing/DatablockSynchPanel.java index 60281b76..8f1a220f 100644 --- a/src/tethys/swing/DatablockSynchPanel.java +++ b/src/tethys/swing/DatablockSynchPanel.java @@ -183,7 +183,7 @@ public class DatablockSynchPanel extends TethysGUIPanel { OfflineDataMap dataMap = synchInfo.getDataBlock().getPrimaryDataMap(); switch (columnIndex) { case 0: - return synchInfo.getDataBlock().getDataName(); + return synchInfo.getDataBlock().getLongDataName(); case 1: if (dataMap == null) { return null; diff --git a/src/tethys/swing/DetectionsExportPanel.java b/src/tethys/swing/DetectionsExportPanel.java index 869cdc15..b790e7f8 100644 --- a/src/tethys/swing/DetectionsExportPanel.java +++ b/src/tethys/swing/DetectionsExportPanel.java @@ -53,7 +53,7 @@ public class DetectionsExportPanel extends TethysGUIPanel implements StreamTable if (selectedDataBlock == null) { return; } - DetectionsExportWizard.showDilaog(getTethysControl().getGuiFrame(), getTethysControl(), selectedDataBlock); + DetectionsExportWizard.showDialog(getTethysControl().getGuiFrame(), getTethysControl(), selectedDataBlock); } @Override diff --git a/src/tethys/swing/export/DetectionsExportWizard.java b/src/tethys/swing/export/DetectionsExportWizard.java index 2e71784e..9973d3c3 100644 --- a/src/tethys/swing/export/DetectionsExportWizard.java +++ b/src/tethys/swing/export/DetectionsExportWizard.java @@ -82,7 +82,7 @@ public class DetectionsExportWizard extends PamDialog { } } - public static void showDilaog(Window parentFrame, TethysControl tethysControl, PamDataBlock dataBlock) { + public static void showDialog(Window parentFrame, TethysControl tethysControl, PamDataBlock dataBlock) { DetectionsExportWizard wiz = new DetectionsExportWizard(parentFrame, tethysControl, dataBlock); wiz.setParams(); wiz.setVisible(true); diff --git a/src/tethys/swing/export/ExportWorkerCard.java b/src/tethys/swing/export/ExportWorkerCard.java index f8400587..1cc44e79 100644 --- a/src/tethys/swing/export/ExportWorkerCard.java +++ b/src/tethys/swing/export/ExportWorkerCard.java @@ -103,6 +103,7 @@ public class ExportWorkerCard extends ExportWizardCard implements DetectionExpor protected void exportData() { DetectionsHandler detHandler = getTethysControl().getDetectionsHandler(); + detHandler.startExportThread(getDataBlock(), streamExportParams, this); enableControls(DetectionExportProgress.STATE_GATHERING); } @@ -128,7 +129,14 @@ public class ExportWorkerCard extends ExportWizardCard implements DetectionExpor if (progress == null) { return; } - if (progress.totalUnits > 0) { + if (progress.state == DetectionExportProgress.STATE_COUNTING) { + itemCount.setText("0"); + projectedCount.setText(String.format("%d", progress.exportCount)); + skipCount.setText(String.format("%d", progress.skipCount)); + long perc = (progress.exportCount+progress.skipCount) * 100 / progress.totalUnits; + progressBar.setValue((int) perc); + } + else if (progress.totalUnits > 0) { itemCount.setText(String.format("%d", progress.exportCount)); skipCount.setText(String.format("%d", progress.skipCount)); long totExpected = progress.totalUnits; @@ -136,7 +144,6 @@ public class ExportWorkerCard extends ExportWizardCard implements DetectionExpor totExpected *= progress.exportCount/(progress.exportCount+progress.skipCount); } projectedCount.setText(String.format("%d", totExpected)); - itemCount.setText(String.format("%d", totExpected)); long perc = (progress.exportCount+progress.skipCount) * 100 / progress.totalUnits; progressBar.setValue((int) perc); }