|
@@ -14,6 +14,8 @@ import javax.swing.JLabel;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JButton;
|
|
|
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
|
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Link;
|
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Port;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
|
|
import java.awt.GridBagLayout;
|
|
import java.awt.GridBagLayout;
|
|
import java.awt.GridBagConstraints;
|
|
import java.awt.GridBagConstraints;
|
|
@@ -64,27 +66,6 @@ public class SmartDeviceCreationPopUp extends JDialog {
|
|
* device should not be added to the controller.
|
|
* device should not be added to the controller.
|
|
*/
|
|
*/
|
|
private boolean edit;
|
|
private boolean edit;
|
|
- /**
|
|
|
|
- * Creates a new SmartDeviceCreationPopUp
|
|
|
|
- *
|
|
|
|
- * @param currentX
|
|
|
|
- * default xPosition of the new SmartDevice
|
|
|
|
- * @param currentY
|
|
|
|
- * default yPosition of the new SmartDevice
|
|
|
|
- * @param maxX
|
|
|
|
- * width of the model
|
|
|
|
- * @param maxY
|
|
|
|
- * hieght of the model
|
|
|
|
- * @param visualisationRadius
|
|
|
|
- * distance from the borders which should be kept
|
|
|
|
- * @param c
|
|
|
|
- * controler which allows manipulation of the model
|
|
|
|
- * @param panel
|
|
|
|
- * Visualisation panel, which represents the SmartDevice
|
|
|
|
- *
|
|
|
|
- * public SmartDeviceCreationPopUp(int currentX, int currentY,
|
|
|
|
- * int maxX, int maxY, int visualisationRadius, Controller c) {
|
|
|
|
- */
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Allows editing/creation of a smartDevice
|
|
* Allows editing/creation of a smartDevice
|
|
@@ -185,10 +166,17 @@ public class SmartDeviceCreationPopUp extends JDialog {
|
|
|
|
|
|
JPanel panelLinks = new JPanel();
|
|
JPanel panelLinks = new JPanel();
|
|
tabbedPane.addTab("Links", null, panelLinks, "Edit Links of the SmartDevice");
|
|
tabbedPane.addTab("Links", null, panelLinks, "Edit Links of the SmartDevice");
|
|
|
|
+ for(Link l:newDevice.getLinks()){
|
|
|
|
+ panelLinks.add(new JLabel(l.getName()));
|
|
|
|
+ }
|
|
|
|
|
|
JPanel panelConnections = new JPanel();
|
|
JPanel panelConnections = new JPanel();
|
|
- tabbedPane.addTab("Connections", null, panelConnections, null);
|
|
|
|
-
|
|
|
|
|
|
+ tabbedPane.addTab("Connections", null, panelConnections, "Edit Connections/Ports/Timings of the SmartDevice");
|
|
|
|
+ for(Port p:newDevice.getPorts()){
|
|
|
|
+ panelConnections.add(new JLabel("Port "+p.getPortNumber()+": "+p.getConnection().getProtocol().getName()+" state:"+Port.statusToString(p.getStatus())+" triggerIntervall:"+p.getTriggerInterval()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
JButton btnCreateDevice = new JButton("Verify & Create SmartDevice");
|
|
JButton btnCreateDevice = new JButton("Verify & Create SmartDevice");
|
|
btnCreateDevice.addActionListener(a -> validateAndAddDevice());
|
|
btnCreateDevice.addActionListener(a -> validateAndAddDevice());
|
|
getContentPane().add(btnCreateDevice, BorderLayout.SOUTH);
|
|
getContentPane().add(btnCreateDevice, BorderLayout.SOUTH);
|