mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
46d01e62db
@ -2407,7 +2407,7 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
if (dbc == null) {
|
if (dbc == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return dbc.getDatabaseName();
|
return dbc.getLongDatabaseName();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class PamguardVersionInfo {
|
|||||||
/**
|
/**
|
||||||
* Release date
|
* Release date
|
||||||
*/
|
*/
|
||||||
static public final String date = "20 December 2023";
|
static public final String date = "28 December 2023";
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Release type - Beta or Core
|
// * Release type - Beta or Core
|
||||||
|
62
src/PamView/panel/SplitPanePositionData.java
Normal file
62
src/PamView/panel/SplitPanePositionData.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package PamView.panel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class SplitPanePositionData implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
public static final long serialVersionUID = 1L;
|
||||||
|
private int position;
|
||||||
|
private double propPosition;
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
|
||||||
|
public SplitPanePositionData(int position, double propPosition, int height) {
|
||||||
|
super();
|
||||||
|
this.position = position;
|
||||||
|
this.setHeight(height);
|
||||||
|
this.setPropPosition(propPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the position
|
||||||
|
*/
|
||||||
|
public int getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param position the position to set
|
||||||
|
*/
|
||||||
|
public void setPosition(int position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the propPosition
|
||||||
|
*/
|
||||||
|
public double getPropPosition() {
|
||||||
|
return propPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param propPosition the propPosition to set
|
||||||
|
*/
|
||||||
|
public void setPropPosition(double propPosition) {
|
||||||
|
this.propPosition = propPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the height
|
||||||
|
*/
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param height the height to set
|
||||||
|
*/
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
}
|
95
src/PamView/panel/SplitPanePositioner.java
Normal file
95
src/PamView/panel/SplitPanePositioner.java
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
package PamView.panel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.swing.JSplitPane;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import PamController.PamControlledUnitSettings;
|
||||||
|
import PamController.PamSettingManager;
|
||||||
|
import PamController.PamSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that will remember and reset the position of a split pane. Any split pane.
|
||||||
|
* Just call this constructor with a unique name and the splitPane and a default
|
||||||
|
* between 0 and 1 and it will register itself automatically with PamSettings.
|
||||||
|
* @author dg50
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SplitPanePositioner implements PamSettings {
|
||||||
|
|
||||||
|
private static final String unitType = "Split Pane Position";
|
||||||
|
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
private JSplitPane splitPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for split pane positioner. Just call this constructor for each
|
||||||
|
* split pane, then forget about it. This will have been registered with
|
||||||
|
* PamSettings and will handle everything, restoring the split pane position
|
||||||
|
* when PAMGuard is restarted.
|
||||||
|
* @param unitName A unique name for the split pane.
|
||||||
|
* @param splitPane reference to an existing split pane.
|
||||||
|
* @param proportionalDefault default position (0 < position < 1).
|
||||||
|
*/
|
||||||
|
public SplitPanePositioner(String unitName, JSplitPane splitPane, double proportionalDefault) {
|
||||||
|
super();
|
||||||
|
this.splitPane = splitPane;
|
||||||
|
this.unitName = unitName;
|
||||||
|
boolean exists = PamSettingManager.getInstance().registerSettings(this);
|
||||||
|
if (exists == false) {
|
||||||
|
// use the default
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
splitPane.setDividerLocation(proportionalDefault);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnitName() {
|
||||||
|
return unitName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnitType() {
|
||||||
|
return unitType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Serializable getSettingsReference() {
|
||||||
|
System.out.printf("Save split position %s as %d out of %d\n", unitName, splitPane.getDividerLocation(), splitPane.getHeight());
|
||||||
|
double propPosition = (double) splitPane.getDividerLocation() / (double) splitPane.getHeight();
|
||||||
|
SplitPanePositionData posData = new SplitPanePositionData(splitPane.getDividerLocation(), propPosition, splitPane.getHeight());
|
||||||
|
return posData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getSettingsVersion() {
|
||||||
|
return SplitPanePositionData.serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
|
||||||
|
|
||||||
|
SplitPanePositionData posData = (SplitPanePositionData) pamControlledUnitSettings.getSettings();
|
||||||
|
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int newPos = posData.getPosition() + splitPane.getHeight() - posData.getHeight();
|
||||||
|
System.out.printf("Set split %s position to %d or %3.3f of %d\n", unitName,
|
||||||
|
posData.getPosition(), posData.getPropPosition(), splitPane.getHeight());
|
||||||
|
splitPane.setDividerLocation(posData.getPosition());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -30,6 +30,7 @@ import org.apache.commons.io.FilenameUtils;
|
|||||||
import offlineProcessing.DataCopyTask;
|
import offlineProcessing.DataCopyTask;
|
||||||
import offlineProcessing.OLProcessDialog;
|
import offlineProcessing.OLProcessDialog;
|
||||||
import offlineProcessing.OfflineTaskGroup;
|
import offlineProcessing.OfflineTaskGroup;
|
||||||
|
import pamguard.GlobalArguments;
|
||||||
import warnings.PamWarning;
|
import warnings.PamWarning;
|
||||||
import warnings.WarningSystem;
|
import warnings.WarningSystem;
|
||||||
import PamController.PamConfiguration;
|
import PamController.PamConfiguration;
|
||||||
@ -698,9 +699,17 @@ PamSettingsSource {
|
|||||||
*/
|
*/
|
||||||
public boolean selectDatabase(Frame frame, String selectTitle) {
|
public boolean selectDatabase(Frame frame, String selectTitle) {
|
||||||
|
|
||||||
|
|
||||||
//this is a bit messy but difficult to figure this out in controller framework because
|
//this is a bit messy but difficult to figure this out in controller framework because
|
||||||
//this is called before the controller has initialised properly.
|
//this is called before the controller has initialised properly.
|
||||||
if (PamGUIManager.getGUIType()==PamGUIManager.FX) {
|
// also have to allow for the database being passed as a command line option, in which case
|
||||||
|
// we don't want to open the dialog.
|
||||||
|
String currentDB = null;
|
||||||
|
DBParameters newParams = checkPassedDatabase();
|
||||||
|
if (newParams != null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (PamGUIManager.getGUIType()==PamGUIManager.FX) {
|
||||||
//open FX
|
//open FX
|
||||||
return ((DBGuiFX) getGUI(PamGUIManager.FX)).selectDatabase(PamController.getMainStage(), selectTitle, true);
|
return ((DBGuiFX) getGUI(PamGUIManager.FX)).selectDatabase(PamController.getMainStage(), selectTitle, true);
|
||||||
}
|
}
|
||||||
@ -711,12 +720,13 @@ PamSettingsSource {
|
|||||||
// object and retrieving the name of the first database in the recently-used list. Double-check the connection
|
// object and retrieving the name of the first database in the recently-used list. Double-check the connection
|
||||||
// field - if it's null, it means we don't actually have the database loaded so just clear the name and continue
|
// field - if it's null, it means we don't actually have the database loaded so just clear the name and continue
|
||||||
// (this happens when starting Viewer mode)
|
// (this happens when starting Viewer mode)
|
||||||
String currentDB = databaseSystems.get(dbParameters.getDatabaseSystem()).getDatabaseName();
|
currentDB = databaseSystems.get(dbParameters.getDatabaseSystem()).getDatabaseName();
|
||||||
if (connection==null) {
|
if (connection==null) {
|
||||||
currentDB = null;
|
currentDB = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBParameters newParams = DBDialog.showDialog(this, frame, dbParameters, selectTitle);
|
newParams = DBDialog.showDialog(this, frame, dbParameters, selectTitle);
|
||||||
|
}
|
||||||
if (newParams != null) {
|
if (newParams != null) {
|
||||||
// first, check if there is a Lookup table. If so, make sure to copy the contents over before
|
// first, check if there is a Lookup table. If so, make sure to copy the contents over before
|
||||||
// we lose the reference to the old database
|
// we lose the reference to the old database
|
||||||
@ -757,9 +767,29 @@ PamSettingsSource {
|
|||||||
PamController.getInstance().getUidManager().runStartupChecks(); // if we've loaded a new database, synch the datablocks with the UID info
|
PamController.getInstance().getUidManager().runStartupChecks(); // if we've loaded a new database, synch the datablocks with the UID info
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if a database has been passed to PAMGuard as a parameter from the command line.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DBParameters checkPassedDatabase() {
|
||||||
|
String passedDatabase = GlobalArguments.getParam(DBControl.GlobalDatabaseNameArg);
|
||||||
|
if (passedDatabase != null) {
|
||||||
|
/*
|
||||||
|
* assume it's a file based database. Anything else is going to get more complicated and will require
|
||||||
|
* a fair amount of type checing, connecint to servers, etc.
|
||||||
|
*/
|
||||||
|
if (passedDatabase.endsWith(".sqlite3")) {
|
||||||
|
DBParameters newParams = dbParameters;
|
||||||
|
newParams.setDatabaseName(passedDatabase);
|
||||||
|
newParams.setDatabaseSystem(0);
|
||||||
|
return newParams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set dB paramaters
|
* Set dB paramaters
|
||||||
|
@ -154,6 +154,7 @@ public class Pamguard {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
boolean showSplash = true;
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
int nArgs = args.length;
|
int nArgs = args.length;
|
||||||
int iArg = 0;
|
int iArg = 0;
|
||||||
@ -172,6 +173,9 @@ public class Pamguard {
|
|||||||
runMode = PamController.RUN_NETWORKRECEIVER;
|
runMode = PamController.RUN_NETWORKRECEIVER;
|
||||||
System.out.println("PAMGUARD Network Reciever Mode");
|
System.out.println("PAMGUARD Network Reciever Mode");
|
||||||
}
|
}
|
||||||
|
else if (anArg.equalsIgnoreCase("-nosplash")) {
|
||||||
|
showSplash = false;
|
||||||
|
}
|
||||||
|
|
||||||
// removed SEICHE switch when the two SEICHE modules were converted to plugins
|
// removed SEICHE switch when the two SEICHE modules were converted to plugins
|
||||||
// else if (anArg.equalsIgnoreCase("-seiche")) {
|
// else if (anArg.equalsIgnoreCase("-seiche")) {
|
||||||
@ -383,7 +387,7 @@ public class Pamguard {
|
|||||||
if(runMode == PamController.RUN_REMOTE) {
|
if(runMode == PamController.RUN_REMOTE) {
|
||||||
spashTime = 0;
|
spashTime = 0;
|
||||||
}
|
}
|
||||||
if (spashTime > 0 && (PamGUIManager.getGUIType() != PamGUIManager.NOGUI)) {
|
if (showSplash && spashTime > 0 && (PamGUIManager.getGUIType() != PamGUIManager.NOGUI)) {
|
||||||
new Splash(spashTime, chosenRunMode);
|
new Splash(spashTime, chosenRunMode);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user