Преглед на файлове

Fixes some bugs

* Infinite Recursion on notifyObservers
* invalid updateCalls
Andreas T. Meyer-Berg преди 6 години
родител
ревизия
584f7569b9

+ 1 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/PacketCollectionManager.java

@@ -99,6 +99,6 @@ public class PacketCollectionManager extends Observable {
 	 */
 	public void notifyObservers(){
 		this.setChanged();
-		this.notifyObservers();
+		this.notifyObservers(null);
 	}
 }

+ 4 - 4
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/EditPacketSniffer.java

@@ -140,7 +140,7 @@ public class EditPacketSniffer extends JDialog implements Observer {
 						 * Set as new PacketAlgorithm
 						 */
 						that.collector.setPacketAlgorithm(p);
-						update(null);
+						update(null,null);
 					} catch (InstantiationException | IllegalAccessException e1) {
 						JOptionPane.showMessageDialog(that, "Instance creation failed: " + e1.getMessage());
 					}
@@ -178,7 +178,7 @@ public class EditPacketSniffer extends JDialog implements Observer {
 				if(it.hasNext()){
 					Link linkToBeRemoved = it.next();
 					captureController.removeLinkFromCollector(collector, linkToBeRemoved);
-					update(null);
+					update(null,null);
 				}
 			}
 		});
@@ -202,12 +202,12 @@ public class EditPacketSniffer extends JDialog implements Observer {
 				if(it.hasNext()){
 					SmartDevice deviceToBeRemoved = it.next();
 					captureController.removeDeviceFromCollector(collector, deviceToBeRemoved);
-					update(null);
+					update(null,null);
 				}
 			}
 		});
 		
-		JButton btnCreatePacketCollector = new JButton("Create Packet Collector");
+		JButton btnCreatePacketCollector = new JButton("Create/Edit Packet Collector");
 		btnCreatePacketCollector.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
 				if(mutex)return;