Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/Jascha'

Jan Enders 8 anni fa
parent
commit
d8c7eaf668

+ 2 - 0
scopviz/.gitignore

@@ -8,3 +8,5 @@
 /asdf.fdsa
 /.DS_Store
 /mapping-exported
+/mapping-exported.graphml
+/mappingexported

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

@@ -234,6 +234,7 @@ public class GraphManager {
 			if (!hasClass(n, UI_CLASS_PROCESSING_ENABLED)
 					|| !GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING)) {
 				n.changeAttribute("ui.style", "fill-color : #F00; size: 15px;");
+				PropertiesManager.setItemsProperties();
 			}
 		}
 	}
@@ -250,6 +251,7 @@ public class GraphManager {
 			this.selectedEdgeID = edgeID;
 
 			addClass(edgeID, "selected");
+			PropertiesManager.setItemsProperties();
 		}
 	}
 
@@ -576,6 +578,14 @@ public class GraphManager {
 		}
 	}
 
+	/**
+	 * Resets the selction of the Node for Edge selection
+	 */
+	public void deselectEdgeCreationNodes() {
+		if (lastClickedID != null)
+			deselectNodesAfterEdgeCreation(lastClickedID);
+	}
+
 	protected boolean addClass(String id, String className) {
 		Element e = getGraph().getEdge(id);
 		if (e == null)

+ 4 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLExporter.java

@@ -52,15 +52,16 @@ public class GraphMLExporter {
 	 *            The parent window of the save Window
 	 */
 	public void writeGraph(final Graph g, final Stage stage) {
-		g.getEdge(0).addAttribute("asd", g);
-		clearAttributes(g);
 		String fileName;
 		FileChooser fileChooser = new FileChooser();
 		fileChooser.setTitle("Saving graph");
 		try {
 			fileName = fileChooser.showSaveDialog(stage).getPath();
 			Main.getInstance().getGraphManager().setCurrentPath(fileName);
-			writeGraph(g, fileName);
+			if (fileName != null) {
+				clearAttributes(g);
+				writeGraph(g, fileName);
+			}
 		} catch (NullPointerException e) {
 
 		}

+ 42 - 5
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -139,7 +139,16 @@ public final class ButtonManager {
 		ToolboxManager.setUnderlayItems();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open...");
+		controller.open.setText("Open...");
+
+		controller.newItem.disableProperty().set(false);
+		controller.open.disableProperty().set(false);
+		controller.add.disableProperty().set(true);
+		controller.save.disableProperty().set(false);
+		controller.saveAs.disableProperty().set(false);
+		controller.delete.disableProperty().set(false);
+		controller.undelete.disableProperty().set(false);
+		controller.updateMetricMI.disableProperty().set(true);
 
 		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
@@ -159,7 +168,16 @@ public final class ButtonManager {
 		ToolboxManager.setOperatorItems();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open...");
+		controller.open.setText("Open...");
+
+		controller.newItem.disableProperty().set(false);
+		controller.open.disableProperty().set(false);
+		controller.add.disableProperty().set(false);
+		controller.save.disableProperty().set(false);
+		controller.saveAs.disableProperty().set(false);
+		controller.delete.disableProperty().set(false);
+		controller.undelete.disableProperty().set(false);
+		controller.updateMetricMI.disableProperty().set(true);
 
 		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
@@ -173,7 +191,7 @@ public final class ButtonManager {
 
 		// show metricbox/update button
 		if (!(GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING))) {
-			controller.rightSide.getChildren().add(2, controller.updateButtonAPane);
+			controller.rightSide.getChildren().add(controller.updateButtonAPane);
 			controller.metricbox.setVisible(true);
 		}
 
@@ -185,7 +203,16 @@ public final class ButtonManager {
 		ToolboxManager.setMappingItems();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open Mapping...");
+		controller.open.setText("Open Mapping...");
+
+		controller.newItem.disableProperty().set(true);
+		controller.open.disableProperty().set(false);
+		controller.add.disableProperty().set(true);
+		controller.save.disableProperty().set(false);
+		controller.saveAs.disableProperty().set(false);
+		controller.delete.disableProperty().set(false);
+		controller.undelete.disableProperty().set(false);
+		controller.updateMetricMI.disableProperty().set(false);
 
 	}
 
@@ -228,7 +255,17 @@ public final class ButtonManager {
 		GraphDisplayManager.switchActiveGraph();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open...");
+		controller.open.setText("Open...");
+
+		controller.newItem.disableProperty().set(true);
+		controller.open.disableProperty().set(true);
+		controller.add.disableProperty().set(true);
+		controller.save.disableProperty().set(true);
+		controller.saveAs.disableProperty().set(true);
+		controller.delete.disableProperty().set(true);
+		controller.undelete.disableProperty().set(true);
+		controller.updateMetricMI.disableProperty().set(true);
+
 	}
 
 	/**

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

@@ -235,6 +235,8 @@ public class GUIController implements Initializable {
 		newItem.setOnAction((event) -> MenuBarManager.newAction(event));
 		open.setOnAction((event) -> MenuBarManager.openAction(event));
 		add.setOnAction((event) -> MenuBarManager.addAction(event));
+		add.setDisable(true);
+		;
 		save.setOnAction((event) -> MenuBarManager.saveAction(event));
 		saveAs.setOnAction((event) -> MenuBarManager.saveAsAction(event));
 		preferences.setOnAction((event) -> MenuBarManager.preferencesAction(event));
@@ -242,6 +244,7 @@ public class GUIController implements Initializable {
 		delete.setOnAction((event) -> MenuBarManager.deleteAction(event));
 		undelete.setOnAction((event) -> MenuBarManager.undeleteAction(event));
 		updateMetricMI.setOnAction((event) -> MetricboxManager.updateMetrics());
+		updateMetricMI.setDisable(true);
 		about.setOnAction((event) -> MenuBarManager.aboutAction(event));
 
 	}
@@ -494,8 +497,4 @@ public class GUIController implements Initializable {
 		assert stackPane != null : "fx:id=\"stackPane\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert swingNodeWorldView != null : "fx:id=\"swingNodeWorldView\" was not injected: check your FXML file 'MainWindow.fxml'.";
 	}
-
-	MenuItem getOpenButton() {
-		return open;
-	}
-}
+}

+ 12 - 22
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java

@@ -207,7 +207,6 @@ public final class GraphDisplayManager {
 			// set basic style
 			v.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
 		} else {
-			// TODO: Testing new Merging code
 			v = new GraphManager(GraphHelper.newMerge(false, getGraphManager().getGraph(), g));
 			v.getGraph().addAttribute("layer", currentLayer);
 			v.getGraph().addAttribute("ui.antialias");
@@ -216,16 +215,6 @@ public final class GraphDisplayManager {
 			ret = count++;
 			// set basic style
 			v.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
-
-			/*
-			 * TODO: remove this OLD CODE v = getGraphManager();
-			 * Debug.out(v.getGraph().toString() + " Nodes: " +
-			 * v.getGraph().getNodeCount() + " Edges: " +
-			 * v.getGraph().getEdgeCount()); GraphHelper.merge(v.getGraph(), g);
-			 * ret = currentGraphManager; Debug.out(v.getGraph().toString() +
-			 * " Nodes: " + v.getGraph().getNodeCount() + " Edges: " +
-			 * v.getGraph().getEdgeCount());
-			 */
 		}
 
 		// set ui.class
@@ -362,19 +351,19 @@ public final class GraphDisplayManager {
 			}
 		}
 		if (underlay == null) {
-			Debug.out("no Underlay found");
+			Debug.out("ERROR: no Underlay found", 3);
 			return;
 		}
 		if (operator == null) {
-			Debug.out("no Operator found");
+			Debug.out("ERROR: no Operator found", 3);
 			return;
 		}
 		if (mapping == null || !mapping.hasGraphManagerAsParent(underlay)
 				|| !mapping.hasGraphManagerAsParent(operator)) {
 			if (mapping == null)
-				Debug.out("no Mapping found");
+				Debug.out("WARNING: no Mapping found", 2);
 			else {
-				Debug.out("old Mapping found");
+				Debug.out("WARNING: old Mapping found", 2);
 				vList.remove(mapping);
 			}
 			MyGraph g;
@@ -417,7 +406,7 @@ public final class GraphDisplayManager {
 		Layer tempLayer = currentLayer;
 
 		// underlay Graph
-		MyGraph tempGraph = new MyGraph(getGraphStringID(count));
+		MyGraph tempGraph = new MyGraph(getGraphStringID(count++));
 		count++;
 		for (Node n : g.getNodeSet()) {
 			String id = n.getId();
@@ -425,7 +414,6 @@ public final class GraphDisplayManager {
 				id = id.substring(MappingGraphManager.UNDERLAY.length());
 				Node tempNode = tempGraph.addNode(id);
 				for (String s : n.getAttributeKeySet()) {
-					Debug.out(s + ":" + n.getAttribute(s).toString());
 					tempNode.addAttribute(s, (Object) n.getAttribute(s));
 				}
 			}
@@ -446,16 +434,16 @@ public final class GraphDisplayManager {
 		currentLayer = Layer.UNDERLAY;
 		addGraph(tempGraph, true);
 		GraphManager und = getGraphManager(Layer.UNDERLAY);
+
 		// operator graph
-		tempGraph = new MyGraph(getGraphStringID(count));
+		MyGraph tempGraph2 = new MyGraph(getGraphStringID(count++));
 		count++;
 		for (Node n : g.getNodeSet()) {
 			String id = n.getId();
 			if (id.startsWith(MappingGraphManager.OPERATOR)) {
 				id = id.substring(MappingGraphManager.OPERATOR.length());
-				Node tempNode = tempGraph.addNode(id);
+				Node tempNode = tempGraph2.addNode(id);
 				for (String s : n.getAttributeKeySet()) {
-					Debug.out(s + ":" + n.getAttribute(s).toString());
 					tempNode.addAttribute(s, (Object) n.getAttribute(s));
 				}
 			}
@@ -464,7 +452,7 @@ public final class GraphDisplayManager {
 			String id = e.getId();
 			if (id.startsWith(MappingGraphManager.OPERATOR)) {
 				id = id.substring(MappingGraphManager.OPERATOR.length());
-				Edge tempEdge = tempGraph.addEdge(id,
+				Edge tempEdge = tempGraph2.addEdge(id,
 						e.getSourceNode().getId().substring(MappingGraphManager.OPERATOR.length()),
 						e.getTargetNode().getId().substring(MappingGraphManager.OPERATOR.length()), e.isDirected());
 				for (String s : e.getAttributeKeySet()) {
@@ -473,8 +461,9 @@ public final class GraphDisplayManager {
 			}
 		}
 		currentLayer = Layer.OPERATOR;
-		addGraph(tempGraph, true);
+		addGraph(tempGraph2, true);
 		GraphManager op = getGraphManager(Layer.OPERATOR);
+
 		// Mapping graph
 		MyGraph moreTempGraph = new MyGraph(getGraphStringID(count));
 		moreTempGraph.addAttribute("layer", Layer.MAPPING);
@@ -492,6 +481,7 @@ public final class GraphDisplayManager {
 		op.addNodeCreatedListener(map);
 		map.loadGraph(g);
 		currentLayer = tempLayer;
+		switchActiveGraph();
 	}
 
 }