Browse Source

Merge remote-tracking branch 'origin/Jascha'

Jan Enders 8 years ago
parent
commit
80c9e0b2bd

+ 3 - 0
scopviz/.gitignore

@@ -3,3 +3,6 @@
 /Example-sprite.graphml
 /Labels.jpg
 /Labels.png
+/testImporter-multigraph.graphml
+/testImporter.graphml
+/asdf.fdsa

+ 2 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/debug/Debug.java

@@ -33,7 +33,7 @@ public final class Debug {
 	 */
 	public static String getDefaultGraph() {
 		String fileName = null;
-		fileName = "/Example.graphml";
+		fileName = "/underlay_example.graphml";
 		return fileName;
 	}
 
@@ -44,7 +44,7 @@ public final class Debug {
 	 */
 	public static String getDefaultGraph2() {
 		String fileName = null;
-		fileName = "/Example2.graphml";
+		fileName = "/operator_example.graphml";
 		return fileName;
 	}
 

+ 50 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLExporter.java

@@ -3,12 +3,14 @@ package de.tu_darmstadt.informatik.tk.scopviz.io;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.LinkedList;
 
 import org.graphstream.graph.Edge;
 import org.graphstream.graph.Graph;
 import org.graphstream.graph.Node;
 import org.graphstream.stream.file.FileSinkGraphML;
 
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import javafx.stage.FileChooser;
 import javafx.stage.Stage;
@@ -51,6 +53,7 @@ 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();
@@ -66,7 +69,8 @@ public class GraphMLExporter {
 
 	/**
 	 * Cleans up the Attributes of all Nodes and Edges of a given Graph,
-	 * removing the ui.j2dsk Attribute.
+	 * removing the ui.j2dsk and ui.class Attribute. also removes all
+	 * Attributesthat are not a String or (a Wrapper of) a primitive type
 	 * 
 	 * @param g
 	 *            the Graph to clean up
@@ -76,11 +80,55 @@ public class GraphMLExporter {
 		while (edges.hasNext()) {
 			Edge e = edges.next();
 			e.removeAttribute("ui.j2dsk");
+			for (String s : e.getEachAttributeKey()) {
+				Class<? extends Object> c = e.getAttribute(s).getClass();
+				if (!c.isPrimitive() && !(c == String.class) && !(c == Character.class) && !(c == Boolean.class)
+						&& !(c == Integer.class) && !(c == Long.class) && !(c == Short.class) && !(c == Byte.class)
+						&& !(c == Float.class) && !(c == Double.class)) {
+					Debug.out("Could not parse an Attribute because it is not Primitive or a String \n\t"
+							+ "(Attribute: " + s + ", Value: " + e.getAttribute(s) + ", from Edge: " + e + ", Type: "
+							+ c + ") ");
+				}
+			}
 		}
 		Iterator<? extends Node> nodes = g.getNodeIterator();
 		while (nodes.hasNext()) {
 			Node n = nodes.next();
 			n.removeAttribute("ui.j2dsk");
+			n.removeAttribute("ui.class");
+			for (String s : n.getEachAttributeKey()) {
+				Class<? extends Object> c = n.getAttribute(s).getClass();
+				if (!c.isPrimitive() && !(c == String.class) && !(c == Character.class) && !(c == Boolean.class)
+						&& !(c == Integer.class) && !(c == Long.class) && !(c == Short.class) && !(c == Byte.class)
+						&& !(c == Float.class) && !(c == Double.class)) {
+					Debug.out("Could not parse an Attribute because it is not Primitive or a String \n\t"
+							+ "(Attribute: " + s + ", Value: " + n.getAttribute(s) + ", from Node: " + n + ", Type: "
+							+ c + ") ");
+				}
+			}
 		}
 	}
-}
+
+	public void writeMapping(Graph underlay, Graph operator, LinkedList<? extends Edge> mappingEdges,
+			Stage parentWindow) {
+		String fileName, underlayId, operatorId;
+		String underlayFile = "underlay_Temp_" + Math.random() + ".graphml";
+		String operatorFile = "operator_Temp_" + Math.random() + ".graphml";
+		String edgesFile = "edges_Temp_" + Math.random() + ".graohml";
+		FileChooser fileChooser = new FileChooser();
+		fileChooser.setTitle("Saving graph");
+
+		underlayId = underlay.getId();
+		writeGraph(underlay, underlayFile);
+		operatorId = operator.getId();
+		writeGraph(operator, operatorFile);
+		writeMappingEdges(mappingEdges, edgesFile);
+
+		fileName = fileChooser.showSaveDialog(parentWindow).getPath();
+
+	}
+
+	private void writeMappingEdges(LinkedList<? extends Edge> mappingEdges, String fileName) {
+
+	}
+}

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

@@ -4,8 +4,10 @@ import java.io.IOException;
 import java.net.URL;
 import java.util.LinkedList;
 
+import org.graphstream.graph.Node;
 import org.graphstream.graph.implementations.SingleGraph;
 
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.main.MyGraph;
 import javafx.stage.FileChooser;
@@ -44,9 +46,27 @@ public class GraphMLImporter {
 			e.printStackTrace();
 		}
 		fs.removeSink(g);
+		addDefaultAttributes(g);
 		return g;
 	}
 
+	/**
+	 * adds default values for typeofNode and typeofDevice to all Nodes
+	 * 
+	 * @param g
+	 *            the graph that the attributes will be added onto
+	 */
+	private void addDefaultAttributes(MyGraph g) {
+		for (Node n : g.getNodeSet()) {
+			if (!n.hasAttribute("typeOfNode")) {
+				n.addAttribute("typeOfNode", "standard");
+			}
+			if (!n.hasAttribute("typeofDevice")) {
+				n.addAttribute("typeofDevice", "unknown");
+			}
+		}
+	}
+
 	/**
 	 * Imports a GraphML file. Opens a open dialog. Returns null if the process
 	 * is aborted.
@@ -89,6 +109,8 @@ public class GraphMLImporter {
 			e.printStackTrace();
 		}
 		fs.removeSink(g);
+		addDefaultAttributes(g);
+		Debug.out(g.getId());
 		return g;
 	}
 

+ 12 - 5
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSourceGraphML.java

@@ -1,4 +1,6 @@
-/*
+/*This is a modified version of the class org.graphstream.stream.file.FileSourceGraphML
+ * It was modified by Jascha Bohne <jaschabohne@web.de> for use in the scopviz project 
+ * 
  * Copyright 2006 - 2015
  *     Stefan Balev     <stefan.balev@graphstream-project.org>
  *     Julien Baudry    <julien.baudry@graphstream-project.org>
@@ -570,9 +572,8 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 
 	// TODO: handle malformed files on state switches
 	/**
-	 * <pre>
-	 * <!ELEMENT graphml  ((desc)?,(key)*,((data)|(graph))*)>
-	 * </pre>
+	 * parses a Stream of xml Events to a graphstream graph it has limited
+	 * support for yEd attributes
 	 * 
 	 * @throws IOException
 	 * @throws XMLStreamException
@@ -1094,8 +1095,14 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 		return d;
 	}
 
+	// TODO color parsing
 	/**
-	 * Parses a yEdattribute returns null if the Attribute is unknown.
+	 * Parses a yEdattribute. returns null if the Attribute is unknown.
+	 * 
+	 * The known Attributes are:
+	 * <li>position of nodes</li>
+	 * <li>The label of Nodes</li>
+	 * <li>color of nodes</li>
 	 * 
 	 * @return the parsed yEd Attribute as a Data object
 	 * @throws IOException

+ 4 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MySourceBase.java

@@ -1,4 +1,7 @@
-/*
+/*This is a modified version of the class org.graphstream.stream.SourceBase
+ * It was modified by Jascha Bohne <jaschabohne@web.de> for use in the scopviz project
+ * This class is based on the 1.3 release of graphstream 
+ *
  * Copyright 2006 - 2015
  *     Stefan Balev     <stefan.balev@graphstream-project.org>
  *     Julien Baudry    <julien.baudry@graphstream-project.org>

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

@@ -1,5 +1,6 @@
 package de.tu_darmstadt.informatik.tk.scopviz.main;
 
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -15,6 +16,7 @@ import org.graphstream.ui.view.ViewerPipe;
 
 import de.tu_darmstadt.informatik.tk.scopviz.ui.OptionsManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.PropertiesManager;
+import de.tu_darmstadt.informatik.tk.scopviz.ui.StylesheetManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.MyMouseManager;
 
 /**
@@ -94,7 +96,6 @@ public class GraphManager {
 		// and need the Node to still be in the Graph
 		deleteEdgesOfNode(id);
 		deletedNode = g.removeNode(id);
-		// System.out.println("test-del");
 	}
 
 	/**
@@ -106,6 +107,7 @@ public class GraphManager {
 	 *            the ID of the Edge that will be removed
 	 */
 	public void deleteEdge(final String id) {
+		deselect();
 		deletedEdges.removeAll(deletedEdges);
 		deletedNode = null;
 		deletedEdges.add(g.removeEdge(id));
@@ -120,6 +122,7 @@ public class GraphManager {
 	 *            the Id of the Node, whose Edges shall be removed
 	 */
 	public void deleteEdgesOfNode(final String id) {
+		deselect();
 		Node node = g.getNode(id);
 		deletedEdges.removeAll(deletedEdges);
 		deletedNode = null;
@@ -486,8 +489,9 @@ public class GraphManager {
 		this.stylesheet = stylesheet;
 		g.removeAttribute("ui.stylesheet");
 		String completeStylesheet = stylesheet;
-		completeStylesheet = completeStylesheet.concat(OptionsManager.getNodeGraphics());
-		completeStylesheet = completeStylesheet.concat(OptionsManager.getLayerStyle((Layer) g.getAttribute("layer")));
+		completeStylesheet = completeStylesheet.concat(StylesheetManager.getNodeGraphics());
+		completeStylesheet = completeStylesheet
+				.concat(StylesheetManager.getLayerStyle((Layer) g.getAttribute("layer")));
 		g.addAttribute("ui.stylesheet", completeStylesheet);
 	}
 
@@ -514,10 +518,25 @@ public class GraphManager {
 	}
 
 	/**
-	 * Updates the Stylesheet, causing any changes to it to come into effect.
+	 * Updates the implicit Stylesheet, causing any changes to it to come into
+	 * effect.
 	 */
 	public void updateStylesheet() {
 		setStylesheet(this.stylesheet);
 	}
 
+	/**
+	 * Sets typeofNode as the ui.class of all Nodes.
+	 * 
+	 */
+	public void convertUiClass() {
+		Collection<Node> allNodes = g.getNodeSet();
+		for (Node n : allNodes) {
+			n.removeAttribute("typeofNode");
+			if (n.hasAttribute("typeofNode")) {
+				n.addAttribute("ui.class", n.getAttribute("typeofNode"));
+			}
+		}
+	}
+
 }

+ 22 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/ScopvizGraphMetric.java

@@ -0,0 +1,22 @@
+package de.tu_darmstadt.informatik.tk.scopviz.main;
+
+import java.util.LinkedList;
+
+import javafx.util.Pair;
+
+public interface ScopvizGraphMetric {
+
+	/**
+	 * calculate the metric on the graph
+	 * 
+	 * @param g
+	 *            a MyGraph
+	 * @return a pair that is displayed in the metrics window
+	 */
+	public LinkedList<Pair<String, String>> calculate(MyGraph g);
+
+	/**
+	 * returns the name of the Metric which will be displayed above the values
+	 */
+	public Pair<String, Object> getName();
+}

+ 16 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/ScopvizGraphOperator.java

@@ -0,0 +1,16 @@
+package de.tu_darmstadt.informatik.tk.scopviz.main;
+
+import java.util.LinkedList;
+
+public interface ScopvizGraphOperator {
+
+	/**
+	 * calculates a new Version of the Graph using the given operator
+	 * 
+	 * @param g
+	 *            a MyGraph
+	 * @return a list of Graphs that is the result of the operator on the Graph
+	 *         g
+	 */
+	public LinkedList<MyGraph> calculate(MyGraph g);
+}

+ 4 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java

@@ -177,8 +177,10 @@ public final class GraphDisplayManager {
 			// return theIdOfTheMergedGraph;
 		}
 
+		// set ui.class
+		v.convertUiClass();
 		// set basic style
-		v.setStylesheet(OptionsManager.DEFAULT_STYLESHEET);
+		v.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
 		// display the graph
 		vList.add(v);
 		switchActiveGraph();
@@ -323,7 +325,7 @@ public final class GraphDisplayManager {
 			mapping = new MappingGraphManager(g, underlay, operator);
 			g.addAttribute("layer", Layer.MAPPING);
 			g.addAttribute("ui.antialias");
-			mapping.setStylesheet(OptionsManager.DEFAULT_STYLESHEET);
+			mapping.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
 			vList.add(mapping);
 
 			underlay.addEdgeCreatedListener(mapping);

+ 8 - 137
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java

@@ -2,9 +2,6 @@ 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;
@@ -24,45 +21,16 @@ import javafx.scene.layout.GridPane;
  * @version 1.0.0.0
  */
 public final class OptionsManager {
-	/**
-	 * all available graphic styles
-	 */
-	private static String[] allNodeGraphics = { "Shapes", "Sprites" };
-	/**
-	 * The Stylesheet that is given to every graph that is added to display
-	 * everything correctly
-	 */
-	public static final String DEFAULT_STYLESHEET = "node{text-alignment:at-right;} \n"
-			+ "edge{text-offset: 4px,-4px;}";
-	/**
-	 * Part of the stylesheet that styles the different Nodes with shapes.
-	 */
-	public static final String STYLE_NODES_SHAPES = "node.standard{shape: circle;}" + "node.source{shape: rounded-box;}"
-			+ "node.procEn{shape: diamond;}" + "node.sink{shape: cross;}";
-	/**
-	 * Part of the stylesheet that styles the different Nodes with sprites.
-	 */
-	public static final String STYLE_NODES_SPRITES = "node.standard{fill-mode: image-scaled; fill-image: url('src/main/resources/png/standard.png'); }"
-			+ "node.source{fill-mode: image-scaled; fill-image: url('src/main/resources/png/source.png'); }"
-			+ "node.procEn{fill-mode: image-scaled; fill-image: url('src/main/resources/png/procEn.png'); }"
-			+ "node.sink{fill-mode: image-scaled; fill-image: url('src/main/resources/png/sink.png'); }"
-			+ "node.operator{fill-mode: image-scaled; fill-image: url('src/main/resources/png/operator.png'); }";
-
 	// SETTINGS
 	/** The Default Weight for all new Edges. */
 	private static int defaultWeight = 0;
 	/** Flag whether to show the weight labels on Edges. */
 	private static boolean showWeight = true;
-	/** The currently selected Display Mode */
-	private static String nodeGraphics = allNodeGraphics[1];
-	/** The currently active Stylesheet. */
-	private static String nodeStylesheet = STYLE_NODES_SPRITES;
-
 	// Layer stylesheets
-	private static String styleLayerUnderlay = "";
-	private static String styleLayerOperator = "";
-	private static String styleLayerMapping = "";
-	private static String styleLayerSymbol = "";
+	static String styleLayerUnderlay = "";
+	static String styleLayerOperator = "";
+	static String styleLayerMapping = "";
+	static String styleLayerSymbol = "";
 
 	/**
 	 * Private Constructor to prevent Instantiation.
@@ -95,8 +63,9 @@ public final class OptionsManager {
 		showWeightButton.setSelected(showWeight);
 
 		ChoiceBox<String> nodeGraphicsSelector = new ChoiceBox<String>();
-		nodeGraphicsSelector.setItems(FXCollections.observableArrayList(allNodeGraphics[0], allNodeGraphics[1]));
-		nodeGraphicsSelector.getSelectionModel().select(nodeGraphics);
+		nodeGraphicsSelector.setItems(FXCollections.observableArrayList(StylesheetManager.getAllNodeGraphics()[0],
+				StylesheetManager.getAllNodeGraphics()[1]));
+		nodeGraphicsSelector.getSelectionModel().select(StylesheetManager.getNodeGraphics());
 		;
 
 		// position elements on grid
@@ -120,7 +89,7 @@ public final class OptionsManager {
 				} catch (NumberFormatException e) {
 				}
 				showWeight = showWeightButton.isSelected();
-				adjustNodeGraphics(nodeGraphicsSelector.getValue());
+				StylesheetManager.adjustNodeGraphics(nodeGraphicsSelector.getValue());
 				return null;
 			} else
 				return null;
@@ -130,35 +99,6 @@ public final class OptionsManager {
 
 	}
 
-	/**
-	 * Changes the Stylesheet and updates all Nodes to use it.
-	 * 
-	 * @param newGraphics
-	 *            the new Stylesheet to use
-	 */
-	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])) {
-				setNodeGraphics(STYLE_NODES_SPRITES);
-			} else {
-				throw new RuntimeException("These graphics do not exist");
-			}
-		}
-		Main.getInstance().getGraphManager().updateStylesheet();
-	}
-
-	/**
-	 * Returns all available Stylesheets as Strings.
-	 * 
-	 * @return all the StyleSheets
-	 */
-	public static String[] getAllNodeGraphics() {
-		return allNodeGraphics;
-	}
-
 	/**
 	 * Returns the default weight for new Edges.
 	 * 
@@ -197,73 +137,4 @@ public final class OptionsManager {
 		OptionsManager.showWeight = showWeight;
 	}
 
-	/**
-	 * Returns the currently active StyleSheet.
-	 * 
-	 * @return the currently active StyleSheet as a String
-	 */
-	public static String getNodeGraphics() {
-		return nodeStylesheet;
-	}
-
-	/**
-	 * Sets the current Stylesheet.
-	 * 
-	 * @param nodeGraphics
-	 *            the Stylesheet to use
-	 */
-	public static void setNodeGraphics(String nodeGraphics) {
-		OptionsManager.nodeStylesheet = nodeGraphics;
-	}
-
-	/**
-	 * Returns the styleSheet for a given Layer
-	 * 
-	 * @param l
-	 *            the Layer
-	 * @return the Stylesheet
-	 */
-	public static String getLayerStyle(Layer l) {
-		switch (l) {
-		case UNDERLAY:
-			return styleLayerUnderlay;
-		case OPERATOR:
-			return styleLayerOperator;
-		case MAPPING:
-			return styleLayerMapping;
-		case SYMBOL:
-			return styleLayerSymbol;
-		default:
-			Debug.out("OptionsManager: Stylesheet for an unknown Layer Requested");
-			return "";
-		}
-	}
-
-	/**
-	 * Sets the Stylesheet for a given Layer
-	 * 
-	 * @param l
-	 *            the Layer
-	 * @param newStyle
-	 *            the Stylesheet
-	 */
-	public static void setLayerStyle(Layer l, String newStyle) {
-		switch (l) {
-		case UNDERLAY:
-			styleLayerUnderlay = newStyle;
-			break;
-		case OPERATOR:
-			styleLayerOperator = newStyle;
-			break;
-		case MAPPING:
-			styleLayerMapping = newStyle;
-			break;
-		case SYMBOL:
-			styleLayerSymbol = newStyle;
-			break;
-		default:
-			Debug.out("OptionsManager: Stylesheet for an unknown Layer Requested");
-		}
-	}
-
 }

+ 135 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/StylesheetManager.java

@@ -0,0 +1,135 @@
+package de.tu_darmstadt.informatik.tk.scopviz.ui;
+
+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;
+
+public class StylesheetManager {
+
+	/**
+	 * all available graphic styles
+	 */
+	private static String[] allNodeGraphics = { "Shapes", "Sprites" };
+	/**
+	 * The Stylesheet that is given to every graph that is added to display
+	 * everything correctly
+	 */
+	public static final String DEFAULT_STYLESHEET = "node{text-alignment:at-right;} \n"
+			+ "edge{text-offset: 4px,-4px;}";
+	/**
+	 * Part of the stylesheet that styles the different Nodes with shapes.
+	 */
+	public static final String STYLE_NODES_SHAPES = "node.standard{shape: circle;}" + "node.source{shape: rounded-box;}"
+			+ "node.procEn{shape: diamond;}" + "node.sink{shape: cross;}";
+	/**
+	 * Part of the stylesheet that styles the different Nodes with sprites.
+	 */
+	public static final String STYLE_NODES_SPRITES = "node.standard{fill-mode: image-scaled; fill-image: url('src/main/resources/png/standard.png'); }"
+			+ "node.source{fill-mode: image-scaled; fill-image: url('src/main/resources/png/source.png'); }"
+			+ "node.procEn{fill-mode: image-scaled; fill-image: url('src/main/resources/png/procEn.png'); }"
+			+ "node.sink{fill-mode: image-scaled; fill-image: url('src/main/resources/png/sink.png'); }"
+			+ "node.operator{fill-mode: image-scaled; fill-image: url('src/main/resources/png/operator.png'); }";
+	/** The currently selected Display Mode */
+	private static String nodeGraphics = allNodeGraphics[1];
+	/** The currently active Stylesheet. */
+	private static String nodeStylesheet = STYLE_NODES_SPRITES;
+
+	/**
+	 * Changes the Stylesheet and updates all Nodes to use it.
+	 * 
+	 * @param newGraphics
+	 *            the new Stylesheet to use
+	 */
+	public static void adjustNodeGraphics(String newGraphics) {
+		if (!newGraphics.equalsIgnoreCase(StylesheetManager.nodeGraphics)) {
+			StylesheetManager.nodeGraphics = newGraphics;
+			if (newGraphics.equals(StylesheetManager.allNodeGraphics[0])) {
+				StylesheetManager.setNodeGraphics(StylesheetManager.STYLE_NODES_SHAPES);
+			} else if (newGraphics.equals(StylesheetManager.allNodeGraphics[1])) {
+				StylesheetManager.setNodeGraphics(StylesheetManager.STYLE_NODES_SPRITES);
+			} else {
+				throw new RuntimeException("These graphics do not exist");
+			}
+		}
+		Main.getInstance().getGraphManager().updateStylesheet();
+	}
+
+	/**
+	 * Returns all available Stylesheets as Strings.
+	 * 
+	 * @return all the StyleSheets
+	 */
+	public static String[] getAllNodeGraphics() {
+		return StylesheetManager.allNodeGraphics;
+	}
+
+	/**
+	 * Returns the currently active StyleSheet.
+	 * 
+	 * @return the currently active StyleSheet as a String
+	 */
+	public static String getNodeGraphics() {
+		return StylesheetManager.nodeStylesheet;
+	}
+
+	/**
+	 * Sets the current Stylesheet.
+	 * 
+	 * @param nodeGraphics
+	 *            the Stylesheet to use
+	 */
+	public static void setNodeGraphics(String nodeGraphics) {
+		StylesheetManager.nodeStylesheet = nodeGraphics;
+	}
+
+	/**
+	 * Returns the styleSheet for a given Layer
+	 * 
+	 * @param l
+	 *            the Layer
+	 * @return the Stylesheet
+	 */
+	public static String getLayerStyle(Layer l) {
+		switch (l) {
+		case UNDERLAY:
+			return OptionsManager.styleLayerUnderlay;
+		case OPERATOR:
+			return OptionsManager.styleLayerOperator;
+		case MAPPING:
+			return OptionsManager.styleLayerMapping;
+		case SYMBOL:
+			return OptionsManager.styleLayerSymbol;
+		default:
+			Debug.out("OptionsManager: Stylesheet for an unknown Layer Requested");
+			return "";
+		}
+	}
+
+	/**
+	 * Sets the Stylesheet for a given Layer
+	 * 
+	 * @param l
+	 *            the Layer
+	 * @param newStyle
+	 *            the Stylesheet
+	 */
+	public static void setLayerStyle(Layer l, String newStyle) {
+		switch (l) {
+		case UNDERLAY:
+			OptionsManager.styleLayerUnderlay = newStyle;
+			break;
+		case OPERATOR:
+			OptionsManager.styleLayerOperator = newStyle;
+			break;
+		case MAPPING:
+			OptionsManager.styleLayerMapping = newStyle;
+			break;
+		case SYMBOL:
+			OptionsManager.styleLayerSymbol = newStyle;
+			break;
+		default:
+			Debug.out("OptionsManager: Stylesheet for an unknown Layer Requested");
+		}
+	}
+
+}

+ 31 - 7
scopviz/src/main/resources/Example2.graphml → scopviz/src/main/resources/operator_example.graphml

@@ -4,35 +4,59 @@
 	 xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
 	   http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
    	<key id="attr0000" for="node" attr.name="ui.label" attr.type="string"/>
-	<key id="attr0001" for="node" attr.name="Eigenschaft" attr.type="string"/>
+	<key id="attr0001" for="edge" attr.name="weight" attr.type="string"/>
 	<key id="attr0002" for="node" attr.name="y" attr.type="double"/>
 	<key id="attr0003" for="node" attr.name="x" attr.type="double"/>
-	<graph id="Example" edgedefault="undirected">
+	<key id="attr0004" for="node" attr.name="typeofNode"  attr.type="string"/>
+	<key id="attr0005" for="node" attr.name="process-need"  attr.type="double"/>	
+
+	<graph id="OperatorExample" edgedefault="undirected">
 		<node id="A">
 			<data key="attr0000">A</data>
-			<data key="attr0001">test</data>
 			<data key="attr0002">100</data>
 			<data key="attr0003">100</data>
+			<data key="attr0004">source</data>
+			<data key="attr0005">20</data>
 		</node>
 		<node id="B">
 			<data key="attr0000">B</data>
 			<data key="attr0002">200</data>
 			<data key="attr0003">100</data>
+			<data key="attr0004">operator</data>
+			<data key="attr0005">25</data>
 		</node>
 		<node id="C">
 			<data key="attr0000">C</data>
-			<data key="attr0002">100</data>
-			<data key="attr0003">200</data>
+			<data key="attr0002">185</data>
+			<data key="attr0003">135</data>
+			<data key="attr0004">sink</data>
+			<data key="attr0005">50</data>
 		</node>
 		<node id="D">
 			<data key="attr0000">D</data>
 			<data key="attr0002">200</data>
 			<data key="attr0003">200</data>
+			<data key="attr0004">sink</data>
+			<data key="attr0005">22.34234</data>
 		</node>
 		<node id="E">
 			<data key="attr0000">E</data>
-			<data key="attr0002">185</data>
-			<data key="attr0003">135</data>
+			<data key="attr0002">100</data>
+			<data key="attr0003">200</data>
+			<data key="attr0004">operator</data>
+			<data key="attr0005">23</data>
 		</node>
+		<edge id="AB" source="A" target="B" directed="true">
+			<data key="attr0001">33</data>
+		</edge>
+		<edge id="BC" source="B" target="C" directed="true">
+			<data key="attr0001">50</data>
+		</edge>
+		<edge id="CD" source="C" target="D" directed="true">
+			<data key="attr0001">18</data>
+		</edge>
+		<edge id="CE" source="C" target="E" directed="true">
+			<data key="attr0001">6</data>
+		</edge>
 	</graph>
 </graphml>

+ 19 - 9
scopviz/src/main/resources/Example.graphml → scopviz/src/main/resources/underlay_example.graphml

@@ -4,51 +4,61 @@
 	 xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
 	   http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
    	<key id="attr0000" for="node" attr.name="ui.label" attr.type="string"/>
-	<key id="attr0001" for="node" attr.name="Eigenschaft" attr.type="string"/>
+	<key id="attr0001" for="edge" attr.name="weight" attr.type="int"/>
 	<key id="attr0002" for="node" attr.name="y" attr.type="double"/>
 	<key id="attr0003" for="node" attr.name="x" attr.type="double"/>
-	<key id="attr0004" for="node" attr.name="ui.class"  attr.type="string" />
-	<graph id="Example" edgedefault="undirected">
+	<key id="attr0004" for="node" attr.name="typeofNode"  attr.type="string"/>
+	<key id="attr0005" for="node" attr.name ="process-max" attr.type="double"/>
+	<key id="attr0006" for="node" attr.name="typeofDevice"  attr.type="string"/>
+	<graph id="UnderlayExample" edgedefault="undirected">
 		<node id="A">
 			<data key="attr0000">A</data>
-			<data key="attr0001">test</data>
 			<data key="attr0002">100</data>
 			<data key="attr0003">100</data>
 			<data key="attr0004">standard</data>
+			<data key="attr0006">desktop</data>
 		</node>
 		<node id="B">
 			<data key="attr0000">B</data>
 			<data key="attr0002">200</data>
 			<data key="attr0003">100</data>
-			<data key="attr0004">sink</data>
+			<data key="attr0004">procEn</data>
+			<data key="attr0005">40</data>
+			<data key="attr0006">router</data>
 		</node>
 		<node id="C">
 			<data key="attr0000">C</data>
 			<data key="attr0002">100</data>
 			<data key="attr0003">200</data>
-			<data key="attr0004">source</data>
+			<data key="attr0004">procEn</data>
+			<data key="attr0005">30</data>
+			<data key="attr0006">switch</data>
 		</node>
 		<node id="D">
 			<data key="attr0000">D</data>
 			<data key="attr0002">200</data>
 			<data key="attr0003">200</data>
 			<data key="attr0004">procEn</data>
+			<data key="attr0005">100</data>
+			<data key="attr0006">smartphone</data>
 		</node>
 		<node id="E">
 			<data key="attr0000">E</data>
 			<data key="attr0002">185</data>
 			<data key="attr0003">135</data>
-			<data key="attr0004">operator</data>
+			<data key="attr0006">router</data>
 		</node>
 		<edge id="AB" source="A" target="B" directed="false">
-			<data key="attr0001">test</data>
+			<data key="attr0001">33</data>
 		</edge>
 		<edge id="BC" source="B" target="C" directed="false">
-			<data key="attr0001">test</data>
+			<data key="attr0001">50</data>
 		</edge>
 		<edge id="CD" source="C" target="D" directed="false">
+			<data key="attr0001">18</data>
 		</edge>
 		<edge id="DB" source="D" target="B" directed="false">
+			<data key="attr0001">6</data>
 		</edge>
 	</graph>
 </graphml>