Browse Source

MERGED EVERYTHING, FORMATTED EVERYTHING;

Jan Enders 7 years ago
parent
commit
687b68d3b0
18 changed files with 242 additions and 94 deletions
  1. 111 4
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java
  2. 18 17
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java
  3. 16 0
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java
  4. 4 2
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSinkGraphML.java
  5. 14 7
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSourceGraphML.java
  6. 4 2
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java
  7. 2 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainApp.java
  8. 4 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/OperatorInfoMetric.java
  9. 2 3
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/interfaces/ScopvizGraphOperator.java
  10. 2 2
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java
  11. 17 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OperatorManager.java
  12. 26 32
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java
  13. 2 2
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/PropertiesManager.java
  14. 8 7
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java
  15. 0 3
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/KeyboardShortcuts.java
  16. 1 0
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/CustomMapClickListener.java
  17. 3 3
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/MapViewFunctions.java
  18. 8 7
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/WorldView.java

+ 111 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java

@@ -33,6 +33,16 @@ public class GraphHelper {
 		return result;
 	}
 
+	/**
+	 * merges the two graphs into one. every Node gets two attributes,
+	 * originalGraph and originalElement which are the ids of the Graph and the
+	 * graphid + "+#" + nodeid
+	 * 
+	 * @param target
+	 *            the graph that the source will be merged into
+	 * @param source
+	 *            the graph that will be merged into the traget graph
+	 */
 	// TODO better way to do scaling
 	private static void mergeInto(MyGraph target, MyGraph source) {
 		double targetMinX = target.getMinX();
@@ -59,6 +69,17 @@ public class GraphHelper {
 
 	}
 
+	/**
+	 * copys all edges from one Graph to another adjusting for nodeId changes.
+	 * this must always be called after copyNodes.
+	 * 
+	 * @param target
+	 *            the graph that the new node will be added into
+	 * @param source
+	 *            the Graph that has the nodes to be copied
+	 * @param newIds
+	 *            a HashMap that give the new id Values of copied Nodes
+	 */
 	private static void copyEdges(MyGraph target, MyGraph source, HashMap<String, String> newIds) {
 		Random ran = new Random();
 		boolean searchingForId = true;
@@ -87,6 +108,16 @@ public class GraphHelper {
 		}
 	}
 
+	/**
+	 * copies all Nodes from one Graph to another always must be called before
+	 * copyEdges
+	 * 
+	 * @param target
+	 *            the Graph that the Nodes will be copied into
+	 * @param source
+	 *            the graph that the node will be taken from
+	 * @return a HahMap to convert the old id of Nodes to new ones
+	 */
 	private static HashMap<String, String> copyNodes(MyGraph target, MyGraph source) {
 		HashMap<String, String> newIds = new HashMap<>();
 		Random ran = new Random();
@@ -118,6 +149,20 @@ public class GraphHelper {
 		return newIds;
 	}
 
+	/**
+	 * adjusts the y coordinates of the source graph so the two are of similar
+	 * size
+	 * 
+	 * @param g
+	 *            the source graph with unaltered coordinates
+	 * @param scalingFactor
+	 *            the factor that is used to ensure a roughly similiar size
+	 *            between the Graphs
+	 * @param targetMinY
+	 *            the minimal y Coordinate of the target Graph
+	 * @param sourceMinY
+	 *            the minimal y Coordinate of the source Graph
+	 */
 	private static void adjustSourceYCoordinates(MyGraph g, double scalingFactor, double targetMinY,
 			double sourceMinY) {
 		for (MyNode n : g.<MyNode>getNodeSet()) {
@@ -129,6 +174,13 @@ public class GraphHelper {
 		}
 	}
 
+	/**
+	 * gives all Nodes a parameter that has the Id of the Graph they belonged to
+	 * before the merge. if a node already has this attriute it will be ignored
+	 * 
+	 * @param g
+	 *            the originalGraph of the Nodes
+	 */
 	private static void graphAttribute(MyGraph g) {
 		for (MyNode n : g.<MyNode>getNodeSet()) {
 			if (n.getAttribute("originalGraph") == null) {
@@ -137,6 +189,20 @@ public class GraphHelper {
 		}
 	}
 
+	/**
+	 * adjusts the x coordinates of the source graph so the two are of similar
+	 * size
+	 * 
+	 * @param g
+	 *            the source graph with unaltered coordinates
+	 * @param scalingFactor
+	 *            the factor that is used to ensure a roughly similiar size
+	 *            between the Graphs
+	 * @param xOffset
+	 *            the x distance between the graphs
+	 * @param sourceMinY
+	 *            the minimal x Coordinate of the source Graph
+	 */
 	private static void adjustSourceXCoordinates(MyGraph g, Double scalingFactor, Double xOffset, Double SourceMinX) {
 		for (MyNode n : g.<MyNode>getNodeSet()) {
 			Double d = (Double) n.getAttribute("x");
@@ -234,6 +300,18 @@ public class GraphHelper {
 		}
 	}
 
+	/**
+	 * propagates an Attribute to the Node in the Graph it originated from
+	 * 
+	 * @param g
+	 *            the root of the Multigraph
+	 * @param n
+	 *            the Element of the multigraph that was changed
+	 * @param attribute
+	 *            the attribute that was changed
+	 * @param value
+	 *            the value the attribute was changed to
+	 */
 	public static void propagateAttribute(MyGraph g, Element n, String attribute, Object value) {
 		if (n.getAttribute("originalElement") == null) {
 			Debug.out("Debug: Attribute originalElement does not Exist");
@@ -282,6 +360,17 @@ public class GraphHelper {
 		Debug.out("WARNING: could not find the specified Graph " + origGraph, 2);
 	}
 
+	/**
+	 * propagates the deletion of a collection of Elements to the Graph the
+	 * element originally came from.
+	 * 
+	 * @param g
+	 *            the root graph of the multigraph
+	 * @param col
+	 *            the collection that has to be deleted
+	 * @return the id of the graph that the elements were deleted from or null
+	 *         if no change occurred
+	 */
 	public static String propagateElementDeletion(MyGraph g, Collection<? extends Element> col) {
 		Iterator<? extends Element> elementIter = col.iterator();
 		while (elementIter.hasNext()) {
@@ -291,6 +380,16 @@ public class GraphHelper {
 		return null;
 	}
 
+	/**
+	 * propagates the deletion of an Element to the Graph it originated from
+	 * 
+	 * @param g
+	 *            the root graph of the multigraph
+	 * @param e
+	 *            the element that will be deleted
+	 * @return the id of the graph that the elements were deleted from or null
+	 *         if no change occurred
+	 */
 	public static String propagateElementDeletion(MyGraph g, Element e) {
 		if (e.getAttribute("originalElement") == null) {
 			return null;
@@ -318,6 +417,18 @@ public class GraphHelper {
 		return null;
 	}
 
+	/**
+	 * propagates the undeletion of an Element
+	 * 
+	 * @param g
+	 *            the root graph of the multigraph
+	 * @param e
+	 *            the element that will be readded
+	 * @param newNodeId
+	 *            the new id of the undeleted Node, only important if elemen is
+	 *            an Edge
+	 * @return the new originalElement Attribute
+	 */
 	public static String propagateElementUndeletion(MyGraph g, Element e, String newNodeId) {
 		if (e.getAttribute("originalElement") == null) {
 			return null;
@@ -361,8 +472,4 @@ public class GraphHelper {
 		Debug.out("WARNING: could not find the specified Graph " + origGraph, 2);
 		return null;
 	}
-
-	public static void resetUndelete() {
-
-	}
 }

+ 18 - 17
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java

@@ -181,10 +181,9 @@ public class GraphManager {
 			}
 			g.addEdge(id, sourceId, targetId, e.isDirected());
 			g.getEdge(id).addAttributes(attributes);
-			if(g.getNode(Main.getInstance().getGraphManager().getActiveSubGraph() + newId) == null|| g.getNode(Main.getInstance().getGraphManager().getActiveSubGraph() + newId).getAttribute("originalElement") == null){
-				deletedEdges = new LinkedList<>();
-				deletedNode = null;
-				return;
+			if (g.getNode(Main.getInstance().getGraphManager().getActiveSubGraph() + newId) == null
+					|| g.getNode(newId).getAttribute("originalElement") == null) {
+				continue;
 			}
 			String origElement = GraphHelper.propagateElementUndeletion(g, e,
 					g.getNode(newId).getAttribute("originalElement"));
@@ -366,7 +365,7 @@ public class GraphManager {
 			attributes.put(s, n.getAttribute(s));
 		}
 		String nodeId = n.getId();
-		if (activeSubGraph != null){
+		if (activeSubGraph != null) {
 			nodeId = activeSubGraph.getId() + nodeId;
 		}
 		g.addNode(nodeId);
@@ -430,7 +429,7 @@ public class GraphManager {
 	 *            the EdgeCreatedListener
 	 */
 	public void addEdgeCreatedListener(EdgeCreatedListener e) {
-		g.addEdgeCreatedListener(e);
+		((MyGraph) g).addEdgeCreatedListener(e);
 	}
 
 	/**
@@ -441,7 +440,7 @@ public class GraphManager {
 	 *            the NodeCreatedListener
 	 */
 	public void addNodeCreatedListener(NodeCreatedListener n) {
-		g.addNodeCreatedListener(n);
+		((MyGraph) g).addNodeCreatedListener(n);
 	}
 
 	/**
@@ -501,30 +500,32 @@ public class GraphManager {
 		boolean isDirected = (Main.getInstance().getCreationMode() == CreationMode.CREATE_DIRECTED_EDGE);
 		MyNode sourceNode = g.getNode(from);
 		MyNode targetNode = g.getNode(to);
-		
+
 		if (activeSubGraph != null && !activeSubGraph.equals(g)) {
-			
+
 			if (sourceNode.getAttribute("originalGraph").equals(activeSubGraph.getId())
 					&& targetNode.getAttribute("originalGraph").equals(activeSubGraph.getId())) {
-				
+
 				g.addEdge(newID, from, to, isDirected);
-				activeSubGraph.addEdge(newID, from.substring(activeSubGraph.getId().length()), to.substring(activeSubGraph.getId().length()), isDirected);
+				activeSubGraph.addEdge(newID, from.substring(activeSubGraph.getId().length()),
+						to.substring(activeSubGraph.getId().length()), isDirected);
 				g.getEdge(newID).addAttribute("originalElement", activeSubGraph.getId() + "+#" + newID);
-				
+
 			} else {
-				Debug.out(sourceNode.getAttribute("originalGraph").toString() + targetNode.getAttribute("originalGraph").toString());
-				if (sourceNode.getAttribute("originalGraph").equals(targetNode.getAttribute("originalGraph"))){
+				Debug.out(sourceNode.getAttribute("originalGraph").toString()
+						+ targetNode.getAttribute("originalGraph").toString());
+				if (sourceNode.getAttribute("originalGraph").equals(targetNode.getAttribute("originalGraph"))) {
 					Debug.out("Can Only add edges to currently active Subgraph!", 2);
 				} else {
 					Debug.out("Can not create Edge between Nodes of different Subgraphs!", 2);
 				}
 				return false;
 			}
-			
+
 		} else {
-			
+
 			g.addEdge(newID, from, to, isDirected);
-			
+
 		}
 
 		selectEdge(newID);

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

@@ -8,6 +8,7 @@ import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphHelper;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyNode;
+import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import javafx.stage.FileChooser;
 import javafx.stage.FileChooser.ExtensionFilter;
@@ -49,6 +50,21 @@ public class GraphMLImporter {
 			e.printStackTrace();
 		}
 		if (fs.wasMultiGraph()) {
+			for (MyGraph gSub : fs.getSubGraphs()) {
+				if ("UNDERLAY".equals(gSub.getAttribute("layer"))) {
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.UNDERLAY);
+				} else if ("OPERATOR".equals(gSub.getAttribute("layer"))) {
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.OPERATOR);
+				} else if ("MAPPING".equals(gSub.getAttribute("layer"))) {
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.MAPPING);
+				} else if ("SYMBOL".equals(gSub.getAttribute("layer"))) {
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.SYMBOL);
+				}
+			}
 			g = GraphHelper.newMerge(false, fs.getSubGraphs().toArray(new MyGraph[0]));
 		}
 		fs.removeSink(g);

+ 4 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSinkGraphML.java

@@ -63,7 +63,8 @@ public class MyFileSinkGraphML extends FileSinkGraphML {
 			for (MyNode n : g.<MyNode>getEachNode()) {
 				for (String k : n.getAttributeKeySet()) {
 					// AttributeFiltering
-					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values") || k.equalsIgnoreCase("originalgraph")) {
+					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")
+							|| k.equalsIgnoreCase("originalgraph")) {
 						continue;
 					}
 					Class<? extends Object> c = n.getAttribute(k).getClass();
@@ -163,7 +164,8 @@ public class MyFileSinkGraphML extends FileSinkGraphML {
 			for (MyNode n : g.<MyNode>getEachNode()) {
 				print("\t\t<node id=\"%s\">\n", n.getId());
 				for (String k : n.getAttributeKeySet()) {
-					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values") || k.equalsIgnoreCase("originalgraph")) {
+					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")
+							|| k.equalsIgnoreCase("originalgraph")) {
 						continue;
 					}
 					Class<? extends Object> c = n.getAttribute(k).getClass();

+ 14 - 7
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSourceGraphML.java

@@ -639,7 +639,8 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 					e = getNextEvent();
 				}
 
-				if (isEvent(e, XMLStreamConstants.START_ELEMENT, "node") || isEvent(e, XMLStreamConstants.START_ELEMENT, "edge")) {
+				if (isEvent(e, XMLStreamConstants.START_ELEMENT, "node")
+						|| isEvent(e, XMLStreamConstants.START_ELEMENT, "edge")) {
 					currentReaderState = ReaderState.NODES_EDGES;
 				} else if (isEvent(e, XMLStreamConstants.END_ELEMENT, "graph")) {
 					currentReaderState = ReaderState.GRAPH_END;
@@ -691,7 +692,8 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 				} else if (isEvent(e, XMLStreamConstants.START_ELEMENT, "key")) {
 					currentReaderState = ReaderState.KEYS;
 
-				} else if (isEvent(e, XMLStreamConstants.START_ELEMENT, "node") || isEvent(e, XMLStreamConstants.START_ELEMENT, "edge")) {
+				} else if (isEvent(e, XMLStreamConstants.START_ELEMENT, "node")
+						|| isEvent(e, XMLStreamConstants.START_ELEMENT, "edge")) {
 					currentReaderState = ReaderState.NODES_EDGES;
 				} else if (isEvent(e, XMLStreamConstants.START_ELEMENT, "data")) {
 					// ignore <data>
@@ -947,7 +949,8 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 			pushback(e);
 			port.desc = __desc();
 		} else {
-			while (isEvent(e, XMLStreamConstants.START_ELEMENT, "data") || isEvent(e, XMLStreamConstants.START_ELEMENT, "port")) {
+			while (isEvent(e, XMLStreamConstants.START_ELEMENT, "data")
+					|| isEvent(e, XMLStreamConstants.START_ELEMENT, "port")) {
 				if (isEvent(e, XMLStreamConstants.START_ELEMENT, "data")) {
 					Data data;
 
@@ -1355,11 +1358,13 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 			__locator();
 		} else {
 			Data data;
-			while (isEvent(e, XMLStreamConstants.START_ELEMENT, "data") || isEvent(e, XMLStreamConstants.START_ELEMENT, "port")
+			while (isEvent(e, XMLStreamConstants.START_ELEMENT, "data")
+					|| isEvent(e, XMLStreamConstants.START_ELEMENT, "port")
 					|| (e.isStartElement() && e.asStartElement().getName().getPrefix() == "y")
 					|| isEvent(e, END_ELEMENT, "data")) {
 				// Yed parsing
-				if (e.getEventType() == XMLStreamConstants.START_ELEMENT && e.asStartElement().getName().getPrefix() == "y") {
+				if (e.getEventType() == XMLStreamConstants.START_ELEMENT
+						&& e.asStartElement().getName().getPrefix() == "y") {
 					pushback(e);
 					data = parseYed();
 					if (data != null) {
@@ -1501,7 +1506,8 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 					|| (e.isStartElement() && e.asStartElement().getName().getPrefix() == "y")
 					|| isEvent(e, END_ELEMENT, "data")) {
 				// Yed parsing
-				if (e.getEventType() == XMLStreamConstants.START_ELEMENT && e.asStartElement().getName().getPrefix() == "y") {
+				if (e.getEventType() == XMLStreamConstants.START_ELEMENT
+						&& e.asStartElement().getName().getPrefix() == "y") {
 					pushback(e);
 					data = parseYed();
 					if (data != null) {
@@ -1617,7 +1623,8 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 			pushback(e);
 			__desc();
 		} else {
-			while (isEvent(e, XMLStreamConstants.START_ELEMENT, "data") || isEvent(e, XMLStreamConstants.START_ELEMENT, "endpoint")) {
+			while (isEvent(e, XMLStreamConstants.START_ELEMENT, "data")
+					|| isEvent(e, XMLStreamConstants.START_ELEMENT, "endpoint")) {
 				if (isEvent(e, XMLStreamConstants.START_ELEMENT, "data")) {
 					pushback(e);
 					__data();

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

@@ -84,7 +84,8 @@ public final class Main {
 		while (true) {
 			String tempID = i + "";
 			if (getGraphManager().getGraph().getNode(tempID) == null
-					&& getGraphManager().getGraph().getEdge(tempID) == null) {
+					&& getGraphManager().getGraph().getEdge(tempID) == null
+					&& getGraphManager().getGraph().getNode(getGraphManager().getGraph().getId() + tempID) == null) {
 				return (tempID);
 			} else {
 				i++;
@@ -96,7 +97,8 @@ public final class Main {
 		int i = 0;
 		while (true) {
 			String tempID = i + "";
-			if (gm.getGraph().getNode(tempID) == null && gm.getGraph().getEdge(tempID) == null) {
+			if (gm.getGraph().getNode(tempID) == null && gm.getGraph().getEdge(tempID) == null
+					&& gm.getGraph().getNode(gm.getGraph().getId() + tempID) == null) {
 				return (tempID);
 			} else {
 				i++;

+ 2 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainApp.java

@@ -79,7 +79,8 @@ public class MainApp extends Application {
 				+ ".selectedForEdgeCreation{fill-color: #00ff00;}"
 				+ "edge.mapping {stroke-color: #33ff33; stroke-mode: dashes; fill-mode: none; size: 0px;}"
 				+ "node.procEn.onMapping {fill-mode: plain; shape: pie-chart; fill-color: #555555, #cccc00, #32cd32, #8b0000; size: 20px;}"
-				+ "edge.mapping.selected{stroke-color: #FF0000;}"+"node.procEn.onMapping.selected{size: 15px;}"+"edge.mapping.blue {stroke-color: #3333ff}");
+				+ "edge.mapping.selected{stroke-color: #FF0000;}" + "node.procEn.onMapping.selected{size: 15px;}"
+				+ "edge.mapping.blue {stroke-color: #3333ff}");
 	}
 
 	/**

+ 4 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/OperatorInfoMetric.java

@@ -3,6 +3,7 @@ package de.tu_darmstadt.informatik.tk.scopviz.metrics;
 import java.util.LinkedList;
 import java.util.stream.Collectors;
 
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MappingGraphManager;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyEdge;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
@@ -42,7 +43,9 @@ public class OperatorInfoMetric implements ScopvizGraphMetric {
 		LinkedList<Pair<String, String>> result = new LinkedList<Pair<String, String>>();
 
 		for (MyGraph subGraph : g.getAllSubGraphs()) {
-			if (subGraph.getAttribute("layer") == Layer.OPERATOR && !subGraph.isComposite()) {
+			if ((subGraph.getAttribute("layer").equals("OPERATOR")
+					|| subGraph.getAttribute("layer").equals(Layer.OPERATOR)) && !subGraph.isComposite()) {
+				Debug.out("no problems");
 				String graphId = subGraph.getId();
 				String info = "";
 				Double priority = Double.valueOf(subGraph.getAttribute("priority"));

+ 2 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/interfaces/ScopvizGraphOperator.java

@@ -8,9 +8,8 @@ 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
+	 *            the GraphManager of the currently active Graph
+	 * 
 	 */
 	public void calculate(GraphManager g);
 

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

@@ -430,7 +430,7 @@ public final class GraphDisplayManager {
 		LinkedList<MyGraph> graphs = g.getAllSubGraphs();
 		Iterator<MyGraph> graphIter = graphs.iterator();
 		while (graphIter.hasNext()) {
-			if (!"UNDERLAY".equalsIgnoreCase(graphIter.next().getAttribute("layer"))) {
+			if (!Layer.UNDERLAY.equals(graphIter.next().getAttribute("layer"))) {
 				graphIter.remove();
 			}
 		}
@@ -443,7 +443,7 @@ public final class GraphDisplayManager {
 		graphs = g.getAllSubGraphs();
 		graphIter = graphs.iterator();
 		while (graphIter.hasNext()) {
-			if (!"OPERATOR".equalsIgnoreCase(graphIter.next().getAttribute("layer"))) {
+			if (!Layer.OPERATOR.equals(graphIter.next().getAttribute("layer"))) {
 				graphIter.remove();
 			}
 		}

+ 17 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OperatorManager.java

@@ -29,10 +29,14 @@ public class OperatorManager {
 	 * 
 	 */
 	private static void initializeGraphOperators() {
-		
+
 		addOperator(new BasicMappingOperator());
 	}
 
+	/**
+	 * opens a dialog allowing the User to choose which GraphOperator he wants
+	 * to use on the current Graph
+	 */
 	public static void openOperatorsDialog() {
 		Dialog<ArrayList<String>> addPropDialog = new Dialog<>();
 		addPropDialog.setTitle("GraphOperators");
@@ -72,10 +76,22 @@ public class OperatorManager {
 
 	}
 
+	/**
+	 * Adds an Operator to the HashMap
+	 * 
+	 * @param op
+	 *            the Operator that will be added
+	 */
 	public static void addOperator(ScopvizGraphOperator op) {
 		operators.put(op.getName(), op);
 	}
 
+	/**
+	 * initializes the OperatorManager
+	 * 
+	 * @param g
+	 *            the guiController of the Programm
+	 */
 	public static void initialize(GUIController g) {
 		initializeGraphOperators();
 	}

+ 26 - 32
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java

@@ -145,7 +145,7 @@ public final class OptionsManager {
 			edgeThickness.setText(Integer.toString(defaultEdgeThickness));
 
 			deviceSize.setText(Integer.toString(defaultDeviceSize));
-			
+
 			edgeStandardColorSymbolLayer.getSelectionModel().select(defaultStandardEdgeColor);
 			edgePlacementColorSymbolLayer.getSelectionModel().select(defaultPlacementColor);
 			edgeSelectedColorSymbolLayer.getSelectionModel().select(defaultClickedEdgeColor);
@@ -154,7 +154,7 @@ public final class OptionsManager {
 			waypointSelectedColorSymbolLayer.getSelectionModel().select(defaultClickedDeviceColor);
 
 		});
-		
+
 		// position elements on grid
 		int row = 0;
 		grid.add(new Label("Default weight of edges:"), 0, row);
@@ -221,16 +221,17 @@ public final class OptionsManager {
 		grid.add(new Label("Logging level"), 0, row);
 		grid.add(loggingLevelSelector, 1, row);
 		row++;
-		
+
 		grid.add(new Label(""), 1, row);
 		row++;
 		grid.add(resetButton, 1, row);
-		
+
 		// Alert window -> when problems with input
 		Alert alert = new Alert(AlertType.WARNING);
 		alert.setTitle("Warning");
 		alert.setHeaderText("Preferences-Type Alert");
-		alert.setContentText("Some Input doesnt fit the Convention (INT for Smybol Layer, Double for Default GeoPosition)");
+		alert.setContentText(
+				"Some Input doesnt fit the Convention (INT for Smybol Layer, Double for Default GeoPosition)");
 
 		// set dialog
 		addPropDialog.getDialogPane().setContent(grid);
@@ -252,22 +253,21 @@ public final class OptionsManager {
 					// symbol layer edge thickness and device size
 					int edgeTh = Integer.parseInt(edgeThickness.getText());
 					int deviceSi = Integer.parseInt(deviceSize.getText());
-					
-					// if Textfield values are not in pre defined range 
+
+					// if Textfield values are not in pre defined range
 					if (edgeTh < 1 || edgeTh > 10 || deviceSi < 40 || deviceSi > 250) {
 						throw new NumberFormatException();
 					}
-					
+
 					if (edgeTh != EdgePainter.getThickness()) {
 						EdgePainter.setEdgeThickness(edgeTh);
-					} 
+					}
 					// symbol layer waypoint size
 					if (deviceSi != CustomWaypointRenderer.getDeviceSize()) {
 						CustomWaypointRenderer.setScaleSize(deviceSi);
 						MapViewFunctions.resetImageMap();
 						MapViewFunctions.initializeWaypointImages();
 					}
-					
 
 				} catch (NumberFormatException e) {
 					// some inputs were wrong -> show Alert message
@@ -347,10 +347,10 @@ public final class OptionsManager {
 	public static void setShowWeight(boolean showWeight) {
 		OptionsManager.showWeight = showWeight;
 	}
-	
-	public static void load(){
-		try{
-			BufferedReader read = new BufferedReader (new FileReader("settings.properties"));
+
+	public static void load() {
+		try {
+			BufferedReader read = new BufferedReader(new FileReader("settings.properties"));
 			defaultWeight = Double.parseDouble(read.readLine());
 			showWeight = Boolean.parseBoolean(read.readLine());
 			defaultLat = Double.parseDouble(read.readLine());
@@ -365,30 +365,24 @@ public final class OptionsManager {
 			defaultClickedDeviceColor = read.readLine();
 			Debug.setLogLevel(Integer.parseInt(read.readLine()));
 			read.close();
-		} catch (IOException e){
+		} catch (IOException e) {
 			defaultValues();
 		}
 	}
-	public static void save(){
-		try{
+
+	public static void save() {
+		try {
 			BufferedWriter write = new BufferedWriter(new FileWriter("settings.properties"));
-			write.write(defaultWeight + "\n"
-					+ showWeight + "\n"
-					+ defaultLat + "\n"
-					+ defaultLong  + "\n"
-					+ coordinatesChanged + "\n"
-					+ defaultDeviceSize + "\n"
-					+ defaultEdgeThickness + "\n"
-					+ defaultStandardEdgeColor + "\n"
-					+ defaultClickedEdgeColor + "\n"
-					+ defaultPlacementColor + "\n"
-					+ defaultStandardDeviceColor + "\n"
-					+ defaultClickedDeviceColor + "\n"
-					+ Debug.getLogLevel());
+			write.write(defaultWeight + "\n" + showWeight + "\n" + defaultLat + "\n" + defaultLong + "\n"
+					+ coordinatesChanged + "\n" + defaultDeviceSize + "\n" + defaultEdgeThickness + "\n"
+					+ defaultStandardEdgeColor + "\n" + defaultClickedEdgeColor + "\n" + defaultPlacementColor + "\n"
+					+ defaultStandardDeviceColor + "\n" + defaultClickedDeviceColor + "\n" + Debug.getLogLevel());
 			write.close();
-		} catch (IOException e){}
+		} catch (IOException e) {
+		}
 	}
-	protected static void defaultValues(){
+
+	protected static void defaultValues() {
 		defaultWeight = 0.0;
 		showWeight = true;
 		defaultLat = 49.877559;

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

@@ -113,7 +113,7 @@ public final class PropertiesManager {
 
 		// properties, which shall be filtered out of the properties window
 		itemVisibilityRules.put("layout.frozen", -1);
-		//itemVisibilityRules.put("ui.style", -1);
+		// itemVisibilityRules.put("ui.style", -1);
 		itemVisibilityRules.put("ui.j2dsk", -1);
 		itemVisibilityRules.put("ui.clicked", -1);
 		itemVisibilityRules.put("ui.map.selected", -1);
@@ -297,7 +297,7 @@ public final class PropertiesManager {
 		temp = selected.getAttributeKeySet().toArray(temp);
 		for (int i = 0; i < temp.length; i++) {
 			String key = temp[i];
-			if(key.startsWith("org.graphstream")){
+			if (key.startsWith("org.graphstream")) {
 				continue;
 			}
 			switch (key) {

+ 8 - 7
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java

@@ -294,7 +294,7 @@ public final class ToolboxManager {
 	 *
 	 */
 	public static class PairKeyFactory
-	implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, String>, ObservableValue<String>> {
+			implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, String>, ObservableValue<String>> {
 		@Override
 		public ObservableValue<String> call(TableColumn.CellDataFeatures<Pair<Object, String>, String> data) {
 			return new ReadOnlyObjectWrapper<>(data.getValue().getValue());
@@ -306,7 +306,7 @@ public final class ToolboxManager {
 	 *
 	 */
 	public static class PairValueFactory
-	implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, Object>, ObservableValue<Object>> {
+			implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, Object>, ObservableValue<Object>> {
 		@SuppressWarnings("unchecked")
 		@Override
 		public ObservableValue<Object> call(TableColumn.CellDataFeatures<Pair<Object, String>, Object> data) {
@@ -392,13 +392,14 @@ public final class ToolboxManager {
 			weightDialog.setContentText("needed Power");
 			Optional<String> result = weightDialog.showAndWait();
 			org.graphstream.graph.Node actualNode = Main.getInstance().getGraphManager().getGraph().getNode(n.getId());
-			if(actualNode == null){
-				actualNode = Main.getInstance().getGraphManager().getGraph().getNode(Main.getInstance().getGraphManager().getActiveSubGraph().getId() + n.getId());
+			if (actualNode == null) {
+				actualNode = Main.getInstance().getGraphManager().getGraph()
+						.getNode(Main.getInstance().getGraphManager().getActiveSubGraph().getId() + n.getId());
 			}
-			if (result.isPresent() && actualNode!= null) {
-				try  {
+			if (result.isPresent() && actualNode != null) {
+				try {
 					actualNode.addAttribute("process-need", Double.parseDouble(result.get()));
-				} catch (Exception e){
+				} catch (Exception e) {
 					actualNode.addAttribute("process-need", 0.0);
 				}
 				GraphHelper.propagateAttribute(Main.getInstance().getGraphManager().getGraph(), actualNode,

+ 0 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/KeyboardShortcuts.java

@@ -6,9 +6,7 @@ import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.GUIController;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.GraphDisplayManager;
-import de.tu_darmstadt.informatik.tk.scopviz.ui.MenuBarManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.MapViewFunctions;
-import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import javafx.scene.input.KeyCode;
 import javafx.scene.input.KeyCodeCombination;
@@ -36,7 +34,6 @@ public final class KeyboardShortcuts {
 	final static KeyCombination rAltShift = new KeyCodeCombination(KeyCode.R, KeyCombination.ALT_DOWN,
 			KeyCombination.SHIFT_DOWN);
 
-
 	/**
 	 * Private constructor to prevent Instantiation.
 	 */

+ 1 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/CustomMapClickListener.java

@@ -2,6 +2,7 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui.mapView;
 
 import java.awt.geom.Line2D;
 import java.awt.geom.Point2D;
+
 import org.jxmapviewer.JXMapViewer;
 import org.jxmapviewer.input.MapClickListener;
 import org.jxmapviewer.viewer.GeoPosition;

+ 3 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/MapViewFunctions.java

@@ -55,7 +55,7 @@ public final class MapViewFunctions {
 	 * load and scale waypoint images and save them in a HashMap
 	 */
 	public static void initializeWaypointImages() {
-		
+
 		if (WorldView.getWaypoints() == null) {
 			return;
 		}
@@ -302,8 +302,8 @@ public final class MapViewFunctions {
 			int index = WorldView.getWaypointsAsArrayList().indexOf(selectedWaypoint);
 
 			if (index == 0) {
-				CustomMapClickListener
-						.selectWaypoint(WorldView.getWaypointsAsArrayList().get(WorldView.getWaypointsAsArrayList().size() - 1));
+				CustomMapClickListener.selectWaypoint(
+						WorldView.getWaypointsAsArrayList().get(WorldView.getWaypointsAsArrayList().size() - 1));
 			} else {
 				CustomMapClickListener.selectWaypoint(WorldView.getWaypointsAsArrayList().get(index - 1));
 			}

+ 8 - 7
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/WorldView.java

@@ -109,7 +109,7 @@ public class WorldView {
 
 		// Get GeoPositions of nodes and get all waypoints created
 		fetchGraphData();
-		
+
 		// underlay is empty
 		if (waypoints.size() == 0) {
 			Alert alert = new Alert(AlertType.WARNING);
@@ -117,10 +117,11 @@ public class WorldView {
 			alert.setHeaderText("Underlay Empty");
 			alert.setContentText("The referenced Underlay-Graph has no nodes to visualize");
 			alert.showAndWait();
-			
-			GeoPosition defaultGeoPos = new GeoPosition(OptionsManager.getDefaultLat(), OptionsManager.getDefaultLong());
+
+			GeoPosition defaultGeoPos = new GeoPosition(OptionsManager.getDefaultLat(),
+					OptionsManager.getDefaultLong());
 			nodePositions.add(defaultGeoPos);
-			
+
 			CustomWaypoint defaultWaypoint = new CustomWaypoint("", "", getDeviceTypeURL(""), "", defaultGeoPos);
 			waypoints.add(defaultWaypoint);
 			waypointsAsList.add(defaultWaypoint);
@@ -364,15 +365,15 @@ public class WorldView {
 	public static HashSet<CustomWaypoint> getWaypoints() {
 		return waypoints;
 	}
-	
+
 	public static HashSet<GeoPosition> getNodePositions() {
 		return nodePositions;
 	}
-	
+
 	public static HashSet<MyEdge> getEdges() {
 		return edges;
 	}
-	
+
 	public static ArrayList<CustomWaypoint> getWaypointsAsArrayList() {
 		return waypointsAsList;
 	}