Merge pull request #55 from PAMGuard/main

MErge from main
This commit is contained in:
Douglas Gillespie 2024-01-17 14:37:30 +00:00 committed by GitHub
commit a3a74adb78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
516 changed files with 21994 additions and 1269 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PamGuard Main DG</name>
<name>PamGuard Main Tethys</name>
<comment></comment>
<projects>
</projects>

View File

@ -1,2 +1,4 @@
eclipse.preferences.version=1
encoding//src/rawDeepLearningClassifer/segmenter/SegmenterProcess.java=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -466,9 +466,9 @@ name="_Version_2.02.10_January"></a>Version 2.02.10 January 2024</h1>
<h2><span lang=EN-US>New Features</span></h2>
<p class=MsoNormal><b><span lang=EN-US>Importing modules</span></b><span
lang=EN-US> from other configurations: New options from file menu allowing import
of specific modules, or module settings from other configurations. E.g. if you
had three similar configurations and had set one of them up with a new
lang=EN-US> from other configurations: New options from file menu allowing
import of specific modules, or module settings from other configurations. E.g.
if you had three similar configurations and had set one of them up with a new
detector, or got the click classifier settings set up just right in one of
those configurations, you can import the additional modules or the click
detector settings easily into the other configurations. </span></p>
@ -478,8 +478,8 @@ files) file performance</span></b><span lang=EN-US> when scrolling through
audio data in Viewer mode. </span></p>
<p class=MsoNormal><b><span lang=EN-US>Viewer Launch</span></b><span
lang=EN-US> by right clicking on sqlite database and selecting open with / Pamguard
ViewerMode launcher menu option.</span></p>
lang=EN-US> by right clicking on sqlite database and selecting ‘open with / Pamguard
ViewerMode launcher’ menu option.</span></p>
<h2><span lang=EN-US>Bug Fixes</span></h2>
@ -496,9 +496,9 @@ correctly saving updated bearings to the database. Now fixed. </span></p>
<p class=MsoNormal><b><span lang=EN-US>ROCCA Classifier fixes</span></b></p>
<p class=MsoNormal><span lang=EN-US>Allow Rocca to run without classifiers:
Fixed bug that threw an error if no classifier files were &nbsp;specified in
Rocca Params dialog</span></p>
<p class=MsoNormal><span lang=EN-US>Allow Rocca to run without classifiers: Fixed
bug that threw an error if no classifier files were  specified in Rocca Params
dialog</span></p>
<p class=MsoNormal><span lang=EN-US>Fix memory issue with
RoccaContourDataBlocks not being released for garbage collection</span></p>
@ -527,7 +527,7 @@ clicks not being correctly reassigned to different events. </span></p>
<p class=MsoNormal><b><span lang=EN-US>Screen Position</span></b><span
lang=EN-US>: When using multiple monitors, if you move a configuration to a
computer with a different monitor layout, the GUI should work out if its
computer with a different monitor layout, the GUI should work out if it’s
opening on a screen area which no longer exists and move itself onto the
primary monitor. </span></p>
@ -549,8 +549,8 @@ were reading local time, even when set to use UTC. </span></p>
which mostly occurred when processing large datasets of many offline files, has
been fixed.</span></p>
<p class=MsoNormal><span lang=EN-US>Data Map: “Scroll To Data” pop-up menu,
which didnt always scroll to the correct place, is now fixed. </span></p>
<p class=MsoNormal><span lang=EN-US>Data Map: “Scroll To Data” pop-up menu,
which didn’t always scroll to the correct place, is now fixed. </span></p>
<p class=MsoNormal><span lang=EN-US>Bearing Localiser offline: If reprocessing
bearings, the localizer was not correctly loading required raw or FFT data to
@ -563,9 +563,9 @@ handlers to handle corrupt map files. </span></p>
<h2><span lang=EN-US>New Features</span></h2>
<p class=MsoNormal><span lang=EN-US>Restart Options: When you restart
processing of offline files, if output data already exist (binary data of
within database tables) you will be asked if you want to overwrite the data,
cancel, or try to continue from where to left off. </span></p>
processing of offline files, if output data already exist (binary data of within
database tables) you will be asked if you want to overwrite the data, cancel,
or try to continue from where to left off. </span></p>
<p class=MsoNormal><span lang=EN-US>Updated SoundTrap sud file interface so
that PAMGuard now extracts and stores the Click Detector settings from the sud
@ -573,7 +573,7 @@ files and stores them within the PAMGuard configuration. This does not affect
processing, but is important for record keeping. </span></p>
<p class=MsoNormal><span lang=EN-US>GPS options to use any valid RMC or GGA
string. Not all GPS receivers output their RMC data as GPRMC e.g. some may
string. Not all GPS receivers output their RMC data as GPRMC – e.g. some may
output as GNRMC. A new option allows the GPS module to use any string, whatever
the first two characters of the string name may be. </span></p>
@ -582,14 +582,14 @@ the first two characters of the string name may be. </span></p>
<h2><span lang=EN-US>Bug Fixes</span></h2>
<p class=MsoNormal><span lang=EN-US>Use of localization sensor and orientation
data for static hydrophones had a bug whereby it would continually forget
data for static hydrophones had a bug whereby it would continually ‘forget’
angle offsets applied to static hydrophones in viewer mode. This is now fixed. </span></p>
<p class=MsoNormal><span lang=EN-US>Click tool bar: Correctly shows event
selection options even if no species classification options are in place. </span></p>
<p class=MsoNormal><span lang=EN-US>Fixed Landmarks: Earlier versions were
losing these every time PAMGuard started or new data were loaded in viewer
‘losing’ these every time PAMGuard started or new data were loaded in viewer
mode. Now fixed. </span></p>
<p class=MsoNormal><span lang=EN-US>ROCCA: Fixed (another) memory leak which
@ -608,11 +608,11 @@ processing.</span></p>
<p class=MsoNormal><span lang=EN-US>New sound type for simulated sounds which
generates random chirps between around 200 and 800Hz, roughly the frequency
youd expect sound from higher frequency baleen whales, such as humpbacks, to
you’d expect sound from higher frequency baleen whales, such as humpbacks, to
vocalise at. &nbsp;&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US>Hiding tool tips. A menu item to
permanently turn off all tool tips, or tap the Esc key to turn them off for 6
permanently turn off all tool tips, or tap the ‘Esc’ key to turn them off for 6
seconds if they are getting in the way, particularly when trying to interact
with displays using the mouse. </span></p>
@ -633,7 +633,7 @@ whistle classification module.</span></p>
<h2><span lang=EN-US>New Features</span></h2>
<p class=MsoNormal><span lang=EN-US>SoundTrap SUD file reading. If youre using
<p class=MsoNormal><span lang=EN-US>SoundTrap SUD file reading. If you’re using
SoundTrap autonomous recorders from Ocean Instruments, you no longer need to
decompress the SoundTrap files prior to processing. This will save time and a
lot of disk space. Extraction of clicks from the inbuilt SoundTrap Click
@ -697,7 +697,7 @@ audio files. </span></p>
<h2><span lang=EN-US>Bug Fixes</span></h2>
<p class=MsoNormal><span lang=EN-US>Soundtrap DWV import. Will now generate
binary files even if DWV file doesnÂt exist (which is correct behavior in
binary files even if DWV file doesn’t exist (which is correct behavior in
quiet conditions when no clicks were detected). </span></p>
<p class=MsoNormal><span lang=EN-US>Spectrogram. Changes to stop occasional
@ -732,8 +732,8 @@ running in real time. Added template names based on file names. </p>
<p class=MsoNormal>#13 Merging files when offline processing file folders: Had
an error introduced in last release which caused it to fail to recognise gaps
between files, meaning that some output data (i.e. after a gap) would have an
incorrect time stamp. This did not affect data if the ‘merge contiguous
files’ option was not selected. </p>
incorrect time stamp. This did not affect data if the ‘merge contiguous
files’ option was not selected. </p>
<p class=MsoNormal>#14 Logger forms data were not plotting correctly. This was
due to the required data selection functions not being fully implemented. This
@ -759,9 +759,8 @@ the TF FX display to crash if no data were displayed.</span></p>
<p class=MsoNormal><span lang=EN-US>See major release notes for V 2.02.01
below. </span></p>
<p class=MsoNormal><span lang=EN-US>Bug 495: TD FX display throws
NullPointerException if user has removed all data units and then moves mouse
over display area.</span></p>
<p class=MsoNormal><span lang=EN-US>Bug 495: TD FX display throws NullPointerException
if user has removed all data units and then moves mouse over display area.</span></p>
<h1><a name="_Latest_Version_2.02.01"></a><span lang=EN-US>Version 2.02.01
October 2021</span></h1>
@ -805,7 +804,7 @@ downloads area <a href="http://www.pamguard.org/downloads.php?cat_id=3">here</a>
<p class=MsoNormal><b><span lang=EN-US>Detection Group Localiser</span></b><span
lang=EN-US> </span></p>
<p class=MsoNormal>This module has been renamed ÓDetection GrouperÔ, so
<p class=MsoNormal>This module has been renamed “Detection Grouper”, so
as to avoid confusion with the Group 3D localizer. This is because the
Detection Grouper is more for organizing data into groups to be localized than
it is for doing localization.</p>
@ -927,10 +926,10 @@ included in a future release. </p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>17. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
lang=EN-US> </span>An implementation of the Generalized Power Law Detector,
developed by Tyler Helble ([Helble et al., ÃÂA generalized power-law detection
algorithm for humpback whale vocalizationsÃÂ, The Journal of the Acoustical
Society of America, vol. 131, no. 4, pp. 2682ÃÂ2699, 2012) is now available.
For details, see the online help </p>
developed by Tyler Helble ([Helble et al., ‘A generalized power-law
detection algorithm for humpback whale vocalizations’, The Journal of the
Acoustical Society of America, vol. 131, no. 4, pp. 2682–2699, 2012) is now
available. For details, see the online help </p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>18. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
@ -1370,8 +1369,8 @@ Implemented a simple UDP output for PAMGuard alarms. </p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>7. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
Changes to Spectrogram Mark Observers, to allow individual channels to be
selected instead of the spectrogram panel as a whole. </p>
Changes to Spectrogram Mark Observers, to allow individual channels to be selected
instead of the spectrogram panel as a whole. </p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>8. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
@ -1406,9 +1405,9 @@ be compatible with this version, and vice-versa.</p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>2. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
Java 12 is better at handling Windows scaling issues on high-DPI displays.
Beyond that, users should not notice much of a difference between this version
and previous beta releases.</p>
Java 12 is better at handling Windows scaling issues on high-DPI displays. Beyond
that, users should not notice much of a difference between this version and
previous beta releases.</p>
<!-- ************************************************************************************************************************** --><!-- ************************************************************************************************************************** -->
@ -1473,8 +1472,8 @@ lang=EN-US> </span>Updates to the Ishmael detectors.</p>
<h1><a name="_Latest_Beta_Version_2.00.16"></a><span lang=EN-US>Beta Version
2.00.16 May 2019</span></h1>
<p class=MsoNormal><span lang=EN-US>PAMGuard Version 2 contains major updates.
You should read and understand the notes listed for <a
<p class=MsoNormal><span lang=EN-US>PAMGuard Version 2 contains major updates. You
should read and understand the notes listed for <a
href="#_Latest_Beta_Version_2.00.10">Beta Version 2.00.10</a> before proceeding
with installation and use of this version.</span></p>
@ -1773,10 +1772,10 @@ settings even when user tries to cancel or discard changes</p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>6. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Bug 387. Map was stopping displaying data based on the start time of
data units. Have changed this to last updated time so that click events will
display if they have been recently modified. Otherwise, long events get lost
from the display.</p>
</span>Bug 387. Map was stopping displaying data based on the start time of data
units. Have changed this to last updated time so that click events will display
if they have been recently modified. Otherwise, long events get lost from the
display.</p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>7. </span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@ -2112,9 +2111,9 @@ showing. </p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>2.</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US>Bug 323. Difar module.</span> Fixed a couple of small
bugs in the DIFAR system which caused it to not work if old configuratins were
used. </p>
</span><span lang=EN-US>Bug 323. Difar module.</span> Fixed a couple of small bugs
in the DIFAR system which caused it to not work if old configuratins were used.
</p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>3.</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@ -2202,7 +2201,7 @@ file format is the addition of a Unique Data Identifier (UID) to each unit of
data. This is intended to aid in offline analysis by making it easier for the
user to link what they are seeing on different PAMGuard displays and also to
link with any data post processed in Matlab or other custom analysis software.
UID’s are also added to PAMGuard database tables. </span></p>
UID’s are also added to PAMGuard database tables. </span></p>
<h4><span lang=EN-US>Converting Old Data</span></h4>
@ -2210,13 +2209,13 @@ UID’s are also added to PAMGuard database tables. </span></p>
viewer they will automatically be converted. For safety, the original binary
files will not be overwritten and the new data will be placed in a new folder
on your computer with the same path as the old data, but suffixed with
ÃÂ_WithUIDÃÂ, e.g. if your binary data were previously stored in the folder
‘_WithUID’, e.g. if your binary data were previously stored in the folder
C:\MySurvey\binarydata the new data will be written to
C:\MySurvey\binarydata_WithUID. </span></p>
<p class=MsoNormal><span lang=EN-US>The additional UID column will be added to
all database tables and populated with unique values. For data which are stored
in both the binary files and in database tables, the same UID’s will be used
in both the binary files and in database tables, the same UID’s will be used
in both data stores. </span></p>
<h3><span lang=EN-US>New Displays</span></h3>
@ -2263,10 +2262,10 @@ so they will no longer work with older PAMGuard versions.</span></p>
<p class=MsoListParagraph style='margin-left:54.0pt;text-indent:-36.0pt'><span
lang=EN-US>2.</span><span lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US>Display colour options will be lost and most data
displayed on the map may default to black. This is due to the above changes to
how colours are managed. Changing back to the colours of your choice is
relatively simple through the PAMGuard GUI. </span></p>
</span><span lang=EN-US>Display colour options will be lost and most data displayed
on the map may default to black. This is due to the above changes to how
colours are managed. Changing back to the colours of your choice is relatively
simple through the PAMGuard GUI. </span></p>
<p class=MsoListParagraph style='margin-left:54.0pt;text-indent:-36.0pt'><span
lang=EN-US>&nbsp;</span></p>
@ -2450,7 +2449,7 @@ November 2016</span></h1>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span lang=EN-US>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Bug 303. Some ASIO sound cards not working with either ASIO system in PAMGuard.
For the PAMGuard ASIO system, this was due to a data format used by some sound
cards never being properly implemented. For the ÓNew ASIO systemÔ which
cards never being properly implemented. For the “New ASIO system” which
is based on jAsioHost, the unpacking of that format contained a bug which
returned incorrect numbers, so data were swamped with noise. Both systems are
now fixed. By preference, users should use the PAMGuard ASIO system since the
@ -2698,11 +2697,11 @@ planned file format changes and that this is purely a future proofing exercise.<
<p class=MsoListParagraph style='margin-left:38.25pt;text-indent:-20.25pt'>7.<span
style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Bug 279. GUI Resizing: The whole PAMGuard GUI would suddenly resize to
something very small when a dialog is opened. This has been traced to improper
use of a common dialog component SourcePanel which tries to repack its parent
Window. Some programmers had inadvertently set it to repack the main PAMGuard
GUI instead. This has been Fixed.</p>
</span>Bug 279. GUI Resizing: The whole PAMGuard GUI would suddenly resize to something
very small when a dialog is opened. This has been traced to improper use of a
common dialog component SourcePanel which tries to repack its parent Window.
Some programmers had inadvertently set it to repack the main PAMGuard GUI
instead. This has been Fixed.</p>
<p class=MsoListParagraph style='margin-left:38.25pt;text-indent:-20.25pt'>8.<span
style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@ -3257,11 +3256,10 @@ sonobuoys. See online help for details.&nbsp; </p>
<p class=MsoNormal><i>MEAL Localiser</i> (Localisation Group)</p>
<p class=MsoNormal>This module, developed by Jamie Macaulay of St Andrews
University estimates the 3D localisation of clicks using a variety of
algorithms. It's primarily been developed to track harbour porpoise in three
dimensions over scales of 10's of metres. While currently only working with
output from the click detector, we hope eventually to extend its use to
whistles as well. </p>
University estimates the 3D localisation of clicks using a variety of algorithms.
It's primarily been developed to track harbour porpoise in three dimensions
over scales of 10's of metres. While currently only working with output from
the click detector, we hope eventually to extend its use to whistles as well. </p>
<p class=MsoNormal><i>Accelerometer Readout</i> (Sensors group)</p>
@ -3444,9 +3442,9 @@ whistle.</p>
<p class=MsoNormal><b>New Modules</b></p>
<p class=MsoNormal style='margin-left:36.0pt'>Clip Generator: Saves and
displays short waveform clips around detections. Can work with any detector (or
indeed any other data stream within PAMGuard). &nbsp;</p>
<p class=MsoNormal style='margin-left:36.0pt'>Clip Generator: Saves and displays
short waveform clips around detections. Can work with any detector (or indeed
any other data stream within PAMGuard). &nbsp;</p>
<p class=MsoNormal style='margin-left:36.0pt'>Local time display: displays the
computers local time on the main display panel. </p>
@ -3522,9 +3520,9 @@ information correctly in the binary files. </p>
<p class=MsoNormal style='margin-left:36.0pt'><i>Logger Forms</i></p>
<p class=MsoNormal style='margin-left:36.0pt'>A substantial amount of work has
been carried out on Logger forms, funded by the South West fisheries Science
Center. </p>
<p class=MsoNormal style='margin-left:36.0pt'>A substantial amount of work has been
carried out on Logger forms, funded by the South West fisheries Science Center.
</p>
<p class=MsoNormal style='margin-left:36.0pt'><i>Click Detector</i></p>
@ -3975,9 +3973,9 @@ more displays are set up for offline data viewing in future releases. </p>
<p class=MsoNormal>Viewer data map</p>
<p class=MsoNormal>When using the PAMGUARD viewer an additional panel will be
displayed showing an overview of data quantity (per hour) from the various
database tables connected to PAMGUARD. </p>
<p class=MsoNormal>When using the PAMGUARD viewer an additional panel will be displayed
showing an overview of data quantity (per hour) from the various database
tables connected to PAMGUARD. </p>
<p class=MsoNormal>Spectrogram Display overlays</p>
@ -4187,9 +4185,9 @@ display correctly and amplitude scale updates after scale parameter changes. </p
<p class=MsoNormal><b>Speed improvement</b>. </p>
<p class=MsoNormal>PAMGAURD FFT calculations now use the JTransforms FFT
library which gives a factor 2 speed improvement compared to previous FFT
methods used in PAMGUARD</p>
<p class=MsoNormal>PAMGAURD FFT calculations now use the JTransforms FFT library
which gives a factor 2 speed improvement compared to previous FFT methods used
in PAMGUARD</p>
<p class=MsoNormal><b>New Modules</b></p>
@ -4545,9 +4543,9 @@ localiser (affects stability of click train localiser and whistle localiser in <
<h2>1.2.0 Beta December 2008</h2>
<p class=MsoNormal>This release contains many bug fixes from the PAMGUARD
industry field trial which took place in the Gulf of Mexico on the RV New
Venture in November 2008.</p>
<p class=MsoNormal>This release contains many bug fixes from the PAMGUARD industry
field trial which took place in the Gulf of Mexico on the RV New Venture in
November 2008.</p>
<p class=MsoNormal><b>Bug Fixes</b></p>
@ -4652,8 +4650,8 @@ mouse is moved over the display. Choice of colour maps for display. </p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span style='font-family:
Symbol'>'</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Sound playback. Now supported in ASIO sound cards, so you can have sound
coming in through the ASIO card and back out through its headphone socket
(after passing through PAMGUARD filters and other modules) at the same time.</p>
coming in through the ASIO card and back out through its headphone socket (after
passing through PAMGUARD filters and other modules) at the same time.</p>
<p class=MsoListParagraph style='text-indent:-18.0pt'><span style='font-family:
Symbol'>'</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@ -4673,11 +4671,11 @@ Symbol'>'</span><span style='font-size:7.0pt;font-family:"Times New Roman",serif
<p class=MsoNormal><b>Multithreading</b></p>
<p class=MsoNormal>PAMGUARD now processes data in each module in a different
processing thread. This allows PAMGUARD to use both processor cores on dual or
multi core processor machines. However, multithreading may still cause
instability in some modules. An option is therefore accessible from the main
Detection menu to enable and disable multithreading. </p>
<p class=MsoNormal>PAMGUARD now processes data in each module in a different processing
thread. This allows PAMGUARD to use both processor cores on dual or multi core
processor machines. However, multithreading may still cause instability in some
modules. An option is therefore accessible from the main Detection menu to
enable and disable multithreading. </p>
<p class=MsoNormal><b>New Modules</b></p>

View File

@ -17,6 +17,7 @@
<resource>
<directory>src</directory>
<excludes>
<exclude>META-INF/*.SF,META-INF/*.DSA,META-INF/*.RSA</exclude>
<exclude>**/*.java</exclude>
<exclude>jars/*.*</exclude>
</excludes>
@ -196,6 +197,10 @@
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>16</javafx.version>
<jaxb.runtime.version>2.4.0-b180830.0438</jaxb.runtime.version>
<jaxb.xjc.version>2.4.0-b180830.0438</jaxb.xjc.version>
<jaxb.api.version>2.4.0-b180830.0359</jaxb.api.version>
</properties>
</project>

1427
pom.xml

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Thu Dec 21 11:13:37 GMT 2023
javaclient-3.0.jar>=
javaclient-3.0.pom>=

Binary file not shown.

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>tethys.org</groupId>
<artifactId>javaclient</artifactId>
<version>3.0</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>tethys.org</groupId>
<artifactId>javaclient</artifactId>
<versioning>
<release>3.0</release>
<versions>
<version>3.0</version>
</versions>
<lastUpdated>20231221111337</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,4 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Thu Dec 21 11:14:13 GMT 2023
nilus-3.0.pom>=
nilus-3.0.jar>=

View File

@ -0,0 +1,11 @@
#Thu Dec 21 16:45:12 GMT 2023
bedatadriven|https\://nexus.bedatadriven.com/content/groups/public/|javadoc=1703177112968
talan|https\://nexus.talanlabs.com/content/repositories/releases/|javadoc=1703177112968
repo|file\://C\:\\Users\\dg50\\source\\repos\\PAMGuardDG_2/repo|javadoc=1703177112968
central|https\://repo1.maven.org/maven2|sources=1703157324238
unidata-all|https\://artifacts.unidata.ucar.edu/repository/unidata-all/|javadoc=1703177112968
repo|file\://C\:\\Users\\dg50\\source\\repos\\PAMGuardDG_2/repo|sources=1703157324238
talan|https\://nexus.talanlabs.com/content/repositories/releases/|sources=1703157324238
bedatadriven|https\://nexus.bedatadriven.com/content/groups/public/|sources=1703157324238
unidata-all|https\://artifacts.unidata.ucar.edu/repository/unidata-all/|sources=1703157324238
central|https\://repo1.maven.org/maven2|javadoc=1703177112968

View File

@ -0,0 +1,12 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Thu Dec 21 16:45:12 GMT 2023
@default-talan-https\://nexus.talanlabs.com/content/repositories/releases/.lastUpdated=1703177112601
https\://repo1.maven.org/maven2/.error=
file\://C\:\\Users\\dg50\\source\\repos\\PAMGuardDG_2/repo/.error=
file\://C\:\\Users\\dg50\\source\\repos\\PAMGuardDG_2/repo/.lastUpdated=1703177110940
https\://artifacts.unidata.ucar.edu/repository/unidata-all/.error=
https\://nexus.bedatadriven.com/content/groups/public/.error=
https\://nexus.bedatadriven.com/content/groups/public/.lastUpdated=1703177112519
https\://artifacts.unidata.ucar.edu/repository/unidata-all/.lastUpdated=1703177112101
https\://repo1.maven.org/maven2/.lastUpdated=1703177112965
https\://nexus.talanlabs.com/content/repositories/releases/.error=Could not transfer artifact tethys.org\:nilus\:jar\:javadoc\:3.0 from/to talan (https\://nexus.talanlabs.com/content/repositories/releases/)\: nexus.talanlabs.com

View File

@ -0,0 +1,12 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Thu Dec 21 11:15:24 GMT 2023
@default-talan-https\://nexus.talanlabs.com/content/repositories/releases/.lastUpdated=1703157323819
https\://repo1.maven.org/maven2/.error=
file\://C\:\\Users\\dg50\\source\\repos\\PAMGuardDG_2/repo/.error=
file\://C\:\\Users\\dg50\\source\\repos\\PAMGuardDG_2/repo/.lastUpdated=1703157322932
https\://artifacts.unidata.ucar.edu/repository/unidata-all/.error=
https\://nexus.bedatadriven.com/content/groups/public/.error=
https\://nexus.bedatadriven.com/content/groups/public/.lastUpdated=1703157323770
https\://artifacts.unidata.ucar.edu/repository/unidata-all/.lastUpdated=1703157323508
https\://repo1.maven.org/maven2/.lastUpdated=1703157324237
https\://nexus.talanlabs.com/content/repositories/releases/.error=Could not transfer artifact tethys.org\:nilus\:jar\:sources\:3.0 from/to talan (https\://nexus.talanlabs.com/content/repositories/releases/)\: nexus.talanlabs.com

Binary file not shown.

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>tethys.org</groupId>
<artifactId>nilus</artifactId>
<version>3.0</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>tethys.org</groupId>
<artifactId>nilus</artifactId>
<versioning>
<release>3.0</release>
<versions>
<version>3.0</version>
</versions>
<lastUpdated>20231221111413</lastUpdated>
</versioning>
</metadata>

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
public class AISParameters implements Serializable, Cloneable, ManagedParameters {
@ -51,7 +52,7 @@ public class AISParameters implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("nmeaSource");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -5,6 +5,7 @@ import java.io.Serializable;
import NMEA.NMEABitArray;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.LatLong;
/**
@ -160,7 +161,7 @@ sensor.
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -6,6 +6,7 @@ import java.util.Calendar;
import NMEA.NMEABitArray;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamCalendar;
public class AISStaticData extends AISReport implements Serializable, ManagedParameters{
@ -393,7 +394,7 @@ public class AISStaticData extends AISReport implements Serializable, ManagedPar
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -10,6 +10,7 @@ import Array.Preamplifier;
import PamController.PamController;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamguardMVC.PamConstants;
@ -320,7 +321,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("channelList");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import binaryFileStorage.BinaryHeader;
import binaryFileStorage.BinaryObjectData;
@ -30,7 +31,7 @@ class DaqStatusModuleHeader extends ModuleHeader implements Serializable, Manage
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("daqName");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Used by FileInputSystem
@ -78,7 +79,7 @@ public class FileInputParameters implements Serializable, Cloneable, ManagedPara
return null;
}
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}
}

View File

@ -700,7 +700,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
if (currentFile > 0 && currentFile >= allFiles.size()) {
fileListComplete();
}
// System.out.println("FolderinputSytem: daqHasEnded");
System.out.println("FolderinputSytem: daqHasEnded");
}
private void setFolderProgress() {

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import simulatedAcquisition.SimProcess;
/**
@ -47,7 +48,7 @@ public class SoundCardParameters implements Serializable, Cloneable, ManagedPara
return null;
}
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}
}

View File

@ -6,6 +6,7 @@ import java.util.TimeZone;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import soundtrap.STXMLFile;
public class StandardFileDateSettings implements Serializable, Cloneable, ManagedParameters {
@ -150,7 +151,7 @@ public class StandardFileDateSettings implements Serializable, Cloneable, Manage
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}
}

View File

@ -6,6 +6,7 @@ import Acquisition.AcquisitionControl;
import Acquisition.AcquisitionDialog;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class PPSParameters implements Cloneable, Serializable, ManagedParameters {
@ -36,7 +37,7 @@ public class PPSParameters implements Cloneable, Serializable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -6,6 +6,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong;
@ -95,7 +96,7 @@ public class AirgunParameters implements Serializable, Cloneable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try {
Field field = this.getClass().getDeclaredField("dimE");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -44,6 +44,8 @@ public class ArrayDialog extends PamDialog implements ActionListener {
private EnvironmentPanel environmentPanel;
private HydrophoneDiagram hydrophoneDiagram;
private InstrumentIdentityPanel instrumentIdentityPanel;
private JButton okButton, cancelButton;
@ -69,11 +71,14 @@ public class ArrayDialog extends PamDialog implements ActionListener {
eastPanel.add(channelPanel.getChannelPanel());
environmentPanel = new EnvironmentPanel(this);
instrumentIdentityPanel = new InstrumentIdentityPanel();
// eastPanel.add(environmentPanel.getEnvironmentPanel());
hydrophoneDiagram = new HydrophoneDiagram(this);
JPanel westPanel = new JPanel(new BorderLayout());
westPanel.add(BorderLayout.CENTER, hydrophoneDiagram.getPlotPanel());
westPanel.add(BorderLayout.SOUTH, environmentPanel.getEnvironmentPanel());
westPanel.add(BorderLayout.NORTH, instrumentIdentityPanel.getComponent());
splitPanel.add(westPanel);
@ -144,6 +149,7 @@ public class ArrayDialog extends PamDialog implements ActionListener {
hydrophoneDialogPanel.setParams(selArray);
channelPanel.setParams();
hydrophoneDiagram.rePaint();
instrumentIdentityPanel.setParams(selArray);
if (selArray != null) {
environmentPanel.setNewSpeed(selArray.getSpeedOfSound());
}
@ -171,6 +177,7 @@ public class ArrayDialog extends PamDialog implements ActionListener {
array.setSpeedOfSound(environmentPanel.getNewSpeed());
array.setSpeedOfSoundError(environmentPanel.getNewError());
hydrophoneDialogPanel.getParams();
instrumentIdentityPanel.getParams(array);
if (checkDaqChannels(array) == false) {
return false;
@ -250,6 +257,7 @@ public class ArrayDialog extends PamDialog implements ActionListener {
environmentPanel.setNewSpeed(currentArray.getSpeedOfSound());
environmentPanel.setNewError(currentArray.getSpeedOfSoundError());
}
instrumentIdentityPanel.setParams(currentArray);
}
void newChannelSelection() {

View File

@ -28,6 +28,7 @@ import java.util.Arrays;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import pamMaths.PamVector;
import PamView.PamSymbol;
@ -158,7 +159,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
return sensitivity;
}
protected void setSensitivity(double sensitivity) {
public void setSensitivity(double sensitivity) {
this.sensitivity = sensitivity;
}
@ -333,7 +334,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
/**
* @return Returns the coordinate.
*/
protected double[] getCoordinates() {
public double[] getCoordinates() {
return Arrays.copyOf(coordinate,3);
}
@ -364,7 +365,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
/**
* @param preampGain The preampGain to set.
*/
protected void setPreampGain(double preampGain) {
public void setPreampGain(double preampGain) {
this.preampGain = preampGain;
}
@ -478,7 +479,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
@Override
public PamParameterSet getParameterSet() {
PamParameterSet pps = PamParameterSet.autoGenerate(this);
PamParameterSet pps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
Field f;
try {
f = this.getClass().getDeclaredField("coordinate");

View File

@ -7,6 +7,7 @@ import Array.streamerOrigin.StreamerDataIterator;
import GPS.GpsData;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong;
import PamguardMVC.PamDataBlock;
@ -225,7 +226,7 @@ abstract public class HydrophoneLocator implements Serializable, Cloneable, Mana
*/
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("pamArray");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -0,0 +1,72 @@
package Array;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import PamView.dialog.PamGridBagContraints;
import PamView.panel.WestAlignedPanel;
/**
* Instrument identity panel, contrians additional fields required by Tethys.
* @author dg50
*
*/
public class InstrumentIdentityPanel {
private JPanel mainPanel;
private JTextField instrumentId;
private JTextField instrumentType;
public InstrumentIdentityPanel() {
mainPanel = new WestAlignedPanel();
mainPanel.setBorder(new TitledBorder("Instrument information"));
mainPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints();
mainPanel.add(new JLabel("Instrument Type ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(instrumentType = new JTextField(20), c);
c.gridx = 0;
c.gridy++;
mainPanel.add(new JLabel("Instrument Id ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(instrumentId = new JTextField(20), c);
instrumentType.setToolTipText("Instrument type, e.g. Towed array, HARP, EAR, Popup, DMON, Rock Hopper, etc.");
instrumentId.setToolTipText("Instrument identifier, e.g. serial number");
}
public JComponent getComponent() {
return mainPanel;
}
public void setParams(PamArray currentArray) {
if (currentArray == null) {
currentArray = ArrayManager.getArrayManager().getCurrentArray();
}
if (currentArray == null) {
return;
}
instrumentType.setText(currentArray.getInstrumentType());
instrumentId.setText(currentArray.getInstrumentId());
}
public void getParams(PamArray currentArray) {
if (currentArray == null) {
currentArray = ArrayManager.getArrayManager().getCurrentArray();
}
if (currentArray == null) {
return;
}
currentArray.setInstrumentType(instrumentType.getText());
currentArray.setInstrumentId(instrumentId.getText());
}
}

View File

@ -16,5 +16,10 @@ abstract public class MovingHydrophoneLocator extends SimpleHydrophoneLocator {
super(pamArray, streamer);
}
@Override
public boolean isChangeable() {
return true;
}
}

View File

@ -35,6 +35,7 @@ import Array.streamerOrigin.StreamerDataIterator;
import GPS.GpsData;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong;
import PamUtils.PamArrayUtils;
@ -90,6 +91,33 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters {
private String arrayName;
private String arrayFile;
/**
* Type, used for Tethys and other meta data control
*/
private String instrumentType;
/**
* Array Id. Can be anything. Compulsory for Tethys.
*/
private String instrumentId;
public String getInstrumentType() {
return instrumentType;
}
public void setInstrumentType(String instrumentType) {
this.instrumentType = instrumentType;
}
public String getInstrumentId() {
return instrumentId;
}
public void setInstrumentId(String instrumentId) {
this.instrumentId = instrumentId;
}
// private int originInterpolation = ORIGIN_USE_LATEST;
private int originInterpolation = ORIGIN_USE_PRECEEDING;
@ -1574,7 +1602,7 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters {
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("streamers");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -25,6 +25,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
*
@ -79,7 +80,7 @@ public class Preamplifier implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -17,6 +17,7 @@ import PamController.PamController;
import PamController.masterReference.MasterReferencePoint;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong;
import PamUtils.PamCalendar;
@ -767,7 +768,7 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters {
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("coordinate");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -259,6 +259,7 @@ public class StreamerDialog extends PamDialog {
// }
singleInstance.currentArray = currentArray;
singleInstance.defaultStreamer = streamer;//.clone();
// singleInstance.st
singleInstance.setParams();
singleInstance.setVisible(true);
return singleInstance.defaultStreamer;
@ -549,6 +550,17 @@ public class StreamerDialog extends PamDialog {
pack();
}
}
try {
OriginSettings os = defaultStreamer.getOriginSettings(currentOriginMethod.getClass());
if (os != null) {
currentOriginMethod.setOriginSettings(os);
}
}
catch (Exception e) {
// will throw if it tries to set the wrong type of settings.
}
enableControls();
}

View File

@ -3,6 +3,7 @@ package Array.streamerOrigin;
import PamController.SettingsObject;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Class to hold settings for the different origin methods.
@ -47,7 +48,7 @@ public abstract class OriginSettings implements SettingsObject, Cloneable, Manag
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import mcc.MccJniInterface;
import mcc.mccjna.MCCConstants;
@ -67,7 +68,7 @@ public class ArrayAccelParams implements Serializable, Cloneable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamView.GroupedSourceParameters;
import PamguardMVC.PamConstants;
@ -44,7 +45,7 @@ public class AzigramParameters implements Serializable, ManagedParameters, Clone
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("name");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -7,6 +7,7 @@ import org.w3c.dom.Element;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* FilterPArameters for use when the filter is on it's own (within a FilterController)
@ -39,7 +40,7 @@ public class FilterParameters_2 implements Serializable, Cloneable, ManagedParam
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -30,6 +30,7 @@ import org.w3c.dom.Element;
import PamController.PamControlledUnit;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.FrequencyFormat;
/**
@ -358,7 +359,7 @@ public class FilterParams implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
public class GPSParameters implements Serializable, Cloneable, ManagedParameters {
@ -175,7 +176,7 @@ public class GPSParameters implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("nmeaSource");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -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;
}
}

View File

@ -295,7 +295,8 @@ public class GpsLogger extends SQLLogging {
* time from the UTC column which is NOT the GpsData time which was the real GPS time.
*/
int gpsIntTimeVal = gpsTime.getIntegerValue();
Object ts = getTableDefinition().getTimeStampItem().getValue();
PamTableDefinition pamTableDef = (PamTableDefinition) getTableDefinition();
Object ts = pamTableDef.getTimeStampItem().getValue();
long gpsDate = sqlTypes.millisFromTimeStamp(ts);
if (gpsDate%1000 == 0) {
// some databases may have stored the milliseconds, in which

View File

@ -17,6 +17,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamView.GroupedSourceParameters;
public class IshDetParams implements Serializable, Cloneable, ManagedParameters {
@ -96,7 +97,7 @@ public class IshDetParams implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("inputDataSource");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Ishamel display parameters for the Spectrogram plug in.
@ -42,7 +43,7 @@ public class IshDisplayParams implements Serializable, Cloneable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -8,14 +8,13 @@ import java.sql.Types;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import generalDatabase.EmptyTableDefinition;
//import pamDatabase.SQLLogging;
//import PamguardMVC.RecyclingDataBlock;
import generalDatabase.PamDetectionLogging;
public class IshLogger extends PamDetectionLogging {
IshDetControl ishDetControl;
PamTableDefinition tableDefinition;
PamTableItem systemDate, durationSecs, secSinceStart, peakHeight;
// Peak is more important than start time for matched filter & spectrogram correlation
PamTableItem peakSample, peakDelaySecs;
@ -25,7 +24,7 @@ public class IshLogger extends PamDetectionLogging {
super(pamDataBlock, UPDATE_POLICY_WRITENEW);
this.ishDetControl = ishDetControl;
tableDefinition = getTableDefinition();
EmptyTableDefinition tableDefinition = getTableDefinition();
// PamTableItem tableItem;
// setUpdatePolicy(UPDATE_POLICY_WRITENEW);

View File

@ -14,14 +14,13 @@ import IshmaelDetector.IshDetection;
import PamUtils.LatLong;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import generalDatabase.EmptyTableDefinition;
//import pamDatabase.SQLLogging;
//import PamguardMVC.RecyclingDataBlock;
import generalDatabase.PamDetectionLogging;
public class IshLocSqlLogging extends PamDetectionLogging {
IshLocControl ishLocControl;
PamTableDefinition tableDefinition;
PamTableItem systemDate, durationSecs, secSinceStart, peakHeight;
private PamTableItem latitude, longitude, refLatitude, refLongitude, x, y, z;
@ -30,7 +29,7 @@ public class IshLocSqlLogging extends PamDetectionLogging {
super(pamDataBlock, UPDATE_POLICY_WRITENEW);
this.ishLocControl = ishDetControl;
tableDefinition = getTableDefinition();
EmptyTableDefinition tableDefinition = getTableDefinition();
tableDefinition.addTableItem(latitude = new PamTableItem("Latitude", Types.DOUBLE));
tableDefinition.addTableItem(longitude = new PamTableItem("Longitude", Types.DOUBLE));
tableDefinition.addTableItem(refLatitude = new PamTableItem("ReferenceLatitude", Types.DOUBLE));

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class KernelSmoothingParameters implements Serializable, Cloneable, ManagedParameters {
@ -25,7 +26,7 @@ public class KernelSmoothingParameters implements Serializable, Cloneable, Manag
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import fftFilter.FFTFilterParams;
/**
@ -157,7 +158,7 @@ public class DelayMeasurementParams implements Serializable, Cloneable, ManagedP
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class MCMCParams2 implements Serializable, Cloneable, ManagedParameters {
@ -126,7 +127,7 @@ public class MCMCParams2 implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class MCMCParams implements Serializable, Cloneable, ManagedParameters {
@ -64,7 +65,7 @@ public class MCMCParams implements Serializable, Cloneable, ManagedParameters {
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
@ -69,7 +70,7 @@ public class HyperbolicParams implements Serializable, Cloneable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import Spectrogram.WindowFunction;
/**
@ -104,7 +105,7 @@ public class RawOrFFTParams implements Serializable, Cloneable, RawOrFFTParamsIn
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -85,7 +85,15 @@ public class GebcoMapFile implements MapFileManager {
* @see Map.MapFile#readFileData(java.io.File)
*/
public boolean readFileData(File file) {
return readMapFile(file, true);
try {
return readMapFile(file, true);
}
catch (Exception e) {
// trap error someone reported at end November 22. Suspect it was their corrupt map file causing problems.
String err = String.format("Map file %s is missing or corrupt and cannot be loaded", file.getName());
WarnOnce.showWarning("Map File Error", err, WarnOnce.OK_OPTION);
return false;
}
}
private boolean readMapFile(File gebcoFile, boolean readContours) {

View File

@ -7,6 +7,7 @@ import java.util.ListIterator;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* PArameters for MapDetectionsManager which
@ -65,7 +66,7 @@ public class MapDetectionsParameters implements Serializable, Cloneable, Managed
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -27,6 +27,7 @@ import java.lang.reflect.Field;
import Array.Hydrophone;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
public class MapParameters implements Serializable, Cloneable, ManagedParameters {
@ -301,7 +302,7 @@ public class MapParameters implements Serializable, Cloneable, ManagedParameters
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -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();
}
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class GridbaseParameters implements Cloneable, Serializable, ManagedParameters {
@ -25,7 +26,7 @@ public class GridbaseParameters implements Cloneable, Serializable, ManagedParam
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -24,6 +24,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import serialComms.jserialcomm.PJSerialComm;
public class NMEAParameters implements Serializable, Cloneable, ManagedParameters {
@ -149,7 +150,7 @@ public class NMEAParameters implements Serializable, Cloneable, ManagedParameter
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -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

View File

@ -23,6 +23,7 @@ package PamController;
import java.awt.Component;
import java.awt.Frame;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JMenu;
@ -39,7 +40,9 @@ import org.w3c.dom.Element;
import PamController.status.ModuleStatus;
import PamController.status.ModuleStatusManager;
import PamController.status.ProcessCheck;
import PamModel.PamModel;
import PamModel.PamModuleInfo;
import PamModel.PamPluginInterface;
import PamView.ClipboardCopier;
import PamView.PamGui;
import PamView.PamSidePanel;
@ -880,6 +883,23 @@ public abstract class PamControlledUnit implements SettingsNameProvider {
public int getInstanceIndex() {
return instanceIndex;
}
/**
* Get detail if this is a plugin.
* @return plugin detail, or null if it's not a plugin.
*/
public PamPluginInterface getPlugin() {
List<PamPluginInterface> pluginList = ((PamModel) PamController.getInstance().getModelInterface()).getPluginList();
if (pluginList == null) {
return null;
}
for (PamPluginInterface plugin : pluginList) {
if (plugin.getClassName().equals(this.getClass().getName())) {
return plugin;
}
}
return null;
}
/**
* The PamConfiguration holds the master list of modules which form part of a

View File

@ -36,6 +36,7 @@ import org.apache.commons.io.input.ClassLoaderObjectInputStream;
import PamModel.PamModel;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamView.dialog.warn.WarnOnce;
@ -398,7 +399,7 @@ public class PamControlledUnitSettings implements Serializable, ManagedParameter
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -57,6 +57,7 @@ import fftManager.FFTDataUnit;
import generalDatabase.DBControlUnit;
import javafx.application.Platform;
import javafx.stage.Stage;
import metadata.MetaDataContol;
import Array.ArrayManager;
import PamController.command.MulticastController;
import PamController.command.NetworkController;
@ -452,6 +453,7 @@ public class PamController implements PamControllerInterface, PamSettings {
System.out.println("");
System.out.println("Note - ignore the following SLF4J warn/error messages, they are not applicable to this application");
ArrayManager.getArrayManager(); // create the array manager so that it get's it's settings
MetaDataContol.getMetaDataControl();
/**
* Check for archived files and unpack automatically.
@ -1161,6 +1163,8 @@ public class PamController implements PamControllerInterface, PamSettings {
}
if (saveSettings) {
startTime = PamCalendar.getSessionStartTime();
// System.out.printf("Saving settings for start time %s\n", PamCalendar.formatDBDateTime(startTime));
saveSettings(PamCalendar.getSessionStartTime());
}
@ -1319,6 +1323,9 @@ public class PamController implements PamControllerInterface, PamSettings {
}
guiFrameManager.pamEnded();
long stopTime = PamCalendar.getTimeInMillis();
saveEndSettings(stopTime);
// no good having this here since it get's called at the end of every file.
// if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) {
//// can exit here, since we've auto started, can auto exit.
@ -1437,6 +1444,26 @@ public class PamController implements PamControllerInterface, PamSettings {
pamConfiguration.saveSettings(timeNow);
}
/**
* Gets called in pamStart and may / will attempt to store all
* PAMGUARD settings via the database and binary storage modules.
*/
private void saveEndSettings(long timeNow) {
// System.out.printf("Updating settings with end time %s\n", PamCalendar.formatDBDateTime(timeNow));
ArrayList<PamControlledUnit> pamControlledUnits = pamConfiguration.getPamControlledUnits();
PamControlledUnit pcu;
PamSettingsSource settingsSource;
for (int iU = 0; iU < pamControlledUnits.size(); iU++) {
pcu = pamControlledUnits.get(iU);
if (PamSettingsSource.class.isAssignableFrom(pcu.getClass())) {
settingsSource = (PamSettingsSource) pcu;
settingsSource.saveEndSettings(timeNow);
}
}
}
/**
* Export configuration into an XML file
* @param parentFrame

View File

@ -0,0 +1,20 @@
package PamController;
/**
* Interface to define modules which can be considered as sensors of some sort.
* e.g. depth and orientation modules and the SoundTrap clickdetecotr
* @author dg50
*
*/
public interface PamSensor {
public String getUnitName();
public String getUnitType();
public String getSensorDescription();
public String getSensorId();
}

View File

@ -20,6 +20,14 @@ public interface PamSettingsSource {
*/
public boolean saveStartSettings(long timeNow);
/**
* Save settings when processing ends.
* This may just be an update of the settings saves with saveStartSettings, e.g. an end time.
* @param timeNow
* @return true if saved correctly.
*/
public boolean saveEndSettings(long timeNow);
/**
* Get the number of different settings
* within the settings source.

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Very simple class used in an ArrayList of used modules that
@ -54,7 +55,7 @@ public class UsedModuleInfo implements Serializable, ManagedParameters {
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -29,6 +29,7 @@ import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import com.sun.javafx.runtime.VersionInfo;
@ -42,12 +43,14 @@ import PamController.PamguardVersionInfo;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterData;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamCalendar;
import PamUtils.XMLUtils;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamProcess;
import binaryFileStorage.BinaryStore;
import tethys.TethysControl;
/**
* Class for writing XML configuration output to a file.
@ -62,6 +65,8 @@ public class PamguardXMLWriter implements PamSettings {
private static final Set<Class<?>> WRAPPER_TYPES = getWrapperTypes();
private XMLWriterSettings writerSettings = new XMLWriterSettings();
private boolean excludeDisplaySettings;
// private String xmlNameSpace;
private static PamguardXMLWriter singleInstance;
@ -83,6 +88,19 @@ public class PamguardXMLWriter implements PamSettings {
}
return singleInstance;
}
/**
* Recursively walk the tree and add a namespace to every
* single element.
* @param doc
* @param nameSpace
* @return
*/
public boolean addNameSpaceToElements(Document doc, Element el, String nameSpace) {
// el.setAttributeNS(nameSpace, nameSpace, nameSpace);
NamedNodeMap attributes = el.getAttributes();
return true;
}
/**
* Make a document with the options specified in writerSettings.
@ -371,6 +389,32 @@ public class PamguardXMLWriter implements PamSettings {
* @return xml content as a a string.
*/
public String getAsString(Document doc) {
return getAsString(doc, true);
// try {
// DOMSource domSource = new DOMSource(doc);
// StringWriter writer = new StringWriter();
// StreamResult result = new StreamResult(writer);
// TransformerFactory tf = TransformerFactory.newInstance();
// Transformer transformer = tf.newTransformer();
// transformer.setOutputProperty(OutputKeys.METHOD, "xml");
// transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
//// transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
// transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
// transformer.transform(domSource, result);
// return writer.toString();
// } catch (TransformerException e) {
// e.printStackTrace();
// return null;
// }
}
/**
* Get the xml document as a String.
* @param doc xml document
* @param indent Indent / format the document.
* @return xml content as a a string.
*/
public String getAsString(Document doc, boolean indent) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
@ -380,7 +424,7 @@ public class PamguardXMLWriter implements PamSettings {
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
// transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, indent ? "yes" : "no");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.transform(domSource, result);
return writer.toString();
@ -411,8 +455,7 @@ public class PamguardXMLWriter implements PamSettings {
* @param pamSettingsUnit
* @return xml element
*/
private Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit) {
public Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit) {
int[] settingInds = findSettings(null, pamSettingsUnit.getUnitName());
PamSettings[] settingsObjects = null;
if (settingInds != null) {
@ -436,7 +479,7 @@ public class PamguardXMLWriter implements PamSettings {
* can be temporary settings objects when writing temporary settings from dialogs.
* @return new XML element.
*/
private Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit, PamSettings[] toWrite) {
public Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit, PamSettings[] toWrite) {
Element moduleData = doc.createElement("MODULE");
moduleData.setAttribute("Java.class", pamSettingsUnit.getClass().getName());
moduleData.setAttribute("UnitType", pamSettingsUnit.getUnitType());
@ -457,6 +500,9 @@ public class PamguardXMLWriter implements PamSettings {
Element settingEl = doc.createElement("CONFIGURATION");
moduleData.appendChild(settingEl);
for (int i = 0; i < toWrite.length; i++) {
if (wantObject(toWrite[i]) == false) {
continue;
}
Element setEl = writeSettings(doc, toWrite[i], new ArrayList<Object>());
if (setEl != null) {
settingEl.appendChild(setEl);
@ -467,6 +513,32 @@ public class PamguardXMLWriter implements PamSettings {
return moduleData;
}
/**
* USed by the Tethys writer to avoid writing display settings.
* @param pamSettings
* @return
*/
private boolean wantObject(PamSettings pamSettings) {
if (excludeDisplaySettings == false) {
return true;
}
Object obj = pamSettings.getSettingsReference();
if (obj == null) {
return false;
}
if (obj instanceof ManagedParameters) {
ManagedParameters managedParams = (ManagedParameters) obj;
PamParameterSet paramSet = managedParams.getParameterSet();
if (paramSet == null) {
return false;
}
if (paramSet.getParameterSetType() == ParameterSetType.DISPLAY && excludeDisplaySettings) {
return false;
}
}
return true;
}
/**
* Write settings for a settings object, using the standard retreived object
* from the settings.
@ -478,6 +550,14 @@ public class PamguardXMLWriter implements PamSettings {
private Element writeSettings(Document doc, PamSettings pamSettings, ArrayList<Object> objectHierarchy) {
return writeSettings(doc, pamSettings, pamSettings.getSettingsReference(), objectHierarchy);
}
public Document writeOneObject(Object data) {
Document doc = XMLUtils.createBlankDoc();
Element el = doc.createElement("Settings");
Element newel = writeObjectData(doc, el, data, new ArrayList<Object>());
doc.appendChild(newel);
return doc;
}
/**
* Write settings using an object of choice instead of the standard one from PamSettings.
@ -489,6 +569,7 @@ public class PamguardXMLWriter implements PamSettings {
* @return
*/
private Element writeSettings(Document doc, PamSettings pamSettings, Object data, ArrayList<Object> objectHierarchy) {
Element el = doc.createElement("SETTINGS");
el.setAttribute("Type", pamSettings.getUnitType());
el.setAttribute("Name", pamSettings.getUnitName());
@ -500,10 +581,13 @@ public class PamguardXMLWriter implements PamSettings {
return el;
}
private Element writeObjectData(Document doc, Element el, Object data, ArrayList<Object> objectHierarchy) {
public Element writeObjectData(Document doc, Element el, Object data, ArrayList<Object> objectHierarchy) {
if (data == null) {
return null;
}
if (objectHierarchy == null) {
objectHierarchy = new ArrayList<>();
}
if (objectHierarchy.contains(data)) {
// just write the reference, but nothing else or we'll end up in an infinite loop of objects.
Element e = doc.createElement("Object");
@ -525,8 +609,10 @@ public class PamguardXMLWriter implements PamSettings {
if (parameterSet == null) {
return null;
}
objectHierarchy.add(data);
if (objectHierarchy != null) {
objectHierarchy.add(data);
}
for (PamParameterData pamParam:parameterSet.getParameterCollection()) {
try {
Object paramData = pamParam.getData();
@ -765,9 +851,10 @@ public class PamguardXMLWriter implements PamSettings {
processData.setAttribute("Name", process.getProcessName());
PamDataBlock source = process.getParentDataBlock();
if (source != null) {
Element inputEl = doc.createElement("Input");
inputEl.setAttribute("Name", source.getLongDataName());
inputEl.setAttribute("Channels", String.format("0x%X", source.getChannelMap()));
Element inputEl = source.getDataBlockXML(doc);
// Element inputEl = doc.createElement("Input");
// inputEl.setAttribute("Name", source.getLongDataName());
// inputEl.setAttribute("Channels", String.format("0x%X", source.getChannelMap()));
processData.appendChild(inputEl);
}
int nOut = process.getNumOutputDataBlocks();
@ -798,7 +885,16 @@ public class PamguardXMLWriter implements PamSettings {
*/
private int[] findSettings(String type, String name) {
if (settingsSets == null) {
return null;
makeSettingsList();
if (settingsSets == null) {
return null;
}
}
if (usedSettingsSets == null) {
usedSettingsSets = new boolean[settingsSets.size()];
}
else if (usedSettingsSets.length < settingsSets.size()) {
usedSettingsSets = Arrays.copyOf(usedSettingsSets, settingsSets.size());
}
int[] found = new int[settingsSets.size()];
int nFound = 0;
@ -818,7 +914,7 @@ public class PamguardXMLWriter implements PamSettings {
return Arrays.copyOf(found, nFound);
}
private ArrayList<PamSettings> makeSettingsList() {
public ArrayList<PamSettings> makeSettingsList() {
PamSettingManager settingsManager = PamSettingManager.getInstance();
settingsSets = settingsManager.getOwners();
if (settingsSets == null) {
@ -850,6 +946,14 @@ public class PamguardXMLWriter implements PamSettings {
return doc;
}
/**
* Is this element a writable type ? Basically, this means
* that it's a primitive of some sort. Otherwise it's
* probably an object and may even be a list in which case
* it will need treating differently.
* @param clazz
* @return
*/
public static boolean isWritableType(Class<?> clazz)
{
if (clazz.isEnum()) return true;
@ -940,5 +1044,23 @@ public class PamguardXMLWriter implements PamSettings {
return true;
}
/**
* @return the excludeDisplaySettings
*/
public boolean isExcludeDisplaySettings() {
return excludeDisplaySettings;
}
/**
* @param excludeDisplaySettings the excludeDisplaySettings to set
*/
public void setExcludeDisplaySettings(boolean excludeDisplaySettings) {
this.excludeDisplaySettings = excludeDisplaySettings;
}
// public void setStaticNameSpace(String xmlNameSpace) {
// this.xmlNameSpace = xmlNameSpace;
// }
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class XMLWriterSettings implements Serializable, Cloneable, ManagedParameters {
@ -34,7 +35,7 @@ public class XMLWriterSettings implements Serializable, Cloneable, ManagedParame
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -5,6 +5,7 @@ import java.io.Serializable;
import PamController.soundMedium.GlobalMedium.SoundMedium;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Stores parameters for the current medium.
@ -41,7 +42,7 @@ public class GlobalMediumParams implements Serializable, Cloneable, ManagedParam
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -44,11 +44,15 @@ import whistlesAndMoans.AbstractWhistleDataUnit;
import fftManager.FFTDataUnit;
import fftManager.PamFFTControl;
import group3dlocaliser.Group3DLocaliserControl;
import metadata.MetaDataContol;
import meygenturbine.MeygenTurbine;
import printscreen.PrintScreenControl;
import rockBlock.RockBlockControl;
import tethys.TethysControl;
import turbineops.TurbineOperationControl;
import GPS.GpsDataUnit;
import Map.MapController;
import Map.gridbaselayer.GridbaseControl;
import NMEA.NMEADataUnit;
import PamController.PamControlledUnitSettings;
import PamController.PamController;
@ -62,6 +66,7 @@ import PamguardMVC.PamDataBlock;
import analogarraysensor.ArraySensorControl;
import backupmanager.BackupManager;
import beamformer.continuous.BeamFormerControl;
import beamformer.localiser.BeamFormLocaliserControl;
import bearinglocaliser.BearingLocaliserControl;
import binaryFileStorage.SecondaryBinaryStore;
import cepstrum.CepstrumControl;
@ -454,6 +459,19 @@ final public class PamModel implements PamSettings {
mi.setToolTipText("Manage automated data backups");
mi.setModulesMenuGroup(utilitiesGroup);
mi.setMaxNumber(1);
// mi = PamModuleInfo.registerControlledUnit(MetaDataContol.class.getName(), MetaDataContol.unitType);
// mi.setToolTipText("Project Meta Data");
// mi.setModulesMenuGroup(utilitiesGroup);
// mi.setMaxNumber(1);
if (isViewer) {
mi = PamModuleInfo.registerControlledUnit(TethysControl.class.getName(), TethysControl.defaultName);
mi.setToolTipText("Interface to Tethys Database");
mi.setModulesMenuGroup(utilitiesGroup);
mi.setMaxNumber(1);
}
/*
* ************* End Utilities Group *******************
@ -1061,7 +1079,7 @@ final public class PamModel implements PamSettings {
// clear the current list
pluginList.clear();
daqList.clear();
/*
* If developing a new PAMPlugin in eclipse, the easiest way to do it is to make a new
* Eclipse project for your plugin code. Within that project, copy this PamModel class
@ -1076,6 +1094,8 @@ final public class PamModel implements PamSettings {
* When you export the code for your plugin to a jar file, remember to NOT inlcude the copy of
* PamModel !
*/
// pluginList.add(new MorlaisWP1aPlugin());
// Load up whatever default classloader was used to create this class. Must use the same classloader
// for all plugins, or else we will not be able to create proper dependencies between them or be able
@ -1143,11 +1163,30 @@ final public class PamModel implements PamSettings {
// to add that URL to the default classloader path.
URL newURL = jarList.get(i).toURI().toURL();
// original method
// Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
// method.setAccessible(true);
// method.invoke(cl, newURL);
// first fix attempt - create a brand new URLClassLoader. As expected, we get a ClassCastException when trying
// to load the parameters so we can't save params using this method
// URL[] newURLArray = new URL[1];
// newURLArray[0] = newURL;
// cl = new URLClassLoader(newURLArray);
// second attempt - custom class loader with the system app loader specified as the parent. Loads controlled unit, but
// as before it doesn't load the parameters
classLoader.addURL(newURL);
// third attempt
// Class<?> genericClass = cl.getClass();
// Method method = genericClass.getSuperclass().getDeclaredMethod("addURL", new Class[] {URL.class});
// method.setAccessible(true);
// method.invoke(cl, new Object[] {newURL});
// Save the name of the class to the global pluginBeingLoaded variable, and load the class.
this.setPluginBeingLoaded(className);
// Class c = cl.loadClass(className);
@ -1228,8 +1267,9 @@ final public class PamModel implements PamSettings {
"for help.<p>" +
"This plug-in will not be available for loading";
String help = null;
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
System.err.println("Exception while loading " + className);
System.err.println(e1.getMessage());
continue;
}
}
@ -1242,7 +1282,7 @@ final public class PamModel implements PamSettings {
"for help.<p>" +
"This plug-in will not be available for loading";
String help = null;
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, ex);
int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, ex);
System.err.println("Exception while loading " + jarList.get(i).getName());
continue;
}
@ -1267,7 +1307,7 @@ final public class PamModel implements PamSettings {
// instantiate the plugin control class using the custom class loader
try {
// File classFile = new File(pf.getJarFile());
File classFile = new File(pf.getJarFile());
//URLClassLoader cl = new URLClassLoader(new URL[]{classFile.toURI().toURL()});
// mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),cl);
mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),classLoader);
@ -1333,7 +1373,7 @@ final public class PamModel implements PamSettings {
"for help.<p>" +
"This plug-in will not be available for loading";
String help = null;
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
System.err.println("Exception while loading " + pf.getDefaultName());
pluginList.remove(pf);
continue;

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class PamModelSettings implements Cloneable, Serializable, ManagedParameters {
@ -74,7 +75,7 @@ public class PamModelSettings implements Cloneable, Serializable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -34,6 +34,11 @@ abstract public class PamParameterData {
*/
private String postTitle;
/**
* field length for automatic dialogs.
*/
private int fieldLength;
/**
* @param parentObject
@ -45,6 +50,21 @@ abstract public class PamParameterData {
this.field = field;
}
/**
* @param parentObject
* @param field
* @param shortName
* @param toolTip
* @param fieldLength length of text in automatic dialogs.
*/
public PamParameterData(Object parentObject, Field field, String shortName, String toolTip, int fieldLength) {
super();
this.field = field;
this.shortName = shortName;
this.toolTip = toolTip;
this.fieldLength = fieldLength;
}
/**
* @param parentObject
* @param field
@ -58,7 +78,6 @@ abstract public class PamParameterData {
this.toolTip = toolTip;
}
/**
* @param shortName the shortName to set
*/
@ -66,6 +85,20 @@ abstract public class PamParameterData {
this.shortName = shortName;
}
/**
* Set info about a parameter
* @param shortName short name, e.g. to use in a dialog
* @param postTitle post title, e.g. text coming after a data entry field in a dialog
* @param toolTip tool tip to display over the component in a dialog.
* @param fieldLength length of text in automatic dialogs.
*/
public void setInfo(String shortName, String postTitle, String toolTip, int fieldLength) {
this.shortName = shortName;
this.postTitle = postTitle;
this.toolTip = toolTip;
this.fieldLength = fieldLength;
}
/**
* Set info about a parameter
* @param shortName short name, e.g. to use in a dialog
@ -136,6 +169,9 @@ abstract public class PamParameterData {
* @return a short name for the field, suitable for use in dialogs.
*/
public String getShortName() {
if (shortName == null) {
return getFieldName();
}
return shortName;
}
@ -166,5 +202,19 @@ abstract public class PamParameterData {
return String.format("Param %s class %s", getFieldName(), getDataClass());
}
/**
* @return the fieldLength
*/
public int getFieldLength() {
return fieldLength;
}
/**
* @param fieldLength the fieldLength to set
*/
public void setFieldLength(int fieldLength) {
this.fieldLength = fieldLength;
}
}

View File

@ -59,9 +59,12 @@ public class PamParameterDataGetter extends PrivatePamParameterData {
if (setter == null) {
return false;
}
// need to convert the type
Object convObj = convertStringType(data);
try {
setter.invoke(getParentObject(), data);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
Object parentObj = getParentObject();
setter.invoke(parentObj, convObj);
} catch (InvocationTargetException e) {
e.printStackTrace();
return false;
}

View File

@ -29,6 +29,9 @@ public class PamParameterSet {
private static boolean printDebug = false;
public enum ParameterSetType {DETECTOR, DISPLAY};
private ParameterSetType parameterSetType;
/**
* Standard modifiers to exclude. This is important for many classes which will tend to
* do crazy things such as incorporate ALL of their final fields, e.g. when a Color
@ -55,8 +58,10 @@ public class PamParameterSet {
* in the STANDARD_MODIFIER_EXCLUSIONS list (FINAL or STATIC).
* @return Created parameter set.
*/
public static PamParameterSet autoGenerate(Object parentObject) {
return autoGenerate(parentObject, STANDARD_MODIFIER_EXCLUSIONS);
public static PamParameterSet autoGenerate(Object parentObject, ParameterSetType parameterSetType) {
PamParameterSet paramSet = autoGenerate(parentObject, STANDARD_MODIFIER_EXCLUSIONS);
paramSet.setParameterSetType(parameterSetType);
return paramSet;
}
/**
@ -286,4 +291,19 @@ public class PamParameterSet {
public PamParameterData removeParameterData(String paramName) {
return parameterDatas.remove(paramName);
}
/**
* @return the parameterSetType
*/
public ParameterSetType getParameterSetType() {
return parameterSetType;
}
/**
* @param parameterSetType the parameterSetType to set
*/
public void setParameterSetType(ParameterSetType parameterSetType) {
this.parameterSetType = parameterSetType;
}
}

View File

@ -0,0 +1,73 @@
package PamModel.parametermanager;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenuItem;
import PamModel.parametermanager.swing.ManagedParameterDialog;
import generalDatabase.parameterstore.ParameterDatabaseStore;
/**
* Just about everything giving overall control of some managed parameters.
* May be a bit too specific on first cut and need to be abstracted.
* Testing on 'Deployment' data.
* @author dg50
*
* @param <T>
*/
public class ParameterSetManager<T extends ManagedParameters> {
private T managedParams;
private String name;
public ParameterSetManager(T defaultParams, String name) {
setManagedParams(defaultParams);
this.name = name;
// if (managedParams == null) {
// managedParams = new T();
// }
}
/**
* @return the managedParams
*/
public T getManagedParams() {
return managedParams;
}
/**
* @param managedParams the managedParams to set
*/
public void setManagedParams(T managedParams) {
this.managedParams = managedParams;
}
public JMenuItem getMenuItem(Window parent) {
if (managedParams == null) {
return null;
}
JMenuItem menuItem = new JMenuItem(name + " ...");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showDialog(parent);
}
});
return menuItem;
}
protected void showDialog(Window parent) {
ManagedParameterDialog<T> dialog = new ManagedParameterDialog<T>(parent, name, managedParams);
T newParams = dialog.showDialog(parent, name, managedParams);
if (newParams != null) {
ParameterDatabaseStore paramDatabase = new ParameterDatabaseStore("MetaData");
paramDatabase.saveParameterSet(newParams);
}
}
}

View File

@ -1,6 +1,7 @@
package PamModel.parametermanager;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
/**
* Abstract instance of PamParameterDataInterface which implements everything
@ -36,9 +37,48 @@ public abstract class PrivatePamParameterData extends PamParameterData {
* This should really be implemented in every concrete class, but no time to do that now. Aim to delete
* this function here, then go through and implement everywhere ...
*/
return false;
// return false;
Object convData = convertStringType(data);
getField().set(this, convData);
return true;
}
/**
* convert a string type to a different type appropriate for the field in
* question.
* @param value
* @return
*/
public Object convertStringType(Object value) {
if (value == null) {
return null;
}
if (value instanceof String == false) {
return value;
}
String str = (String) value;
Type type = getField().getGenericType();
Class<?> cls = getField().getType();
String clsName = cls.getName();
switch (clsName) {
case "int":
case "Integer":
return Integer.valueOf(str);
case "double":
case "Double":
return Double.valueOf(str);
case "float":
case "Float":
return Float.valueOf(str);
case "short":
case "Short":
return Short.valueOf(str);
}
return value;
}
}

View File

@ -0,0 +1,49 @@
package PamModel.parametermanager.swing;
import java.awt.Window;
import PamModel.parametermanager.ManagedParameters;
import PamView.dialog.PamDialog;
public class ManagedParameterDialog<T extends ManagedParameters> extends PamDialog {
private T params;
private ManagedParameterPanel<T> parameterPanel;
public ManagedParameterDialog(Window parentFrame, String title, T params) {
super(parentFrame, title, false);
parameterPanel = new ManagedParameterPanel<T>(params);
setDialogComponent(parameterPanel.getPanel());
}
public T showDialog(Window parentFrame, String title, T parameters) {
// ManagedParameterDialog dialog = new ManagedParameterDialog<>(parentFrame, title, parameters);
setParams(parameters);
setVisible(true);
return params;
}
private void setParams(T params) {
this.params = params;
this.parameterPanel.setParams(params);
}
@Override
public boolean getParams() {
return parameterPanel.getParams(params);
}
@Override
public void cancelButtonPressed() {
params = null;
}
@Override
public void restoreDefaultSettings() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,149 @@
package PamModel.parametermanager.swing;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.Collection;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.JTextComponent;
import PamModel.parametermanager.FieldNotFoundException;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterData;
import PamModel.parametermanager.PamParameterSet;
import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints;
public class ManagedParameterPanel<T extends ManagedParameters> {
private JPanel mainPanel;
private Collection<PamParameterData> parameterSet;
private static final int DEFAULT_TEXT_LENGTH = 6;
private static final int MAX_SINGLE_LINE_LENGTH = 40;
private JTextComponent[] textComponents;
public ManagedParameterPanel(T parameterExample) {
mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints();
PamParameterSet exampleSet = parameterExample.getParameterSet();
parameterSet = exampleSet.getParameterCollection();
int n = parameterSet.size();
textComponents = new JTextComponent[n];
int i = 0;
for (PamParameterData paramData : parameterSet) {
textComponents[i] = createComponent(paramData);
c.gridx = 0;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.NORTHEAST;
mainPanel.add(new JLabel(paramData.getShortName(), JLabel.RIGHT), c);
c.gridx++;
if (textComponents[i] instanceof JTextArea) {
c.fill = GridBagConstraints.HORIZONTAL;
}
else {
c.fill = GridBagConstraints.NONE;
}
c.anchor = GridBagConstraints.WEST;
mainPanel.add(textComponents[i], c);
textComponents[i].setToolTipText(getTipText(paramData));
c.gridy++;
i++;
}
}
private String getTipText(PamParameterData paramData) {
String tip = paramData.getToolTip();
if (tip != null) {
return tip;
}
else {
return paramData.getFieldName();
}
}
private JTextComponent createComponent(PamParameterData paramData) {
int textLen = paramData.getFieldLength();
if (textLen == 0) {
textLen = DEFAULT_TEXT_LENGTH;
}
if (textLen <= MAX_SINGLE_LINE_LENGTH) {
return new JTextField(textLen);
}
else {
JTextField dummyField = new JTextField(2);
// dummyField.getBorder().
JTextArea textArea = new JTextArea(textLen/MAX_SINGLE_LINE_LENGTH+1, MAX_SINGLE_LINE_LENGTH);
textArea.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
return textArea;
}
}
public JComponent getPanel() {
return mainPanel;
}
public void setParams(T params) {
int i = 0;
PamParameterData newParamData = null;
Object data = null;
for (PamParameterData paramData : this.parameterSet) {
// find the parameter in the new parameters (parameterSet is just a formatting placeholder)
try {
newParamData = params.getParameterSet().findParameterData(paramData.getFieldName());
} catch (FieldNotFoundException e) {
e.printStackTrace();
}
try {
data = newParamData.getData();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
if (data != null) {
textComponents[i].setText(data.toString());
}
else {
textComponents[i].setText(null);
}
i++;
}
}
public boolean getParams(T params) {
int i = 0;
PamParameterData newParamData = null;
Object data = null;
for (PamParameterData paramData : this.parameterSet) {
// find the parameter in the new parameters (parameterSet is just a formatting placeholder)
try {
newParamData = params.getParameterSet().findParameterData(paramData.getFieldName());
} catch (FieldNotFoundException e) {
e.printStackTrace();
}
String txt = textComponents[i].getText();
try {
newParamData.setData(txt);
} catch (IllegalArgumentException | IllegalAccessException e) {
String msg = "Invalid parameter. Data type should be " + paramData.getField().getType().getName();
return PamDialog.showWarning(null, newParamData.getShortName(), msg);
}
i++;
}
return true;
}
}

View File

@ -26,6 +26,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Class definition for a x,y coordinate number type.
@ -168,7 +169,7 @@ public class Coordinate3d implements Serializable , Cloneable, PamCoordinate, Ma
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -15,6 +15,7 @@ import java.text.NumberFormat;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamguardMVC.PamConstants;
import net.sf.geographiclib.Geodesic;
import net.sf.geographiclib.PolygonArea;
@ -833,7 +834,7 @@ public class LatLong implements Serializable, Cloneable, Transferable, PamCoordi
*/
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
Field field = this.getClass().getDeclaredField("height");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -47,10 +47,7 @@ public class PamCalendar {
public static TimeZone defaultTimeZone = TimeZone.getTimeZone("UTC");
/*
* Not used: all now handled in PamCalendar.
*/
// private static TimeZone localTimeZone = defaultTimeZone;// TimeZone.getDefault();
private static TimeZone localTimeZone = defaultTimeZone;// TimeZone.getDefault();
public static final long millisPerDay = 1000L*24L*3600L;
@ -63,7 +60,7 @@ public class PamCalendar {
private static boolean soundFile;
/**
* time from the start of the file to the current moment.
* time from the start of the file to the currentmoment.
* This is updated every time data re read from the file, so is
* accurate to about 1/10 second.
* For accurate timing within detectors, always try to use sample number
@ -180,44 +177,8 @@ public class PamCalendar {
public static TimeZone getDisplayTimeZone(boolean useLocal) {
// return TimeZone.getTimeZone("UTC");
return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone;
// return useLocal ? localTimeZone : defaultTimeZone;
}
/**
* Get the display time zone offset in milliseconds.
* @param useLocal
* @return
*/
public static long getDisplayTimeZoneOffest(boolean useLocal) {
TimeZone tz = getDisplayTimeZone(useLocal);
return tz.getOffset(getTimeInMillis());
}
/**
* Get a short string describing the time zone. This should be less than
* 10 characters. So if the full name of the TZ is long, then write it
* in the format "UTC+..."
* @param useLocal
* @return
*/
public static String getShortDisplayTimeZoneString(boolean useLocal) {
TimeZone tz = getDisplayTimeZone(useLocal);
String str = tz.getDisplayName();
str = CalendarControl.getInstance().getTZCode(true);
if (str.length() <= 10) {
return str;
}
// otherwise make up a string.
long offset = getDisplayTimeZoneOffest(useLocal) / 1000;
boolean isInt = offset % 3600 == 0;
if (isInt) {
str = String.format("UTC%+d", offset/3600);
}
else {
str = String.format("UTC%+3.1f", (double) offset/3600.);
}
return str;
// return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone;
return useLocal ? localTimeZone : defaultTimeZone;
}
public static String formatDateTime(Date date) {
@ -430,13 +391,8 @@ public class PamCalendar {
public static String formatDBStyleTime(long timeInMillis, boolean showMillis, boolean useLocal) {
Calendar c = Calendar.getInstance();
TimeZone tz = getDisplayTimeZone(useLocal);
// if (tz != null) {
// long offs = tz.getOffset(timeInMillis);
// timeInMillis += tz.getOffset(timeInMillis);
// }
c.setTimeInMillis(timeInMillis);
c.setTimeZone(tz);
c.setTimeZone(getDisplayTimeZone(useLocal));
DateFormat df;
if (showMillis) {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@ -444,7 +400,7 @@ public class PamCalendar {
else {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
df.setTimeZone(tz);
df.setTimeZone(getDisplayTimeZone(useLocal));
Date d = c.getTime();
// return String.format("%tY-%<tm-%<td %<tH:%<tM:%<tS", d);
@ -776,7 +732,6 @@ public class PamCalendar {
public static long msFromDateString(String dateString) {
return msFromDateString(dateString, false);
}
/**
* Read a date string and turn it into a millisecond time.
* @param dateString

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class GlobalTimeParameters implements Serializable, Cloneable, ManagedParameters {
@ -91,7 +92,7 @@ public class GlobalTimeParameters implements Serializable, Cloneable, ManagedPar
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -5,6 +5,7 @@ import java.util.TimeZone;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class TimeDisplayParameters implements Serializable, Cloneable, ManagedParameters {
@ -34,7 +35,7 @@ public class TimeDisplayParameters implements Serializable, Cloneable, ManagedPa
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class NMEATimeParameters implements Serializable, Cloneable, ManagedParameters {
@ -26,7 +27,7 @@ public class NMEATimeParameters implements Serializable, Cloneable, ManagedParam
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class NTPTimeParameters implements Serializable, Cloneable, ManagedParameters {
@ -32,7 +33,7 @@ public class NTPTimeParameters implements Serializable, Cloneable, ManagedParame
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -5,6 +5,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* A series of functions for creating arrays of colours
@ -410,7 +411,7 @@ public class ColourArray implements Cloneable, Serializable, ManagedParameters {
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -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;
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamUtils;
import PamView.dialog.GroupedSourcePanel;
@ -210,7 +211,7 @@ public class GroupedSourceParameters implements Serializable, Cloneable, Managed
*/
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}

View File

@ -7,6 +7,7 @@ import java.util.ArrayList;
import PamController.PamControlledUnit;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
/**
@ -55,7 +56,7 @@ public class GuiFrameSettings implements Serializable, Cloneable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try {
Field field = this.getClass().getDeclaredField("unitFrameInfo");
ps.put(new PrivatePamParameterData(this, field) {
@ -89,7 +90,7 @@ public class GuiFrameSettings implements Serializable, Cloneable, ManagedParamet
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try {
Field field = this.getClass().getDeclaredField("guiFrame");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -61,6 +61,7 @@ import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
@ -73,6 +74,7 @@ import javax.swing.event.MenuListener;
import Acquisition.DaqSystemInterface;
import annotation.tasks.AnnotationManager;
import metadata.MetaDataContol;
import performanceTests.PerformanceDialog;
import tipOfTheDay.TipOfTheDayManager;
import Array.ArrayManager;
@ -601,6 +603,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
fileMenu.add(menuItem);
}
// if (SMRUEnable.isEnable()) {
menuItem = new JMenuItem("Import PAMGuard Modules");
menuItem.setToolTipText("Import module settings from a different PAMGuard configuration (psfx files only");
menuItem.addActionListener(new ActionListener() {
@ -610,6 +613,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
}
});
fileMenu.add(menuItem);
// }
fileMenu.addSeparator();
@ -759,6 +763,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
//for changing "hydrophones" to "microphone" and vice versa if medium changes.
menu.addMenuListener(new SettingsMenuListener());
menu.add(MetaDataContol.getMetaDataControl().createMenu(frame));
menu.addSeparator();
@ -1664,10 +1669,10 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
protected void getGuiParameters() {
guiParameters.extendedState = frame.getExtendedState();
guiParameters.state = frame.getState();
if (guiParameters.state != Frame.MAXIMIZED_BOTH) {
// if (guiParameters.state != Frame.MAXIMIZED_BOTH) {
guiParameters.size = frame.getSize();
guiParameters.bounds = frame.getBounds();
}
// }
}
/**
@ -1982,6 +1987,30 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
public PamTabbedPane getTabbedPane() {
return this.mainTab;
}
/**
* find a parent window for a JComponent. This can be useful in
* finding windows to open child dialogs when the object holding
* the component may not have a direct reference back to it's dialog.
* @param component any Swing component
* @return parent Window (or frame) if it can be found
*/
public static Window findComponentWindow(JComponent component) {
if (component == null) {
return null;
}
JRootPane root = component.getRootPane();
if (root == null) {
return null;
}
Container rootP = root.getParent();
if (rootP instanceof Window) {
return (Window) rootP;
}
else {
return null;
}
}
}

View File

@ -38,6 +38,7 @@ import javax.swing.JPanel;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamView.PamColors.PamColor;
import PamView.symbol.SymbolData;
@ -808,7 +809,7 @@ public class PamSymbol extends PamSymbolBase implements Serializable, Icon, Clon
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -48,6 +48,7 @@ public class WarnOnce implements PamSettings {
int ans = showWarning(parent, "Warning Messages", "Show all PAMGuard warning messages", WarnOnce.OK_CANCEL_OPTION);
if (ans == WarnOnce.CANCEL_OPTION) return;
singleInstance.warnOnceList.clearList();
singleInstance.showThisSess.clear();
}
@Override

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class OverlayDataInfo implements Serializable, Cloneable, ManagedParameters {
@ -31,7 +32,7 @@ public class OverlayDataInfo implements Serializable, Cloneable, ManagedParamete
*/
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps;
}

View File

@ -6,6 +6,7 @@ import java.util.Hashtable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData;
import PamguardMVC.PamDataBlock;
@ -73,7 +74,7 @@ public class MarkDataSelectorParams implements Serializable, Cloneable, ManagedP
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try {
Field field = this.getClass().getDeclaredField("overlayChoices");
ps.put(new PrivatePamParameterData(this, field) {

View File

@ -3,7 +3,11 @@ package PamView.symbol;
import java.io.Serializable;
import java.util.Hashtable;
public class ManagedSymbolData implements Cloneable, Serializable {
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class ManagedSymbolData implements Cloneable, Serializable, ManagedParameters {
public static final long serialVersionUID = 1L;
@ -34,5 +38,10 @@ public class ManagedSymbolData implements Cloneable, Serializable {
return symbolOptions;
}
@Override
public PamParameterSet getParameterSet() {
return PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
}
}

View File

@ -0,0 +1,160 @@
package PamView.wizard;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
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.JPanel;
import PamView.dialog.PamDialog;
import tethys.swing.export.ExportStreamInfoPanel;
import tethys.swing.export.ExportWizardCard;
abstract public class PamWizard extends PamDialog {
private static final long serialVersionUID = 1L;
private JPanel cardPanel;
private CardLayout cardLayout;
private JPanel mainPanel;
private JButton prevButton;
private ArrayList<PamWizardCard> wizardCards = new ArrayList();
public PamWizard(Window parentFrame, String title) {
super(parentFrame, title, false);
cardLayout = new CardLayout();
mainPanel = new JPanel(new BorderLayout());
cardPanel = new JPanel(cardLayout);
mainPanel.add(BorderLayout.CENTER, cardPanel);
setDialogComponent(mainPanel);
getOkButton().setText("Finish");
prevButton = new JButton("Previous");
getButtonPanel().add(prevButton, 0);
prevButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
previousButton();
}
});
setResizable(true);
}
public void addCard(PamWizardCard wizPanel) {
cardPanel.add(wizPanel, wizPanel.getTitle());
wizardCards.add(wizPanel);
}
/**
* Get the main panel. This is the main dialog panel and uses a borderlayout
* with the cards in the CENTER of the panel. Additional information panels
* (generally fixed and not changing with the dialog) can be added NORTH, SOUTH, WEST and EAST.
* @return main Panel.
*/
public JPanel getMainPanel() {
return mainPanel;
}
/**
* Called when 'previous' button is clicked.
*/
protected void previousButton() {
cardLayout.previous(cardPanel);
enableControls();
}
public void enableControls() {
int iCard = getCardIndex();
prevButton.setEnabled(iCard > 0);
boolean isLast = iCard == wizardCards.size()-1;
// getOkButton().setEnabled(!isLast);
getOkButton().setText(isLast ? "Finish" : "Next");
}
private boolean checkCurrentCard() {
int iCard = getCardIndex();
if (iCard < 0) {
return true;
}
return getCardParams(wizardCards.get(iCard));
}
abstract public void setCardParams(PamWizardCard wizardCard);
abstract public boolean getCardParams(PamWizardCard wizardCard);
public int getCardIndex() {
for (int i = 0; i < cardPanel.getComponentCount(); i++) {
Component component = cardPanel.getComponent(i);
if (component.isVisible()) {
return i;
}
}
return -1;
}
public JButton getPreviousButton() {
return prevButton;
}
public void setParams() {
for (PamWizardCard wizCard : wizardCards) {
setCardParams(wizCard);
}
enableControls();
}
@Override
public boolean getParams() {
/**
* This is the OK button, so we need to NOT return OK, which would close the
* dialog until we're on the last card.
*/
if (checkCurrentCard() == false) {
return false;
}
int iCard = getCardIndex();
if (iCard < wizardCards.size()-1) {
cardLayout.next(cardPanel);
enableControls();
return false;
}
return true;
}
@Override
public void restoreDefaultSettings() {
// TODO Auto-generated method stub
}
/**
* Move to the first card in the stack
*/
public void moveFirst() {
cardLayout.first(cardPanel);
}
/**
* Move to the last card in the stack
*/
public void moveLast() {
cardLayout.last(cardPanel);
}
}

View File

@ -0,0 +1,45 @@
package PamView.wizard;
import java.io.Serializable;
import javax.swing.JPanel;
/**
* Base class for PAMGuard wizard cards.
* @author dg50
*
* @param <T> class type for parameters to set and get.
*/
abstract public class PamWizardCard<T extends Object> extends JPanel {
private static final long serialVersionUID = 1L;
private String title;
private PamWizard pamWizard;
/**
* @param title
*/
public PamWizardCard(PamWizard pamWizard, String title) {
this.pamWizard = pamWizard;
this.title = title;
}
public abstract boolean getParams(T cardParams);
public abstract void setParams(T cardParams);
public String getTitle() {
return title;
}
/**
* @return the pamWizard
*/
public PamWizard getPamWizard() {
return pamWizard;
}
}

Some files were not shown because too many files have changed in this diff Show More