Browse Source

Merged Jan

Jan Enders 7 years ago
parent
commit
2147638482

+ 1 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java

@@ -1,5 +1,4 @@
 package de.tu_darmstadt.informatik.tk.scopviz.graphs;
-
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -320,7 +319,7 @@ public class GraphHelper {
 			return null;
 		}
 		String origGraph = e.getAttribute("originalElement").toString().split("\\+#")[0];
-		String origId = e.getAttribute("originalElement").toString().split("\\+#")[1];
+		//String origId = e.getAttribute("originalElement").toString().split("\\+#")[1];
 		Iterator<MyGraph> graphIter = g.getAllSubGraphs().iterator();
 		HashMap<String, Object> attributes = new HashMap<String, Object>();
 		for (String s : e.getAttributeKeySet()) {

+ 0 - 16
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java

@@ -43,8 +43,6 @@ public class GraphManager {
 	 */
 	protected String stylesheet = "";
 
-	/** the grpah that a Node was last deleted of */
-	private String graphDeleteId;
 	/** The last Node that was deleted. */
 	protected Node deletedNode;
 	/** The last Edge that was deleted. */
@@ -107,7 +105,6 @@ public class GraphManager {
 		// and need the Node to still be in the Graph
 		deleteEdgesOfNode(id);
 		deletedNode = g.removeNode(id);
-		graphDeleteId = GraphHelper.propagateElementDeletion(g, deletedNode);
 	}
 
 	/**
@@ -123,7 +120,6 @@ public class GraphManager {
 		deletedEdges.removeAll(deletedEdges);
 		deletedNode = null;
 		deletedEdges.add(g.removeEdge(id));
-		graphDeleteId = GraphHelper.propagateElementDeletion(g, deletedEdges);
 	}
 
 	/**
@@ -398,9 +394,6 @@ public class GraphManager {
 	 * Returns the smallest X Coordinate of any Node in the Graph.
 	 * 
 	 * @return the smallest X Coordinate in the Graph
-	 * @deprecated Use
-	 *             {@link de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph#getMinX()}
-	 *             instead
 	 */
 	public double getMinX() {
 		return g.getMinX();
@@ -410,9 +403,6 @@ public class GraphManager {
 	 * Returns the biggest X Coordinate of any Node in the Graph.
 	 * 
 	 * @return the biggest X Coordinate in the Graph
-	 * @deprecated Use
-	 *             {@link de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph#getMaxX()}
-	 *             instead
 	 */
 	public double getMaxX() {
 		return g.getMaxX();
@@ -422,9 +412,6 @@ public class GraphManager {
 	 * Returns the smallest Y Coordinate of any Node in the Graph.
 	 * 
 	 * @return the smallest Y Coordinate in the Graph
-	 * @deprecated Use
-	 *             {@link de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph#getMinY()}
-	 *             instead
 	 */
 	public double getMinY() {
 		return g.getMinY();
@@ -434,9 +421,6 @@ public class GraphManager {
 	 * Returns the biggest Y Coordinate of any Node in the Graph.
 	 * 
 	 * @return the biggest Y Coordinate in the Graph
-	 * @deprecated Use
-	 *             {@link de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph#getMaxY()}
-	 *             instead
 	 */
 	public double getMaxY() {
 		return g.getMaxY();

+ 6 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/MappingGraphManager.java

@@ -10,6 +10,7 @@ import org.graphstream.graph.Node;
 
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
+import de.tu_darmstadt.informatik.tk.scopviz.ui.MetricboxManager;
 
 /**
  * Class extending GraphManager. Offers the possibility to merge an underlay and
@@ -374,8 +375,11 @@ public class MappingGraphManager extends GraphManager implements EdgeCreatedList
 			return false;
 
 		// check and update capacity
-		if (!addMapping(underlayNode, operatorNode))
+		if (!addMapping(underlayNode, operatorNode)){
+			Debug.out("Could not place Mapping Edge due to insufficient capacity!", 2);
 			return false;
+		}
+			
 
 		e = getGraph().addEdge(newID, operatorNode, underlayNode, true);
 		Debug.out("Created an directed edge with Id " + newID + " from " + operatorNode + " to " + underlayNode);
@@ -390,6 +394,7 @@ public class MappingGraphManager extends GraphManager implements EdgeCreatedList
 		e.addAttribute(ATTRIBUTE_KEY_MAPPING, true);
 
 		selectEdge(newID);
+		MetricboxManager.updateMetrics();
 		return true;
 	}
 

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/MyGraph.java

@@ -129,7 +129,7 @@ public class MyGraph extends SingleGraph {
 	 * Notifies all added NodeCreatedListener. also sets defaults
 	 * 
 	 * @param n
-	 *            the Edge that was just created
+	 *            the Node that was just created
 	 */
 	private void nodeCreatedNotify(Node n) {
 		GraphHelper.setAllDefaults(this);

+ 0 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainApp.java

@@ -4,8 +4,6 @@ import java.io.IOException;
 import java.net.URL;
 
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
-import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyEdge;
-import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyNode;
 import de.tu_darmstadt.informatik.tk.scopviz.io.GraphMLExporter;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.GraphDisplayManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.css.CSSManager;

+ 1 - 9
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/PlacementCostMetric.java

@@ -114,15 +114,7 @@ public class PlacementCostMetric implements ScopvizGraphMetric {
 					.collect(Collectors.toList()));
 			for (Edge e : mappingEdges) {
 				placementCostSum += placementCost(e.getNode0(), e.getNode1());
-			}
-			/*
-			 * for (Node n : g.getNodeSet()) { if
-			 * (n.getId().startsWith(MappingGraphManager.OPERATOR)) { for (Edge
-			 * e : n.getEdgeSet()) { String edgeTargetParent = e.getNode1()
-			 * .getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT);
-			 * if (edgeTargetParent == MappingGraphManager.UNDERLAY) {
-			 * placementCostSum += placementCost(n, e.getNode1()); } } } }
-			 */
+			}			
 			results.add(new Pair<String, String>("Overall Cost", "" + placementCostSum));
 		}
 		return results;

+ 2 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/TaskFulfillmentMetric.java

@@ -63,7 +63,7 @@ public class TaskFulfillmentMetric implements ScopvizGraphMetric {
 			}
 		}
 		// This corresponds to F'
-		double percentagePlaced = placedSum / prioritySum;
+		double percentagePlaced = (placedSum / prioritySum)*100;
 
 		if (error) {
 			error = false;
@@ -71,7 +71,7 @@ public class TaskFulfillmentMetric implements ScopvizGraphMetric {
 		}
 
 		results.add(new Pair<String, String>("Task Placement", "" + placedSum));
-		results.add(new Pair<String, String>("Placement Percentage", "" + percentagePlaced));
+		results.add(new Pair<String, String>("Placement Percentage", percentagePlaced+"%"));
 
 		return results;
 	}

+ 29 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -3,10 +3,13 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.stream.Collectors;
 
 import org.jxmapviewer.viewer.GeoPosition;
 import org.jxmapviewer.viewer.WaypointPainter;
 
+import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphManager;
+import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.CustomMapClickListener;
@@ -14,6 +17,7 @@ import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.CustomWaypoint;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.CustomWaypointRenderer;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.MapViewFunctions;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.WorldView;
+import javafx.application.Platform;
 import javafx.beans.value.ObservableValue;
 import javafx.event.ActionEvent;
 import javafx.scene.control.Alert;
@@ -483,4 +487,29 @@ public final class ButtonManager {
 		MapViewFunctions.changeMapView();
 	}
 
+	public static void setupOpGraphComboBox() {
+		controller.opGraphSelectionBox.getItems().clear();
+		GraphManager operatorManager = GraphDisplayManager.getGraphManager(Layer.OPERATOR);
+		for (MyGraph g: operatorManager.getGraph().getAllSubGraphs().stream().filter((g) -> !g.isComposite()).collect(Collectors.toList())){
+			controller.opGraphSelectionBox.getItems().add(g.getId());
+		}
+		controller.opGraphSelectionBox.getItems().add("Add...");	
+		
+		//Platform.runLater(() -> controller.opGraphSelectionBox.setValue(controller.opGraphSelectionBox.getItems().get(0)));
+	}
+
+	public static void addToOpGraphComboBox(String id){
+		controller.opGraphSelectionBox.getItems().add(controller.opGraphSelectionBox.getItems().size()-1, id);
+	}
+	
+	public static void opGraphSelectedAction(ActionEvent v) {
+		
+		if (controller.opGraphSelectionBox.getValue().equals("Add...")){
+			MenuBarManager.addAction(v);
+			Platform.runLater(() -> controller.opGraphSelectionBox.setValue(controller.opGraphSelectionBox.getItems().get(controller.opGraphSelectionBox.getItems().size()-2)));
+		} else {
+			//FIXME: aktuell zu bearbeitenden graphen im GraphManager setzen (erfordert Jaschas Implementierung)!
+		}
+	}
+
 }

+ 7 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -489,12 +489,15 @@ public class GUIController implements Initializable {
 	private void initializeOpGraphComboBox() {
 
 		opGraphSelectionBox.setVisible(false);
+		
+		ButtonManager.setupOpGraphComboBox();
 
 		// initialization of the values of the box
-		String firstOpGraph = GraphDisplayManager.getGraphManager(Layer.OPERATOR).getGraph().getId();
-		opGraphSelectionBox.getItems().addAll(firstOpGraph, "Add...");
-		Platform.runLater(() -> opGraphSelectionBox.setValue(firstOpGraph));
+		
+		Platform.runLater(() -> opGraphSelectionBox.setValue(opGraphSelectionBox.getItems().get(0)));
 
+		opGraphSelectionBox.setOnAction((v) -> ButtonManager.opGraphSelectedAction(v));
+		/*
 		opGraphSelectionBox.setOnAction((v) -> {
 			if (opGraphSelectionBox.getValue().equals("Add...")) {
 				// add Dialog erscheint, Operator Graph wird importiert und fügt
@@ -509,7 +512,7 @@ public class GUIController implements Initializable {
 				// wechselt auf Operatorgraph mit diesem Namen
 
 			}
-		});
+		});*/
 	}
 
 	/**

+ 9 - 13
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java

@@ -7,9 +7,6 @@ import java.util.Iterator;
 import java.util.LinkedList;
 
 import org.apache.commons.math3.exception.NullArgumentException;
-import org.graphstream.graph.Edge;
-import org.graphstream.graph.Node;
-
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphHelper;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphManager;
@@ -125,7 +122,7 @@ public final class GraphDisplayManager {
 	 * 
 	 * @return the id to access the specific Graph
 	 */
-	public static int addGraph() {
+	public static MyGraph addGraph() {
 		String id = getGraphStringID(count);
 		MyGraph g = new MyGraph(id);
 		return addGraph(g, true);
@@ -142,7 +139,7 @@ public final class GraphDisplayManager {
 	 *            the current layer, if false they will be merged.
 	 * @return the id to access the specific Graph
 	 */
-	public static int addGraph(String fileName, boolean replaceCurrent) {
+	public static MyGraph addGraph(String fileName, boolean replaceCurrent) {
 		String id = getGraphStringID(count);
 		MyGraph g = importer.readGraph(id, Main.class.getResource(fileName));
 		return addGraph(g, replaceCurrent);
@@ -158,11 +155,11 @@ public final class GraphDisplayManager {
 	 *            the current layer, if false they will be merged.
 	 * @return the id to access the specific Graph
 	 */
-	public static int addGraph(Stage stage, boolean replaceCurrent) {
+	public static MyGraph addGraph(Stage stage, boolean replaceCurrent) {
 		String id = getGraphStringID(count);
 		MyGraph g = importer.readGraph(id, stage);
 		if (g == null) {
-			return currentGraphManager;
+			return getGraphManager().getGraph();
 		}
 		return addGraph(g, replaceCurrent);
 	}
@@ -177,7 +174,7 @@ public final class GraphDisplayManager {
 	 *            the current layer, if false they will be merged.
 	 * @return the id to access the specific Graph
 	 */
-	public static int addGraph(URL fileURL, boolean replaceCurrent) {
+	public static MyGraph addGraph(URL fileURL, boolean replaceCurrent) {
 		String id = getGraphStringID(count);
 		MyGraph g = importer.readGraph(id, fileURL);
 		return addGraph(g, replaceCurrent);
@@ -194,13 +191,12 @@ public final class GraphDisplayManager {
 	 *            the current layer, if false they will be merged.
 	 * @return the id to access the specific graph
 	 */
-	public static int addGraph(MyGraph g, boolean replaceCurrent) {
+	public static MyGraph addGraph(MyGraph g, boolean replaceCurrent) {
 		if (g == null) {
 			throw new NullArgumentException();
 		}
 
 		GraphManager v;
-		int ret = 0;
 		// replacing the current graph or merging
 		if (replaceCurrent) {
 			v = new GraphManager(g);
@@ -210,7 +206,7 @@ public final class GraphDisplayManager {
 			v.getGraph().addAttribute("ui.antialias");
 			removeAllCurrentGraphs();
 			vList.add(v);
-			ret = count++;
+			count++;
 			// set basic style
 			v.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
 		} else {
@@ -221,7 +217,7 @@ public final class GraphDisplayManager {
 			g.addAttribute("ui.antialias");
 			removeAllCurrentGraphs();
 			vList.add(v);
-			ret = count++;
+			count++;
 			// set basic style
 			v.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
 		}
@@ -230,7 +226,7 @@ public final class GraphDisplayManager {
 		v.convertUiClass();
 		// display the graph
 		switchActiveGraph();
-		return ret;
+		return g;
 	}
 
 	/**

+ 3 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/MenuBarManager.java

@@ -1,6 +1,7 @@
 package de.tu_darmstadt.informatik.tk.scopviz.ui;
 
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphManager;
+import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.io.GraphMLExporter;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
@@ -47,7 +48,8 @@ public final class MenuBarManager {
 	 * Handler for the "add" MenuItem.
 	 */
 	public static final void addAction(ActionEvent event) {
-		GraphDisplayManager.addGraph(Main.getInstance().getPrimaryStage(), false);
+		MyGraph newGraph = GraphDisplayManager.addGraph(Main.getInstance().getPrimaryStage(), false);
+		ButtonManager.addToOpGraphComboBox(newGraph.getId());
 	}
 
 	/**

+ 0 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OperatorManager.java

@@ -19,8 +19,6 @@ import javafx.scene.layout.GridPane;
 
 public class OperatorManager {
 
-	private static GUIController guiController;
-
 	private static HashMap<String, ScopvizGraphOperator> operators = new HashMap<String, ScopvizGraphOperator>();
 
 	/**
@@ -81,6 +79,5 @@ public class OperatorManager {
 
 	public static void initialize(GUIController g) {
 		initializeGraphOperators();
-		guiController = g;
 	}
 }

+ 7 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java

@@ -371,11 +371,13 @@ public final class ToolboxManager {
 			weightDialog.setHeaderText("Please enter the maximum processing power of the Node");
 			weightDialog.setContentText("processing power");
 			Optional<String> result = weightDialog.showAndWait();
+			org.graphstream.graph.Node actualNode = Main.getInstance().getGraphManager().getGraph().getNode(n.getId());
 			if (result.isPresent()) {
-				n.addAttribute("process-max", Double.parseDouble(result.get()));
+				actualNode.addAttribute("process-max", Double.parseDouble(result.get()));
 				GraphHelper.propagateAttribute(Main.getInstance().getGraphManager().getGraph(), 
-						n, "process-max", Double.parseDouble(result.get()));
+						actualNode, "process-max", Double.parseDouble(result.get()));
 			}
+			PropertiesManager.setItemsProperties();
 		});
 	}
 
@@ -390,10 +392,11 @@ public final class ToolboxManager {
 			weightDialog.setHeaderText("Please enter the amount of processing power the node needs");
 			weightDialog.setContentText("neede Power");
 			Optional<String> result = weightDialog.showAndWait();
+			org.graphstream.graph.Node actualNode = Main.getInstance().getGraphManager().getGraph().getNode(n.getId());
 			if (result.isPresent()) {
-				n.addAttribute("process-need", Double.parseDouble(result.get()));
+				actualNode.addAttribute("process-need", Double.parseDouble(result.get()));
 				GraphHelper.propagateAttribute(Main.getInstance().getGraphManager().getGraph(), 
-				n, "process-need", Double.parseDouble(result.get()));
+				actualNode, "process-need", Double.parseDouble(result.get()));
 			}
 		});
 	}

+ 12 - 9
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/MyMouseManager.java

@@ -3,7 +3,6 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui.handlers;
 import java.awt.event.MouseEvent;
 
 import org.graphstream.graph.Edge;
-import org.graphstream.graph.Graph;
 import org.graphstream.graph.Node;
 import org.graphstream.ui.geom.Point3;
 import org.graphstream.ui.graphicGraph.GraphicElement;
@@ -12,6 +11,7 @@ import org.graphstream.ui.view.util.DefaultMouseManager;
 
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphManager;
+import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.main.CreationMode;
 import de.tu_darmstadt.informatik.tk.scopviz.main.EdgeSelectionHelper;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
@@ -69,9 +69,9 @@ public class MyMouseManager extends DefaultMouseManager {
 	protected void mouseButtonPress(MouseEvent event) {
 		view.requestFocus();
 
-		Graph graph = graphManager.getGraph();
 		Point3 cursorPos = graphManager.getView().getCamera().transformPxToGu(event.getX(), event.getY());
 		Node n;
+		MyGraph nodeProducer = new MyGraph("temp");
 		Edge selectedEdge = EdgeSelectionHelper.getClosestEdge(cursorPos);
 
 		switch (Main.getInstance().getCreationMode()) {
@@ -86,10 +86,11 @@ public class MyMouseManager extends DefaultMouseManager {
 
 		// Otherwise, create node based on creation Mode
 		case CREATE_STANDARD_NODE:
-			n = graph.addNode(Main.getInstance().getUnusedID());
+			n = nodeProducer.addNode(Main.getInstance().getUnusedID());
 			n.setAttribute("xyz", cursorPos);
 			n.setAttribute("ui.class", "standard");
 			n.setAttribute("typeofNode", "standard");
+			graphManager.addNode(n);
 			graphManager.selectNode(n.getId());
 			Debug.out("INFORMATION: Added Node with ID " + n.getId() + " at Position (" + cursorPos.x + "/"
 					+ cursorPos.y + ")", 1);
@@ -97,10 +98,11 @@ public class MyMouseManager extends DefaultMouseManager {
 			break;
 
 		case CREATE_SOURCE_NODE:
-			n = graph.addNode(Main.getInstance().getUnusedID());
+			n = nodeProducer.addNode(Main.getInstance().getUnusedID());
 			n.setAttribute("xyz", cursorPos);
 			n.setAttribute("ui.class", "source");
 			n.setAttribute("typeofNode", "source");
+			graphManager.addNode(n);
 			graphManager.selectNode(n.getId());
 			Debug.out("INFORMATION: Added Source Node with ID " + n.getId() + " at Position (" + cursorPos.x + "/"
 					+ cursorPos.y + ")", 1);
@@ -108,10 +110,11 @@ public class MyMouseManager extends DefaultMouseManager {
 			break;
 
 		case CREATE_SINK_NODE:
-			n = graph.addNode(Main.getInstance().getUnusedID());
+			n = nodeProducer.addNode(Main.getInstance().getUnusedID());
 			n.setAttribute("xyz", cursorPos);
 			n.setAttribute("ui.class", "sink");
 			n.setAttribute("typeofNode", "sink");
+			graphManager.addNode(n);
 			graphManager.selectNode(n.getId());
 			Debug.out("INFORMATION: Added Sink Node with ID " + n.getId() + " at Position (" + cursorPos.x + "/"
 					+ cursorPos.y + ")", 1);
@@ -119,12 +122,12 @@ public class MyMouseManager extends DefaultMouseManager {
 			break;
 
 		case CREATE_PROC_NODE:
-			n = graph.addNode(Main.getInstance().getUnusedID());
+			n = nodeProducer.addNode(Main.getInstance().getUnusedID());
 			n.setAttribute("xyz", cursorPos);
 			n.setAttribute("ui.class", "procEn");
 			n.setAttribute("typeofNode", "procEn");
 			ToolboxManager.createProcMaxDialog(n);
-
+			graphManager.addNode(n);
 			graphManager.selectNode(n.getId());
 			Debug.out("INFORMATION: Added ProcEn Node with ID " + n.getId() + " at Position (" + cursorPos.x + "/"
 					+ cursorPos.y + ")", 1);
@@ -132,12 +135,12 @@ public class MyMouseManager extends DefaultMouseManager {
 			break;
 
 		case CREATE_OPERATOR_NODE:
-			n = graph.addNode(Main.getInstance().getUnusedID());
+			n = nodeProducer.addNode(Main.getInstance().getUnusedID());
 			n.setAttribute("xyz", cursorPos);
 			n.setAttribute("ui.class", "operator");
 			n.setAttribute("typeofNode", "operator");
 			ToolboxManager.createProcNeedDialog(n);
-
+			graphManager.addNode(n);
 			graphManager.selectNode(n.getId());
 			Debug.out("INFORMATION: Added Operator Node with ID " + n.getId() + " at Position (" + cursorPos.x + "/"
 					+ cursorPos.y + ")", 1);