Browse Source

Merge remote-tracking branch 'origin/Jascha'

Jan Enders 8 years ago
parent
commit
a33af84104

+ 1 - 0
scopviz/.gitignore

@@ -7,3 +7,4 @@
 /testImporter.graphml
 /testImporter.graphml
 /asdf.fdsa
 /asdf.fdsa
 /.DS_Store
 /.DS_Store
+/mapping-exported

+ 19 - 6
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java

@@ -158,26 +158,39 @@ public class GraphManager {
 	 * Graph
 	 * Graph
 	 */
 	 */
 	public void undelete() {
 	public void undelete() {
+		String newId = "";
 		// System.out.println("test-undel");
 		// System.out.println("test-undel");
 		HashMap<String, Object> attributes = new HashMap<String, Object>();
 		HashMap<String, Object> attributes = new HashMap<String, Object>();
 		if (deletedNode != null) {
 		if (deletedNode != null) {
 			for (String s : deletedNode.getAttributeKeySet()) {
 			for (String s : deletedNode.getAttributeKeySet()) {
 				attributes.put(s, deletedNode.getAttribute(s));
 				attributes.put(s, deletedNode.getAttribute(s));
 			}
 			}
-			String id = Main.getInstance().getUnusedID();
-			g.addNode(id);
-			g.getNode(id).addAttributes(attributes);
+			newId = Main.getInstance().getUnusedID();
+			g.addNode(newId);
+			g.getNode(newId).addAttributes(attributes);
 		}
 		}
 
 
 		for (Edge e : deletedEdges) {
 		for (Edge e : deletedEdges) {
+			String sourceId = null;
+			String targetId = null;
 			attributes = new HashMap<String, Object>();
 			attributes = new HashMap<String, Object>();
 			for (String s : e.getAttributeKeySet()) {
 			for (String s : e.getAttributeKeySet()) {
 				attributes.put(s, e.getAttribute(s));
 				attributes.put(s, e.getAttribute(s));
 			}
 			}
 			String id = Main.getInstance().getUnusedID();
 			String id = Main.getInstance().getUnusedID();
-			g.addEdge(id, (Node) e.getSourceNode(), (Node) e.getTargetNode());
+			if (deletedNode != null) {
+				sourceId = (e.getSourceNode().getId().equals(deletedNode.getId())) ? newId : e.getSourceNode().getId();
+				targetId = (e.getTargetNode().getId().equals(deletedNode.getId())) ? newId : e.getTargetNode().getId();
+			} else {
+				sourceId = e.getSourceNode().getId();
+				targetId = e.getTargetNode().getId();
+
+			}
+			g.addEdge(id, sourceId, targetId);
 			g.getEdge(id).addAttributes(attributes);
 			g.getEdge(id).addAttributes(attributes);
 		}
 		}
+		deletedEdges = new LinkedList<>();
+		deletedNode = null;
 	}
 	}
 
 
 	/**
 	/**
@@ -227,8 +240,8 @@ public class GraphManager {
 				String nodeType = n.getAttribute("ui.class");
 				String nodeType = n.getAttribute("ui.class");
 				n.changeAttribute("ui.style",
 				n.changeAttribute("ui.style",
 						(StylesheetManager.getNodeGraphics().equals(StylesheetManager.getAllNodeGraphics()[1]))
 						(StylesheetManager.getNodeGraphics().equals(StylesheetManager.getAllNodeGraphics()[1]))
-								? ("fill-mode: image-scaled; fill-image: url('src/main/resources/png/" + nodeType
-										+ "_red.png'); size: 15px;")
+						? ("fill-mode: image-scaled; fill-image: url('src/main/resources/png/" + nodeType
+								+ "_red.png'); size: 15px;")
 								: "fill-color : #F00; size: 15px;");
 								: "fill-color : #F00; size: 15px;");
 				if (StylesheetManager.getNodeGraphics().equals(StylesheetManager.getAllNodeGraphics()[1]))
 				if (StylesheetManager.getNodeGraphics().equals(StylesheetManager.getAllNodeGraphics()[1]))
 					n.changeAttribute("ui.class", nodeType + "_red");
 					n.changeAttribute("ui.class", nodeType + "_red");

+ 3 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java

@@ -60,6 +60,9 @@ public class GraphMLImporter {
 	 */
 	 */
 	private void handleAttributes(MyGraph g) {
 	private void handleAttributes(MyGraph g) {
 		for (Node n : g.getNodeSet()) {
 		for (Node n : g.getNodeSet()) {
+			if (!n.hasAttribute("ui.label")){
+				n.addAttribute("ui.label", "");
+			}
 			if (!n.hasAttribute("typeofNode") || n.getAttribute("typeofNode").equals("")) {
 			if (!n.hasAttribute("typeofNode") || n.getAttribute("typeofNode").equals("")) {
 				n.addAttribute("typeofNode", "standard");
 				n.addAttribute("typeofNode", "standard");
 			}
 			}