mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
commit
9f7331c389
@ -4,7 +4,7 @@
|
|||||||
<groupId>org.pamguard</groupId>
|
<groupId>org.pamguard</groupId>
|
||||||
<artifactId>Pamguard</artifactId>
|
<artifactId>Pamguard</artifactId>
|
||||||
<name>Pamguard Java12+</name>
|
<name>Pamguard Java12+</name>
|
||||||
<version>2.02.10</version>
|
<version>2.02.10b</version>
|
||||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||||
<url>www.pamguard.org</url>
|
<url>www.pamguard.org</url>
|
||||||
<organization>
|
<organization>
|
||||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.pamguard</groupId>
|
<groupId>org.pamguard</groupId>
|
||||||
<artifactId>Pamguard</artifactId>
|
<artifactId>Pamguard</artifactId>
|
||||||
<version>2.02.10</version>
|
<version>2.02.10b</version>
|
||||||
<name>Pamguard Java12+</name>
|
<name>Pamguard Java12+</name>
|
||||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||||
<url>www.pamguard.org</url>
|
<url>www.pamguard.org</url>
|
||||||
@ -748,7 +748,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.ucanaccess</groupId>
|
<groupId>net.sf.ucanaccess</groupId>
|
||||||
<artifactId>ucanaccess</artifactId>
|
<artifactId>ucanaccess</artifactId>
|
||||||
<version>4.0.4</version>
|
<version>5.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-dev -->
|
<!-- https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-dev -->
|
||||||
|
@ -53,7 +53,7 @@ public class HydrophoneDataBlock extends PamDataBlock<HydrophoneDataUnit> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getNumRequiredBeforeLoadTime() {
|
public int getNumRequiredBeforeLoadTime() {
|
||||||
return ArrayManager.getArrayManager().getCurrentArray().getHydrophoneCount();
|
return ArrayManager.getArrayManager().getCurrentArray().getHydrophoneCount()*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package Array;
|
|||||||
import pamScrollSystem.AbstractScrollManager;
|
import pamScrollSystem.AbstractScrollManager;
|
||||||
import PamUtils.PamCalendar;
|
import PamUtils.PamCalendar;
|
||||||
import PamView.symbol.StandardSymbolManager;
|
import PamView.symbol.StandardSymbolManager;
|
||||||
|
import PamguardMVC.PamConstants;
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
import PamguardMVC.PamProcess;
|
import PamguardMVC.PamProcess;
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class HydrophoneProcess extends PamProcess{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOutputDataBlock(PamDataBlock outputDataBlock){
|
public void addOutputDataBlock(PamDataBlock outputDataBlock){
|
||||||
AbstractScrollManager.getScrollManager().addToSpecialDatablock(outputDataBlock);
|
AbstractScrollManager.getScrollManager().addToSpecialDatablock(outputDataBlock, 60000, 0);
|
||||||
super.addOutputDataBlock(outputDataBlock);
|
super.addOutputDataBlock(outputDataBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,4 +403,9 @@ public class PamControlledUnitSettings implements Serializable, ManagedParameter
|
|||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("Type %s; Name %s, Data ", getUnitType(), getUnitName()) + getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -384,6 +384,8 @@ public class PamSettingManager {
|
|||||||
boolean[] usedSettings, PamSettings user) {
|
boolean[] usedSettings, PamSettings user) {
|
||||||
if (settingsList == null) return null;
|
if (settingsList == null) return null;
|
||||||
// go through the list and see if any match this module. Avoid repeats.
|
// go through the list and see if any match this module. Avoid repeats.
|
||||||
|
// String unitName = user.getUnitName();
|
||||||
|
// String unitType = user.getUnitType();
|
||||||
for (int i = 0; i < settingsList.size(); i++) {
|
for (int i = 0; i < settingsList.size(); i++) {
|
||||||
if (usedSettings != null && usedSettings[i]) continue;
|
if (usedSettings != null && usedSettings[i]) continue;
|
||||||
if (isSettingsUnit(user, settingsList.get(i))) {
|
if (isSettingsUnit(user, settingsList.get(i))) {
|
||||||
@ -393,6 +395,7 @@ public class PamSettingManager {
|
|||||||
return settingsList.get(i);
|
return settingsList.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To improve complex module loading where settings may be saved by multiple sub-modules, in
|
* To improve complex module loading where settings may be saved by multiple sub-modules, in
|
||||||
* July 2015 many modules which had fixed settings had their settings names and types changed !
|
* July 2015 many modules which had fixed settings had their settings names and types changed !
|
||||||
@ -1482,11 +1485,20 @@ public class PamSettingManager {
|
|||||||
if (settings.getUnitName() == null || settingsUser.getUnitName() == null) return false;
|
if (settings.getUnitName() == null || settingsUser.getUnitName() == null) return false;
|
||||||
if (settings.getUnitType() == null || settingsUser.getUnitType() == null) return false;
|
if (settings.getUnitType() == null || settingsUser.getUnitType() == null) return false;
|
||||||
|
|
||||||
|
/*
|
||||||
if (settings.getUnitName().equals(settingsUser.getUnitName())
|
* some of the settings names used in Viewer mode have become too long, notably
|
||||||
&& settings.getUnitType().equals(settingsUser.getUnitType())
|
* in some data selectors which are using a datablocks long data name. This
|
||||||
&& settings.versionNo == settingsUser.getSettingsVersion()){
|
* screws things up, so moving to a begins with rather than equals for the name.
|
||||||
return true;
|
*/
|
||||||
|
String name = settingsUser.getUnitName();
|
||||||
|
String type = settingsUser.getUnitType();
|
||||||
|
long version = settingsUser.getSettingsVersion();
|
||||||
|
|
||||||
|
if (settings.getUnitType().equals(type)
|
||||||
|
&& settings.versionNo == version){
|
||||||
|
if (name.startsWith(settings.getUnitName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -31,7 +31,7 @@ public class PamguardVersionInfo {
|
|||||||
* Version number, major version.minorversion.sub-release.
|
* Version number, major version.minorversion.sub-release.
|
||||||
* Note: can't go higher than sub-release 'f'
|
* Note: can't go higher than sub-release 'f'
|
||||||
*/
|
*/
|
||||||
static public final String version = "2.02.10";
|
static public final String version = "2.02.10b";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release date
|
* Release date
|
||||||
|
@ -10,7 +10,6 @@ import java.util.Collection;
|
|||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import binaryFileStorage.BinaryStoreSettings;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the parameters within a class. Primarily holds a list
|
* Description of the parameters within a class. Primarily holds a list
|
||||||
@ -51,6 +50,17 @@ public class PamParameterSet {
|
|||||||
hiddenFields = new ArrayList<>();
|
hiddenFields = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically generate a parameter set for a class. Will include all public fields and
|
||||||
|
* any private or protected fields for which a getter can be found that has a similar enough name
|
||||||
|
* @param parentObject class to generate description for. Exception is anything that's listed
|
||||||
|
* in the STANDARD_MODIFIER_EXCLUSIONS list (FINAL or STATIC).
|
||||||
|
* @return Created parameter set.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static PamParameterSet autoGenerate(Object parentObject) {
|
||||||
|
return autoGenerate(parentObject, ParameterSetType.DETECTOR);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Automatically generate a parameter set for a class. Will include all public fields and
|
* Automatically generate a parameter set for a class. Will include all public fields and
|
||||||
* any private or protected fields for which a getter can be found that has a similar enough name
|
* any private or protected fields for which a getter can be found that has a similar enough name
|
||||||
|
@ -19,4 +19,10 @@ public class CompoundParams extends DataSelectParams {
|
|||||||
public DataSelectParams getSelectorParams(DataSelector dataSelector) {
|
public DataSelectParams getSelectorParams(DataSelector dataSelector) {
|
||||||
return selectorParams.get(dataSelector.getLongSelectorName());
|
return selectorParams.get(dataSelector.getLongSelectorName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCombinationFlag() {
|
||||||
|
return DATA_SELECT_AND;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,14 @@ public abstract class DataSelectorCreator implements PamSettings {
|
|||||||
return allSelectors.get(0);
|
return allSelectors.get(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new CompoundDataSelector(pamDataBlock, allSelectors, selectorName, allowScores, selectorType);
|
CompoundDataSelector selector = new CompoundDataSelector(pamDataBlock, allSelectors, selectorName, allowScores, selectorType);
|
||||||
|
// not needed since it get's done after this call anyway.
|
||||||
|
// DataSelectParams params = dataSelectorSettings.getParams(selectorName);
|
||||||
|
// if (params instanceof CompoundParams) {
|
||||||
|
// selector.setParams(params);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return selector;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,9 @@ public class BinaryOutputStream {
|
|||||||
*/
|
*/
|
||||||
public synchronized boolean storeData(DataOutputStream outputStream, int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) {
|
public synchronized boolean storeData(DataOutputStream outputStream, int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) {
|
||||||
if (lastObjectType == BinaryTypes.MODULE_FOOTER) {
|
if (lastObjectType == BinaryTypes.MODULE_FOOTER) {
|
||||||
System.out.printf("Storing binary object type %d in file %s with no module header\n", objectId, outputStream == null ? null : outputStream.toString());
|
System.out.printf("Storing binary object at %s from %s in file %s with no module header\n",
|
||||||
|
PamCalendar.formatDBDateTime(baseData.getTimeMilliseconds()),
|
||||||
|
parentDataBlock.getDataName(), outputStream == null ? null : outputStream.toString());
|
||||||
}
|
}
|
||||||
byte[] data = binaryObjectData.getData();
|
byte[] data = binaryObjectData.getData();
|
||||||
int objectLength = binaryObjectData.getDataLength();
|
int objectLength = binaryObjectData.getDataLength();
|
||||||
|
@ -407,8 +407,13 @@ public class ClickDisplayManager implements PamSettings {
|
|||||||
|
|
||||||
public Serializable getSettingsReference() {
|
public Serializable getSettingsReference() {
|
||||||
cdmp.countEverything(this);
|
cdmp.countEverything(this);
|
||||||
|
cdmp.saveDisplayLocations(getWindowList());
|
||||||
return cdmp;
|
return cdmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void restoreWindowSizes() {
|
||||||
|
cdmp.restoreWindowSizes(getWindowList());
|
||||||
|
}
|
||||||
|
|
||||||
public int countDisplays(Class displayType) {
|
public int countDisplays(Class displayType) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package clickDetector;
|
package clickDetector;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import Layout.PamInternalFrame;
|
||||||
import clickDetector.IDI_Display.IDIHistogramImage;
|
import clickDetector.IDI_Display.IDIHistogramImage;
|
||||||
|
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
@ -35,6 +40,10 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable,
|
|||||||
|
|
||||||
private boolean initialised = false;
|
private boolean initialised = false;
|
||||||
|
|
||||||
|
private boolean manualWindowSizes = false;
|
||||||
|
|
||||||
|
private ArrayList<WindowSizeData> windowSizes = new ArrayList();
|
||||||
|
|
||||||
public ClickDisplayManagerParameters2() {
|
public ClickDisplayManagerParameters2() {
|
||||||
setDefaults();
|
setDefaults();
|
||||||
}
|
}
|
||||||
@ -159,6 +168,11 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable,
|
|||||||
return null;
|
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) {
|
public void countEverything(ClickDisplayManager clickDisplayManager) {
|
||||||
lastMode = PamController.getInstance().getRunMode();
|
lastMode = PamController.getInstance().getRunMode();
|
||||||
if (lastMode >= NMODES) lastMode = 0;
|
if (lastMode >= NMODES) lastMode = 0;
|
||||||
@ -208,4 +222,101 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable,
|
|||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save windows sizes in an array list.
|
||||||
|
* @param windowList
|
||||||
|
*/
|
||||||
|
public void saveDisplayLocations(ArrayList<ClickDisplay> 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<ClickDisplay> 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<WindowSizeData> 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,19 @@ public class ClickTabPanel extends JDesktopPane implements ComponentListener {
|
|||||||
public void componentMoved(ComponentEvent e) {
|
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) {
|
public void componentResized(ComponentEvent e) {
|
||||||
// if (++resizeCount < 5) {
|
// if (++resizeCount < 5) {
|
||||||
arrangeWindows();
|
if (clickTabPanelControl.clickDisplayManager.cdmp.isManualWindowSizes() == false) {
|
||||||
|
arrangeWindows();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clickTabPanelControl.clickDisplayManager.restoreWindowSizes();
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import java.awt.Frame;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
@ -117,11 +118,29 @@ public class ClickTabPanelControl implements PamTabPanel {
|
|||||||
|
|
||||||
menu.add(clickDisplayManager.getModulesMenu());
|
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.addActionListener(new ArrangeWindows(parentFrame));
|
||||||
|
menuItem.setToolTipText("Automatically arrange windows in a standard layout");
|
||||||
menu.add(menuItem);
|
menu.add(menuItem);
|
||||||
|
|
||||||
menu.add(clickControl.angleVetoes.getDisplayMenuItem(parentFrame));
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
@ -458,6 +458,7 @@ public class DetectionGroupProcess extends PamProcess {
|
|||||||
detectionGroupDataBlock.saveViewerData();
|
detectionGroupDataBlock.saveViewerData();
|
||||||
int nUpdates = 0;
|
int nUpdates = 0;
|
||||||
int nOK = 0;
|
int nOK = 0;
|
||||||
|
int consecutiveOK = 0;
|
||||||
System.out.printf("Checking %d data units in %s ", detectionGroupDataBlock.getUnitsCount(), detectionGroupDataBlock.getDataName());
|
System.out.printf("Checking %d data units in %s ", detectionGroupDataBlock.getUnitsCount(), detectionGroupDataBlock.getDataName());
|
||||||
synchronized (detectionGroupDataBlock.getSynchLock()) {
|
synchronized (detectionGroupDataBlock.getSynchLock()) {
|
||||||
ListIterator<DetectionGroupDataUnit> it = detectionGroupDataBlock.getListIterator(0);
|
ListIterator<DetectionGroupDataUnit> it = detectionGroupDataBlock.getListIterator(0);
|
||||||
@ -466,11 +467,16 @@ public class DetectionGroupProcess extends PamProcess {
|
|||||||
boolean ok = checkDataIntegrity(du, false);
|
boolean ok = checkDataIntegrity(du, false);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
nUpdates++;
|
nUpdates++;
|
||||||
|
consecutiveOK = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nOK++;
|
nOK++;
|
||||||
|
consecutiveOK++;
|
||||||
}
|
}
|
||||||
System.out.printf(".");
|
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);
|
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();
|
subTabLogging = detectionGroupLogging.getSubLogging();
|
||||||
PamConnection con = DBControlUnit.findConnection();
|
PamConnection con = DBControlUnit.findConnection();
|
||||||
String desc = String.format("Detection group UID %d at %s", du.getUID(), PamCalendar.formatDBDateTime(du.getTimeMilliseconds()));
|
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<PamSubtableData> stData = subTabLogging.loadSubtableData(con, detectionGroupLogging, idList, null);
|
ArrayList<PamSubtableData> stData = subTabLogging.loadSubtableData(con, detectionGroupLogging, idList, null);
|
||||||
if (stData == null) {
|
if (stData == null) {
|
||||||
System.out.println("Error loading sub table data for event uid " + du.getUID());
|
System.out.println("Error loading sub table data for event uid " + du.getUID());
|
||||||
|
@ -2002,7 +2002,7 @@ public abstract class SQLLogging {
|
|||||||
*
|
*
|
||||||
* @param con database connection
|
* @param con database connection
|
||||||
* @param parentLogging super detection logging instance.
|
* @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
|
* @return list of all PamSubtableData items
|
||||||
*/
|
*/
|
||||||
public ArrayList<PamSubtableData> loadSubtableData(PamConnection con, SQLLogging parentLogging, String idList, ViewLoadObserver loadObserver) {
|
public ArrayList<PamSubtableData> loadSubtableData(PamConnection con, SQLLogging parentLogging, String idList, ViewLoadObserver loadObserver) {
|
||||||
@ -2034,6 +2034,13 @@ public abstract class SQLLogging {
|
|||||||
return loadSubtableData(con, subtableResults, loadObserver);
|
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, <br>i.e. the query is WHERE ParentID IN ...
|
||||||
|
* @return child table result set
|
||||||
|
*/
|
||||||
private ResultSet createSubTableResultSet(PamConnection con, SQLLogging parentLogging,
|
private ResultSet createSubTableResultSet(PamConnection con, SQLLogging parentLogging,
|
||||||
String parentIdList) {
|
String parentIdList) {
|
||||||
String clause = String.format(" WHERE ParentID IN %s ORDER BY UTC, UTCMilliseconds", parentIdList);
|
String clause = String.format(" WHERE ParentID IN %s ORDER BY UTC, UTCMilliseconds", parentIdList);
|
||||||
|
@ -3,10 +3,13 @@ package generalDatabase.lookupTables;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
import PamView.dialog.warn.WarnOnce;
|
import PamView.dialog.warn.WarnOnce;
|
||||||
@ -101,9 +104,101 @@ public class LookUpTables {
|
|||||||
checkedTableConnection = null;
|
checkedTableConnection = null;
|
||||||
if (dbControlUnit.getDbProcess().checkTable(lutTableDef)) {
|
if (dbControlUnit.getDbProcess().checkTable(lutTableDef)) {
|
||||||
checkedTableConnection = con;
|
checkedTableConnection = con;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
checkTableRepeats(con, lutTableDef);
|
||||||
|
|
||||||
|
return checkedTableConnection != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for some reason some repeats have got into the LUT and need to be removed
|
||||||
|
* or it really messes stuff up. So check it automatically.
|
||||||
|
* @param con
|
||||||
|
* @param lutTableDef2
|
||||||
|
*/
|
||||||
|
private boolean checkTableRepeats(PamConnection con, EmptyTableDefinition lutTableDef) {
|
||||||
|
/*
|
||||||
|
* first get a list of unique topics, then check them one at a time.
|
||||||
|
*/
|
||||||
|
ArrayList<String> topics = getTopicList(con, lutTableDef);
|
||||||
|
if (topics == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String topic : topics) {
|
||||||
|
checkTopicRepeats(con, lutTableDef, topic);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkTopicRepeats(PamConnection con, EmptyTableDefinition lutTableDef2, String topic) {
|
||||||
|
LookupList lutList = getLookupList(topic);
|
||||||
|
Vector<LookupItem> list = lutList.getList();
|
||||||
|
int n = list.size();
|
||||||
|
boolean[] isRepeat = new boolean[n];
|
||||||
|
int nRepeat = 0;
|
||||||
|
// search for repeats.
|
||||||
|
for (int i = 0; i < n-1; i++) {
|
||||||
|
String code = list.get(i).getCode().trim();
|
||||||
|
for (int j = i+1; j < n; j++) {
|
||||||
|
String code2 = list.get(j).getCode().trim();
|
||||||
|
if (code.equals(code2)) {
|
||||||
|
isRepeat[j] = true;
|
||||||
|
nRepeat++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nRepeat == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// make a clause to delete the repeats.
|
||||||
|
String sql = null;
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
if (isRepeat[i] == false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (sql == null) {
|
||||||
|
sql = String.format("DELETE FROM %s WHERE Id IN (%d", lutTableDef.getTableName(), list.get(i).getDatabaseId());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sql = sql + String.format(",%d", list.get(i).getDatabaseId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql += ")";
|
||||||
|
boolean ok = false;
|
||||||
|
try {
|
||||||
|
Statement stmt = con.getConnection().createStatement();
|
||||||
|
ok = stmt.execute(sql);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<String> getTopicList(PamConnection con, EmptyTableDefinition lutTableDef) {
|
||||||
|
if (con == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ArrayList<String> topics = new ArrayList<>();
|
||||||
|
String qStr = "SELECT DISTINCT Topic FROM " + lutTableDef.getTableName();
|
||||||
|
try {
|
||||||
|
Statement stmt = con.getConnection().createStatement();
|
||||||
|
boolean ok = stmt.execute(qStr);
|
||||||
|
if (ok == false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ResultSet results = stmt.getResultSet();
|
||||||
|
while (results.next()) {
|
||||||
|
String topic = results.getString(1);
|
||||||
|
topics.add(topic);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return topics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LookupList createLookupList(PamCursor resultSet, String topic) {
|
public LookupList createLookupList(PamCursor resultSet, String topic) {
|
||||||
|
@ -153,7 +153,7 @@ public class UCanAccessSystem extends BaseAccessSystem implements PamSettings {
|
|||||||
String conStr = "jdbc:ucanaccess://"
|
String conStr = "jdbc:ucanaccess://"
|
||||||
+ fl.getAbsolutePath() + passwordEntry+noMem;
|
+ fl.getAbsolutePath() + passwordEntry+noMem;
|
||||||
System.out.println("UCanAccess connection string = " + conStr);
|
System.out.println("UCanAccess connection string = " + conStr);
|
||||||
conn = DriverManager.getConnection(conStr);
|
conn = DriverManager.getConnection(conStr,"","");
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -1598,7 +1598,9 @@ public class FormDescription implements Cloneable, Comparable<FormDescription> {
|
|||||||
normalForm.destroyForm();
|
normalForm.destroyForm();
|
||||||
}
|
}
|
||||||
if (hiddenForm != null) {
|
if (hiddenForm != null) {
|
||||||
normalForm.destroyForm();
|
if (normalForm != null) {
|
||||||
|
normalForm.destroyForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (subtabForms != null) {
|
if (subtabForms != null) {
|
||||||
for (LoggerForm aForm:subtabForms) {
|
for (LoggerForm aForm:subtabForms) {
|
||||||
|
@ -21,6 +21,7 @@ import javax.swing.BoxLayout;
|
|||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JRootPane;
|
import javax.swing.JRootPane;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
@ -529,7 +530,10 @@ public class LoggerForm{
|
|||||||
innerCenterPanel.add(currentRow);
|
innerCenterPanel.add(currentRow);
|
||||||
currentRow = new LoggerFormPanel(this, new FlowLayout(FlowLayout.LEFT));
|
currentRow = new LoggerFormPanel(this, new FlowLayout(FlowLayout.LEFT));
|
||||||
}else{
|
}else{
|
||||||
currentRow.add(c.makeComponent(this));
|
JPanel component = c.makeComponent(this);
|
||||||
|
if (component != null) {
|
||||||
|
currentRow.add(component);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user