This commit is contained in:
Douglas Gillespie 2023-04-19 09:08:58 +01:00
commit 96d18b85a7
6 changed files with 36 additions and 11 deletions

View File

@ -46,6 +46,8 @@ public class PamCalendar {
public static TimeZone defaultTimeZone = TimeZone.getTimeZone("UTC");
private static TimeZone localTimeZone = TimeZone.getDefault();
public static final long millisPerDay = 1000L*24L*3600L;
@ -174,8 +176,9 @@ public class PamCalendar {
}
public static TimeZone getDisplayTimeZone(boolean useLocal) {
return TimeZone.getTimeZone("UTC");
// return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone;
// return TimeZone.getTimeZone("UTC");
// return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone;
return useLocal ? localTimeZone : defaultTimeZone;
}
public static String formatDateTime(Date date) {

View File

@ -106,6 +106,13 @@ public abstract class DataBlockTableView<T extends PamDataUnit> {
}
}
/**
* Call the table data changed function to update table values.
*/
public void fireTableDataChanged() {
blockTableModel.fireTableDataChanged();
}
public JComponent getComponent() {
return tablePanel;
}
@ -150,13 +157,22 @@ public abstract class DataBlockTableView<T extends PamDataUnit> {
String tip = null;
java.awt.Point p = e.getPoint();
int rowIndex = rowAtPoint(p);
// int column = columnAtPoint(p);
// System.out.println("Get tooltip for row " + rowIndex + " column" + column);
if (rowIndex < 0) {
return null;
}
int colIndex = columnAtPoint(p);
int realColumnIndex = convertColumnIndexToModel(colIndex);
T dataUnit = getDataUnit(rowIndex);
return DataBlockTableView.this.getToolTipText(dataUnit, realColumnIndex);
try {
T dataUnit = getDataUnit(rowIndex);
return DataBlockTableView.this.getToolTipText(dataUnit, realColumnIndex);
}
catch (Exception ex) {
// I once got an index out of bounds here, or it might have been
// a concurrent modification exception ? Either way return null;
return null;
}
}
}
@ -226,13 +242,16 @@ public abstract class DataBlockTableView<T extends PamDataUnit> {
/**
* Get the number of rows in the table - default behaviour is the
* number of rows in the datablock, but this may be overridded if
* number of rows in the datablock, but this may be overridden if
* data are being selected in a different way.
* @return number of table rows to show.
*/
public int getRowCount() {
if (dataUnitCopy == null) {
return 0;
updatePamData();
if (dataUnitCopy == null) {
return 0;
}
}
return dataUnitCopy.size();
}

View File

@ -177,7 +177,7 @@ public class RWEProcess extends PamProcess {
minSoundType = rweControl.rweParameters.minSoundType;
classifier.setSoundData(getSampleRate(), sourceDataBlock.getFftLength(),
sourceDataBlock.getFftHop());
System.out.println("Create right whale channel process " + iChannel);
// System.out.println("Create right whale channel process " + iChannel);
}

View File

@ -46,7 +46,7 @@ public class BinaryStoreProcess extends PamProcess {
startTime = PamCalendar.getTimeInMillis();
long round = binaryStore.binaryStoreSettings.fileSeconds * 1000;
nextFileTime = (startTime/round) * round + round;
System.out.println("Next file start at " + PamCalendar.formatDateTime(nextFileTime));
// System.out.println("Next file start at " + PamCalendar.formatDateTime(nextFileTime));
timer = new Timer();
timer.schedule(new FileTimerTask(), 1000, 1000);

View File

@ -412,8 +412,9 @@ PamSettingsSource {
}
if (dbParameters.getUseAutoCommit() == false) {
// if (dbParameters.getUseAutoCommit() == false) {
JMenuItem commitItem = new JMenuItem("Commit Changes");
commitItem.setEnabled(dbParameters.getUseAutoCommit() == false);
commitItem.setToolTipText("Immediately commit recent changes to the database");
commitItem.addActionListener(new ActionListener() {
@Override
@ -422,7 +423,7 @@ PamSettingsSource {
}
});
menu.add(commitItem);
}
// }
if (SMRUEnable.isEnable()) {
JMenuItem speedMenu = new JMenuItem("Test database speed");

View File

@ -279,7 +279,9 @@ public class SqliteSystem extends DBSystem implements PamSettings {
{
if(connection != null){
// if (USEAUTOCOMMIT == false) {
connection.getConnection().commit();
if (connection.getConnection().getAutoCommit()) {
connection.getConnection().commit();
}
// }
connection.getConnection().close();
}