Procházet zdrojové kódy

fixed a delte bug and added default label

jascha Bohne před 8 roky
rodič
revize
026ca686e1

+ 12 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java

@@ -171,13 +171,21 @@ public class GraphManager {
 		}
 
 		for (Edge e : deletedEdges) {
+			String sourceId = null;
+			String targetId = null;
 			attributes = new HashMap<String, Object>();
 			for (String s : e.getAttributeKeySet()) {
 				attributes.put(s, e.getAttribute(s));
 			}
 			String id = Main.getInstance().getUnusedID();
-			String sourceId = (e.getSourceNode().getId().equals(deletedNode.getId())) ? newId : e.getSourceNode().getId();
-			String targetId = (e.getTargetNode().getId().equals(deletedNode.getId())) ? newId : e.getTargetNode().getId();
+			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);
 		}
@@ -232,8 +240,8 @@ public class GraphManager {
 				String nodeType = n.getAttribute("ui.class");
 				n.changeAttribute("ui.style",
 						(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;");
 				if (StylesheetManager.getNodeGraphics().equals(StylesheetManager.getAllNodeGraphics()[1]))
 					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) {
 		for (Node n : g.getNodeSet()) {
+			if (!n.hasAttribute("ui.label")){
+				n.addAttribute("ui.label", "");
+			}
 			if (!n.hasAttribute("typeofNode") || n.getAttribute("typeofNode").equals("")) {
 				n.addAttribute("typeofNode", "standard");
 			}