diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index 1eb2342e..24b67836 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -4,7 +4,7 @@
org.pamguard
Pamguard
Pamguard Java12+
- 2.02.10
+ 2.02.10a
Pamguard for Java 12+, using Maven to control dependcies
www.pamguard.org
diff --git a/pom.xml b/pom.xml
index 18731009..791baced 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.pamguard
Pamguard
- 2.02.10
+ 2.02.10a
Pamguard Java12+
Pamguard for Java 12+, using Maven to control dependcies
www.pamguard.org
diff --git a/src/Array/HydrophoneDataBlock.java b/src/Array/HydrophoneDataBlock.java
index 558aa372..43ec7fb3 100644
--- a/src/Array/HydrophoneDataBlock.java
+++ b/src/Array/HydrophoneDataBlock.java
@@ -53,7 +53,7 @@ public class HydrophoneDataBlock extends PamDataBlock {
*/
@Override
public int getNumRequiredBeforeLoadTime() {
- return ArrayManager.getArrayManager().getCurrentArray().getHydrophoneCount();
+ return ArrayManager.getArrayManager().getCurrentArray().getHydrophoneCount()*2;
}
diff --git a/src/Array/HydrophoneProcess.java b/src/Array/HydrophoneProcess.java
index 1ac1a7c4..6c5c9f68 100644
--- a/src/Array/HydrophoneProcess.java
+++ b/src/Array/HydrophoneProcess.java
@@ -3,6 +3,7 @@ package Array;
import pamScrollSystem.AbstractScrollManager;
import PamUtils.PamCalendar;
import PamView.symbol.StandardSymbolManager;
+import PamguardMVC.PamConstants;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamProcess;
@@ -42,7 +43,7 @@ public class HydrophoneProcess extends PamProcess{
@Override
public void addOutputDataBlock(PamDataBlock outputDataBlock){
- AbstractScrollManager.getScrollManager().addToSpecialDatablock(outputDataBlock);
+ AbstractScrollManager.getScrollManager().addToSpecialDatablock(outputDataBlock, 60000, 0);
super.addOutputDataBlock(outputDataBlock);
}
diff --git a/src/PamController/PamguardVersionInfo.java b/src/PamController/PamguardVersionInfo.java
index c6753329..cb03138a 100644
--- a/src/PamController/PamguardVersionInfo.java
+++ b/src/PamController/PamguardVersionInfo.java
@@ -31,7 +31,7 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f'
*/
- static public final String version = "2.02.10";
+ static public final String version = "2.02.10a";
/**
* Release date
diff --git a/src/clickDetector/ClickDisplayManager.java b/src/clickDetector/ClickDisplayManager.java
index f992ef2d..2329bb4a 100644
--- a/src/clickDetector/ClickDisplayManager.java
+++ b/src/clickDetector/ClickDisplayManager.java
@@ -407,8 +407,13 @@ public class ClickDisplayManager implements PamSettings {
public Serializable getSettingsReference() {
cdmp.countEverything(this);
+ cdmp.saveDisplayLocations(getWindowList());
return cdmp;
}
+
+ public void restoreWindowSizes() {
+ cdmp.restoreWindowSizes(getWindowList());
+ }
public int countDisplays(Class displayType) {
int count = 0;
diff --git a/src/clickDetector/ClickDisplayManagerParameters2.java b/src/clickDetector/ClickDisplayManagerParameters2.java
index d8fd18cf..6bcc110a 100644
--- a/src/clickDetector/ClickDisplayManagerParameters2.java
+++ b/src/clickDetector/ClickDisplayManagerParameters2.java
@@ -1,8 +1,13 @@
package clickDetector;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Rectangle;
import java.io.Serializable;
import java.lang.reflect.Field;
+import java.util.ArrayList;
+import Layout.PamInternalFrame;
import clickDetector.IDI_Display.IDIHistogramImage;
import PamController.PamController;
@@ -35,6 +40,10 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable,
private boolean initialised = false;
+ private boolean manualWindowSizes = false;
+
+ private ArrayList windowSizes = new ArrayList();
+
public ClickDisplayManagerParameters2() {
setDefaults();
}
@@ -159,6 +168,11 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable,
return null;
}
+ /**
+ * This populates the serialised settings with lists of how many displays of
+ * each type there are.
+ * @param clickDisplayManager
+ */
public void countEverything(ClickDisplayManager clickDisplayManager) {
lastMode = PamController.getInstance().getRunMode();
if (lastMode >= NMODES) lastMode = 0;
@@ -208,4 +222,101 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable,
return ps;
}
+ /**
+ * Save windows sizes in an array list.
+ * @param windowList
+ */
+ public void saveDisplayLocations(ArrayList windowList) {
+ if (windowList == null) {
+ return;
+ }
+ getWindowSizes(); // make sure the array is created
+ windowSizes.clear();
+ for (ClickDisplay disp : windowList) {
+ Point loc = disp.getFrame().getLocation();
+ Dimension sz = disp.getFrame().getSize();
+ String cls = disp.getClass().toString();
+ windowSizes.add(new WindowSizeData(cls, loc, sz));
+ }
+ }
+
+ /**
+ * Try to restore window locations and sizes from a stored list.
+ * @param windowList
+ * @return
+ */
+ public boolean restoreWindowSizes(ArrayList windowList){
+ if (windowSizes == null || windowList == null) {
+ return false;
+ }
+ int resized = 0;
+ for (ClickDisplay disp : windowList) {
+ PamInternalFrame frame = disp.getFrame();
+ String cls = disp.getClass().toString();
+ // find an element in the list with that class.
+ WindowSizeData sizeData = null;
+ for (int i = 0; i < windowSizes.size(); i++) {
+ if (windowSizes.get(i).windowClass.equals(cls)) {
+ sizeData = windowSizes.remove(i);
+ break;
+ }
+ }
+ if (sizeData != null) {
+ frame.setLocation(sizeData.location);
+ frame.setSize(sizeData.size);
+ resized ++;
+ }
+ }
+ return resized > 0;
+ }
+
+
+
+ /**
+ * @return the windowSizes
+ */
+ public ArrayList getWindowSizes() {
+ if (windowSizes == null) {
+ windowSizes = new ArrayList<>();
+ }
+ return windowSizes;
+ }
+
+
+
+ /**
+ * @return the manualWindowSizes
+ */
+ public boolean isManualWindowSizes() {
+ return manualWindowSizes;
+ }
+
+ /**
+ * @param manualWindowSizes the manualWindowSizes to set
+ */
+ public void setManualWindowSizes(boolean manualWindowSizes) {
+ this.manualWindowSizes = manualWindowSizes;
+ }
+
+
+
+ private class WindowSizeData implements Serializable {
+
+ static public final long serialVersionUID = 1;
+
+ protected String windowClass;
+
+ public WindowSizeData(String windowClass, Point location, Dimension size) {
+ super();
+ this.windowClass = windowClass;
+ this.location = location;
+ this.size = size;
+ }
+
+ protected Point location;
+
+ protected Dimension size;
+
+ }
+
}
diff --git a/src/clickDetector/ClickTabPanel.java b/src/clickDetector/ClickTabPanel.java
index cf32c245..d969b5ca 100644
--- a/src/clickDetector/ClickTabPanel.java
+++ b/src/clickDetector/ClickTabPanel.java
@@ -72,9 +72,19 @@ public class ClickTabPanel extends JDesktopPane implements ComponentListener {
public void componentMoved(ComponentEvent e) {
}
+ /**
+ * This get's called during startup when the window is created and will
+ * automatically resize everything. IT may get called 2 or 3 times at startup
+ * as components such as the side bar sort themselves out.
+ */
public void componentResized(ComponentEvent e) {
// if (++resizeCount < 5) {
- arrangeWindows();
+ if (clickTabPanelControl.clickDisplayManager.cdmp.isManualWindowSizes() == false) {
+ arrangeWindows();
+ }
+ else {
+ clickTabPanelControl.clickDisplayManager.restoreWindowSizes();
+ }
// }
}
diff --git a/src/clickDetector/ClickTabPanelControl.java b/src/clickDetector/ClickTabPanelControl.java
index 4880521e..5e8f6491 100644
--- a/src/clickDetector/ClickTabPanelControl.java
+++ b/src/clickDetector/ClickTabPanelControl.java
@@ -26,6 +26,7 @@ import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
@@ -117,11 +118,29 @@ public class ClickTabPanelControl implements PamTabPanel {
menu.add(clickDisplayManager.getModulesMenu());
- menuItem = new JMenuItem("Arrange Windows ...");
+ menu.add(clickControl.angleVetoes.getDisplayMenuItem(parentFrame));
+
+ menu.addSeparator();
+
+ JCheckBoxMenuItem autoArrange = new JCheckBoxMenuItem("Auto arrange windows");
+ autoArrange.setSelected(clickDisplayManager.cdmp.isManualWindowSizes() == false);
+ autoArrange.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ clickDisplayManager.cdmp.setManualWindowSizes(autoArrange.isSelected() == false);
+ if (autoArrange.isSelected()) {
+ clickPanel.arrangeWindows();
+ }
+ }
+ });
+ autoArrange.setToolTipText("Automatically arrange windows in a standard layout whenever the display dimensions change");
+ menu.add(autoArrange);
+
+ menuItem = new JMenuItem("Arrange Windows Now");
menuItem.addActionListener(new ArrangeWindows(parentFrame));
+ menuItem.setToolTipText("Automatically arrange windows in a standard layout");
menu.add(menuItem);
- menu.add(clickControl.angleVetoes.getDisplayMenuItem(parentFrame));
return menu;
}
diff --git a/src/detectiongrouplocaliser/DetectionGroupProcess.java b/src/detectiongrouplocaliser/DetectionGroupProcess.java
index 3c5158fb..587b3719 100644
--- a/src/detectiongrouplocaliser/DetectionGroupProcess.java
+++ b/src/detectiongrouplocaliser/DetectionGroupProcess.java
@@ -458,6 +458,7 @@ public class DetectionGroupProcess extends PamProcess {
detectionGroupDataBlock.saveViewerData();
int nUpdates = 0;
int nOK = 0;
+ int consecutiveOK = 0;
System.out.printf("Checking %d data units in %s ", detectionGroupDataBlock.getUnitsCount(), detectionGroupDataBlock.getDataName());
synchronized (detectionGroupDataBlock.getSynchLock()) {
ListIterator it = detectionGroupDataBlock.getListIterator(0);
@@ -466,11 +467,16 @@ public class DetectionGroupProcess extends PamProcess {
boolean ok = checkDataIntegrity(du, false);
if (ok) {
nUpdates++;
+ consecutiveOK = 0;
}
else {
nOK++;
+ consecutiveOK++;
}
System.out.printf(".");
+ if (consecutiveOK % 80 == 0) {
+ System.out.printf("\n");
+ }
}
}
System.out.printf("\n%s: %d out of %d data units required corrections\n", detectionGroupDataBlock.getDataName(), nUpdates, nUpdates+nOK);
@@ -486,7 +492,7 @@ public class DetectionGroupProcess extends PamProcess {
subTabLogging = detectionGroupLogging.getSubLogging();
PamConnection con = DBControlUnit.findConnection();
String desc = String.format("Detection group UID %d at %s", du.getUID(), PamCalendar.formatDBDateTime(du.getTimeMilliseconds()));
- String idList = "( " + du.getUID() + " )";
+ String idList = "( " + du.getDatabaseIndex() + " )";
ArrayList stData = subTabLogging.loadSubtableData(con, detectionGroupLogging, idList, null);
if (stData == null) {
System.out.println("Error loading sub table data for event uid " + du.getUID());
diff --git a/src/generalDatabase/SQLLogging.java b/src/generalDatabase/SQLLogging.java
index 8f8b9f84..905ee28f 100644
--- a/src/generalDatabase/SQLLogging.java
+++ b/src/generalDatabase/SQLLogging.java
@@ -2002,7 +2002,7 @@ public abstract class SQLLogging {
*
* @param con database connection
* @param parentLogging super detection logging instance.
- * @param uidList list of UID's in the parent data that have been loaded.
+ * @param idList list of ID's in the parent data that have been loaded. Note Id, NOT UID
* @return list of all PamSubtableData items
*/
public ArrayList loadSubtableData(PamConnection con, SQLLogging parentLogging, String idList, ViewLoadObserver loadObserver) {
@@ -2034,6 +2034,13 @@ public abstract class SQLLogging {
return loadSubtableData(con, subtableResults, loadObserver);
}
+ /**
+ * Get a sub table result set. Note that this is based on ID, not UID
+ * @param con connection
+ * @param parentLogging parent logging system
+ * @param parentIdList ParentID list. Note that this is ID, not UID,
i.e. the query is WHERE ParentID IN ...
+ * @return child table result set
+ */
private ResultSet createSubTableResultSet(PamConnection con, SQLLogging parentLogging,
String parentIdList) {
String clause = String.format(" WHERE ParentID IN %s ORDER BY UTC, UTCMilliseconds", parentIdList);