Преглед изворни кода

Merge remote-tracking branch 'origin/Jascha' into Jan

Jan Enders пре 8 година
родитељ
комит
45c0b4eab1

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

@@ -237,16 +237,9 @@ public class GraphManager {
 			// set selected node color to red
 			if (!hasClass(n, UI_CLASS_PROCESSING_ENABLED)
 					|| !GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING)) {
-				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-color : #F00; size: 15px;");
-				if (StylesheetManager.getNodeGraphics().equals(StylesheetManager.getAllNodeGraphics()[1]))
-					n.changeAttribute("ui.class", nodeType + "_red");
+				n.changeAttribute("ui.style", "fill-color : #F00; size: 15px;");
+				PropertiesManager.setItemsProperties();
 			}
-			PropertiesManager.setItemsProperties();
 		}
 	}
 
@@ -439,8 +432,6 @@ public class GraphManager {
 		return g.getMaxY();
 	}
 
-	
-
 	/**
 	 * Returns the Stylesheet used by the Graph.
 	 * 
@@ -571,12 +562,8 @@ public class GraphManager {
 	protected boolean selectNodeForEdgeCreation(String nodeID) {
 		deselect();
 		Node n = getGraph().getNode(nodeID);
-		String nodeType = n.getAttribute("ui.class");
 		if (!hasClass(n, UI_CLASS_PROCESSING_ENABLED) || !GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING)) {
-			nodeType = nodeType.split("_")[0];
-			n.changeAttribute("ui.style", "fill-mode: image-scaled; fill-image: url('src/main/resources/png/" + nodeType
-					+ "_green.png'); size: 15px;");
-			n.changeAttribute("ui.class", nodeType + "_green");
+			n.changeAttribute("ui.style", "fill-color:green; size: 15px;");
 		}
 		return true;
 	}
@@ -590,9 +577,8 @@ public class GraphManager {
 	protected void deselectNodesAfterEdgeCreation(String nodeID) {
 		Node n = getGraph().getNode(nodeID);
 		if (!hasClass(n, UI_CLASS_PROCESSING_ENABLED) || !GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING)) {
-			String nodeType = n.getAttribute("ui.class");
-			n.changeAttribute("ui.style", "fill-color: #000000; size: 10px;");
-			n.changeAttribute("ui.class", nodeType.split("_")[0]);
+			n.removeAttribute("ui.style");
+			n.changeAttribute("ui.style", "fill-color: #000000; size: 15px;");
 		}
 	}
 

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

@@ -80,11 +80,11 @@ public class GraphMLImporter {
 				n.addAttribute("ui.label", n.getAttribute("yEd.label").toString());
 				n.removeAttribute("yEd.label");
 			}
-			if (n.hasAttribute("yEd.x") || n.getAttribute("yEd.y").equals("")) {
+			if (n.hasAttribute("yEd.x") && !n.getAttribute("yEd.x").equals("")) {
 				n.addAttribute("x", Double.parseDouble(n.getAttribute("yEd.x").toString()));
 				n.removeAttribute("yEd.x");
 			}
-			if (n.hasAttribute("yEd.y") || n.getAttribute("yEd.y").equals("")) {
+			if (n.hasAttribute("yEd.y") && !n.getAttribute("yEd.y").equals("")) {
 				n.addAttribute("y", Double.parseDouble(n.getAttribute("yEd.y").toString()));
 				n.removeAttribute("yEd.y");
 			}
@@ -114,7 +114,7 @@ public class GraphMLImporter {
 			String fileName = fileChooser.showOpenDialog(stage).getPath();
 			Main.getInstance().getGraphManager().setCurrentPath(fileName);
 			return readGraph(id, fileName);
-		} catch (NullPointerException e) {
+		} catch (IllegalArgumentException e) {
 			return null;
 		}
 	}