浏览代码

Adds SimulationController

Andreas T. Meyer-Berg 5 年之前
父节点
当前提交
bf814621dc

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

@@ -54,7 +54,7 @@ public class Main {
 		m = new Model();
 		controller = new Controller(m);
 		c = controller.getNetworkController();
-		conf = controller.getControllerConfiguration();
+		conf = controller.getSettingsController();
 	    //initializeTest();
 	    initializeMQTTTest();
 	    v = new MainFrame(m, controller);

+ 21 - 32
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/control/Controller.java

@@ -2,11 +2,7 @@ package de.tu_darmstadt.tk.SmartHomeNetworkSim.control;
 
 import java.util.Observer;
 
-
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Port;
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SimulationManager;
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
 
 /**
  * Controller which allows interaction with the Model and Simulation
@@ -17,7 +13,7 @@ public class Controller {
 	/**
 	 * {@link Model} which stores the smart home model
 	 */
-	private Model model;
+	Model model;
 	
 	/**
 	 * Controller for Import of user defined java classes
@@ -25,7 +21,7 @@ public class Controller {
 	private ImportController importController;
 	
 	/**
-	 * Controller which allows configuration of the program
+	 * Controller which allows configuration of the program e.g. settings
 	 */
 	private SettingsController settingsController;
 	
@@ -34,6 +30,11 @@ public class Controller {
 	 */
 	private NetworkController networkController;
 	
+	/**
+	 * SimulationController which controls the simulation
+	 */
+	private SimulationController simulationController;
+	
 	/**
 	 * Create a new Controller, which controls the given model and allows
 	 * manipulation of this model
@@ -46,6 +47,7 @@ public class Controller {
 		settingsController = new SettingsController(this.model, this);
 		importController = new ImportController(this.model, this);
 		networkController = new NetworkController(this.model, this);
+		simulationController = new SimulationController(this.model, this);
 	}
 	
 	/**
@@ -53,26 +55,34 @@ public class Controller {
 	 * which can be used in the framework
 	 * @return {@link ImportController}
 	 */
-	public ImportController getControllerImport(){
+	public ImportController getImportController(){
 		return importController;
 	}
 	
 	/**
-	 * Returns the controller responsible for configuration of the program
+	 * Returns the controller responsible for configuration of the program, e.g. changing the settings 
 	 * @return {@link SettingsController}
 	 */
-	public SettingsController getControllerConfiguration(){
+	public SettingsController getSettingsController(){
 		return settingsController;
 	}
 	
 	/**
-	 * Return the controller, managing the networkModel
-	 * @return
+	 * Return the controller, which manages the network Model
+	 * @return {@link NetworkController} 
 	 */
 	public NetworkController getNetworkController(){
 		return networkController;
 	}
 	
+	/**
+	 * Return the simulation controller, to manage the simulation
+	 * @return
+	 */
+	public SimulationController getSimulationController(){
+		return simulationController;
+	}
+	
 	/**
 	 * Notifies Observer, which may update their visualization/state
 	 */
@@ -98,25 +108,4 @@ public class Controller {
 	public void removeObserver(Observer observer){
 		model.deleteObserver(observer);
 	}
-		
-	// TODO: Maybe Settings controller ? 
-	/**
-	 * Reset Simulation 
-	 * 
-	 * @param timestep
-	 */
-	public void resetSimulation(long timestep){
-		for(SmartDevice d: model.getDevices())
-			for(Port p:d.getPorts())
-				if(p.getLastTrigger()>timestep)
-					p.setLastTrigger(timestep);
-	}
-	
-	/**
-	 * Returns the Simulation Manager of the Program
-	 * @return Simulation Manager
-	 */
-	public SimulationManager getSimulationManager() {
-		return model.getSim();
-	}
 }

+ 1 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/control/ImportController.java

@@ -40,7 +40,7 @@ public class ImportController {
 	public ImportController(Model model, Controller controller) {
 		this.model = model;
 		this.controller = controller;
-		this.importConf = controller.getControllerConfiguration().getConfigurationManager().getImportConfiguration();
+		this.importConf = controller.getSettingsController().getConfigurationManager().getImportConfiguration();
 	}
 
 	/**

+ 10 - 10
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/control/NetworkController.java

@@ -44,9 +44,9 @@ public class NetworkController {
 	public void validateDevicePosition() {
 		// Update all device positions
 		for (SmartDevice d : model.getDevices()) {
-			d.setX(controller.getControllerConfiguration().scalePos(d.getX(), 1.0, controller.getControllerConfiguration().getWidth()));
-			d.setY(controller.getControllerConfiguration().scalePos(d.getY(), 1.0, controller.getControllerConfiguration().getHeight()));
-			d.setZ(controller.getControllerConfiguration().scalePos(d.getZ(), 1.0, controller.getControllerConfiguration().getDepth()));
+			d.setX(controller.getSettingsController().scalePos(d.getX(), 1.0, controller.getSettingsController().getWidth()));
+			d.setY(controller.getSettingsController().scalePos(d.getY(), 1.0, controller.getSettingsController().getHeight()));
+			d.setZ(controller.getSettingsController().scalePos(d.getZ(), 1.0, controller.getSettingsController().getDepth()));
 		}
 	}
 
@@ -62,9 +62,9 @@ public class NetworkController {
 			return;
 		model.addDevices(sd);
 		// validate Position
-		sd.setX(controller.getControllerConfiguration().scalePos(sd.getX(), 1.0, controller.getControllerConfiguration().getWidth()));
-		sd.setY(controller.getControllerConfiguration().scalePos(sd.getY(), 1.0, controller.getControllerConfiguration().getHeight()));
-		sd.setZ(controller.getControllerConfiguration().scalePos(sd.getZ(), 1.0, controller.getControllerConfiguration().getDepth()));
+		sd.setX(controller.getSettingsController().scalePos(sd.getX(), 1.0, controller.getSettingsController().getWidth()));
+		sd.setY(controller.getSettingsController().scalePos(sd.getY(), 1.0, controller.getSettingsController().getHeight()));
+		sd.setZ(controller.getSettingsController().scalePos(sd.getZ(), 1.0, controller.getSettingsController().getDepth()));
 	}
 
 	/**
@@ -82,9 +82,9 @@ public class NetworkController {
 	 */
 	public void createSmartDevice(String name, int x_pos, int y_pos, int z_pos) {
 		SmartDevice sd = new SmartDevice(name);
-		sd.setX(controller.getControllerConfiguration().scalePos(x_pos, 1.0, controller.getControllerConfiguration().getWidth()));
-		sd.setY(controller.getControllerConfiguration().scalePos(y_pos, 1.0, controller.getControllerConfiguration().getHeight()));
-		sd.setZ(controller.getControllerConfiguration().scalePos(z_pos, 1.0, controller.getControllerConfiguration().getDepth()));
+		sd.setX(controller.getSettingsController().scalePos(x_pos, 1.0, controller.getSettingsController().getWidth()));
+		sd.setY(controller.getSettingsController().scalePos(y_pos, 1.0, controller.getSettingsController().getHeight()));
+		sd.setZ(controller.getSettingsController().scalePos(z_pos, 1.0, controller.getSettingsController().getDepth()));
 		model.addDevices(sd);
 	}
 
@@ -382,7 +382,7 @@ public class NetworkController {
 			removeConnection(connection);
 		}
 		addConnection(newCon);	
-		controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection.clear();
+		controller.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection.clear();
 			
 			
 		connection.setLink(null);

+ 58 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/control/SimulationController.java

@@ -0,0 +1,58 @@
+package de.tu_darmstadt.tk.SmartHomeNetworkSim.control;
+
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Port;
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SimulationManager;
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
+
+/**
+ * Controller which enables configuration and manipulation of the simulation
+ * 
+ *
+ * @author Andreas T. Meyer-Berg
+ */
+public class SimulationController {
+
+	/**
+	 * Main Controller which can be used internally
+	 */
+	@SuppressWarnings("unused")
+	private Controller controller;
+	/**
+	 * Model which can be manipulated
+	 */
+	private Model model;
+	
+	/**
+	 * Creates a new Simulation
+	 * @param model
+	 * @param controller
+	 */
+	public SimulationController(Model model, Controller controller) {
+		this.model = model;
+		this.controller = controller;
+	}
+
+	/**
+	 * Reset Simulation 
+	 * 
+	 * @param controller TODO
+	 * @param timestep
+	 */
+	public void resetSimulation(long timestep){
+		for(SmartDevice d: model.getDevices())
+			for(Port p:d.getPorts())
+				if(p.getLastTrigger()>timestep)
+					p.setLastTrigger(timestep);
+	}
+
+	/**
+	 * Returns the Simulation Manager of the Program
+	 * 
+	 * @param controller TODO
+	 * @return Simulation Manager
+	 */
+	public SimulationManager getSimulationManager() {
+		return model.getSim();
+	}
+}

+ 38 - 38
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/VisualisationInteractor.java

@@ -214,7 +214,7 @@ public class VisualisationInteractor implements MouseInputListener,
 		this.model = model;
 		this.controller = controller;
 		this.panel = panel;
-		this.config = controller.getControllerConfiguration();
+		this.config = controller.getSettingsController();
 		this.network = controller.getNetworkController();
 		this.toolTip = new LinkToolTip();
 
@@ -229,9 +229,9 @@ public class VisualisationInteractor implements MouseInputListener,
 		 */
 		clicked = getSmartDeviceAtPosition(e.getX(), e.getY());
 		
-		controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection.clear();
+		controller.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection.clear();
 		if(clicked == null)
-			controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection = getConnectionsAtPosition(e.getX(), e.getY());
+			controller.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection = getConnectionsAtPosition(e.getX(), e.getY());
 		
 		
 		switch (mode) {
@@ -250,24 +250,24 @@ public class VisualisationInteractor implements MouseInputListener,
 				showRightClickMenu(clicked, linkAtPosition);
 				break;
 			}
-			if(!controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty()&&!controlDown){
-				controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.clear();
+			if(!controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty()&&!controlDown){
+				controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.clear();
 				if (clicked == null) {
 					panel.repaint();					
 				}
 			}
 			if(clicked!=null){
 				if(!controlDown)
-					controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.add(clicked);
-				else if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.remove(clicked)&&!draggedDeviceWasSelected){
-					controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.add(clicked);
+					controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.add(clicked);
+				else if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.remove(clicked)&&!draggedDeviceWasSelected){
+					controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.add(clicked);
 				}
 				mode = SELECTED;
 				panel.repaint();
 			}else{
 				if(!controlDown)
 					mode = NOTHING; 
-				else if(!controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+				else if(!controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 					mode = SELECTED;
 
 				panel.repaint();	
@@ -301,15 +301,15 @@ public class VisualisationInteractor implements MouseInputListener,
 				dragged_y_start = e.getY();
 				mode = DRAG_SELECT;
 				if(!controlDown)
-					controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.clear();
+					controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.clear();
 				break;
 			} else if (e.getButton() == MouseEvent.BUTTON1){// && connectionFrom == null) {
 				// Recognize possible drag operation
-				draggedDeviceWasSelected = controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(pressedOn);
+				draggedDeviceWasSelected = controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(pressedOn);
 				if(!draggedDeviceWasSelected){
 					if(!controlDown)
-						controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.clear();
-					controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.add(pressedOn);
+						controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.clear();
+					controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.add(pressedOn);
 				}
 				dragged = pressedOn;
 				dragged_x = pressedOn.getX();
@@ -378,11 +378,11 @@ public class VisualisationInteractor implements MouseInputListener,
 			int max_x = Math.max(dragged_x, dragged_x_start);
 			int max_y = Math.max(dragged_y, dragged_y_start);
 			//Remove unselected
-			controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.removeIf(s->(s.getX()<min_x||s.getX()>max_x||s.getY()<min_y||s.getY()>max_y));
+			controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.removeIf(s->(s.getX()<min_x||s.getX()>max_x||s.getY()<min_y||s.getY()>max_y));
 			//Add selected devices
 			for(SmartDevice sel:model.getDevices()){
-				if(sel.getX()>=min_x&&sel.getX()<=max_x&&sel.getY()>=min_y&&sel.getY()<=max_y&&!controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(sel)){
-					controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.add(sel);
+				if(sel.getX()>=min_x&&sel.getX()<=max_x&&sel.getY()>=min_y&&sel.getY()<=max_y&&!controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(sel)){
+					controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.add(sel);
 				}
 			}
 			break;
@@ -394,7 +394,7 @@ public class VisualisationInteractor implements MouseInputListener,
 			int x_offset = dragged_x - dragged.getX();
 			int y_offset = dragged_y - dragged.getY();
 			//Validate for all moved devices, that they are within the model, if not change offset
-			for(SmartDevice d:controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices){
+			for(SmartDevice d:controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices){
 				if (d.getX() + x_offset <= config.getDeviceVisualizationRadius())
 					x_offset = config.getDeviceVisualizationRadius()-d.getX();
 				else if (d.getX() + x_offset >= model.getWidth() - config.getDeviceVisualizationRadius())
@@ -428,11 +428,11 @@ public class VisualisationInteractor implements MouseInputListener,
 				&& (dragged.getX() != dragged_x || dragged.getY() != dragged_y)) {
 				int x_offset = dragged_x-dragged.getX();
 				int y_offset = dragged_y-dragged.getY();
-				for(SmartDevice d: controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices)
+				for(SmartDevice d: controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices)
 					network.moveSmartDevice(d, d.getX()+x_offset, d.getY()+y_offset, d.getZ());
 			}
 			dragged = null;
-			if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+			if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 				mode = NOTHING;
 			else
 				mode = SELECTED;
@@ -444,15 +444,15 @@ public class VisualisationInteractor implements MouseInputListener,
 	private void finishDragSelect() {
 		LinkedList<SmartDevice> merged = new LinkedList<SmartDevice>();
 		//XOR of controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices and controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices Drag
-		merged.addAll(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices);
-		merged.removeAll(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag);
-		controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.removeAll(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices);
-		merged.addAll(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag);
+		merged.addAll(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices);
+		merged.removeAll(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag);
+		controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.removeAll(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices);
+		merged.addAll(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag);
 		//clear sets
-		controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.clear();
-		controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.clear();
-		controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices = merged;
-		if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+		controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.clear();
+		controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.clear();
+		controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices = merged;
+		if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 			mode = NOTHING;
 		else
 			mode = SELECTED;
@@ -492,7 +492,7 @@ public class VisualisationInteractor implements MouseInputListener,
 			
 		}
 		connectionFrom = null;
-		if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+		if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 			mode = NOTHING;
 		else
 			mode = SELECTED;
@@ -746,7 +746,7 @@ public class VisualisationInteractor implements MouseInputListener,
 				itemCreate.setEnabled(true);
 				itemDelete.setEnabled(false);
 				itemDeleteSelected.setEnabled(false);
-				if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection.size()>0){
+				if(controller.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection.size()>0){
 					/**
 					 * Update Connections which can be edited
 					 */
@@ -754,7 +754,7 @@ public class VisualisationInteractor implements MouseInputListener,
 					
 					//List to prevent duplicate connection entries
 					LinkedList<Connection> editableConnections = new LinkedList<Connection>();
-					for(Pair<Connection, Pair<Port,Port>> p:controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection){
+					for(Pair<Connection, Pair<Port,Port>> p:controller.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection){
 						//Don't add the same connection multiple times
 						if(editableConnections.contains(p.getLeft())|| p == null || p.getLeft() == null)continue;
 						editableConnections.add(p.getLeft());
@@ -786,7 +786,7 @@ public class VisualisationInteractor implements MouseInputListener,
 					rightClickMenu.add(itemCreateConnection,editCreateConnectionIndex);
 				}
 				itemCreateLink.setText("Create Link");
-				if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(clickedOn)){
+				if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(clickedOn)){
 					itemDeleteSelected.setEnabled(true);
 					itemCreateLink.setEnabled(true);
 					itemCreateConnection.setEnabled(true);
@@ -840,9 +840,9 @@ public class VisualisationInteractor implements MouseInputListener,
 			if(clickedLink!=null){
 				new LinkCreationDialog(clickedLink, controller, panel);
 			}else{
-				new LinkCreationDialog(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices, controller, panel);
+				new LinkCreationDialog(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices, controller, panel);
 			}
-			if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+			if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 				mode = NOTHING;
 			else
 				mode = SELECTED;
@@ -854,10 +854,10 @@ public class VisualisationInteractor implements MouseInputListener,
 		itemCreateConnection = new JMenuItem("Create Connection");
 		itemCreateConnection.addActionListener(e->{
 			LinkedList<Port> ports = new LinkedList<Port>();
-			for(SmartDevice d: controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices)
+			for(SmartDevice d: controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices)
 				ports.add(new Port(d, (short) 12));
 			new ConnectionCreationDialog(ports,new SimpleLink("TestLink"), controller, panel);
-			if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+			if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 				mode = NOTHING;
 			else
 				mode = SELECTED;
@@ -885,9 +885,9 @@ public class VisualisationInteractor implements MouseInputListener,
 		
 		itemDeleteSelected.addActionListener(e -> {
 			// Delete the clicked object
-			for(SmartDevice c: controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices)
+			for(SmartDevice c: controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices)
 				network.deleteSmartDevice(c);
-			controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.clear();
+			controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.clear();
 			clicked = null;
 			controller.notifyObservers();
 			mode = NOTHING;
@@ -943,7 +943,7 @@ public class VisualisationInteractor implements MouseInputListener,
 								System.out.println(p.getTextualRepresentation());
 						});
 				model.getConnections().removeAll(terminated);
-				if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
+				if(controller.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
 					mode = NOTHING;
 				else
 					mode = SELECTED;

+ 11 - 11
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/VisualisationPanel.java

@@ -74,7 +74,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 
 		this.model = model;
 		this.control = control;
-		this.config = control.getControllerConfiguration();
+		this.config = control.getSettingsController();
 		this.network = control.getNetworkController();
 		
 		this.interactor = new VisualisationInteractor(model, control, this);
@@ -218,7 +218,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 		 * Pixel offset of dragged devices on the y axis
 		 */
 		int y_offset = 0;
-		if(interactor.mode == VisualisationInteractor.SELECTED_DRAG && !control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty()){
+		if(interactor.mode == VisualisationInteractor.SELECTED_DRAG && !control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty()){
 			x_offset = interactor.dragged_x-interactor.dragged.getX();
 			y_offset = interactor.dragged_y-interactor.dragged.getY();
 		}
@@ -232,7 +232,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 			 * y Position of the device
 			 */
 			int y = s.getY();
-			if(interactor.mode==VisualisationInteractor.SELECTED_DRAG && control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(s)) {
+			if(interactor.mode==VisualisationInteractor.SELECTED_DRAG && control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(s)) {
 				// Update visualization of dragged object
 				x += x_offset;
 				y += y_offset;
@@ -256,7 +256,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 			
 			}
 			if(//(interactor.mode==VisualisationInteractor.SELECTED||interactor.mode==VisualisationInteractor.DRAG_SELECT ||interactor.mode == VisualisationInteractor.SELECTED_DRAG || interactor.mode == VisualisationInteractor.RIGHTCLICK_MENU)&&
-					(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(s)^control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(s))){
+					(control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(s)^control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(s))){
 				//HighlightSelected Devices
 				g.setColor(new Color(135,206,235));
 			}else{
@@ -289,7 +289,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 		//Values for dragging of multiple Devices
 		int x_offset = 0;
 		int y_offset = 0;
-		if(interactor.mode == VisualisationInteractor.SELECTED_DRAG && !control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty()){
+		if(interactor.mode == VisualisationInteractor.SELECTED_DRAG && !control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty()){
 			x_offset = interactor.dragged_x-interactor.dragged.getX();
 			y_offset = interactor.dragged_y-interactor.dragged.getY();
 		}
@@ -330,7 +330,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 			}
 			for(Pair<Port,Port> p: c.getProtocol().getTopology() ){
 				if(p.getLeft() != null && p.getLeft().getOwner() != null && p.getRight() != null && p.getRight().getOwner() != null){
-					if(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection.contains(new Pair<Connection, Pair<Port,Port>>(c, p)))
+					if(control.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection.contains(new Pair<Connection, Pair<Port,Port>>(c, p)))
 						g.setColor(Color.BLUE);
 					else
 						g.setColor(connectionState);
@@ -340,11 +340,11 @@ public class VisualisationPanel extends JPanel implements Observer {
 					int yFrom = from.getY();
 					int xTo = to.getX();
 					int yTo = to.getY();
-					if(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(from)^control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(from)){
+					if(control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(from)^control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(from)){
 						xFrom+=x_offset;
 						yFrom+=y_offset;
 					}
-					if(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(to)^control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(to)){
+					if(control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(to)^control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(to)){
 						xTo+=x_offset;
 						yTo+=y_offset;
 					}
@@ -352,7 +352,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 				}
 			}
 			for(Pair<Port,Port> p: c.getProtocol().getDeletedTopology() ){
-				if(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection.contains(new Pair<Connection, Pair<Port,Port>>(c, p)))
+				if(control.getSettingsController().getConfigurationManager().getSelectionModel().clickedConnection.contains(new Pair<Connection, Pair<Port,Port>>(c, p)))
 					g.setColor(Color.BLUE);
 				else{
 					//Just paint terminated connection, if config says so
@@ -369,11 +369,11 @@ public class VisualisationPanel extends JPanel implements Observer {
 					int yFrom = from.getY();
 					int xTo = to.getX();
 					int yTo = to.getY();
-					if(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(from)^control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(from)){
+					if(control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(from)^control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(from)){
 						xFrom+=x_offset;
 						yFrom+=y_offset;
 					}
-					if(control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(to)^control.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(to)){
+					if(control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevices.contains(to)^control.getSettingsController().getConfigurationManager().getSelectionModel().selectedDevicesDrag.contains(to)){
 						xTo+=x_offset;
 						yTo+=y_offset;
 					}

+ 7 - 7
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/ConnectionCreationPanel.java

@@ -187,8 +187,8 @@ public class ConnectionCreationPanel extends JScrollPane {
 		// Init variables
 		disconnectedIndex = connection.getProtocol().getNumberOfRoles();
 
-		availableProtocols = controller.getControllerImport().getProtocols();
-		availableConnection = controller.getControllerImport().getConnections();
+		availableProtocols = controller.getImportController().getProtocols();
+		availableConnection = controller.getImportController().getConnections();
 
 		// Sets up window
 		setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
@@ -314,7 +314,7 @@ public class ConnectionCreationPanel extends JScrollPane {
 				Class<? extends Connection> imported = popUp.showPopUp();
 				if (imported == null)
 					return;
-				if (controller.getControllerImport().addConnection(imported)) {
+				if (controller.getImportController().addConnection(imported)) {
 					refreshGUI();
 				} else {
 					JOptionPane.showMessageDialog(frame,
@@ -355,7 +355,7 @@ public class ConnectionCreationPanel extends JScrollPane {
 				Protocol newProtocol = null;
 				try {
 					// Create new Instance of the protocol
-					newProtocol = controller.getControllerImport().getProtocols().get(
+					newProtocol = controller.getImportController().getProtocols().get(
 							cmbProtocolType.getSelectedIndex()).newInstance();
 				} catch (InstantiationException | IllegalAccessException e1) {
 					System.out
@@ -439,7 +439,7 @@ public class ConnectionCreationPanel extends JScrollPane {
 				return;
 			}
 			// Add Protocol
-			if (controller.getControllerImport().addProtocol(imported)) {
+			if (controller.getImportController().addProtocol(imported)) {
 				// Update GUI
 				refreshGUI();
 			} else {
@@ -677,8 +677,8 @@ public class ConnectionCreationPanel extends JScrollPane {
 
 		disconnectedIndex = connection.getProtocol().getNumberOfRoles();
 
-		availableProtocols = controller.getControllerImport().getProtocols();
-		availableConnection = controller.getControllerImport().getConnections();
+		availableProtocols = controller.getImportController().getProtocols();
+		availableConnection = controller.getImportController().getConnections();
 
 		/**
 		 * Update Boxes, Textfield e.g.

+ 2 - 2
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/LinkCreationPanel.java

@@ -73,7 +73,7 @@ public class LinkCreationPanel extends JScrollPane{
 	
 	@SuppressWarnings("unchecked")
 	private void initializePanel() {
-		LinkedList<Class<? extends Link>> availableLinks = controller.getControllerImport().getLinks();
+		LinkedList<Class<? extends Link>> availableLinks = controller.getImportController().getLinks();
 		
 		setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
 		this.setPreferredSize(new Dimension(600, 170 + devices.length*20));
@@ -193,7 +193,7 @@ public class LinkCreationPanel extends JScrollPane{
 	            			return;
 	            		}
 	            		//Add Link
-	            		if(controller.getControllerImport().addLink(imported)){
+	            		if(controller.getImportController().addLink(imported)){
 	            			//Update GUI
 	            			try {
 								cmbLinkType.addItem(imported.getSimpleName());

+ 1 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/SettingsPopUp.java

@@ -30,7 +30,7 @@ public class SettingsPopUp extends JFrame {
 		setBounds(new Rectangle(0, 0, 450, 300));
 		this.model = model;
 		this.controller = controller;
-		this.config = controller.getControllerConfiguration();
+		this.config = controller.getSettingsController();
 		
 		setTitle("Settings");
 		setIconImage(Utility.loadFile("/images/settings.png"));

+ 2 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/SimulationConfigurator.java

@@ -86,7 +86,7 @@ public class SimulationConfigurator extends JFrame {
 	 */
 	public SimulationConfigurator(Controller control) {
 		this.controller = control;
-		this.sim = controller.getSimulationManager();
+		this.sim = controller.getSimulationController().getSimulationManager();
 		
 		setBounds(new Rectangle(0, 0, 460, 300));
 		setResizable(false);
@@ -206,6 +206,7 @@ public class SimulationConfigurator extends JFrame {
 			duration = Long.parseLong(tfStepDuration.getText());
 			progressBar.setValue(0);
 			lbCurrentTimeShow.setText(currentTime + " ms");
+			controller.getSimulationController().resetSimulation(currentTime);
 		} catch (Exception e) {
 			JOptionPane.showMessageDialog(this, "Following Error occured:\n" + e.toString(),
 					"Error while configuring simulation ", JOptionPane.ERROR_MESSAGE);

+ 3 - 3
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/SmartDeviceCreationPopUp.java

@@ -78,9 +78,9 @@ public class SmartDeviceCreationPopUp extends JDialog {
 		setModal(true);
 		// setType(Type.POPUP); -> Crashes on Linux
 		this.c = control;
-		this.maxX = c.getControllerConfiguration().getWidth();
-		this.maxY = c.getControllerConfiguration().getHeight();
-		this.visualisationRadius = c.getControllerConfiguration().getDeviceVisualizationRadius();
+		this.maxX = c.getSettingsController().getWidth();
+		this.maxY = c.getSettingsController().getHeight();
+		this.visualisationRadius = c.getSettingsController().getDeviceVisualizationRadius();
 		this.edit = edit;
 		newDevice = deviceToEdit;
 

+ 1 - 1
src/test/java/de/tu_darmstadt/tk/shNetSimTests/control/ClassValidateTest.java

@@ -18,7 +18,7 @@ public class ClassValidateTest {
 	@Before
 	public void init() {
 		controller = new Controller(new Model());
-		importController = controller.getControllerImport();
+		importController = controller.getImportController();
 	}
 	
 	@Test

+ 2 - 2
src/test/java/de/tu_darmstadt/tk/shNetSimTests/control/ConfigurationTest.java

@@ -23,13 +23,13 @@ public class ConfigurationTest {
 	public void initialize() {
 		model = new Model();
 		control = new Controller(model);
-		config = control.getControllerConfiguration();
+		config = control.getSettingsController();
 	}
 
 	@Test
 	public void testConfigurationManager() {
 		Assert.assertEquals(model.getConfigurator(), control
-				.getControllerConfiguration().getConfigurationManager());
+				.getSettingsController().getConfigurationManager());
 		Assert.assertNotNull(config);
 	}