Update button enablers

And reinstate output of a single deployment document, with non-recording
periods stores in the QA section

And update help TOC for latest help documents.
This commit is contained in:
Douglas Gillespie 2024-01-29 16:54:24 +00:00
parent 810ec67077
commit 6b1845293c
17 changed files with 127 additions and 89 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
JavaSearch 1.0
TMAP bs=2048 rt=1 fl=-1 id1=6872 id2=1
TMAP bs=2048 rt=1 fl=-1 id1=6882 id2=1

Binary file not shown.

View File

@ -54,6 +54,8 @@
<mapID target="classifiers.whistleClassifierHelp.docs.whistleClassifier_Output" url="classifiers/whistleClassifierHelp/docs/whistleClassifier_Output.html"/>
<mapID target="utilities.tethys.docs.calibrations" url="utilities/tethys/docs/calibrations.html"/>
<mapID target="utilities.hydrophoneArrayManagerHelp.docs.Array_Configuration_sec1" url="utilities/hydrophoneArrayManagerHelp/docs/Array_Configuration.html#sec1"/>
<mapID target="sound_processing.fftManagerHelp.docs.noise_removal_medianfilter" url="sound_processing/fftManagerHelp/docs/noise_removal.html#medianfilter"/>
@ -138,6 +140,8 @@
<mapID target="sound_processing.NoiseBands.Docs.NoiseBands" url="sound_processing/NoiseBands/Docs/NoiseBands.html"/>
<mapID target="utilities.tethys.docs.detect_localize" url="utilities/tethys/docs/detect_localize.html"/>
<mapID target="visual_methods.videoRangeHelp.docs.videoRange_Calibrating" url="visual_methods/videoRangeHelp/docs/videoRange_Calibrating.html"/>
<mapID target="detectors.gpl.docs.detection" url="detectors/gpl/docs/detection.html"/>
@ -198,6 +202,8 @@
<mapID target="displays.userDisplayHelp.docs.userDisplayPanel" url="displays/userDisplayHelp/docs/userDisplayPanel.html"/>
<mapID target="utilities.tethys.docs.tethys_speciescodes_TSNLookup" url="utilities/tethys/docs/tethys_speciescodes.html#TSNLookup"/>
<mapID target="classifiers.roccaHelp.docs.rocca_Configure_SchoolStats" url="classifiers/roccaHelp/docs/rocca_Configure.html#SchoolStats"/>
<mapID target="visual_methods.loggerFormsHelp.docs.SUBTABS" url="visual_methods/loggerFormsHelp/docs/SUBTABS.html"/>
@ -276,8 +282,6 @@
<mapID target="detectors.clickDetectorHelp.docs.offline_Tools_AmplSel" url="detectors/clickDetectorHelp/docs/offline_Tools.html#AmplSel"/>
<mapID target="utilities.tethys.docs.tethys_quickstart" url="utilities/tethys/docs/tethys_quickstart.html"/>
<mapID target="displays.spectrogramDisplayHelp.docs.UserDisplay_Spectrogram_Overlays" url="displays/spectrogramDisplayHelp/docs/UserDisplay_Spectrogram_Overlays.html"/>
<mapID target="displays.radarDisplayHelp.docs.UserDisplay_Radar_Creating" url="displays/radarDisplayHelp/docs/UserDisplay_Radar_Creating.html"/>
@ -390,6 +394,8 @@
<mapID target="localisation.group3d.docs.3dsimplex" url="localisation/group3d/docs/3dsimplex.html"/>
<mapID target="utilities.tethys.docs.connection" url="utilities/tethys/docs/connection.html"/>
<mapID target="visual_methods.loggerFormsHelp.docs.NOCLEAR" url="visual_methods/loggerFormsHelp/docs/NOCLEAR.html"/>
<mapID target="sound_processing.beamformer.docs.Beamformer_Settings_BF_SourceTab" url="sound_processing/beamformer/docs/Beamformer_Settings.html#BF_SourceTab"/>
@ -458,6 +464,8 @@
<mapID target="sound_processing.seismicveto.docs.veto_configuration" url="sound_processing/seismicveto/docs/veto_configuration.html"/>
<mapID target="utilities.tethys.docs.deployments" url="utilities/tethys/docs/deployments.html"/>
<mapID target="detectors.whistleMoanHelp.docs.whistleMoan_ConfigNoise_averagesubtraction" url="detectors/whistleMoanHelp/docs/whistleMoan_ConfigNoise.html#averagesubtraction"/>
<mapID target="localisation.largeAperture3D.docs.meal_exercise3_localise" url="localisation/largeAperture3D/docs/meal_exercise3_localise.html"/>
@ -594,6 +602,8 @@
<mapID target="detectors.gpl.docs.notes" url="detectors/gpl/docs/notes.html"/>
<mapID target="utilities.tethys.docs.tethys_module" url="utilities/tethys/docs/tethys_module.html"/>
<mapID target="sound_processing.fftManagerHelp.docs.FFTEngine_Creating" url="sound_processing/fftManagerHelp/docs/FFTEngine_Creating.html"/>
<mapID target="sound_processing.fftManagerHelp.docs.noise_removal_clickremoval" url="sound_processing/fftManagerHelp/docs/noise_removal.html#clickremoval"/>

View File

@ -198,10 +198,18 @@
<tocitem text="Tethys Interface ">
<tocitem text="Tethys Overview " target="utilities.tethys.docs.tethys_overview" image="topic"/>
<tocitem text="Quick Start " target="utilities.tethys.docs.tethys_quickstart" image="topic"/>
<tocitem text="Tethys Module " target="utilities.tethys.docs.tethys_module" image="topic"/>
<tocitem text="Tethys Server " target="utilities.tethys.docs.tethys_server" image="topic"/>
<tocitem text="Connecting to Tethys " target="utilities.tethys.docs.connection" image="topic"/>
<tocitem text="Instrument Calibrations " target="utilities.tethys.docs.calibrations" image="topic"/>
<tocitem text="Instrument Deployments " target="utilities.tethys.docs.deployments" image="topic"/>
<tocitem text="Detections and Localizations " target="utilities.tethys.docs.detect_localize" image="topic"/>
<tocitem text="ITIS Species Codes " target="utilities.tethys.docs.tethys_speciescodes" image="topic"/>
</tocitem>

View File

@ -53,7 +53,6 @@ import tethys.output.TethysExportParams;
import tethys.species.ITISFunctions;
import tethys.species.SpeciesMapManager;
import tethys.swing.ProjectDeploymentsDialog;
import tethys.swing.TethysEnabler;
import tethys.swing.TethysTabPanel;
import tethys.swing.XMLStringView;
import tethys.swing.documents.TethysDocumentsFrame;
@ -92,12 +91,10 @@ public class TethysControl extends PamControlledUnit implements PamSettings, Tet
private CalibrationHandler calibrationHandler;
private ITISFunctions itisFunctions;
private TethysEnabler tethysEnabler;
public TethysControl(String unitName) {
super(unitType, unitName);
stateObservers = new ArrayList();
tethysEnabler = new TethysEnabler(this);
dbxmlConnect = new DBXMLConnect(this);
dbxmlQueries = new DBXMLQueries(this, dbxmlConnect);
deploymentHandler = new DeploymentHandler(this);
@ -494,10 +491,10 @@ public class TethysControl extends PamControlledUnit implements PamSettings, Tet
public ServerStatus checkServer() {
ServerStatus serverState = dbxmlConnect.pingServer();
if (lastServerStatus == null || lastServerStatus.ok != serverState.ok) {
lastServerStatus = serverState; // set before sending notification!
sendStateUpdate(new TethysState(StateType.UPDATESERVER));
}
lastServerStatus = serverState;
tethysEnabler.enableControls(serverState.ok);
// lastServerStatus = serverState;
return serverState;
}
@ -704,11 +701,22 @@ public class TethysControl extends PamControlledUnit implements PamSettings, Tet
}
/**
* Get a utility class that enables / disables controls depending on server state.
* @return
* @return the lastServerStatus
*/
public TethysEnabler getEnabler() {
return tethysEnabler;
public ServerStatus getLastServerStatus() {
return lastServerStatus;
}
/**
* Quick way for any controls to see that the server is probably OK
* without actually pinging it.
* @return true if last ping of server was OK
*/
public boolean isServerOk() {
if (lastServerStatus == null) {
return false;
}
return lastServerStatus.ok;
}
}

View File

@ -13,6 +13,7 @@ import javax.swing.border.TitledBorder;
import PamView.panel.PamPanel;
import tethys.TethysControl;
import tethys.TethysState;
import tethys.calibration.CalibrationHandler;
import tethys.swing.TethysGUIPanel;
@ -41,7 +42,6 @@ public class CalibrationsMainPanel extends TethysGUIPanel {
ctrlPanel = new PamPanel(new BorderLayout());
exportButton = new JButton("Export ...");
tethysControl.getEnabler().addComponent(exportButton);
ctrlPanel.add(BorderLayout.WEST, exportButton);
warning = new JLabel();
ctrlPanel.add(BorderLayout.CENTER, warning);
@ -64,4 +64,14 @@ public class CalibrationsMainPanel extends TethysGUIPanel {
return mainPanel;
}
@Override
public void updateState(TethysState tethysState) {
super.updateState(tethysState);
enableControls();
}
private void enableControls() {
exportButton.setEnabled(getTethysControl().isServerOk());
}
}

View File

@ -45,6 +45,9 @@ import dataMap.OfflineDataMapPoint;
import generalDatabase.DBControlUnit;
import metadata.MetaDataContol;
import metadata.PamguardMetaData;
import nilus.AcousticDataQAType;
import nilus.AcousticDataQAType.Quality;
import nilus.AcousticDataQAType.Quality.FrequencyRange;
import nilus.Audio;
import nilus.ChannelInfo;
import nilus.ChannelInfo.DutyCycle;
@ -403,6 +406,14 @@ public class DeploymentHandler implements TethysStateObserver, DeploymentTableOb
*/
private void exportOneDeploymnet(ArrayList<RecordingPeriod> selectedDeployments) {
// do the lot, whatever ...
Float sampleRate = null;
AcquisitionControl daq = (AcquisitionControl) PamController.getInstance().findControlledUnit(AcquisitionControl.class, null);
if (daq != null) {
DaqSystem system = daq.findDaqSystem(null);
AcquisitionParameters daqParams = daq.acquisitionParameters;
sampleRate = daqParams.sampleRate;
}
selectedDeployments = getDeploymentOverview().getRecordingPeriods();
int freeId = getTethysControl().getDeploymentHandler().getFirstFreeDeploymentId();
RecordingPeriod onePeriod = new RecordingPeriod(selectedDeployments.get(0).getRecordStart(),
@ -415,11 +426,37 @@ public class DeploymentHandler implements TethysStateObserver, DeploymentTableOb
deployment.setCruise(globalMeta.getCruise());
deployment.setSite(globalMeta.getSite());
if (selectedDeployments.size() > 1) {
// now need to remove the
SamplingDetails samplingDetails = deployment.getSamplingDetails();
samplingDetails.getChannel().clear();
for (int i = 0; i < selectedDeployments.size(); i++) {
addSamplingDetails(deployment, selectedDeployments.get(i));
// // now need to remove the sampling details - don't though, add invalid periods instead.
// SamplingDetails samplingDetails = deployment.getSamplingDetails();
// samplingDetails.getChannel().clear();
// for (int i = 0; i < selectedDeployments.size(); i++) {
// addSamplingDetails(deployment, selectedDeployments.get(i));
// }
/*
* Instead, we're putting invalid periods into the QA section.
*/
AcousticDataQAType qa = deployment.getQualityAssurance();
if (qa == null) {
deployment.setQualityAssurance(qa = new AcousticDataQAType());
}
List<Quality> qualityList = qa.getQuality();
for (int i = 1; i < selectedDeployments.size(); i++) {
long end = selectedDeployments.get(i-1).getRecordStop();
long start = selectedDeployments.get(i).getRecordStart();
Quality q = new Quality();
q.setStart(TethysTimeFuncs.xmlGregCalFromMillis(end));
q.setEnd(TethysTimeFuncs.xmlGregCalFromMillis(start));
q.setCategory("unusable");
if (sampleRate != null) {
FrequencyRange f = q.getFrequencyRange();
if (f == null) {
q.setFrequencyRange(f = new FrequencyRange());
}
f.setLowHz(0);
f.setHighHz(sampleRate/2);
}
q.setComment("No data (probably off or out of water)");
qualityList.add(q);
}
}
DBXMLConnect dbxmlConnect = getTethysControl().getDbxmlConnect();

View File

@ -100,9 +100,9 @@ public class DeploymentDataCard extends PamWizardCard {
/*
* temp code to only allow export of multiple documents.
*/
exportOptions.separateDeployments = true;
exportOne.setEnabled(false);
exportOne.setToolTipText("Feature not yet enabled");
// exportOptions.separateDeployments = true;
// exportOne.setEnabled(false);
// exportOne.setToolTipText("Feature not yet enabled");
exportOne.setSelected(exportOptions.separateDeployments == false);

View File

@ -61,7 +61,6 @@ public class DatablockSynchPanel extends TethysGUIPanel {
mainPanel.add(BorderLayout.CENTER, scrollPane);
PamPanel ctrlPanel = new PamPanel(new BorderLayout());
exportButton = new JButton("Export ...");
tethysControl.getEnabler().addComponent(exportButton);
ctrlPanel.add(BorderLayout.WEST, exportButton);
mainPanel.add(BorderLayout.NORTH, ctrlPanel);
@ -148,7 +147,7 @@ public class DatablockSynchPanel extends TethysGUIPanel {
if (deployments == null || deployments.size() == 0) {
en = false;
}
exportButton.setEnabled(en);
exportButton.setEnabled(getTethysControl().isServerOk() & en);
}
public void showPopup(MouseEvent e, int row) {
@ -182,6 +181,9 @@ public class DatablockSynchPanel extends TethysGUIPanel {
// dataBlockSynchInfo = null;
// getSychInfos();
// getTethysControl().coun
break;
case UPDATESERVER:
enableExportButton();
}
synchTableModel.fireTableDataChanged();

View File

@ -100,7 +100,6 @@ public class DeploymentExportPanel extends TethysGUIPanel implements DeploymentT
addPair("Set from ", projectDeployments, c);
bigExportButton = new JButton("Export selection");
tethysControl.getEnabler().addComponent(bigExportButton);
bigExportButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -155,6 +154,9 @@ public class DeploymentExportPanel extends TethysGUIPanel implements DeploymentT
case UPDATEMETADATA:
setInternal();
break;
case UPDATESERVER:
enableControls();
break;
}
}
@ -245,7 +247,7 @@ public class DeploymentExportPanel extends TethysGUIPanel implements DeploymentT
private void enableControls() {
boolean enable = selectedDeployments != null && selectedDeployments.size() > 0;
bigExportButton.setEnabled(enable);
bigExportButton.setEnabled(getTethysControl().isServerOk() & enable);
}
}

View File

@ -15,6 +15,7 @@ import javax.swing.border.TitledBorder;
import PamView.panel.PamPanel;
import tethys.TethysControl;
import tethys.TethysState;
import tethys.deployment.DeploymentHandler;
import tethys.deployment.RecordingPeriod;
@ -57,7 +58,6 @@ public class DeploymentsPanel extends TethysGUIPanel implements DeploymentTableO
ctrlButtons.setLayout(new BoxLayout(ctrlButtons, BoxLayout.X_AXIS));
optionsButton = new JButton("Options ...");
exportButton = new JButton("Export ...");
tethysControl.getEnabler().addComponent(exportButton);
ctrlButtons.add(optionsButton);
ctrlButtons.add(exportButton);
ctrlPanel.add(BorderLayout.WEST, ctrlButtons);
@ -98,14 +98,22 @@ public class DeploymentsPanel extends TethysGUIPanel implements DeploymentTableO
enableExportButton();
}
private void enableExportButton() {
ArrayList<RecordingPeriod> selected = pamDeploymentsTable.getSelectedPeriods();
// and see if any warnings are needed: basically if anything selected has an output.
if (selected == null) {
exportButton.setEnabled(false);
return;
}
boolean existing = false;
for (RecordingPeriod aPeriod: selected) {
if (aPeriod.getMatchedTethysDeployment() != null) {
existing = true;
break;
if (selected != null) {
// and see if any warnings are needed: basically if anything selected has an output.
for (RecordingPeriod aPeriod: selected) {
if (aPeriod.getMatchedTethysDeployment() != null) {
existing = true;
break;
}
}
}
String warning = null;
@ -114,7 +122,13 @@ public class DeploymentsPanel extends TethysGUIPanel implements DeploymentTableO
exportWarning.setText(warning);
}
exportButton.setEnabled(selected.size()>0 & existing == false);
exportButton.setEnabled(selected.size()>0 & existing == false && getTethysControl().isServerOk());
}
@Override
public void updateState(TethysState tethysState) {
super.updateState(tethysState);
enableExportButton();
}

View File

@ -326,6 +326,9 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
* @return
*/
public ArrayList<RecordingPeriod> getSelectedPeriods() {
if (deploymentOverview == null) {
return null;
}
ArrayList<RecordingPeriod> allPeriods = deploymentOverview.getRecordingPeriods();
ArrayList<RecordingPeriod> selPeriods = new ArrayList();
int n = allPeriods.size();

View File

@ -1,56 +0,0 @@
package tethys.swing;
import java.awt.Component;
import java.util.ArrayList;
import tethys.TethysControl;
import tethys.TethysState;
import tethys.TethysState.StateType;
import tethys.TethysStateObserver;
/**
* Handle enabling / disabling of any buttons / controls on the GUI.
* @author dg50
*
*/
public class TethysEnabler implements TethysStateObserver {
private TethysControl tethysControl;
private ArrayList<Component> components = new ArrayList<>();
/**
* @param tethysControl
*/
public TethysEnabler(TethysControl tethysControl) {
this.tethysControl = tethysControl;
tethysControl.addStateObserver(this);
}
/**
* Add a component to the enable list.
* @param aComponent
*/
public synchronized void addComponent(Component aComponent) {
components.add(aComponent);
}
public synchronized void removeComponent(Component aComponent) {
components.remove(aComponent);
}
@Override
public void updateState(TethysState tethysState) {
// if (tethysState.stateType == StateType.UPDATESERVER) {
// boolean ok = tethysControl.getDbxmlConnect().pingServer()
// }
}
public synchronized void enableControls(boolean enable) {
for (Component c : components) {
c.setEnabled(enable);
}
}
}