Sfoglia il codice sorgente

Fixed Stylesheet issues, fixed Importer Issues.

Jan Enders 8 anni fa
parent
commit
47eadc56b5

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

@@ -542,4 +542,8 @@ public class GraphManager {
 		((MyGraph) g).addNodeCreatedListener(n);
 	}
 
+	public void updateStylesheet() {
+		setStylesheet(this.stylesheet);
+	}
+
 }

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

@@ -7,7 +7,6 @@ import java.util.ArrayList;
 import org.apache.commons.math3.exception.NullArgumentException;
 import org.graphstream.graph.Graph;
 import org.graphstream.graph.implementations.SingleGraph;
-import org.graphstream.ui.geom.Point3;
 import de.tu_darmstadt.informatik.tk.scopviz.io.GraphMLImporter;
 import de.tu_darmstadt.informatik.tk.scopviz.main.CreationMode;
 import de.tu_darmstadt.informatik.tk.scopviz.main.GraphManager;
@@ -34,17 +33,6 @@ public final class GraphDisplayManager {
 	/** Prefix to add to the Name of the Graphs. */
 	private static final String GRAPH_STRING_ID_PREFIX = "graph";
 
-//TODO: are these necessary?
-	/**
-	 * Last saved Mouse Position from the Time of the last Mouse Button Press.
-	 */
-	public static Point3 oldMousePos;
-
-	/**
-	 * Last saved Camera view Center from the time of the last Mouse Button
-	 * Press.
-	 */
-	public static Point3 oldViewCenter;
 
 	/** A List of all GraphManagers managed by this class. */
 	private static ArrayList<GraphManager> vList = new ArrayList<GraphManager>();
@@ -177,7 +165,6 @@ public final class GraphDisplayManager {
 		}
 
 		// set basic style
-		OptionsManager.adjustNodeGraphics(OptionsManager.getAllNodeGraphics()[0]);
 		v.setStylesheet(OptionsManager.DEFAULT_STYLESHEET);
 		// display the graph
 		vList.add(v);
@@ -222,6 +209,7 @@ public final class GraphDisplayManager {
 				.setPreferredSize(new Dimension((int) pane.getWidth() - 5, (int) pane.getHeight() - 5));
 		guiController.swingNode.setContent(Main.getInstance().getGraphManager().getView());
 
+		Main.getInstance().getGraphManager().updateStylesheet();
 		Main.getInstance().setCreationMode(CreationMode.CREATE_NONE);
 	}
 

+ 4 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java

@@ -3,6 +3,7 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui;
 import java.util.ArrayList;
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
+import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import javafx.application.Platform;
 import javafx.collections.FXCollections;
 import javafx.geometry.Insets;
@@ -53,7 +54,7 @@ public final class OptionsManager {
 	/** The currently selected Display Mode */
 	private static String nodeGraphics = allNodeGraphics[1];
 	/** The currently active Stylesheet. */
-	private static String nodeStylesheet = null;
+	private static String nodeStylesheet = STYLE_NODES_SPRITES;
 
 	// Layer stylesheets
 	private static String styleLayerUnderlay = "";
@@ -135,6 +136,7 @@ public final class OptionsManager {
 	 */
 	public static void adjustNodeGraphics(String newGraphics) {
 		if (!newGraphics.equalsIgnoreCase(nodeGraphics)) {
+			nodeGraphics = newGraphics;
 			if (newGraphics.equals(allNodeGraphics[0])) {
 				setNodeGraphics(STYLE_NODES_SHAPES);
 			} else if (newGraphics.equals(allNodeGraphics[1])) {
@@ -143,6 +145,7 @@ public final class OptionsManager {
 				throw new RuntimeException("These graphics do not exist");
 			}
 		}
+		Main.getInstance().getGraphManager().updateStylesheet();
 	}
 
 	/**