|
@@ -0,0 +1,72 @@
|
|
|
|
+package de.tu_darmstadt.tk.SmartHomeNetworkSim.view.popups;
|
|
|
|
+
|
|
|
|
+import javax.swing.JFrame;
|
|
|
|
+
|
|
|
|
+import java.awt.BorderLayout;
|
|
|
|
+
|
|
|
|
+import javax.swing.JTabbedPane;
|
|
|
|
+import javax.swing.JPanel;
|
|
|
|
+
|
|
|
|
+import java.awt.Toolkit;
|
|
|
|
+
|
|
|
|
+import javax.swing.JLabel;
|
|
|
|
+import javax.swing.JSlider;
|
|
|
|
+
|
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
|
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
|
|
+import java.awt.Rectangle;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * PopUp to display and edit the settings
|
|
|
|
+ *
|
|
|
|
+ * @author Andreas T. Meyer-Berg
|
|
|
|
+ */
|
|
|
|
+public class SettingsPopUp extends JFrame {
|
|
|
|
+ Model model;
|
|
|
|
+ Controller controller;
|
|
|
|
+
|
|
|
|
+ public SettingsPopUp(Model model, Controller controller) {
|
|
|
|
+ setBounds(new Rectangle(0, 0, 450, 300));
|
|
|
|
+ this.model = model;
|
|
|
|
+ this.controller = controller;
|
|
|
|
+
|
|
|
|
+ setTitle("Settings");
|
|
|
|
+ setIconImage(Toolkit.getDefaultToolkit().getImage(SettingsPopUp.class.getResource("/images/settings.png")));
|
|
|
|
+
|
|
|
|
+ JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
|
|
+ getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
|
|
|
+
|
|
|
|
+ JPanel pVisualisation = new JPanel();
|
|
|
|
+ tabbedPane.addTab("Visualization", null, pVisualisation, null);
|
|
|
|
+ pVisualisation.setLayout(null);
|
|
|
|
+
|
|
|
|
+ JLabel lblVisualisationSize = new JLabel("Visualization Radius:");
|
|
|
|
+ lblVisualisationSize.setBounds(12, 13, 125, 16);
|
|
|
|
+ pVisualisation.add(lblVisualisationSize);
|
|
|
|
+
|
|
|
|
+ JSlider slider = new JSlider();
|
|
|
|
+ slider.setPaintLabels(true);
|
|
|
|
+ slider.setPaintTicks(true);
|
|
|
|
+ slider.setMajorTickSpacing(18);
|
|
|
|
+ slider.setMaximum(110);
|
|
|
|
+ slider.setMinimum(2);
|
|
|
|
+ slider.setValue(controller.getDevice_visualization_radius());
|
|
|
|
+ slider.setBounds(135, 13, 280, 45);
|
|
|
|
+ pVisualisation.add(slider);
|
|
|
|
+ slider.addChangeListener(a -> {
|
|
|
|
+ controller.setDevice_visualization_radius(slider.getValue());
|
|
|
|
+ controller.notifyObservers();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ JPanel pImports = new JPanel();
|
|
|
|
+ tabbedPane.addTab("Imports", null, pImports, null);
|
|
|
|
+
|
|
|
|
+ JPanel pSimulation = new JPanel();
|
|
|
|
+ tabbedPane.addTab("Simulation", null, pSimulation, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ private static final long serialVersionUID = -7638231800254589350L;
|
|
|
|
+}
|