|
@@ -13,7 +13,6 @@ import javax.swing.SwingConstants;
|
|
|
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.SettingsController;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.SettingsController;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
|
|
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.view.util.Utility;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.view.util.Utility;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -22,36 +21,51 @@ import de.tu_darmstadt.tk.SmartHomeNetworkSim.view.util.Utility;
|
|
* @author Andreas T. Meyer-Berg
|
|
* @author Andreas T. Meyer-Berg
|
|
*/
|
|
*/
|
|
public class SettingsPopUp extends JFrame {
|
|
public class SettingsPopUp extends JFrame {
|
|
- Model model;
|
|
|
|
- Controller controller;
|
|
|
|
- SettingsController config;
|
|
|
|
-
|
|
|
|
- public SettingsPopUp(Model model, Controller controller) {
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Main Controller
|
|
|
|
+ */
|
|
|
|
+ private Controller controller;
|
|
|
|
+ /**
|
|
|
|
+ * Settings controller
|
|
|
|
+ */
|
|
|
|
+ private SettingsController config;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Creates a SettingsPopUp
|
|
|
|
+ *
|
|
|
|
+ * @param controller
|
|
|
|
+ * controller which should manipulate the model
|
|
|
|
+ */
|
|
|
|
+ public SettingsPopUp(Controller controller) {
|
|
setBounds(new Rectangle(0, 0, 450, 300));
|
|
setBounds(new Rectangle(0, 0, 450, 300));
|
|
- this.model = model;
|
|
|
|
this.controller = controller;
|
|
this.controller = controller;
|
|
- this.config = controller.getSettingsController();
|
|
|
|
-
|
|
|
|
|
|
+ this.config = this.controller.getSettingsController();
|
|
|
|
+
|
|
setTitle("Settings");
|
|
setTitle("Settings");
|
|
setIconImage(Utility.loadFile("/images/settings.png"));
|
|
setIconImage(Utility.loadFile("/images/settings.png"));
|
|
-
|
|
|
|
|
|
+
|
|
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
|
getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Visualization Radius Settings
|
|
|
|
+ ****************************************************************************/
|
|
JPanel pVisualisation = new JPanel();
|
|
JPanel pVisualisation = new JPanel();
|
|
tabbedPane.addTab("Visualization", null, pVisualisation, null);
|
|
tabbedPane.addTab("Visualization", null, pVisualisation, null);
|
|
pVisualisation.setLayout(null);
|
|
pVisualisation.setLayout(null);
|
|
-
|
|
|
|
|
|
+
|
|
JLabel lblVisualisationSize = new JLabel("Visualization Radius:");
|
|
JLabel lblVisualisationSize = new JLabel("Visualization Radius:");
|
|
lblVisualisationSize.setBounds(12, 13, 125, 16);
|
|
lblVisualisationSize.setBounds(12, 13, 125, 16);
|
|
- lblVisualisationSize.setToolTipText("<html>Radius of the SmartDevice Visualization, which is half of the Device width.</html>");
|
|
|
|
|
|
+ lblVisualisationSize
|
|
|
|
+ .setToolTipText("<html>Radius of the SmartDevice Visualization, which is half of the Device width.</html>");
|
|
pVisualisation.add(lblVisualisationSize);
|
|
pVisualisation.add(lblVisualisationSize);
|
|
-
|
|
|
|
|
|
+
|
|
JLabel lblradiusInPixels = new JLabel("(Radius in pixels:)");
|
|
JLabel lblradiusInPixels = new JLabel("(Radius in pixels:)");
|
|
lblradiusInPixels.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
lblradiusInPixels.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
lblradiusInPixels.setBounds(12, 43, 118, 16);
|
|
lblradiusInPixels.setBounds(12, 43, 118, 16);
|
|
pVisualisation.add(lblradiusInPixels);
|
|
pVisualisation.add(lblradiusInPixels);
|
|
-
|
|
|
|
|
|
+
|
|
JSlider sliderRadius = new JSlider();
|
|
JSlider sliderRadius = new JSlider();
|
|
sliderRadius.setPaintLabels(true);
|
|
sliderRadius.setPaintLabels(true);
|
|
sliderRadius.setPaintTicks(true);
|
|
sliderRadius.setPaintTicks(true);
|
|
@@ -65,58 +79,94 @@ public class SettingsPopUp extends JFrame {
|
|
config.setDeviceVisualizationRadius(sliderRadius.getValue());
|
|
config.setDeviceVisualizationRadius(sliderRadius.getValue());
|
|
controller.notifyObservers();
|
|
controller.notifyObservers();
|
|
});
|
|
});
|
|
-
|
|
|
|
- JCheckBox chckbxTerminatedConnections = new JCheckBox("Show terminated connections");
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show Terminated Connections Settings
|
|
|
|
+ ****************************************************************************/
|
|
|
|
+ JCheckBox chckbxTerminatedConnections = new JCheckBox(
|
|
|
|
+ "Show terminated connections");
|
|
chckbxTerminatedConnections.setBounds(8, 67, 197, 25);
|
|
chckbxTerminatedConnections.setBounds(8, 67, 197, 25);
|
|
- chckbxTerminatedConnections.setSelected(config.isShowTerminatedConnections());
|
|
|
|
- chckbxTerminatedConnections.addActionListener(a->config.setShowTerminatedConnections(chckbxTerminatedConnections.isSelected()));
|
|
|
|
- chckbxTerminatedConnections.setToolTipText("<html>True if connections to devices, which were removed from the connection,<br> should be shown until the terminating packages of this device were sent.</html>");
|
|
|
|
|
|
+ chckbxTerminatedConnections.setSelected(config
|
|
|
|
+ .isShowTerminatedConnections());
|
|
|
|
+ chckbxTerminatedConnections.addActionListener(a -> config
|
|
|
|
+ .setShowTerminatedConnections(chckbxTerminatedConnections
|
|
|
|
+ .isSelected()));
|
|
|
|
+ chckbxTerminatedConnections
|
|
|
|
+ .setToolTipText("<html>True if connections to devices, which were removed from the connection,<br> should be shown until the terminating packages of this device were sent.</html>");
|
|
pVisualisation.add(chckbxTerminatedConnections);
|
|
pVisualisation.add(chckbxTerminatedConnections);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show Connections Settings
|
|
|
|
+ ****************************************************************************/
|
|
JCheckBox chckbxConnections = new JCheckBox("Show connections");
|
|
JCheckBox chckbxConnections = new JCheckBox("Show connections");
|
|
chckbxConnections.setBounds(237, 67, 182, 25);
|
|
chckbxConnections.setBounds(237, 67, 182, 25);
|
|
chckbxConnections.setSelected(config.isShowConnections());
|
|
chckbxConnections.setSelected(config.isShowConnections());
|
|
- chckbxConnections.addActionListener(a->config.setShowConnections(chckbxConnections.isSelected()));
|
|
|
|
- chckbxConnections.setToolTipText("True if connections (Services/Connections) should be shown on the Visualization Panel.");
|
|
|
|
|
|
+ chckbxConnections.addActionListener(a -> config
|
|
|
|
+ .setShowConnections(chckbxConnections.isSelected()));
|
|
|
|
+ chckbxConnections
|
|
|
|
+ .setToolTipText("True if connections (Services/Connections) should be shown on the Visualization Panel.");
|
|
pVisualisation.add(chckbxConnections);
|
|
pVisualisation.add(chckbxConnections);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show Links Settings
|
|
|
|
+ ****************************************************************************/
|
|
JCheckBox chckbxLinks = new JCheckBox("Show links");
|
|
JCheckBox chckbxLinks = new JCheckBox("Show links");
|
|
chckbxLinks.setBounds(237, 97, 178, 25);
|
|
chckbxLinks.setBounds(237, 97, 178, 25);
|
|
chckbxLinks.setSelected(config.isShowLinks());
|
|
chckbxLinks.setSelected(config.isShowLinks());
|
|
- chckbxLinks.addActionListener(a->config.setShowLinks(chckbxLinks.isSelected()));
|
|
|
|
- chckbxLinks.setToolTipText("<html>True if Links (Mediums of physical connection for devices like Wifi, Ethernet, Zigbee),<br> should be visualized (As part of the Circle around the Devices)</html>");
|
|
|
|
|
|
+ chckbxLinks.addActionListener(a -> config.setShowLinks(chckbxLinks
|
|
|
|
+ .isSelected()));
|
|
|
|
+ chckbxLinks
|
|
|
|
+ .setToolTipText("<html>True if Links (Mediums of physical connection for devices like Wifi, Ethernet, Zigbee),<br> should be visualized (As part of the Circle around the Devices)</html>");
|
|
pVisualisation.add(chckbxLinks);
|
|
pVisualisation.add(chckbxLinks);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show Link Tool Tips Settings
|
|
|
|
+ ****************************************************************************/
|
|
JCheckBox chckbxLinkToolTips = new JCheckBox("Show link ToolTips");
|
|
JCheckBox chckbxLinkToolTips = new JCheckBox("Show link ToolTips");
|
|
chckbxLinkToolTips.setBounds(237, 127, 178, 25);
|
|
chckbxLinkToolTips.setBounds(237, 127, 178, 25);
|
|
chckbxLinkToolTips.setSelected(config.isShowLinkToolTips());
|
|
chckbxLinkToolTips.setSelected(config.isShowLinkToolTips());
|
|
- chckbxLinkToolTips.addActionListener(a->config.setShowLinkToolTips(chckbxLinkToolTips.isSelected()));
|
|
|
|
- chckbxLinkToolTips.setToolTipText("True if the link name should be shown on, when the mouse hovers over the link");
|
|
|
|
|
|
+ chckbxLinkToolTips.addActionListener(a -> config
|
|
|
|
+ .setShowLinkToolTips(chckbxLinkToolTips.isSelected()));
|
|
|
|
+ chckbxLinkToolTips
|
|
|
|
+ .setToolTipText("True if the link name should be shown on, when the mouse hovers over the link");
|
|
pVisualisation.add(chckbxLinkToolTips);
|
|
pVisualisation.add(chckbxLinkToolTips);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show SmartDevices Settings
|
|
|
|
+ ****************************************************************************/
|
|
JCheckBox chckbxSmartdevices = new JCheckBox("Show SmartDevices");
|
|
JCheckBox chckbxSmartdevices = new JCheckBox("Show SmartDevices");
|
|
chckbxSmartdevices.setBounds(8, 97, 197, 25);
|
|
chckbxSmartdevices.setBounds(8, 97, 197, 25);
|
|
chckbxSmartdevices.setSelected(config.isShowSmartDevices());
|
|
chckbxSmartdevices.setSelected(config.isShowSmartDevices());
|
|
- chckbxSmartdevices.addActionListener(a->config.setShowSmartDevices(chckbxSmartdevices.isSelected()));
|
|
|
|
- chckbxSmartdevices.setToolTipText("True if SmartDevices should be shown (Circles on the VisualizationPanel)");
|
|
|
|
|
|
+ chckbxSmartdevices.addActionListener(a -> config
|
|
|
|
+ .setShowSmartDevices(chckbxSmartdevices.isSelected()));
|
|
|
|
+ chckbxSmartdevices
|
|
|
|
+ .setToolTipText("True if SmartDevices should be shown (Circles on the VisualizationPanel)");
|
|
pVisualisation.add(chckbxSmartdevices);
|
|
pVisualisation.add(chckbxSmartdevices);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show SmartDevice Names Settings
|
|
|
|
+ ****************************************************************************/
|
|
JCheckBox chckbxDeviceNames = new JCheckBox("Show SmartDevice names");
|
|
JCheckBox chckbxDeviceNames = new JCheckBox("Show SmartDevice names");
|
|
chckbxDeviceNames.setBounds(8, 127, 197, 25);
|
|
chckbxDeviceNames.setBounds(8, 127, 197, 25);
|
|
chckbxDeviceNames.setSelected(config.isShowSmartDeviceNames());
|
|
chckbxDeviceNames.setSelected(config.isShowSmartDeviceNames());
|
|
- chckbxDeviceNames.addActionListener(a->config.setShowSmartDeviceNames(chckbxDeviceNames.isSelected()));
|
|
|
|
- chckbxDeviceNames.setToolTipText("True if SmartDevice names should be shown");
|
|
|
|
|
|
+ chckbxDeviceNames.addActionListener(a -> config
|
|
|
|
+ .setShowSmartDeviceNames(chckbxDeviceNames.isSelected()));
|
|
|
|
+ chckbxDeviceNames
|
|
|
|
+ .setToolTipText("True if SmartDevice names should be shown");
|
|
pVisualisation.add(chckbxDeviceNames);
|
|
pVisualisation.add(chckbxDeviceNames);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /****************************************************************************
|
|
|
|
+ * Show Further tabs for: Imports, Simulation, Graphics e.g.
|
|
|
|
+ ****************************************************************************/
|
|
/**
|
|
/**
|
|
* Unused Tabs for further settings
|
|
* Unused Tabs for further settings
|
|
**
|
|
**
|
|
- JPanel pImports = new JPanel();
|
|
|
|
- tabbedPane.addTab("Imports", null, pImports, null);
|
|
|
|
-
|
|
|
|
- JPanel pSimulation = new JPanel();
|
|
|
|
- tabbedPane.addTab("Simulation", null, pSimulation, null);
|
|
|
|
- */
|
|
|
|
|
|
+ * JPanel pImports = new JPanel(); tabbedPane.addTab("Imports", null,
|
|
|
|
+ * pImports, null);
|
|
|
|
+ *
|
|
|
|
+ * JPanel pSimulation = new JPanel(); tabbedPane.addTab("Simulation",
|
|
|
|
+ * null, pSimulation, null);
|
|
|
|
+ */
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|