mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
Fix settings load.
Problems in viewer mode with long (>50char) settings names which don't get fully stored in the database. Fixed by only looking at the start of the name. Better to not use such long names.
This commit is contained in:
parent
2721095a03
commit
c36ad2a33a
@ -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;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* some of the settings names used in Viewer mode have become too long, notably
|
||||||
|
* in some data selectors which are using a datablocks long data name. This
|
||||||
|
* screws things up, so moving to a begins with rather than equals for the name.
|
||||||
|
*/
|
||||||
|
String name = settingsUser.getUnitName();
|
||||||
|
String type = settingsUser.getUnitType();
|
||||||
|
long version = settingsUser.getSettingsVersion();
|
||||||
|
|
||||||
if (settings.getUnitName().equals(settingsUser.getUnitName())
|
if (settings.getUnitType().equals(type)
|
||||||
&& settings.getUnitType().equals(settingsUser.getUnitType())
|
&& settings.versionNo == version){
|
||||||
&& settings.versionNo == settingsUser.getSettingsVersion()){
|
if (name.startsWith(settings.getUnitName())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -201,10 +201,11 @@ public abstract class DataSelectorCreator implements PamSettings {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CompoundDataSelector selector = new CompoundDataSelector(pamDataBlock, allSelectors, selectorName, allowScores, selectorType);
|
CompoundDataSelector selector = new CompoundDataSelector(pamDataBlock, allSelectors, selectorName, allowScores, selectorType);
|
||||||
DataSelectParams params = dataSelectorSettings.getParams(selectorName);
|
// not needed since it get's done after this call anyway.
|
||||||
if (params instanceof CompoundParams) {
|
// DataSelectParams params = dataSelectorSettings.getParams(selectorName);
|
||||||
selector.setParams(params);
|
// if (params instanceof CompoundParams) {
|
||||||
}
|
// selector.setParams(params);
|
||||||
|
// }
|
||||||
|
|
||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user