mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Fix small bugs
This commit is contained in:
parent
3e4dd77908
commit
639f33607e
@ -318,6 +318,9 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
|
||||
}
|
||||
selection = folderInputParameters.getSelectedFiles();
|
||||
}
|
||||
if (selection == null) {
|
||||
return 0;
|
||||
}
|
||||
if (selection.length > 0) {
|
||||
System.out.println("FolderInputSystem.makeSelFileList(): Searching for sound files in " + selection[0]);
|
||||
}
|
||||
|
@ -1096,6 +1096,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana
|
||||
return;
|
||||
}
|
||||
ds = dataBlock.getDataSelector(simpleMapRef.getUnitName(), false, DATASELECTNAME);
|
||||
// ds = null;
|
||||
ArrayList<PamDataUnit> dataCopy = dataBlock.getDataCopy(earliestToPlot, now, true, ds);
|
||||
duIterator = dataCopy.listIterator();
|
||||
while (duIterator.hasNext()) {
|
||||
|
@ -614,6 +614,32 @@ public class FormsControl extends PamControlledUnit {
|
||||
return new ModuleStatus(ModuleStatus.STATUS_OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Some things that are meant to be boolean are coming out as int or string so
|
||||
* need to do some type checking.
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Boolean checkBadBoolean(Object value) {
|
||||
if (value instanceof Boolean) {
|
||||
return (Boolean) value;
|
||||
}
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
String str = (String) value;
|
||||
str = str.strip();
|
||||
return str.equals("1") || str.toLowerCase().equals("false");
|
||||
}
|
||||
if (value instanceof Integer) {
|
||||
int val = (Integer) value;
|
||||
return val != 0;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public Serializable getSettingsReference() {
|
||||
// return (Serializable) dummyParams;
|
||||
|
@ -213,7 +213,7 @@ public class FormsDataDisplayTable {
|
||||
if (getColumnClass(columnIndex) == Boolean.class) {
|
||||
if (value instanceof Boolean == false) {
|
||||
// System.out.println("Bad boolean value: " + value);
|
||||
return interpretBadBoolean(value);
|
||||
return FormsControl.checkBadBoolean(value);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
@ -260,23 +260,6 @@ public class FormsDataDisplayTable {
|
||||
}
|
||||
|
||||
|
||||
public Boolean interpretBadBoolean(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
String str = (String) value;
|
||||
str = str.strip();
|
||||
return str.equals("1") || str.toLowerCase().equals("false");
|
||||
}
|
||||
if (value instanceof Integer) {
|
||||
int val = (Integer) value;
|
||||
return val != 0;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when data have changed in the datablock.
|
||||
|
@ -9,6 +9,7 @@ import NMEA.NMEADataBlock;
|
||||
import NMEA.NMEADataUnit;
|
||||
import PamView.dialog.PamCheckBox;
|
||||
import PamView.dialog.PamLabel;
|
||||
import loggerForms.FormsControl;
|
||||
import loggerForms.LoggerForm;
|
||||
import loggerForms.controlDescriptions.ControlDescription;
|
||||
|
||||
@ -41,7 +42,7 @@ public class CheckboxControl extends LoggerControl {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
checkBox.setSelected((Boolean) data);
|
||||
checkBox.setSelected(FormsControl.checkBadBoolean(data));
|
||||
}
|
||||
catch(ClassCastException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -70,7 +70,7 @@ public class FormDataSelector extends DataSelector {
|
||||
@Override
|
||||
public double scoreData(PamDataUnit pamDataUnit) {
|
||||
if (controlDataSelector == null) {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
Object[] formData = null;
|
||||
if (pamDataUnit instanceof FormsDataUnit) {
|
||||
|
Loading…
Reference in New Issue
Block a user