Bug fix fro Group loclaiser

Stopped channel error dialog showing for all algorithms
This commit is contained in:
Jamie Mac 2024-04-22 10:49:59 +01:00
parent 6a8593ece8
commit 85ae261a4c
5 changed files with 36 additions and 5 deletions

View File

@ -6,9 +6,8 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-21.0.2.13-hotspot">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>

1
.gitignore vendored
View File

@ -107,3 +107,4 @@ settings.xml
.classpath
.classpath
.classpath
.classpath

View File

@ -10,4 +10,14 @@ public abstract class ToadManagedSettingsPane<S> extends ManagedSettingsPane<S>{
* @return the main tab pane.
*/
public abstract TabPane getTabPane();
/**
* Set whether the pane should show errors. Because there are multiple algorithms that
* will use this pane we do not want to warn for every algorithm only the user selected one.
* @param warn = true to warn errors e.g. show an dialog - false and there are no error warnings.
*/
public abstract void setErrorWarn(boolean warn);
}

View File

@ -34,6 +34,8 @@ public class TOADSettingsPaneWithChannels<T> extends ToadManagedSettingsPane<T>
private Object parent;
private TOADOptionsPane toadOptionsPane;
private boolean warnError = true;
public TOADSettingsPaneWithChannels(Object parent, TOADBaseAlgorithm toadBaseAlgorithm, ManagedSettingsPane<T> toadSettingsPane) {
this.parent = parent;
@ -54,7 +56,11 @@ public class TOADSettingsPaneWithChannels<T> extends ToadManagedSettingsPane<T>
int chMap = channelPanel.getChannelMap();
toadBaseAlgorithm.getToadBaseParams().setChannelBitmap(chMap);
int nSelChannels = PamUtils.getNumChannels(chMap);
if (nSelChannels < 3) {
if (nSelChannels < 3 && warnError) {
/**
* TODO - This is a nasty way of doing this. There should be a validator in this pane which is checked before getParams is called ]
* but that would require a lot of restructuring.
*/
return SwingFXDialogWarning.showWarning(parent, "Channel selection", "Not enough channels selected");
}
TOADBaseParams ans = toadOptionsPane.getParams(toadBaseAlgorithm.getToadBaseParams());
@ -138,4 +144,10 @@ public class TOADSettingsPaneWithChannels<T> extends ToadManagedSettingsPane<T>
public ChannelPanelFX getChannelPanel() {
return channelPanel;
}
@Override
public void setErrorWarn(boolean warn) {
this.warnError = warn;
}
}

View File

@ -338,7 +338,16 @@ public class GroupLocSettingPaneFX extends SettingsPane<Group3DParams>{
if (algoProvider.getSourceSettingsPane(null, currSource)!=null) {
//get the source pane paramters
//set only the selected algorithm to show the user warning sif settings are wrong
if (algorithms.getSelectionModel().getSelectedIndex()==i) {
//this is the currently selected algorithm
algoProvider.getSourceSettingsPane(null, currSource).setErrorWarn(true);
}
else {
algoProvider.getSourceSettingsPane(null, currSource).setErrorWarn(false);
}
//get the source pane paramters.
Serializable newSourceParams = algoProvider.getSourceSettingsPane(null, currSource).getParams();
if (locAlgorithmParams==null) locAlgorithmParams = new LocaliserAlgorithmParams();
@ -350,7 +359,7 @@ public class GroupLocSettingPaneFX extends SettingsPane<Group3DParams>{
currParams.setAlgorithmParams(algoProvider, locAlgorithmParams);
System.out.println("Get params" + algoProvider.getName() + " " + currParams.getAlgorithmParams(algoProvider));
//System.out.println("Get params" + algoProvider.getName() + " " + currParams.getAlgorithmParams(algoProvider));
}