mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 00:22:27 +00:00
Deployment export
Improved deployment export interface and options.
This commit is contained in:
parent
860d1bec17
commit
03483ded18
@ -6,7 +6,7 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -283,6 +283,16 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
|
||||
return daqControllers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
if (offlineFileServer == null) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return offlineFileServer.getDataLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public AcquisitionProcess getDaqProcess() {
|
||||
return acquisitionProcess;
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ public class AcquisitionDialog extends PamDialog {
|
||||
acquisitionParameters = oldParams.clone();
|
||||
|
||||
acquisitionControl = daqControl;
|
||||
// singleInstance = null;
|
||||
|
||||
if (singleInstance == null || singleInstance.getOwner() != parentFrame) {
|
||||
singleInstance = new AcquisitionDialog(parentFrame);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package GPS;
|
||||
|
||||
import PamUtils.PamCalendar;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
|
||||
public class GpsDataUnit extends PamDataUnit {
|
||||
@ -52,12 +53,18 @@ public class GpsDataUnit extends PamDataUnit {
|
||||
*/
|
||||
@Override
|
||||
public String getSummaryString() {
|
||||
// TODO Auto-generated method stub
|
||||
String str = super.getSummaryString();
|
||||
// String str = super.getSummaryString();
|
||||
String str = String.format("<html>%s<br>UID:%d, Database: %d<br>%s<br>",
|
||||
"GPS Data", getUID(), getDatabaseIndex(), PamCalendar.formatDBDateTime(getTimeMilliseconds(), true));
|
||||
if (gpsData != null) {
|
||||
str += gpsData.summaryString();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getFrequency() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,9 +20,15 @@
|
||||
*/
|
||||
package Map;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import GPS.GPSControl;
|
||||
import GPS.GPSDataBlock;
|
||||
import GPS.GpsDataUnit;
|
||||
import PamController.PamController;
|
||||
import PamUtils.Coordinate3d;
|
||||
import PamUtils.LatLong;
|
||||
import PamUtils.PamCoordinate;
|
||||
@ -385,6 +391,45 @@ public class MapRectProjector extends MapProjector {
|
||||
return xTrans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHoverText(Point mousePoint, int ploNumberMatch) {
|
||||
String text = super.getHoverText(mousePoint, ploNumberMatch);
|
||||
if (text == null) {
|
||||
return findGpsTrackText(mousePoint, ploNumberMatch);
|
||||
}
|
||||
else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
private String findGpsTrackText(Point mousePoint, int ploNumberMatch) {
|
||||
GPSControl gpsControl = GPSControl.getGpsControl();
|
||||
if (gpsControl == null) {
|
||||
return null;
|
||||
}
|
||||
LatLong currentPos = getDataPosition(new Coordinate3d(mousePoint.x, mousePoint.y));
|
||||
GPSDataBlock gpsDataBlock = gpsControl.getGpsDataBlock();
|
||||
double dist = Double.MAX_VALUE;
|
||||
GpsDataUnit closest = null;
|
||||
ListIterator<GpsDataUnit> it = gpsDataBlock.getListIterator(0);
|
||||
while (it.hasNext()) {
|
||||
GpsDataUnit gpsUnit = it.next();
|
||||
double r = gpsUnit.getGpsData().distanceToMetres(currentPos);
|
||||
if (r < dist) {
|
||||
dist = r;
|
||||
closest = gpsUnit;
|
||||
}
|
||||
}
|
||||
if (closest == null) {
|
||||
return null;
|
||||
}
|
||||
double rPix = dist*this.pixelsPerMetre;
|
||||
if (rPix > 20) {
|
||||
return null;
|
||||
}
|
||||
return closest.getSummaryString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,13 @@ public interface OfflineDataStore {
|
||||
*/
|
||||
public String getDataSourceName();
|
||||
|
||||
/**
|
||||
* Get the data location. This may be a specific file, or might be a folder
|
||||
* if data are in many files, a URI, etc.
|
||||
* @return store locations
|
||||
*/
|
||||
public String getDataLocation();
|
||||
|
||||
/**
|
||||
* Load data for a given datablock between two time limits.
|
||||
* @param dataBlock datablock owner of the data
|
||||
|
@ -265,6 +265,11 @@ public abstract class GeneralProjector<T extends PamCoordinate> {
|
||||
|
||||
JComponent toolTipComponent;
|
||||
|
||||
/**
|
||||
* Gets an adapter that can provide tooltips automatically based on plotted data units.
|
||||
* @param component
|
||||
* @return
|
||||
*/
|
||||
public MouseHoverAdapter getMouseHoverAdapter(JComponent component) {
|
||||
ToolTipManager tt = ToolTipManager.sharedInstance();
|
||||
tt.registerComponent(component);
|
||||
@ -384,7 +389,9 @@ public abstract class GeneralProjector<T extends PamCoordinate> {
|
||||
}
|
||||
String hintText = dataBlock.getHoverText(this, hoveredDataUnit, hoverData.get(unitIndex).getAmbiguity());
|
||||
|
||||
if (hintText == null) return null;
|
||||
if (hintText == null) {
|
||||
return null;
|
||||
}
|
||||
// System.out.println(hintText);
|
||||
return hintText;
|
||||
}
|
||||
|
@ -974,8 +974,13 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
|
||||
|
||||
|
||||
// add frequency and amplitude information
|
||||
str += "Frequency: " + FrequencyFormat.formatFrequencyRange(this.getFrequency(), true) + "<br>";
|
||||
str += String.format("Amplitude: %3.1fdB<br>", getAmplitudeDB());
|
||||
double[] frequency = this.getFrequency();
|
||||
if (frequency != null) {
|
||||
str += "Frequency: " + FrequencyFormat.formatFrequencyRange(this.getFrequency(), true) + "<br>";
|
||||
}
|
||||
if (getAmplitudeDB() != 0) {
|
||||
str += String.format("Amplitude: %3.1fdB<br>", getAmplitudeDB());
|
||||
}
|
||||
if (getSignalSPL() != null) {
|
||||
str += String.format("SPL: %3.1fdBre1uPa<br>",linAmplitudeToDB(getSignalSPL()));
|
||||
}
|
||||
|
@ -2553,5 +2553,9 @@ PamSettingsSource, DataOutputStore {
|
||||
BinaryStoreDeleter storeDeleter = new BinaryStoreDeleter(this);
|
||||
return storeDeleter.deleteDataFrom(timeMillis);
|
||||
}
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
return binaryStoreSettings.getStoreLocation();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -341,6 +341,12 @@ public abstract class OfflineFileServer<TmapPoint extends FileDataMapPoint> impl
|
||||
// TODO Auto-generated method stub
|
||||
return "Sound Files";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
getOfflineFileParameters();
|
||||
return offlineFileParameters.folderName;
|
||||
}
|
||||
|
||||
public TmapPoint findFirstMapPoint(Iterator<TmapPoint> mapIterator, long startMillis, long endMillis) {
|
||||
TmapPoint mapPoint, prevMapPoint = null;
|
||||
|
@ -193,6 +193,15 @@ public class DecimatorControl extends PamControlledUnit implements PamSettings,
|
||||
}
|
||||
return offlineFileServer.getDataSourceName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
if (offlineFileServer == null) {
|
||||
return getUnitName();
|
||||
}
|
||||
return offlineFileServer.getDataLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData(PamDataBlock dataBlock, OfflineDataLoadInfo offlineDataLoadInfo, ViewLoadObserver loadObserver) {
|
||||
if (offlineFileServer == null) {
|
||||
|
@ -88,6 +88,16 @@ public class BeamformControl extends PamControlledUnit implements PamSettings, O
|
||||
return DifarParameters.serialVersionUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
if (offlineFileServer != null) {
|
||||
return offlineFileServer.getDataLocation();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean restoreSettings(
|
||||
PamControlledUnitSettings pamControlledUnitSettings) {
|
||||
|
@ -54,6 +54,11 @@ public abstract class OfflineFileControl extends PamControlledUnit implements Of
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
return fileParams.offlineFolder;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see PamController.PamControlledUnit#notifyModelChanged(int)
|
||||
*/
|
||||
|
@ -404,6 +404,11 @@ public class DBControlUnit extends DBControl implements DataOutputStore {
|
||||
return getUnitName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataLocation() {
|
||||
return getDatabaseName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadData(PamDataBlock dataBlock, OfflineDataLoadInfo offlineDataLoadInfo, ViewLoadObserver loadObserver) {
|
||||
SQLLogging logging = dataBlock.getLogging();
|
||||
|
@ -4,20 +4,34 @@ import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamController.PamController;
|
||||
import PamView.dialog.PamDialog;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import PamView.panel.WestAlignedPanel;
|
||||
import metadata.PamguardMetaData;
|
||||
import nilus.Deployment;
|
||||
import tethys.TethysControl;
|
||||
import tethys.TethysState;
|
||||
import tethys.TethysState.StateType;
|
||||
import tethys.deployment.swing.ProjectInformationPanel;
|
||||
import tethys.swing.NewProjectDialog;
|
||||
import tethys.swing.SelectProjectDialog;
|
||||
import tethys.swing.export.DescriptionTypePanel;
|
||||
import tethys.swing.export.ResponsiblePartyPanel;
|
||||
|
||||
@ -29,9 +43,11 @@ public class MetaDataDialog extends PamDialog {
|
||||
|
||||
private DescriptionTypePanel descriptionPanel;
|
||||
|
||||
private JTextField project, site, cruise, region;
|
||||
private ProjectInformationPanel projectInformationPanel;
|
||||
|
||||
private ResponsiblePartyPanel responsiblePanel;
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
private MetaDataDialog(Window parentFrame) {
|
||||
super(parentFrame, "Project information", false);
|
||||
@ -40,38 +56,21 @@ public class MetaDataDialog extends PamDialog {
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
JTabbedPane tabbedPane = new JTabbedPane();
|
||||
|
||||
tethysControl = (TethysControl) PamController.getInstance().findControlledUnit(TethysControl.unitType);
|
||||
|
||||
projectInformationPanel = new ProjectInformationPanel(parentFrame, null);
|
||||
descriptionPanel = new DescriptionTypePanel(null, false, false, false);
|
||||
descriptionPanel.getMainPanel().setPreferredSize(new Dimension(400,300));
|
||||
|
||||
JPanel projectPanel = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints c = new PamGridBagContraints();
|
||||
projectPanel.add(new JLabel("Project Name ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
projectPanel.add(project = new JTextField(40), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
projectPanel.add(new JLabel("Region ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
projectPanel.add(region = new JTextField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
projectPanel.add(new JLabel("Cruise name ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
projectPanel.add(cruise = new JTextField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
projectPanel.add(new JLabel("Site ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
projectPanel.add(site = new JTextField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
|
||||
// JPanel projectPanel = new JPanel(new GridBagLayout());
|
||||
|
||||
responsiblePanel = new ResponsiblePartyPanel();
|
||||
JPanel northPanel = new JPanel();
|
||||
WestAlignedPanel wp;
|
||||
northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
northPanel.add(wp = new WestAlignedPanel(projectPanel));
|
||||
northPanel.add(wp = new WestAlignedPanel(projectInformationPanel.getMainPanel()));
|
||||
wp.setBorder(new TitledBorder("General project information"));
|
||||
northPanel.add(wp = new WestAlignedPanel(responsiblePanel.getMainPanel()));
|
||||
wp.setBorder(new TitledBorder("Contact information"));
|
||||
@ -87,6 +86,9 @@ public class MetaDataDialog extends PamDialog {
|
||||
setDialogComponent(mainPanel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static PamguardMetaData showDialog(Window frame, PamguardMetaData pamguardMetaData) {
|
||||
singleInstance = new MetaDataDialog(frame);
|
||||
singleInstance.setParams(pamguardMetaData);
|
||||
@ -99,10 +101,6 @@ public class MetaDataDialog extends PamDialog {
|
||||
Deployment deployment = pamguardMetaData.getDeployment();
|
||||
descriptionPanel.setParams(deployment.getDescription());
|
||||
responsiblePanel.setParams(deployment.getMetadataInfo().getContact());
|
||||
cruise.setText(deployment.getCruise());
|
||||
region.setText(deployment.getRegion());
|
||||
site.setText(deployment.getSite());
|
||||
project.setText(deployment.getProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -110,11 +108,10 @@ public class MetaDataDialog extends PamDialog {
|
||||
Deployment deployment = pamguardMetaData.getDeployment();
|
||||
boolean ok = descriptionPanel.getParams(deployment.getDescription());
|
||||
ok &= responsiblePanel.getParams(deployment.getMetadataInfo().getContact());
|
||||
deployment.setCruise(cruise.getText());
|
||||
deployment.setRegion(region.getText());
|
||||
deployment.setSite(site.getText());
|
||||
deployment.setProject(project.getText());
|
||||
|
||||
if (tethysControl != null) {
|
||||
tethysControl.sendStateUpdate(new TethysState(StateType.NEWPROJECTSELECTION));
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,13 @@ public class CalibrationHandler implements TethysStateObserver {
|
||||
* @return list of calibration documents using this instrument, based on the start of the document name.
|
||||
*/
|
||||
private ArrayList<DocumentInfo> getArrayCalibrations() {
|
||||
ArrayList<DocumentInfo> allCals = tethysControl.getDbxmlQueries().getCollectionDocumentList(Collection.Calibrations);
|
||||
ArrayList<DocumentInfo> allCals = null;
|
||||
try {
|
||||
allCals = tethysControl.getDbxmlQueries().getCollectionDocumentList(Collection.Calibrations);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
if (allCals == null) {
|
||||
return null;
|
||||
}
|
||||
|
40
src/tethys/deployment/DeploymentExportOpts.java
Normal file
40
src/tethys/deployment/DeploymentExportOpts.java
Normal file
@ -0,0 +1,40 @@
|
||||
package tethys.deployment;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* options for Deployment export collected by the export Wizard.
|
||||
* @author dg50
|
||||
*
|
||||
*/
|
||||
public class DeploymentExportOpts implements Serializable, Cloneable {
|
||||
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
public boolean separateDeployments;
|
||||
|
||||
public double trackPointInterval;
|
||||
|
||||
/**
|
||||
* Max gap before recording periods are separated, potentially into
|
||||
* separate Deployment documents
|
||||
*/
|
||||
public int maxGapSeconds = 60;
|
||||
|
||||
/**
|
||||
* A recording section after joining with max gap parameter is too short
|
||||
* to be worth keeping.
|
||||
*/
|
||||
public int minLengthSeconds = 10;
|
||||
|
||||
@Override
|
||||
protected DeploymentExportOpts clone() {
|
||||
try {
|
||||
return (DeploymentExportOpts) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package tethys.deployment;
|
||||
|
||||
import java.awt.Window;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -24,10 +26,16 @@ import Array.HydrophoneLocator;
|
||||
import Array.PamArray;
|
||||
import Array.Streamer;
|
||||
import Array.ThreadingHydrophoneLocator;
|
||||
import GPS.GPSControl;
|
||||
import GPS.GPSDataBlock;
|
||||
import GPS.GpsData;
|
||||
import GPS.GpsDataUnit;
|
||||
import PamController.PamSensor;
|
||||
import PamController.PamSettingManager;
|
||||
import PamController.PamSettings;
|
||||
import PamController.PamControlledUnit;
|
||||
import PamController.PamControlledUnitSettings;
|
||||
import PamController.PamController;
|
||||
import PamUtils.LatLong;
|
||||
import PamUtils.PamUtils;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamRawDataBlock;
|
||||
@ -46,6 +54,10 @@ import nilus.ChannelInfo.Sampling;
|
||||
import nilus.ChannelInfo.Sampling.Regimen;
|
||||
import nilus.Deployment;
|
||||
import nilus.Deployment.Data;
|
||||
import nilus.Deployment.Data.Tracks;
|
||||
import nilus.Deployment.Data.Tracks.Track;
|
||||
import nilus.Deployment.Data.Tracks.Track.Point;
|
||||
import nilus.Deployment.Data.Tracks.Track.Point.BearingDegN;
|
||||
import nilus.Deployment.Instrument;
|
||||
import nilus.Deployment.SamplingDetails;
|
||||
import nilus.Deployment.Sensors;
|
||||
@ -66,8 +78,12 @@ import tethys.calibration.CalibrationHandler;
|
||||
import tethys.TethysState.StateType;
|
||||
import tethys.dbxml.DBXMLConnect;
|
||||
import tethys.dbxml.TethysException;
|
||||
import tethys.deployment.swing.DeploymentWizard;
|
||||
import tethys.deployment.swing.RecordingGapDialog;
|
||||
import tethys.niluswraps.PDeployment;
|
||||
import tethys.output.TethysExportParams;
|
||||
import tethys.pamdata.AutoTethysProvider;
|
||||
import tethys.swing.DeploymentTableObserver;
|
||||
|
||||
/**
|
||||
* Functions to gather data for the deployment document from all around PAMGuard.
|
||||
@ -77,7 +93,7 @@ import tethys.output.TethysExportParams;
|
||||
* @author dg50
|
||||
*
|
||||
*/
|
||||
public class DeploymentHandler implements TethysStateObserver {
|
||||
public class DeploymentHandler implements TethysStateObserver, DeploymentTableObserver {
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
@ -93,6 +109,8 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
private ArrayList<PDeployment> projectDeployments;
|
||||
|
||||
private Helper nilusHelper;
|
||||
|
||||
private DeploymentExportOpts exportOptions = new DeploymentExportOpts();
|
||||
|
||||
public DeploymentHandler(TethysControl tethysControl) {
|
||||
super();
|
||||
@ -103,6 +121,32 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PamSettingManager.getInstance().registerSettings(new SettingsHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather up all track information both from the GPS module (if it exists) and
|
||||
* the type of hydrophone array (or many!)
|
||||
* @return
|
||||
*/
|
||||
public TrackInformation getTrackInformation() {
|
||||
PamArray array = ArrayManager.getArrayManager().getCurrentArray();
|
||||
int nStreamers = array.getStreamerCount();
|
||||
HydrophoneLocator locator = null;
|
||||
for (int i = 0; i < nStreamers; i++) {
|
||||
Streamer aStreamer = array.getStreamer(i);
|
||||
locator = aStreamer.getHydrophoneLocator();
|
||||
// locator.getLocatorSettings().
|
||||
}
|
||||
// try to find a GPS datablock and see what's in it's datamap.
|
||||
OfflineDataMap gpsDataMap = null;
|
||||
GPSControl gpsControl = (GPSControl) PamController.getInstance().findControlledUnit(GPSControl.gpsUnitType);
|
||||
if (gpsControl != null) {
|
||||
GPSDataBlock gpsDataBlock = gpsControl.getGpsDataBlock();
|
||||
gpsDataMap = gpsDataBlock.getPrimaryDataMap();
|
||||
}
|
||||
TrackInformation trackInformation = new TrackInformation(gpsDataMap, locator);
|
||||
return trackInformation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,6 +181,7 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
projectDeployments.add(new PDeployment(deployment));
|
||||
}
|
||||
matchPamguard2Tethys(deploymentOverview, projectDeployments);
|
||||
tethysControl.sendStateUpdate(new TethysState(TethysState.StateType.NEWPAMGUARDSELECTION));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -240,7 +285,7 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
if (prevPeriod != null) {
|
||||
long gap = nextPeriod.getRecordStart() - prevPeriod.getRecordStop();
|
||||
long prevDur = prevPeriod.getRecordStop()-prevPeriod.getRecordStart();
|
||||
if (gap < 3000 || gap < prevDur/50) {
|
||||
if (gap < exportOptions.maxGapSeconds*1000) {
|
||||
// ignoring up to 3s gap or a sample error < 2%.Dunno if this is sensible or not.
|
||||
prevPeriod.setRecordStop(nextPeriod.getRecordStop());
|
||||
iterator.remove();
|
||||
@ -249,6 +294,15 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
}
|
||||
prevPeriod = nextPeriod;
|
||||
}
|
||||
// now remove ones which are too short even after merging.
|
||||
iterator = tempPeriods.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
RecordingPeriod nextPeriod = iterator.next();
|
||||
long duration = nextPeriod.getDuration();
|
||||
if (duration < exportOptions.minLengthSeconds*1000L) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
// i = 0;
|
||||
// for (RecordingPeriod aP : tempPeriods) {
|
||||
// System.out.printf("Post merge %d : %s to %s\n", i++, PamCalendar.formatDBDateTime(aP.getRecordStart()),
|
||||
@ -288,12 +342,38 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
|
||||
}
|
||||
|
||||
public void showOptions(Window parent) {
|
||||
if (parent == null) {
|
||||
parent = tethysControl.getGuiFrame();
|
||||
}
|
||||
DeploymentExportOpts newOpts = RecordingGapDialog.showDiloag(parent, exportOptions);
|
||||
if (newOpts != null) {
|
||||
exportOptions = newOpts;
|
||||
deploymentOverview = createPamguardOverview();
|
||||
updateProjectDeployments();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exprt deployments docs. Playing with a couple of different ways of doing this.
|
||||
* Export button pressed on GUI. Run wizard....
|
||||
*/
|
||||
public void exportDeployments() {
|
||||
Deployment deployment = MetaDataContol.getMetaDataControl().getMetaData().getDeployment();
|
||||
DeploymentExportOpts exportOptions = DeploymentWizard.showWizard(getTethysControl().getGuiFrame(), tethysControl, deployment, this.exportOptions);
|
||||
if (exportOptions != null) {
|
||||
this.exportOptions = exportOptions;
|
||||
deploymentOverview = getDeploymentOverview();
|
||||
ArrayList<RecordingPeriod> allPeriods = deploymentOverview.getRecordingPeriods();
|
||||
exportDeployments(allPeriods);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export deployments docs. Playing with a couple of different ways of doing this.
|
||||
* @param selectedDeployments
|
||||
*/
|
||||
public void exportDeployments(ArrayList<RecordingPeriod> selectedDeployments) {
|
||||
if (false) {
|
||||
if (exportOptions.separateDeployments) {
|
||||
exportSeparateDeployments(selectedDeployments);
|
||||
}
|
||||
else {
|
||||
@ -765,9 +845,11 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
deployment.setDeploymentDetails(deploymentDetails);
|
||||
deployment.setRecoveryDetails(recoveryDetails);
|
||||
|
||||
TethysLocationFuncs.getTrackAndPositionData(deployment);
|
||||
|
||||
getProjectData(deployment);
|
||||
|
||||
TethysLocationFuncs.getTrackAndPositionData(deployment);
|
||||
|
||||
getTrackDetails(deployment);
|
||||
|
||||
DescriptionType description = deployment.getDescription();
|
||||
if (description == null ) {
|
||||
@ -797,6 +879,67 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
return deployment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the track to the deployment, if there is one (i.e. not for
|
||||
* a fixed sensor).
|
||||
* @param deployment
|
||||
*/
|
||||
private void getTrackDetails(Deployment deployment) {
|
||||
TrackInformation trackInfo = getTrackInformation();
|
||||
if (trackInfo.haveGPSTrack() == false) {
|
||||
return;
|
||||
}
|
||||
GPSDataBlock gpsDataBlock = (GPSDataBlock) trackInfo.getGpsDataMap().getParentDataBlock();
|
||||
if (gpsDataBlock == null) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* should have some track information. Do a load from the
|
||||
* database for the whole deployment. this may be the entire GPS record, but
|
||||
* we should be able to cope with that.
|
||||
*/
|
||||
long trackStart = TethysTimeFuncs.millisFromGregorianXML(deployment.getDeploymentDetails().getTimeStamp());
|
||||
long trackEnd = TethysTimeFuncs.millisFromGregorianXML(deployment.getRecoveryDetails().getTimeStamp());
|
||||
long dataWin =(long) (Math.max(1./trackInfo.getGPSDataRate(), exportOptions.trackPointInterval));
|
||||
|
||||
// get the tracks object.
|
||||
Tracks tracks = deployment.getData().getTracks();
|
||||
if (tracks == null) {
|
||||
tracks = new Tracks();
|
||||
deployment.getData().setTracks(tracks);
|
||||
}
|
||||
List<Track> trackList = tracks.getTrack(); // lists are usually there.
|
||||
|
||||
Track aTrack = new Track();
|
||||
trackList.add(aTrack);
|
||||
List<Point> points = aTrack.getPoint();
|
||||
|
||||
gpsDataBlock.loadViewerData(trackStart-dataWin, trackEnd+dataWin, null);
|
||||
long lastPointTime = 0;
|
||||
ListIterator<GpsDataUnit> it = gpsDataBlock.getListIterator(0);
|
||||
while (it.hasNext()) {
|
||||
GpsDataUnit gpsDataUnit = it.next();
|
||||
if (gpsDataUnit.getTimeMilliseconds()-lastPointTime < exportOptions.trackPointInterval*1000) {
|
||||
continue;
|
||||
}
|
||||
GpsData gpsData = gpsDataUnit.getGpsData();
|
||||
Point gpsPoint = new Point();
|
||||
gpsPoint.setTimeStamp(TethysTimeFuncs.xmlGregCalFromMillis(gpsDataUnit.getTimeMilliseconds()));
|
||||
gpsPoint.setLatitude(gpsData.getLatitude());
|
||||
gpsPoint.setLongitude(PamUtils.constrainedAngle(gpsData.getLongitude()));
|
||||
BearingDegN bdn = gpsPoint.getBearingDegN();
|
||||
if (bdn == null) {
|
||||
bdn = new BearingDegN();
|
||||
gpsPoint.setBearingDegN(bdn);
|
||||
}
|
||||
bdn.setValue(AutoTethysProvider.roundDecimalPlaces(PamUtils.constrainedAngle(gpsData.getHeading()),1));
|
||||
gpsPoint.setSpeedKn(AutoTethysProvider.roundDecimalPlaces(gpsData.getSpeed(),2));
|
||||
|
||||
points.add(gpsPoint);
|
||||
lastPointTime = gpsDataUnit.getTimeMilliseconds();
|
||||
}
|
||||
}
|
||||
|
||||
public String getBinaryDataURI() {
|
||||
BinaryStore binStore = BinaryStore.findBinaryStoreControl();
|
||||
if (binStore != null) {
|
||||
@ -926,15 +1069,17 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
if (depTime != null) {
|
||||
deployment.getDeploymentDetails().setTimeStamp(depTime);
|
||||
}
|
||||
XMLGregorianCalendar recMillis = deploymentData.getRecoveryDetails().getTimeStamp();
|
||||
if (recMillis != null) {
|
||||
deployment.getRecoveryDetails().setTimeStamp(recMillis);
|
||||
}
|
||||
double recLat = deploymentData.getRecoveryDetails().getLatitude();
|
||||
double recLong = deploymentData.getRecoveryDetails().getLongitude();
|
||||
if (recLat != 0 & recLong != 0.) {
|
||||
deployment.getRecoveryDetails().setLatitude(recLat);
|
||||
deployment.getRecoveryDetails().setLongitude(PamUtils.constrainedAngle(recLong));
|
||||
if (deploymentData.getRecoveryDetails() != null) {
|
||||
XMLGregorianCalendar recMillis = deploymentData.getRecoveryDetails().getTimeStamp();
|
||||
if (recMillis != null) {
|
||||
deployment.getRecoveryDetails().setTimeStamp(recMillis);
|
||||
}
|
||||
double recLat = deploymentData.getRecoveryDetails().getLatitude();
|
||||
double recLong = deploymentData.getRecoveryDetails().getLongitude();
|
||||
if (recLat != 0 & recLong != 0.) {
|
||||
deployment.getRecoveryDetails().setLatitude(recLat);
|
||||
deployment.getRecoveryDetails().setLongitude(PamUtils.constrainedAngle(recLong));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1164,4 +1309,40 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectionChanged() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private class SettingsHandler implements PamSettings {
|
||||
|
||||
@Override
|
||||
public String getUnitName() {
|
||||
return tethysControl.getUnitName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnitType() {
|
||||
return "Tethys Deployment Handler";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getSettingsReference() {
|
||||
return exportOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSettingsVersion() {
|
||||
return DeploymentExportOpts.serialVersionUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
|
||||
exportOptions = (DeploymentExportOpts) pamControlledUnitSettings.getSettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ public class RecordingPeriod {
|
||||
|
||||
private long recordStop;
|
||||
|
||||
private boolean selected; // selected in the table or elsewhere for export.
|
||||
/**
|
||||
* Reference to a matched nilus Deployment document retrieved
|
||||
* from the database.
|
||||
@ -47,6 +48,28 @@ public class RecordingPeriod {
|
||||
public void setMatchedTethysDeployment(PDeployment closestDeployment) {
|
||||
this.matchedTethysDeployment = closestDeployment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the selected
|
||||
*/
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param selected the selected to set
|
||||
*/
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle the selected state
|
||||
* @return the new state
|
||||
*/
|
||||
public boolean toggleSelected() {
|
||||
selected = !selected;
|
||||
return selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
85
src/tethys/deployment/TrackInformation.java
Normal file
85
src/tethys/deployment/TrackInformation.java
Normal file
@ -0,0 +1,85 @@
|
||||
package tethys.deployment;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import Array.HydrophoneLocator;
|
||||
import GPS.GPSDataBlock;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import dataMap.OfflineDataMap;
|
||||
import dataMap.OfflineDataMapPoint;
|
||||
|
||||
/**
|
||||
* Some general information about the track: whether it exists and
|
||||
* the frequency of GPS points.
|
||||
* @author dg50
|
||||
*
|
||||
*/
|
||||
public class TrackInformation {
|
||||
|
||||
private HydrophoneLocator hydrophoneLocator;
|
||||
private OfflineDataMap gpsDataMap;
|
||||
|
||||
public TrackInformation(OfflineDataMap gpsDataMap, HydrophoneLocator locator) {
|
||||
this.gpsDataMap = gpsDataMap;
|
||||
this.hydrophoneLocator = locator;
|
||||
}
|
||||
|
||||
public boolean haveGPSTrack() {
|
||||
if (gpsDataMap == null) {
|
||||
return false;
|
||||
}
|
||||
return (gpsDataMap.getDataCount() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an estimate of the highest GPS data rate in points per second. This is obtained from the
|
||||
* datamap, taking the highest rate for all data map points (typically an hour of
|
||||
* database data).
|
||||
* @return
|
||||
*/
|
||||
public double getGPSDataRate() {
|
||||
if (gpsDataMap == null) {
|
||||
return 0;
|
||||
}
|
||||
GPSDataBlock gpsDataBlock = (GPSDataBlock) gpsDataMap.getParentDataBlock();
|
||||
Iterator<OfflineDataMapPoint> mPs = gpsDataMap.getListIterator();
|
||||
double highRate = 0;
|
||||
while (mPs.hasNext()) {
|
||||
OfflineDataMapPoint mP = mPs.next();
|
||||
int n = mP.getNDatas();
|
||||
double dur = (mP.getEndTime()-mP.getStartTime())/1000.;
|
||||
double rate = n/dur;
|
||||
highRate = Math.max(highRate, rate);
|
||||
}
|
||||
return highRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hydrophoneLocator
|
||||
*/
|
||||
public HydrophoneLocator getHydrophoneLocator() {
|
||||
return hydrophoneLocator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hydrophoneLocator the hydrophoneLocator to set
|
||||
*/
|
||||
public void setHydrophoneLocator(HydrophoneLocator hydrophoneLocator) {
|
||||
this.hydrophoneLocator = hydrophoneLocator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the gpsDataMap
|
||||
*/
|
||||
public OfflineDataMap getGpsDataMap() {
|
||||
return gpsDataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gpsDataMap the gpsDataMap to set
|
||||
*/
|
||||
public void setGpsDataMap(OfflineDataMap gpsDataMap) {
|
||||
this.gpsDataMap = gpsDataMap;
|
||||
}
|
||||
|
||||
}
|
103
src/tethys/deployment/swing/DeploymentDataCard.java
Normal file
103
src/tethys/deployment/swing/DeploymentDataCard.java
Normal file
@ -0,0 +1,103 @@
|
||||
package tethys.deployment.swing;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamController.OfflineDataStore;
|
||||
import PamController.PamController;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import PamView.wizard.PamWizard;
|
||||
import PamView.wizard.PamWizardCard;
|
||||
import nilus.Deployment;
|
||||
import tethys.TethysControl;
|
||||
import tethys.deployment.DeploymentExportOpts;
|
||||
import tethys.deployment.DeploymentHandler;
|
||||
|
||||
public class DeploymentDataCard extends PamWizardCard {
|
||||
|
||||
private TethysControl tethysControl;
|
||||
private DeploymentHandler deploymentHandler;
|
||||
|
||||
private JRadioButton exportOne, exportMany;
|
||||
|
||||
private JTextField[] dataStores;
|
||||
// private JTextField rawURI, binaryURI, databaseURI;
|
||||
private ArrayList<OfflineDataStore> offlineDataStores;
|
||||
|
||||
public DeploymentDataCard(PamWizard pamWizard, TethysControl tethysControl) {
|
||||
super(pamWizard, "Data");
|
||||
this.tethysControl = tethysControl;
|
||||
deploymentHandler = tethysControl.getDeploymentHandler();
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
exportOne = new JRadioButton("Export a single detection document for all data");
|
||||
exportMany = new JRadioButton("Export separate documents for each ad-hoc recording period");
|
||||
bg.add(exportOne);
|
||||
bg.add(exportMany);
|
||||
|
||||
JPanel optsPanel = new JPanel(new GridBagLayout());
|
||||
optsPanel.setBorder(new TitledBorder("Number of documents"));
|
||||
GridBagConstraints c = new PamGridBagContraints();
|
||||
optsPanel.add(exportOne, c);
|
||||
c.gridy++;
|
||||
optsPanel.add(exportMany, c);
|
||||
|
||||
JPanel dataPanel = new JPanel(new GridBagLayout());
|
||||
dataPanel.setBorder(new TitledBorder("Data location"));
|
||||
|
||||
// automatically generate fields for every offline data store.
|
||||
offlineDataStores = PamController.getInstance().findOfflineDataStores();
|
||||
dataStores = new JTextField[offlineDataStores.size()];
|
||||
c = new PamGridBagContraints();
|
||||
for (int i = 0; i < offlineDataStores.size(); i++) {
|
||||
OfflineDataStore aStore = offlineDataStores.get(i);
|
||||
dataPanel.add(new JLabel(aStore.getDataSourceName() + " ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
dataStores[i] = new JTextField(40);
|
||||
dataPanel.add(dataStores[i], c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
}
|
||||
|
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
this.add(optsPanel);
|
||||
this.add(dataPanel);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getParams(Object cardParams) {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(Object cardParams) {
|
||||
for (int i = 0; i < offlineDataStores.size(); i++) {
|
||||
OfflineDataStore aStore = offlineDataStores.get(i);
|
||||
dataStores[i].setText(aStore.getDataLocation());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean getParams(DeploymentExportOpts exportOptions, Deployment deployment) {
|
||||
exportOptions.separateDeployments = exportMany.isSelected();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setParams(DeploymentExportOpts exportOptions, Deployment deployment) {
|
||||
exportOne.setSelected(exportOptions.separateDeployments == false);
|
||||
exportMany.setSelected(exportOptions.separateDeployments == true);
|
||||
setParams(deployment);
|
||||
}
|
||||
|
||||
}
|
47
src/tethys/deployment/swing/DeploymentInfoCard.java
Normal file
47
src/tethys/deployment/swing/DeploymentInfoCard.java
Normal file
@ -0,0 +1,47 @@
|
||||
package tethys.deployment.swing;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
|
||||
import PamView.wizard.PamWizard;
|
||||
import PamView.wizard.PamWizardCard;
|
||||
import nilus.Deployment;
|
||||
import tethys.deployment.DeploymentExportOpts;
|
||||
import tethys.swing.export.ResponsiblePartyPanel;
|
||||
|
||||
public class DeploymentInfoCard extends PamWizardCard<Deployment> {
|
||||
|
||||
private ResponsiblePartyPanel responsiblePartyPanel;
|
||||
|
||||
private ProjectInformationPanel projectInformationPanel;
|
||||
|
||||
public DeploymentInfoCard(PamWizard pamWizard, String title) {
|
||||
super(pamWizard, title);
|
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
projectInformationPanel = new ProjectInformationPanel(pamWizard, title);
|
||||
this.add(projectInformationPanel.getMainPanel());
|
||||
responsiblePartyPanel = new ResponsiblePartyPanel("Responsible Party");
|
||||
this.add(responsiblePartyPanel.getMainPanel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams(Deployment cardParams) {
|
||||
boolean ok = responsiblePartyPanel.getParams(cardParams.getMetadataInfo().getContact());
|
||||
ok &= projectInformationPanel.getParams(cardParams);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(Deployment cardParams) {
|
||||
projectInformationPanel.setParams(cardParams);
|
||||
responsiblePartyPanel.setParams(cardParams.getMetadataInfo().getContact());
|
||||
}
|
||||
|
||||
public boolean getParams(DeploymentExportOpts exportOptions, Deployment deployment) {
|
||||
boolean ok = getParams(deployment);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
}
|
183
src/tethys/deployment/swing/DeploymentTrackCard.java
Normal file
183
src/tethys/deployment/swing/DeploymentTrackCard.java
Normal file
@ -0,0 +1,183 @@
|
||||
package tethys.deployment.swing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import PamUtils.PamCalendar;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import PamView.panel.WestAlignedPanel;
|
||||
import PamView.wizard.PamWizard;
|
||||
import PamView.wizard.PamWizardCard;
|
||||
import dataMap.OfflineDataMap;
|
||||
import tethys.TethysControl;
|
||||
import tethys.deployment.DeploymentExportOpts;
|
||||
import tethys.deployment.TrackInformation;
|
||||
|
||||
public class DeploymentTrackCard extends PamWizardCard<DeploymentExportOpts> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
private TrackInformation trackInfo;
|
||||
|
||||
private JTextField totalPoints, startDate, endDate, highestRate;
|
||||
|
||||
private JTextField exportInterval, exportCount;
|
||||
|
||||
public DeploymentTrackCard(PamWizard pamWizard, TethysControl tethysControl, TrackInformation trackInfo) {
|
||||
super(pamWizard, "Track Data");
|
||||
this.tethysControl = tethysControl;
|
||||
this.trackInfo = trackInfo;
|
||||
JPanel trackPanel = new JPanel();
|
||||
WestAlignedPanel wp = new WestAlignedPanel(trackPanel);
|
||||
wp.setBorder(new TitledBorder("Track data summary"));
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
add(wp);
|
||||
trackPanel.setLayout(new GridBagLayout());
|
||||
GridBagConstraints c = new PamGridBagContraints();
|
||||
c.gridx = 1;
|
||||
trackPanel.add(new JLabel("PAMGuard data content .... ", JLabel.LEFT), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
trackPanel.add(new JLabel("Track Start ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
trackPanel.add(startDate = new TrackField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
trackPanel.add(new JLabel("Track End ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
trackPanel.add(endDate = new TrackField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
trackPanel.add(new JLabel("Total Points ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
trackPanel.add(totalPoints = new TrackField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
trackPanel.add(new JLabel("Interval ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
trackPanel.add(highestRate = new TrackField(20), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
trackPanel.add(new JLabel("Export .... ", JLabel.LEFT), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
trackPanel.add(new JLabel("Export interval ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
trackPanel.add(exportInterval = new JTextField(12), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
trackPanel.add(new JLabel("Estimated elements ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
trackPanel.add(exportCount = new TrackField(12), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
|
||||
IntervalListener il = new IntervalListener();
|
||||
// exportInterval.addActionListener(il);
|
||||
// exportInterval.addKeyListener(il);
|
||||
// exportInterval.addFocusListener(il);
|
||||
exportInterval.getDocument().addDocumentListener(il);
|
||||
|
||||
|
||||
// c.gridx++;
|
||||
// trackPanel.add(new JLabel(" per minute ", JLabel.LEFT), c);
|
||||
// c.gridy++;
|
||||
|
||||
}
|
||||
|
||||
private class IntervalListener implements DocumentListener {
|
||||
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
updateExportCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
updateExportCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
updateExportCount();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class TrackField extends JTextField {
|
||||
|
||||
/**
|
||||
* @param columns
|
||||
*/
|
||||
public TrackField(int columns) {
|
||||
super(columns);
|
||||
setEditable(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams(DeploymentExportOpts cardParams) {
|
||||
try {
|
||||
cardParams.trackPointInterval = Double.valueOf(exportInterval.getText());
|
||||
}
|
||||
catch (Exception e) {
|
||||
return getPamWizard().showWarning("Invalid track point interval");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateExportCount() {
|
||||
OfflineDataMap dataMap = trackInfo.getGpsDataMap();
|
||||
if (dataMap == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// System.out.println(exportInterval.getText());
|
||||
double intval = Double.valueOf(exportInterval.getText());
|
||||
double highRate = trackInfo.getGPSDataRate();
|
||||
int nCount = dataMap.getDataCount();
|
||||
int newEst = (int) Math.round(Math.min(nCount/(intval*highRate), nCount));
|
||||
exportCount.setText(String.format("%d", newEst));
|
||||
}
|
||||
catch (Exception e) {
|
||||
exportCount.setText(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(DeploymentExportOpts cardParams) {
|
||||
OfflineDataMap dataMap = trackInfo.getGpsDataMap();
|
||||
if (dataMap == null) {
|
||||
return;
|
||||
}
|
||||
startDate.setText(PamCalendar.formatDBDateTime(dataMap.getFirstDataTime()));
|
||||
endDate.setText(PamCalendar.formatDBDateTime(dataMap.getLastDataTime()));
|
||||
totalPoints.setText(String.format("%d", dataMap.getDataCount()));
|
||||
double rate = trackInfo.getGPSDataRate();
|
||||
highestRate.setText(PamCalendar.formatDuration((long) (1000/rate)));
|
||||
|
||||
}
|
||||
|
||||
}
|
100
src/tethys/deployment/swing/DeploymentWizard.java
Normal file
100
src/tethys/deployment/swing/DeploymentWizard.java
Normal file
@ -0,0 +1,100 @@
|
||||
package tethys.deployment.swing;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Window;
|
||||
|
||||
import PamView.wizard.PamWizard;
|
||||
import PamView.wizard.PamWizardCard;
|
||||
import metadata.MetaDataContol;
|
||||
import nilus.Deployment;
|
||||
import tethys.TethysControl;
|
||||
import tethys.deployment.DeploymentExportOpts;
|
||||
import tethys.deployment.DeploymentHandler;
|
||||
import tethys.deployment.TrackInformation;
|
||||
import tethys.swing.export.DescriptionCard;
|
||||
import tethys.swing.export.ResponsiblePartyCard;
|
||||
|
||||
public class DeploymentWizard extends PamWizard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Deployment deployment;
|
||||
|
||||
private DeploymentExportOpts exportOptions;
|
||||
|
||||
private DescriptionCard descriptionCard;
|
||||
|
||||
private DeploymentInfoCard deploymentInfoCard;
|
||||
|
||||
private DeploymentDataCard deploymentDataCard;
|
||||
|
||||
private DeploymentTrackCard deploymentTrackCard;
|
||||
// private
|
||||
|
||||
private DeploymentWizard(Window parentFrame, TethysControl tethysControl, Deployment deployment, DeploymentExportOpts exportOptions) {
|
||||
super(parentFrame, "Deployment Export");
|
||||
this.deployment = deployment;
|
||||
this.exportOptions = exportOptions;
|
||||
DeploymentHandler deploymentHandler = tethysControl.getDeploymentHandler();
|
||||
TrackInformation trackInfo = deploymentHandler.getTrackInformation();
|
||||
|
||||
addCard(deploymentInfoCard = new DeploymentInfoCard(this, "Responsible Party"));
|
||||
addCard(deploymentDataCard = new DeploymentDataCard(this, tethysControl));
|
||||
addCard(descriptionCard = new DescriptionCard(this, tethysControl));
|
||||
boolean haveGPS = trackInfo.haveGPSTrack();
|
||||
if (haveGPS) {
|
||||
deploymentTrackCard = new DeploymentTrackCard(this, tethysControl, trackInfo);
|
||||
addCard(deploymentTrackCard);
|
||||
}
|
||||
descriptionCard.setPreferredSize(new Dimension(10, 300));
|
||||
}
|
||||
|
||||
public static DeploymentExportOpts showWizard(Window parentFrame, TethysControl tethysControl, Deployment deployment, DeploymentExportOpts exportOptions) {
|
||||
if (deployment == null) {
|
||||
deployment = MetaDataContol.getMetaDataControl().getMetaData().getDeployment();
|
||||
}
|
||||
DeploymentWizard wiz = new DeploymentWizard(parentFrame, tethysControl, deployment, exportOptions);
|
||||
wiz.setParams();
|
||||
wiz.setVisible(true);
|
||||
return wiz.exportOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCardParams(PamWizardCard wizardCard) {
|
||||
if (wizardCard == descriptionCard) {
|
||||
descriptionCard.setParams(deployment.getDescription());
|
||||
}
|
||||
if (wizardCard == deploymentInfoCard) {
|
||||
deploymentInfoCard.setParams(deployment);
|
||||
}
|
||||
if (wizardCard == deploymentDataCard) {
|
||||
deploymentDataCard.setParams(exportOptions, deployment);
|
||||
}
|
||||
if (wizardCard == deploymentTrackCard) {
|
||||
deploymentTrackCard.setParams(exportOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCardParams(PamWizardCard wizardCard) {
|
||||
if (wizardCard == descriptionCard) {
|
||||
return descriptionCard.getParams(deployment.getDescription());
|
||||
}
|
||||
if (wizardCard == deploymentInfoCard) {
|
||||
return deploymentInfoCard.getParams(exportOptions, deployment);
|
||||
}
|
||||
if (wizardCard == deploymentDataCard) {
|
||||
return deploymentDataCard.getParams(exportOptions, deployment);
|
||||
}
|
||||
if (wizardCard == deploymentTrackCard) {
|
||||
return deploymentTrackCard.getParams(exportOptions);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelButtonPressed() {
|
||||
this.exportOptions = null;
|
||||
}
|
||||
|
||||
}
|
219
src/tethys/deployment/swing/ProjectInformationPanel.java
Normal file
219
src/tethys/deployment/swing/ProjectInformationPanel.java
Normal file
@ -0,0 +1,219 @@
|
||||
package tethys.deployment.swing;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamController.PamController;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import metadata.PamguardMetaData;
|
||||
import nilus.Deployment;
|
||||
import tethys.TethysControl;
|
||||
import tethys.swing.NewProjectDialog;
|
||||
import tethys.swing.SelectProjectDialog;
|
||||
|
||||
/**
|
||||
* Panel for entering project information
|
||||
* @author dg50
|
||||
*
|
||||
*/
|
||||
public class ProjectInformationPanel {
|
||||
|
||||
private JPanel projectPanel;
|
||||
|
||||
private JTextField project, site, cruise, region;
|
||||
|
||||
private JButton newProject, selectProject;
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
private Deployment deployment;
|
||||
|
||||
private Window owner;
|
||||
|
||||
public ProjectInformationPanel(Window owner, String title) {
|
||||
super();
|
||||
this.owner = owner;
|
||||
|
||||
tethysControl = (TethysControl) PamController.getInstance().findControlledUnit(TethysControl.unitType);
|
||||
|
||||
int txtWidth = 1;
|
||||
if (tethysControl != null) {
|
||||
txtWidth = 3;
|
||||
}
|
||||
projectPanel = new JPanel(new GridBagLayout());
|
||||
if (title != null) {
|
||||
projectPanel.setBorder(new TitledBorder(title));
|
||||
}
|
||||
GridBagConstraints c = new PamGridBagContraints();
|
||||
projectPanel.add(new JLabel("Project Name ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
projectPanel.add(project = new JTextField(30), c);
|
||||
if (tethysControl != null) {
|
||||
c.gridx++;
|
||||
projectPanel.add(selectProject = new JButton("Select"));
|
||||
c.gridx++;
|
||||
projectPanel.add(newProject = new JButton("New"));
|
||||
}
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
projectPanel.add(new JLabel("Region ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
c.gridwidth = txtWidth;
|
||||
projectPanel.add(region = new JTextField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
projectPanel.add(new JLabel("Cruise name ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
c.gridwidth = txtWidth;
|
||||
projectPanel.add(cruise = new JTextField(40), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
projectPanel.add(new JLabel("Site ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
c.gridwidth = txtWidth;
|
||||
projectPanel.add(site = new JTextField(20), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
|
||||
|
||||
if (newProject != null) {
|
||||
newProject.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selNewProject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (selectProject != null) {
|
||||
selectProject.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selProjectPressed(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mainPanel
|
||||
*/
|
||||
public JPanel getMainPanel() {
|
||||
return projectPanel;
|
||||
}
|
||||
|
||||
public void setParams(Deployment deployment) {
|
||||
this.deployment = deployment;
|
||||
cruise.setText(deployment.getCruise());
|
||||
region.setText(deployment.getRegion());
|
||||
site.setText(deployment.getSite());
|
||||
project.setText(deployment.getProject());
|
||||
}
|
||||
|
||||
public boolean getParams(Deployment deployment) {
|
||||
deployment.setCruise(cruise.getText());
|
||||
deployment.setRegion(region.getText());
|
||||
deployment.setSite(site.getText());
|
||||
deployment.setProject(project.getText());
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Select a new project, uses a dialog from Tethys. Only enabled
|
||||
* when the tethys database is present to allow this.
|
||||
* @param e
|
||||
*/
|
||||
protected void selNewProject(ActionEvent e) {
|
||||
if (tethysControl == null) {
|
||||
return;
|
||||
}
|
||||
getParams(deployment);
|
||||
Deployment newDeployment = NewProjectDialog.showDialog(owner, tethysControl, deployment);
|
||||
if (newDeployment != null) {
|
||||
deployment.setProject(newDeployment.getProject());
|
||||
deployment.setRegion(newDeployment.getRegion());
|
||||
}
|
||||
setParams(deployment);
|
||||
}
|
||||
|
||||
protected void selProjectPressed(ActionEvent e) {
|
||||
if (tethysControl == null) {
|
||||
return;
|
||||
}
|
||||
getParams(deployment);
|
||||
// will this be fast enough, or do we need to get Tethys to hold this list in memory ?
|
||||
ArrayList<String> projectNames = tethysControl.getDbxmlQueries().getProjectNames();
|
||||
if (projectNames.size() < 12) {
|
||||
showAsMenu(projectNames);
|
||||
}
|
||||
else {
|
||||
showAsDialog(projectNames);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showAsDialog(ArrayList<String> projectNames) {
|
||||
Point p = selectProject.getLocationOnScreen();
|
||||
String selName = SelectProjectDialog.showDialog(owner, projectNames, project.getText(), p);
|
||||
if (selName != null) {
|
||||
project.setText(selName);
|
||||
}
|
||||
}
|
||||
|
||||
private void showAsMenu(ArrayList<String> projectNames) {
|
||||
String currentName = project.getText();
|
||||
JPopupMenu popMenu = new JPopupMenu();
|
||||
JMenuItem menuItem;
|
||||
if (currentName != null && currentName.length()>0) {
|
||||
addProjMenuItem(popMenu, currentName);
|
||||
}
|
||||
for (String projName : projectNames) {
|
||||
if (projName.equals(currentName)) {
|
||||
continue;
|
||||
}
|
||||
addProjMenuItem(popMenu, projName);
|
||||
}
|
||||
|
||||
popMenu.show(selectProject, selectProject.getWidth()/2, selectProject.getHeight()/2);
|
||||
}
|
||||
|
||||
private void addProjMenuItem(JPopupMenu popMenu, String projectName) {
|
||||
JMenuItem menuItem = new JMenuItem(projectName);
|
||||
menuItem.addActionListener(new SelectProject(projectName));
|
||||
popMenu.add(menuItem);
|
||||
}
|
||||
|
||||
private class SelectProject implements ActionListener {
|
||||
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* @param projectName
|
||||
*/
|
||||
public SelectProject(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
project.setText(projectName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
85
src/tethys/deployment/swing/RecordingGapDialog.java
Normal file
85
src/tethys/deployment/swing/RecordingGapDialog.java
Normal file
@ -0,0 +1,85 @@
|
||||
package tethys.deployment.swing;
|
||||
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Window;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamView.dialog.PamDialog;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import tethys.deployment.DeploymentExportOpts;
|
||||
|
||||
public class RecordingGapDialog extends PamDialog {
|
||||
|
||||
private JTextField maxGap, minLength;
|
||||
|
||||
private DeploymentExportOpts exportOpts;
|
||||
|
||||
private RecordingGapDialog(Window parentFrame) {
|
||||
super(parentFrame, "Maximum Gap", true);
|
||||
JPanel mainPanel = new JPanel(new GridBagLayout());
|
||||
mainPanel.setBorder(new TitledBorder("Max recording gap"));
|
||||
PamGridBagContraints c = new PamGridBagContraints();
|
||||
mainPanel.add(new JLabel("Maximum gap ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
mainPanel.add(maxGap = new JTextField(3), c);
|
||||
c.gridx++;
|
||||
mainPanel.add(new JLabel(" seconds", JLabel.RIGHT), c);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
mainPanel.add(new JLabel("Minimum length ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
mainPanel.add(minLength = new JTextField(3), c);
|
||||
c.gridx++;
|
||||
mainPanel.add(new JLabel(" seconds", JLabel.RIGHT), c);
|
||||
|
||||
maxGap.setToolTipText("Maximum gap between recording periods. Periods with a gap less than this will be counted as one");
|
||||
minLength.setToolTipText("Minimum recording length. Recording sections shorter than this will be ignored");
|
||||
|
||||
setDialogComponent(mainPanel);
|
||||
}
|
||||
|
||||
public static DeploymentExportOpts showDiloag(Window parent, DeploymentExportOpts exportOpts) {
|
||||
RecordingGapDialog dialog = new RecordingGapDialog(parent);
|
||||
dialog.setParams(exportOpts);
|
||||
dialog.setVisible(true);
|
||||
return dialog.exportOpts;
|
||||
}
|
||||
|
||||
private void setParams(DeploymentExportOpts exportOpts) {
|
||||
this.exportOpts = exportOpts;
|
||||
maxGap.setText(String.format("%d", exportOpts.maxGapSeconds));
|
||||
minLength.setText(String.format("%d", exportOpts.minLengthSeconds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams() {
|
||||
try {
|
||||
exportOpts.maxGapSeconds = Integer.valueOf(maxGap.getText());
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return showWarning("Invalid inter recording interval");
|
||||
}
|
||||
try {
|
||||
exportOpts.minLengthSeconds = Integer.valueOf(minLength.getText());
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return showWarning("Invalid minimum recording length");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelButtonPressed() {
|
||||
exportOpts = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreDefaultSettings() {
|
||||
DeploymentExportOpts defaults = new DeploymentExportOpts();
|
||||
}
|
||||
|
||||
}
|
@ -185,8 +185,10 @@ public class NilusUnpacker {
|
||||
// find a setter for it.
|
||||
Method setter = findSetter(nilusClass, fieldName);
|
||||
// System.out.printf("Field %s with element %s and setter %s\n", fieldName, childName, setter);
|
||||
if (setter == null & verbose) {
|
||||
System.out.printf("No setter available for field %s and element %s\n", fieldName, elementName);
|
||||
if (setter == null) {
|
||||
if (verbose) {
|
||||
System.out.printf("No setter available for field %s and element %s\n", fieldName, elementName);
|
||||
}
|
||||
continue; // eventually do something more intelligent here.
|
||||
}
|
||||
Parameter[] params = setter.getParameters();
|
||||
|
@ -231,7 +231,6 @@ public class DeploymentExportPanel extends TethysGUIPanel implements DeploymentT
|
||||
|
||||
@Override
|
||||
public void selectionChanged() {
|
||||
selectedDeployments = pamDeploymentsTable.getSelectedDeployments();
|
||||
enableControls();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package tethys.swing;
|
||||
|
||||
|
||||
public interface DeploymentTableObserver {
|
||||
|
||||
public void selectionChanged();
|
||||
|
@ -1,33 +1,46 @@
|
||||
package tethys.swing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamView.panel.PamPanel;
|
||||
import tethys.TethysControl;
|
||||
import tethys.deployment.DeploymentHandler;
|
||||
import tethys.deployment.RecordingPeriod;
|
||||
|
||||
public class DeploymentsPanel extends TethysGUIPanel {
|
||||
public class DeploymentsPanel extends TethysGUIPanel implements DeploymentTableObserver {
|
||||
|
||||
private JPanel mainPanel;
|
||||
|
||||
private PAMGuardDeploymentsTable pamDeploymentsTable;
|
||||
|
||||
DeploymentExportPanel exportPanel;
|
||||
private DeploymentExportPanel exportPanel;
|
||||
|
||||
private JButton exportButton, optionsButton;
|
||||
// private TethysDeploymentsTable tethysDeploymentsTable;
|
||||
private JLabel exportWarning;
|
||||
|
||||
public DeploymentsPanel(TethysControl tethysControl) {
|
||||
super(tethysControl);
|
||||
DeploymentHandler deploymentHandler = tethysControl.getDeploymentHandler();
|
||||
pamDeploymentsTable = new PAMGuardDeploymentsTable(tethysControl);
|
||||
exportPanel = new DeploymentExportPanel(tethysControl, pamDeploymentsTable);
|
||||
pamDeploymentsTable.addObserver(exportPanel);
|
||||
// tethysDeploymentsTable = new TethysDeploymentsTable(tethysControl);
|
||||
mainPanel = new PamPanel(new BorderLayout());
|
||||
mainPanel.setBorder(new TitledBorder("Deployment information"));
|
||||
pamDeploymentsTable.addObserver(this);
|
||||
pamDeploymentsTable.addObserver(deploymentHandler);
|
||||
// JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
// splitPane.add(pamDeploymentsTable.getComponent());
|
||||
// splitPane.add(tethysDeploymentsTable.getComponent());
|
||||
@ -39,8 +52,39 @@ public class DeploymentsPanel extends TethysGUIPanel {
|
||||
// splitPane.setDividerLocation(0.6);
|
||||
// }
|
||||
// });
|
||||
JPanel ctrlPanel = new PamPanel(new BorderLayout());
|
||||
JPanel ctrlButtons = new JPanel();
|
||||
ctrlButtons.setLayout(new BoxLayout(ctrlButtons, BoxLayout.X_AXIS));
|
||||
optionsButton = new JButton("Options ...");
|
||||
exportButton = new JButton("Export ...");
|
||||
ctrlButtons.add(optionsButton);
|
||||
ctrlButtons.add(exportButton);
|
||||
ctrlPanel.add(BorderLayout.WEST, ctrlButtons);
|
||||
|
||||
optionsButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getTethysControl().getDeploymentHandler().showOptions(null);
|
||||
}
|
||||
});
|
||||
|
||||
exportButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
exportDeployments();
|
||||
}
|
||||
});
|
||||
exportWarning = new JLabel(" ");
|
||||
ctrlPanel.add(BorderLayout.CENTER, exportWarning);
|
||||
|
||||
mainPanel.add(BorderLayout.CENTER, pamDeploymentsTable.getComponent());
|
||||
mainPanel.add(BorderLayout.EAST, exportPanel.getComponent());
|
||||
mainPanel.add(BorderLayout.NORTH, ctrlPanel);
|
||||
// mainPanel.add(BorderLayout.EAST, exportPanel.getComponent());
|
||||
exportButton.setEnabled(false);
|
||||
}
|
||||
|
||||
protected void exportDeployments() {
|
||||
getTethysControl().getDeploymentHandler().exportDeployments();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,6 +92,30 @@ public class DeploymentsPanel extends TethysGUIPanel {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectionChanged() {
|
||||
enableExportButton();
|
||||
}
|
||||
|
||||
private void enableExportButton() {
|
||||
ArrayList<RecordingPeriod> selected = pamDeploymentsTable.getSelectedPeriods();
|
||||
// and see if any warnings are needed: basically if anything selected has an output.
|
||||
boolean existing = false;
|
||||
for (RecordingPeriod aPeriod: selected) {
|
||||
if (aPeriod.getMatchedTethysDeployment() != null) {
|
||||
existing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String warning = null;
|
||||
if (existing) {
|
||||
warning = " One or more deployment documents already exist. These must be deleted prior to exporting new documents";
|
||||
exportWarning.setText(warning);
|
||||
}
|
||||
|
||||
exportButton.setEnabled(selected.size()>0 & existing == false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class NewProjectDialog extends PamView.dialog.PamDialog {
|
||||
|
||||
private JTextField projectRegion;
|
||||
|
||||
private PamguardMetaData metaData;
|
||||
private Deployment deployment;
|
||||
|
||||
private NewProjectDialog(Window parentFrame, TethysControl tethysControl) {
|
||||
super(parentFrame, "New Project", false);
|
||||
@ -46,30 +46,29 @@ public class NewProjectDialog extends PamView.dialog.PamDialog {
|
||||
setDialogComponent(mainPanel);
|
||||
}
|
||||
|
||||
public static PamguardMetaData showDialog(Window parent, TethysControl tethysControl, PamguardMetaData metaData) {
|
||||
public static Deployment showDialog(Window parent, TethysControl tethysControl, Deployment deployment) {
|
||||
if (singleInstance == null) {
|
||||
singleInstance = new NewProjectDialog(parent, tethysControl);
|
||||
}
|
||||
singleInstance.setParams(metaData);
|
||||
singleInstance.setParams(deployment);
|
||||
singleInstance.setVisible(true);
|
||||
return singleInstance.metaData;
|
||||
return singleInstance.deployment;
|
||||
}
|
||||
|
||||
private void setParams(PamguardMetaData deploymentData) {
|
||||
private void setParams(Deployment deploymentData) {
|
||||
if (deploymentData == null) {
|
||||
return;
|
||||
}
|
||||
this.metaData = deploymentData;
|
||||
projectName.setText(deploymentData.getDeployment().getProject());
|
||||
projectRegion.setText(deploymentData.getDeployment().getRegion());
|
||||
this.deployment = deploymentData;
|
||||
projectName.setText(deploymentData.getProject());
|
||||
projectRegion.setText(deploymentData.getRegion());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams() {
|
||||
if (metaData == null) {
|
||||
if (deployment == null) {
|
||||
return false;
|
||||
}
|
||||
Deployment deployment = metaData.getDeployment();
|
||||
deployment.setProject(projectName.getText());
|
||||
deployment.setRegion(projectRegion.getText());
|
||||
if (deployment.getProject() == null || deployment.getProject().length() == 0) {
|
||||
@ -81,7 +80,7 @@ public class NewProjectDialog extends PamView.dialog.PamDialog {
|
||||
|
||||
@Override
|
||||
public void cancelButtonPressed() {
|
||||
metaData = null;
|
||||
deployment = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
|
||||
private DeploymentOverview deploymentOverview;
|
||||
|
||||
private boolean[] selection = new boolean[0];
|
||||
// private boolean[] selection = new boolean[0];
|
||||
|
||||
private ArrayList<DeploymentTableObserver> observers = new ArrayList<>();
|
||||
|
||||
@ -95,16 +95,15 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int aRow = table.getSelectedRow();
|
||||
int col = table.getSelectedColumn();
|
||||
if (aRow >= 0 && aRow < selection.length && col == TableModel.SELECTCOLUMN) {
|
||||
selection[aRow] = !selection[aRow];
|
||||
for (DeploymentTableObserver obs : observers) {
|
||||
obs.selectionChanged();
|
||||
}
|
||||
ArrayList<RecordingPeriod> periods = deploymentOverview.getRecordingPeriods();
|
||||
if (aRow >= 0 && aRow < periods.size() && col == TableModel.SELECTCOLUMN) {
|
||||
periods.get(aRow).toggleSelected();
|
||||
notifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void showPopup(MouseEvent e) {
|
||||
int aRow = table.getSelectedRow();
|
||||
int[] selRows = table.getSelectedRows();
|
||||
@ -132,9 +131,31 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
JPopupMenu popMenu = new JPopupMenu();
|
||||
|
||||
JMenuItem menuItem = new JMenuItem("Select all");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selectAll(true);
|
||||
}
|
||||
});
|
||||
popMenu.add(menuItem);
|
||||
menuItem = new JMenuItem("Select none");
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selectAll(false);
|
||||
}
|
||||
});
|
||||
popMenu.add(menuItem);
|
||||
|
||||
if (matchedDeployments.size() > 0) {
|
||||
popMenu.addSeparator();
|
||||
}
|
||||
|
||||
if (matchedDeployments.size() == 1) {
|
||||
JPopupMenu popMenu = new JPopupMenu();
|
||||
JMenuItem menuItem = new JMenuItem("Delete deployment document " + matchedDeployments.get(0));
|
||||
menuItem = new JMenuItem("Delete deployment document " + matchedDeployments.get(0));
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@ -160,19 +181,55 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
popMenu.add(menuItem);
|
||||
|
||||
|
||||
popMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
// if (newPeriods.size() == 0) {
|
||||
// return;
|
||||
// }
|
||||
// /*
|
||||
// * if we get here, we've one or more rows without a Tethys output, so can have
|
||||
// * a menu to create them.
|
||||
// */
|
||||
|
||||
else if (matchedDeployments.size() > 1){
|
||||
menuItem = new JMenuItem(String.format("Delete %d deployment documents", matchedDeployments.size()));
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
deleteMultipleDeployments(matchedDeployments);
|
||||
}
|
||||
});
|
||||
popMenu.add(menuItem);
|
||||
}
|
||||
|
||||
popMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void selectAll(boolean select) {
|
||||
ArrayList<RecordingPeriod> recordingPeriods = deploymentOverview.getRecordingPeriods();
|
||||
for (int i = 0; i < recordingPeriods.size(); i++) {
|
||||
recordingPeriods.get(i).setSelected(select);
|
||||
}
|
||||
|
||||
tableModel.fireTableDataChanged();
|
||||
|
||||
notifyObservers();
|
||||
|
||||
}
|
||||
|
||||
protected void deleteMultipleDeployments(ArrayList<PDeployment> matchedDeployments) {
|
||||
int ans = WarnOnce.showWarning(getTethysControl().getGuiFrame(), "Delete Deployment document",
|
||||
"Are you sure you want to delete multiple deployment documents ", WarnOnce.OK_CANCEL_OPTION);
|
||||
if (ans == WarnOnce.CANCEL_OPTION) {
|
||||
return;
|
||||
}
|
||||
for (PDeployment depl : matchedDeployments) {
|
||||
if (depl.deployment == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
boolean gone = getTethysControl().getDbxmlConnect().deleteDocument(depl.deployment);
|
||||
} catch (TethysException e) {
|
||||
getTethysControl().showException(e);
|
||||
}
|
||||
}
|
||||
getTethysControl().sendStateUpdate(new TethysState(StateType.UPDATESERVER, Collection.Deployments));
|
||||
}
|
||||
|
||||
protected void exportDeployment(PDeployment pDeployment) {
|
||||
getTethysControl().exportDocument(Collection.Deployments.collectionName(), pDeployment.deployment.getId());
|
||||
}
|
||||
@ -199,24 +256,6 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
getTethysControl().sendStateUpdate(new TethysState(StateType.UPDATESERVER, Collection.Deployments));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of selected recording periods.
|
||||
* @return list of selected periods.
|
||||
*/
|
||||
public ArrayList<RecordingPeriod> getSelectedDeployments() {
|
||||
if (deploymentOverview == null) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<RecordingPeriod> selDeps = new ArrayList<>();
|
||||
int n = Math.min(selection.length, deploymentOverview.getRecordingPeriods().size());
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (selection[i]) {
|
||||
selDeps.add(deploymentOverview.getRecordingPeriods().get(i));
|
||||
}
|
||||
}
|
||||
return selDeps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(TethysState tethysState) {
|
||||
switch(tethysState.stateType) {
|
||||
@ -242,21 +281,33 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of selected periods irrespective of whether they have an existing deployment document.
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<RecordingPeriod> getSelectedPeriods() {
|
||||
ArrayList<RecordingPeriod> allPeriods = deploymentOverview.getRecordingPeriods();
|
||||
ArrayList<RecordingPeriod> selPeriods = new ArrayList();
|
||||
int n = allPeriods.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (allPeriods.get(i).isSelected()) {
|
||||
selPeriods.add(allPeriods.get(i));
|
||||
}
|
||||
}
|
||||
return selPeriods;
|
||||
}
|
||||
private void notifyObservers() {
|
||||
for (DeploymentTableObserver obs : observers) {
|
||||
obs.selectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDeployments() {
|
||||
DeploymentHandler deploymentHandler = getTethysControl().getDeploymentHandler();
|
||||
deploymentOverview = deploymentHandler.getDeploymentOverview();
|
||||
if (deploymentOverview == null) {
|
||||
return;
|
||||
}
|
||||
int n = deploymentOverview.getRecordingPeriods().size();
|
||||
if (selection.length < n) {
|
||||
selection = Arrays.copyOf(selection, n);
|
||||
// for (int i = 0; i < setDefaultStores.length; i++) {
|
||||
// if (selectBoxes[i] == null) {
|
||||
// selectBoxes[i] = new JCheckBox();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
tableModel.fireTableDataChanged();
|
||||
// DeploymentData deplData = getTethysControl().getGlobalDeplopymentData();
|
||||
// ArrayList<Deployment> projectDeployments = getTethysControl().getDbxmlQueries().getProjectDeployments(deplData.getProject());
|
||||
@ -269,9 +320,9 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
|
||||
private class TableModel extends AbstractTableModel {
|
||||
|
||||
private String[] columnNames = {"Id", "Start", "Stop", "Gap", "Duration", "Cycle", "Tethys Deployment", "Select"};
|
||||
private String[] columnNames = {"Id", "Select", "Start", "Stop", "Gap", "Duration", "Cycle", "Tethys Deployment"};
|
||||
|
||||
private static final int SELECTCOLUMN = 7;
|
||||
private static final int SELECTCOLUMN = 1;
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
@ -306,10 +357,10 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
RecordingPeriod period = deploymentOverview.getRecordingPeriods().get(rowIndex);
|
||||
// DeploymentRecoveryPair deplInfo = deploymentInfo.get(rowIndex);
|
||||
if (columnIndex == 5) {
|
||||
if (columnIndex == 6) {
|
||||
return deploymentOverview.getDutyCycleInfo();
|
||||
}
|
||||
if (columnIndex == 3 && rowIndex > 0) {
|
||||
if (columnIndex == 4 && rowIndex > 0) {
|
||||
RecordingPeriod prevPeriod = deploymentOverview.getRecordingPeriods().get(rowIndex-1);
|
||||
long gap = period.getRecordStart() - prevPeriod.getRecordStop();
|
||||
return PamCalendar.formatDuration(gap);
|
||||
@ -321,22 +372,22 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return rowIndex;
|
||||
case 1:
|
||||
case 2:
|
||||
return PamCalendar.formatDBDateTime(period.getRecordStart());
|
||||
// return TethysTimeFuncs.formatGregorianTime(deplInfo.deploymentDetails.getAudioTimeStamp());
|
||||
case 2:
|
||||
case 3:
|
||||
return PamCalendar.formatDBDateTime(period.getRecordStop());
|
||||
// return TethysTimeFuncs.formatGregorianTime(deplInfo.recoveryDetails.getAudioTimeStamp());
|
||||
case 4:
|
||||
case 5:
|
||||
// long t1 = TethysTimeFuncs.millisFromGregorianXML(deplInfo.deploymentDetails.getAudioTimeStamp());
|
||||
// long t2 = TethysTimeFuncs.millisFromGregorianXML(deplInfo.recoveryDetails.getAudioTimeStamp());
|
||||
return PamCalendar.formatDuration(period.getRecordStop()-period.getRecordStart());
|
||||
case 6:
|
||||
case 7:
|
||||
PDeployment deployment = period.getMatchedTethysDeployment();
|
||||
return makeDeplString(period, deployment);
|
||||
case SELECTCOLUMN:
|
||||
// return selectBoxes[rowIndex];
|
||||
return selection[rowIndex];
|
||||
return period.isSelected();
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -357,7 +408,8 @@ public class PAMGuardDeploymentsTable extends TethysGUIPanel {
|
||||
long start = period.getRecordStart();
|
||||
long stop = period.getRecordStop();
|
||||
double percOverlap = (overlap*100.) / (stop-start);
|
||||
return String.format("%s : %3.1f%% overlap", deployment.toString(), percOverlap);
|
||||
// return String.format("%s : %3.1f%% overlap", deployment.toString(), percOverlap);
|
||||
return deployment.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
81
src/tethys/swing/SelectProjectDialog.java
Normal file
81
src/tethys/swing/SelectProjectDialog.java
Normal file
@ -0,0 +1,81 @@
|
||||
package tethys.swing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.Window;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamView.dialog.PamDialog;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import tethys.TethysControl;
|
||||
|
||||
public class SelectProjectDialog extends PamDialog {
|
||||
|
||||
private String project;
|
||||
|
||||
private JComboBox<String> comboBox;
|
||||
|
||||
private SelectProjectDialog(Window parentFrame, List<String> projects, String topOne) {
|
||||
super(parentFrame, "Projects", topOne != null & topOne.length() > 0);
|
||||
this.project = topOne;
|
||||
|
||||
comboBox = new JComboBox<String>();
|
||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
// GridBagConstraints c = new PamGridBagContraints();
|
||||
mainPanel.setBorder(new TitledBorder("Project names"));
|
||||
mainPanel.add(comboBox, BorderLayout.CENTER);
|
||||
|
||||
if (project != null) {
|
||||
comboBox.addItem(topOne);
|
||||
}
|
||||
for (String name : projects) {
|
||||
comboBox.addItem(name);
|
||||
}
|
||||
|
||||
setDialogComponent(mainPanel);
|
||||
}
|
||||
|
||||
public static String showDialog(Window parentFrame, TethysControl tethysControl, String topOne) {
|
||||
ArrayList<String> projects = tethysControl.getDbxmlQueries().getProjectNames();
|
||||
return showDialog(parentFrame, projects, topOne, null);
|
||||
}
|
||||
|
||||
public static String showDialog(Window parentFrame, List<String> projects, String topOne, Point point) {
|
||||
if (topOne != null & topOne.length() == 0) {
|
||||
topOne = null;
|
||||
}
|
||||
SelectProjectDialog dialog = new SelectProjectDialog(parentFrame, projects, topOne);
|
||||
if (point != null) {
|
||||
dialog.setLocation(point);
|
||||
}
|
||||
dialog.setVisible(true);
|
||||
|
||||
return dialog.project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams() {
|
||||
project = (String) comboBox.getSelectedItem();
|
||||
return (project != null & project.length()>0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelButtonPressed() {
|
||||
project = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreDefaultSettings() {
|
||||
if (project != null) {
|
||||
comboBox.setSelectedItem(project);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -187,8 +187,9 @@ public class TethysConnectionPanel extends TethysGUIPanel {
|
||||
*/
|
||||
protected void createNewProject() {
|
||||
PamguardMetaData pamDeploymentData = MetaDataContol.getMetaDataControl().getMetaData();
|
||||
pamDeploymentData = NewProjectDialog.showDialog(getTethysControl().getGuiFrame(), getTethysControl(), pamDeploymentData);
|
||||
if (pamDeploymentData != null) {
|
||||
Deployment newDep = NewProjectDialog.showDialog(getTethysControl().getGuiFrame(), getTethysControl(), pamDeploymentData.getDeployment());
|
||||
if (newDep != null) {
|
||||
// oldDep
|
||||
MetaDataContol.getMetaDataControl().setMetaData(pamDeploymentData);
|
||||
updateProjectList();
|
||||
}
|
||||
@ -265,7 +266,9 @@ public class TethysConnectionPanel extends TethysGUIPanel {
|
||||
fillServerControl();
|
||||
updateProjectList();
|
||||
}
|
||||
|
||||
if (tethysState.stateType == StateType.NEWPROJECTSELECTION) {
|
||||
updateProjectList();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProjectList() {
|
||||
|
@ -53,10 +53,12 @@ public class TethysMainPanel extends TethysGUIPanel {
|
||||
// splitPane.set
|
||||
mainPanel.add(BorderLayout.CENTER, splitPane);
|
||||
// mainPanel.add(BorderLayout.CENTER, datablockSynchPanel.getComponent());
|
||||
JPanel splitNorth = new JPanel(new BorderLayout());
|
||||
splitNorth.add(BorderLayout.WEST, calibrationPanel.getComponent());
|
||||
splitNorth.add(deploymentsPanel.getComponent());
|
||||
splitPane.add(splitNorth);
|
||||
// JPanel splitNorth = new JPanel(new BorderLayout());
|
||||
JSplitPane northSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
northSplit.add(calibrationPanel.getComponent());
|
||||
northSplit.add(deploymentsPanel.getComponent());
|
||||
|
||||
splitPane.add(northSplit);
|
||||
southwestSplit.add(datablockSynchPanel.getComponent());
|
||||
southwestSplit.add(southEastPanel);
|
||||
southEastPanel.add(datablockDetectionsPanel.getComponent(), BorderLayout.CENTER);
|
||||
@ -68,6 +70,7 @@ public class TethysMainPanel extends TethysGUIPanel {
|
||||
public void run() {
|
||||
splitPane.setDividerLocation(0.5);
|
||||
southwestSplit.setDividerLocation(0.5);
|
||||
northSplit.setDividerLocation(0.27);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ public class XMLStringView extends PamDialog {
|
||||
setDialogComponent(mainPanel);
|
||||
setResizable(true);
|
||||
textArea.setText(xmlString);
|
||||
textArea.setEditable(false);
|
||||
textArea.setCaretPosition(0);
|
||||
|
||||
getCancelButton().setVisible(false);
|
||||
}
|
||||
@ -35,7 +37,6 @@ public class XMLStringView extends PamDialog {
|
||||
|
||||
@Override
|
||||
public boolean getParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2,29 +2,40 @@ package tethys.swing.export;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import PamView.wizard.PamWizard;
|
||||
import PamView.wizard.PamWizardCard;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import nilus.DescriptionType;
|
||||
import tethys.TethysControl;
|
||||
import tethys.output.StreamExportParams;
|
||||
|
||||
public class DescriptionCard extends ExportWizardCard {
|
||||
public class DescriptionCard extends PamWizardCard<DescriptionType> {
|
||||
|
||||
private DescriptionTypePanel descriptionPanel;
|
||||
|
||||
public DescriptionCard(DetectionsExportWizard detectionsExportWizard, TethysControl tethysControl, PamDataBlock dataBlock) {
|
||||
super(tethysControl, detectionsExportWizard, "Description", dataBlock);
|
||||
public DescriptionCard(PamWizard detectionsExportWizard, TethysControl tethysControl) {
|
||||
super(detectionsExportWizard, "Description");
|
||||
this.setLayout(new BorderLayout());
|
||||
descriptionPanel = new DescriptionTypePanel("Description data", true, true, true);
|
||||
this.add(BorderLayout.CENTER, descriptionPanel.getMainPanel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams(DescriptionType description) {
|
||||
return descriptionPanel.getParams(description);
|
||||
}
|
||||
|
||||
public boolean getParams(StreamExportParams streamExportParams) {
|
||||
return descriptionPanel.getParams(streamExportParams.getDetectionDescription().getDescription());
|
||||
return descriptionPanel.getParams(streamExportParams.getNilusDetectionDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(DescriptionType description) {
|
||||
descriptionPanel.setParams(description);
|
||||
}
|
||||
|
||||
public void setParams(StreamExportParams streamExportParams) {
|
||||
descriptionPanel.setParams(streamExportParams.getDetectionDescription().getDescription());
|
||||
descriptionPanel.setParams(streamExportParams.getNilusDetectionDescription());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class DetectionsExportWizard extends PamWizard {
|
||||
|
||||
addCard(algorithmCard = new AlgorithmCard(this, tethysControl, dataBlock));
|
||||
addCard(granularityCard = new GranularityCard(this, tethysControl, dataBlock));
|
||||
addCard(descriptionCard = new DescriptionCard(this, tethysControl, dataBlock));
|
||||
addCard(descriptionCard = new DescriptionCard(this, tethysControl));
|
||||
addCard(exportWorkerCard = new ExportWorkerCard(this, tethysControl, dataBlock));
|
||||
|
||||
moveFirst();
|
||||
|
31
src/tethys/swing/export/ResponsiblePartyCard.java
Normal file
31
src/tethys/swing/export/ResponsiblePartyCard.java
Normal file
@ -0,0 +1,31 @@
|
||||
package tethys.swing.export;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import PamView.panel.PamNorthPanel;
|
||||
import PamView.wizard.PamWizard;
|
||||
import PamView.wizard.PamWizardCard;
|
||||
import nilus.ResponsibleParty;
|
||||
|
||||
public class ResponsiblePartyCard extends PamWizardCard<ResponsibleParty> {
|
||||
|
||||
private ResponsiblePartyPanel responsiblePartyPanel;
|
||||
|
||||
public ResponsiblePartyCard(PamWizard pamWizard, String title) {
|
||||
super(pamWizard, title);
|
||||
responsiblePartyPanel = new ResponsiblePartyPanel("Responsible Party");
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.CENTER, new PamNorthPanel(responsiblePartyPanel.getMainPanel()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParams(ResponsibleParty cardParams) {
|
||||
return responsiblePartyPanel.getParams(cardParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(ResponsibleParty cardParams) {
|
||||
responsiblePartyPanel.setParams(cardParams);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user