Skip to content
Snippets Groups Projects
Commit 8d1ca428 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

current config can't be modified (SCAN-968)

parent 0e963dab
Branches
Tags
No related merge requests found
......@@ -1558,20 +1558,20 @@ public class FlyScanTangoBox extends AbstractTangoBox {
* @param configuration Configuration
* @param plugins
* @param categories
* @param isExpert
* @param isEnabled
* @param expert
* @param enabled
* @return
*/
protected ConfigurationGUIContainer createConfigurationGUI(Configuration configuration, Collection<Plugin> plugins,
Map<PluginType, Collection<Plugin>> categories, final boolean isExpert, boolean isEnabled) {
Map<PluginType, Collection<Plugin>> categories, final boolean expert, boolean enabled) {
final ConfigurationGUIContainer container;
if (configuration == null) {
container = null;
} else {
final JPanel headerPanel = createHeaderPanel();
final JPanel errorPanel = createErrorPanel(headerPanel);
ConfigurationGUI panel = new ConfigurationGUI(configuration, plugins, categories, errorPanel, isExpert,
isEnabled, isEasyConfigOnly());
ConfigurationGUI panel = new ConfigurationGUI(configuration, plugins, categories, errorPanel, expert,
enabled, isEasyConfigOnly());
return new ConfigurationGUIContainer(panel, headerPanel, errorPanel);
}
return container;
......@@ -1983,12 +1983,9 @@ public class FlyScanTangoBox extends AbstractTangoBox {
final boolean withProgressDialog) {
// If configuration is already displayed, just select its tab
final int index = getConfigurationTabIndex(Utilities.CURRENT_CONFIG);
if (index == -1) {
readAndParseCurrentConfig(isExpert, index, withProgressDialog);
} else if (removeFormerTab) {
JPanel panelLoading = new JPanel();
panelLoading.setLayout(new BorderLayout());
JLabel labelLoading = new JLabel(Utilities.LOADING_ICON);
......@@ -2042,19 +2039,14 @@ public class FlyScanTangoBox extends AbstractTangoBox {
panel = entry.getKey();
headerPanel = entry.getValue();
}
if (panel != null && headerPanel != null) {
if ((panel != null) && (headerPanel != null)) {
String title = panel.getConfiguration().getName();
// Delete config not allowed for mock configurations
configTabbedPane.addTabWithHeader(title, panel, headerPanel, index, true,
createReloadListener(isExpert, title), null);
configTabbedPane.setSelectedComponent(panel);
} else {
configTabbedPane.addEmptyConfigTab(Utilities.CURRENT_CONFIG, index);
}
} catch (InterruptedException e) {
LOGGER.warn(String.format(Utilities.getMessage("flyscan.configuration.update.cancelled"),
......@@ -2254,15 +2246,15 @@ public class FlyScanTangoBox extends AbstractTangoBox {
if (startAllowed) {
final int selectedIndex = configTabbedPane.getSelectedIndex();
boolean atLeastOneTabisDisplayed = (selectedIndex > -1);
boolean currentConfigPaneisSelected = false;
boolean currentConfigPanelisSelected = false;
// If current config tab is selected, disable start button
if (selectedIndex > -1) {
String title = configTabbedPane.getConfigNameAt(selectedIndex);
if ((title != null) && (title.equalsIgnoreCase(Utilities.CURRENT_CONFIG))) {
currentConfigPaneisSelected = true;
currentConfigPanelisSelected = true;
}
}
if (atLeastOneTabisDisplayed && !(currentConfigPaneisSelected)) {
if (atLeastOneTabisDisplayed && !(currentConfigPanelisSelected)) {
startButton.setEnabled(true);
startButton.setToolTipText(START_SELECTED_CONFIG);
} else {
......@@ -3256,16 +3248,6 @@ public class FlyScanTangoBox extends AbstractTangoBox {
protected boolean isExpert, closeDialog;
protected ConfigurationGUIContainer guiContainer;
@Override
public void setCanceled(boolean canceled) {
this.canceled = canceled;
}
@Override
public boolean isCanceled() {
return canceled;
}
public AConfigGUIBuilder(String configName, int index, boolean isExpert, boolean closeDialog) {
super();
this.configName = configName;
......@@ -3297,6 +3279,16 @@ public class FlyScanTangoBox extends AbstractTangoBox {
displayErrorMessage(String.format(Utilities.getMessage("flyscan.configuration.read"), configName), message);
}
@Override
public void setCanceled(boolean canceled) {
this.canceled = canceled;
}
@Override
public boolean isCanceled() {
return canceled;
}
@Override
protected ConfigurationGUIContainer doInBackground() throws Exception {
ConfigurationGUIContainer guiContainer = null;
......@@ -3336,7 +3328,8 @@ public class FlyScanTangoBox extends AbstractTangoBox {
// Create configuration GUI for edition
if (!canceled) {
guiContainer = createConfigurationGUI(configuration, plugins, categories, isExpert, true);
guiContainer = createConfigurationGUI(configuration, plugins, categories, isExpert,
shouldCheckConfig());
this.guiContainer = guiContainer;
}
}
......@@ -3406,6 +3399,7 @@ public class FlyScanTangoBox extends AbstractTangoBox {
configTabbedPane.addEmptyConfigTab(Utilities.CURRENT_CONFIG, index);
}
}
}
protected class MockConfigGUIBuilder extends AConfigGUIBuilder {
......
......@@ -191,7 +191,6 @@ public class ConfigurationGUI extends JPanel {
final Map<PluginType, Collection<Plugin>> categories, final JPanel errorPanel, final boolean expert,
final boolean enabled, final boolean easyConfigOnly) {
super(new BorderLayout());
errorsMap = new HashMap<>();
recordingComponents = new HashMap<>();
errorLabels = new WeakHashMap<>();
......
......@@ -18,7 +18,7 @@ import fr.soleil.flyscan.gui.view.renderer.DeviceRenderer;
*/
public class DeviceComboBox extends JPanel {
private static final long serialVersionUID = 3948463451256460573L;
private static final long serialVersionUID = -3316002271693802523L;
private final ComboBox deviceBox;
private final JButton deviceButton;
......@@ -49,4 +49,12 @@ public class DeviceComboBox extends JPanel {
public JButton getDeviceButton() {
return deviceButton;
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (deviceBox != null) {
deviceBox.setEnabled(enabled);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment