|
@@ -12,6 +12,7 @@ import javax.swing.JSlider;
|
|
|
import javax.swing.JTabbedPane;
|
|
|
import javax.swing.SwingConstants;
|
|
|
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.ConfigurationController;
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
|
|
|
@@ -23,11 +24,13 @@ import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
|
public class SettingsPopUp extends JFrame {
|
|
|
Model model;
|
|
|
Controller controller;
|
|
|
+ ConfigurationController config;
|
|
|
|
|
|
public SettingsPopUp(Model model, Controller controller) {
|
|
|
setBounds(new Rectangle(0, 0, 450, 300));
|
|
|
this.model = model;
|
|
|
this.controller = controller;
|
|
|
+ this.config = controller.getControllerConfiguration();
|
|
|
|
|
|
setTitle("Settings");
|
|
|
setIconImage(Toolkit.getDefaultToolkit().getImage(SettingsPopUp.class.getResource("/images/settings.png")));
|
|
@@ -54,32 +57,42 @@ public class SettingsPopUp extends JFrame {
|
|
|
sliderRadius.setMajorTickSpacing(18);
|
|
|
sliderRadius.setMaximum(110);
|
|
|
sliderRadius.setMinimum(2);
|
|
|
- sliderRadius.setValue(controller.getDevice_visualization_radius());
|
|
|
+ sliderRadius.setValue(config.getDeviceVisualizationRadius());
|
|
|
sliderRadius.setBounds(135, 13, 280, 45);
|
|
|
pVisualisation.add(sliderRadius);
|
|
|
sliderRadius.addChangeListener(a -> {
|
|
|
- controller.setDevice_visualization_radius(sliderRadius.getValue());
|
|
|
+ config.setDeviceVisualizationRadius(sliderRadius.getValue());
|
|
|
controller.notifyObservers();
|
|
|
});
|
|
|
|
|
|
JCheckBox chckbxTerminatedConnections = new JCheckBox("Show terminated connections");
|
|
|
chckbxTerminatedConnections.setBounds(8, 67, 197, 25);
|
|
|
+ chckbxTerminatedConnections.setSelected(config.isShowTerminatedConnections());
|
|
|
+ chckbxTerminatedConnections.addActionListener(a->config.setShowTerminatedConnections(chckbxTerminatedConnections.isSelected()));
|
|
|
pVisualisation.add(chckbxTerminatedConnections);
|
|
|
|
|
|
JCheckBox chckbxDeviceNames = new JCheckBox("Show SmartDevice names");
|
|
|
chckbxDeviceNames.setBounds(8, 127, 197, 25);
|
|
|
+ chckbxDeviceNames.setSelected(config.isShowSmartDeviceNames());
|
|
|
+ chckbxDeviceNames.addActionListener(a->config.setShowSmartDeviceNames(chckbxDeviceNames.isSelected()));
|
|
|
pVisualisation.add(chckbxDeviceNames);
|
|
|
|
|
|
JCheckBox chckbxConnections = new JCheckBox("Show connections");
|
|
|
chckbxConnections.setBounds(237, 67, 182, 25);
|
|
|
+ chckbxConnections.setSelected(config.isShowConnections());
|
|
|
+ chckbxConnections.addActionListener(a->config.setShowConnections(chckbxConnections.isSelected()));
|
|
|
pVisualisation.add(chckbxConnections);
|
|
|
|
|
|
JCheckBox chckbxLinks = new JCheckBox("Show links");
|
|
|
chckbxLinks.setBounds(237, 97, 178, 25);
|
|
|
+ chckbxLinks.setSelected(config.isShowLinks());
|
|
|
+ chckbxLinks.addActionListener(a->config.setShowLinks(chckbxLinks.isSelected()));
|
|
|
pVisualisation.add(chckbxLinks);
|
|
|
|
|
|
JCheckBox chckbxSmartdevices = new JCheckBox("Show SmartDevices");
|
|
|
chckbxSmartdevices.setBounds(8, 97, 197, 25);
|
|
|
+ chckbxSmartdevices.setSelected(config.isShowSmartDevices());
|
|
|
+ chckbxSmartdevices.addActionListener(a->config.setShowSmartDevices(chckbxSmartdevices.isSelected()));
|
|
|
pVisualisation.add(chckbxSmartdevices);
|
|
|
|
|
|
JPanel pImports = new JPanel();
|