فهرست منبع

formated and organized inputs

jascha Bohne 8 سال پیش
والد
کامیت
6bcdc11aea
20فایلهای تغییر یافته به همراه328 افزوده شده و 325 حذف شده
  1. 7 5
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/debug/Debug.java
  2. 38 40
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java
  3. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java
  4. 3 3
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/MappingGraphManager.java
  5. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java
  6. 44 43
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java
  7. 34 27
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/CommunicationCostMetric.java
  8. 18 20
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/PlacementCostMetric.java
  9. 1 4
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/TaskFulfillmentMetric.java
  10. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/TestMetric.java
  11. 40 41
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java
  12. 20 15
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ConsoleManager.java
  13. 44 48
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java
  14. 26 18
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java
  15. 28 31
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/MetricboxManager.java
  16. 7 8
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java
  17. 8 10
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/PropertiesManager.java
  18. 2 2
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/StylesheetManager.java
  19. 5 3
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java
  20. 0 4
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/CustomTileFactory.java

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

@@ -26,7 +26,8 @@ public final class Debug {
 	/**
 	 * All Logs with a severity smaller than the loglevel will be ignored
 	 * 
-	 * @param logLevel the logLevel to set
+	 * @param logLevel
+	 *            the logLevel to set
 	 */
 	public static void setLogLevel(int logLevel) {
 		Debug.logLevel = logLevel;
@@ -80,14 +81,15 @@ public final class Debug {
 	}
 
 	/**
-	 * Short form for System.out.println(). 
-	 * Also look if a message is important enough to be printed
+	 * Short form for System.out.println(). Also look if a message is important
+	 * enough to be printed
 	 * 
 	 * @param s
 	 *            String to be printed on the console
 	 * 
-	 * @param severity 
-	 * 			  the severity of the message (1 = INFORMATION, 2 = WARNING, 3 = ERROR)
+	 * @param severity
+	 *            the severity of the message (1 = INFORMATION, 2 = WARNING, 3 =
+	 *            ERROR)
 	 */
 	public static void out(String s, int severity) {
 		if (DEBUG_ENABLED && severity >= logLevel) {

+ 38 - 40
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java

@@ -6,11 +6,9 @@ import java.util.Random;
 import org.graphstream.graph.Edge;
 import org.graphstream.graph.Node;
 
-import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
-
 public class GraphHelper {
 
-	//TODO better way to do scaling
+	// TODO better way to do scaling
 	public static void merge(MyGraph target, MyGraph source) {
 		double targetMinX = target.getMinX();
 		double targetMaxX = target.getMaxX();
@@ -19,79 +17,79 @@ public class GraphHelper {
 		double scalingFactorX = ((targetMaxX - targetMinX + 1) / target.getNodeCount())
 				/ ((sourceMaxX - sourceMinX + 1) / source.getNodeCount());
 		double xOffset = targetMaxX - sourceMinX + 10;
-		
+
 		double targetMinY = target.getMinY();
-		//double targetMaxY = target.getMaxY();
+		// double targetMaxY = target.getMaxY();
 		double sourceMinY = source.getMinY();
-		//double sourceMaxY = source.getMaxY();
-		//experimental
-		double scalingFactorY = scalingFactorX;//((targetMaxY - targetMinY + 1) /target.getNodeCount())
-			//	/ ((sourceMaxY - sourceMinY + 1) /source.getNodeCount());
-		
-		
-		//adjust Cordinates and Attributes
+		// double sourceMaxY = source.getMaxY();
+		// experimental
+		double scalingFactorY = scalingFactorX;// ((targetMaxY - targetMinY + 1)
+												// /target.getNodeCount())
+		// / ((sourceMaxY - sourceMinY + 1) /source.getNodeCount());
+
+		// adjust Cordinates and Attributes
 		adjustSourceXCoordinates(source, scalingFactorX, xOffset, sourceMinX);
 		graphAttribute(target);
 		graphAttribute(source);
 		adjustSourceYCoordinates(source, scalingFactorY, targetMinY, sourceMinY);
-		
-		//Copy Nodes and Edges
+
+		// Copy Nodes and Edges
 		HashMap<String, String> newIds = copyNodes(target, source);
 		copyEdges(target, source, newIds);
-		
+
 	}
 
 	private static void copyEdges(MyGraph target, MyGraph source, HashMap<String, String> newIds) {
 		Random ran = new Random();
 		boolean searchingForId = true;
-		for (Edge e : source.getEdgeSet()){
-			//finding a new ID for the Node
+		for (Edge e : source.getEdgeSet()) {
+			// finding a new ID for the Node
 			searchingForId = true;
-			String newId = source.getId() + e.getId(); 
-			while (searchingForId){
-				if(target.getEdge(newId) == null){
+			String newId = source.getId() + e.getId();
+			while (searchingForId) {
+				if (target.getEdge(newId) == null) {
 					searchingForId = false;
 					target.addEdge(newId, newIds.get(e.getSourceNode().getId()), newIds.get(e.getTargetNode().getId()));
 				} else {
-					newId = newId.concat(String.valueOf((char)(ran.nextInt(52) + 'a')));
+					newId = newId.concat(String.valueOf((char) (ran.nextInt(52) + 'a')));
 				}
 			}
-			for (String s : e.getAttributeKeySet()){
-				target.getEdge(newId).addAttribute(s,(Object) e.getAttribute(s));
+			for (String s : e.getAttributeKeySet()) {
+				target.getEdge(newId).addAttribute(s, (Object) e.getAttribute(s));
 			}
 		}
-		
+
 	}
 
-	private static HashMap<String, String>  copyNodes(MyGraph target, MyGraph source) {
+	private static HashMap<String, String> copyNodes(MyGraph target, MyGraph source) {
 		HashMap<String, String> newIds = new HashMap<>();
 		Random ran = new Random();
 		boolean searchingForId = true;
-		for (Node n : source.getNodeSet()){
-			//finding a new ID for the Node
+		for (Node n : source.getNodeSet()) {
+			// finding a new ID for the Node
 			searchingForId = true;
-			String newId = source.getId() + n.getId(); 
-			while (searchingForId){
-				if(target.getNode(newId) == null){
+			String newId = source.getId() + n.getId();
+			while (searchingForId) {
+				if (target.getNode(newId) == null) {
 					searchingForId = false;
 					target.addNode(newId);
 					newIds.put(n.getId(), newId);
 				} else {
-					newId = newId.concat(String.valueOf((char)(ran.nextInt(52) + 'a')));
+					newId = newId.concat(String.valueOf((char) (ran.nextInt(52) + 'a')));
 				}
 			}
-			for (String s : n.getAttributeKeySet()){
-				target.getNode(newId).addAttribute(s,(Object) n.getAttribute(s));
+			for (String s : n.getAttributeKeySet()) {
+				target.getNode(newId).addAttribute(s, (Object) n.getAttribute(s));
 			}
 		}
-		
+
 		return newIds;
 	}
 
 	private static void adjustSourceYCoordinates(MyGraph g, double scalingFactor, double targetMinY,
 			double sourceMinY) {
-		for (Node n : g.getNodeSet()){
-			double d = (Double)n.getAttribute("y");
+		for (Node n : g.getNodeSet()) {
+			double d = (Double) n.getAttribute("y");
 			d = d - sourceMinY;
 			d = d * scalingFactor;
 			d = d + targetMinY;
@@ -100,16 +98,16 @@ public class GraphHelper {
 	}
 
 	private static void graphAttribute(MyGraph g) {
-		for(Node n : g.getNodeSet()){
-			if(n.getAttribute("originalGraph") == null){
+		for (Node n : g.getNodeSet()) {
+			if (n.getAttribute("originalGraph") == null) {
 				n.addAttribute("originalGraph", g.getId());
 			}
 		}
 	}
 
 	private static void adjustSourceXCoordinates(MyGraph g, Double scalingFactor, Double xOffset, Double SourceMinX) {
-		for (Node n : g.getNodeSet()){
-			Double d = (Double)n.getAttribute("x");
+		for (Node n : g.getNodeSet()) {
+			Double d = (Double) n.getAttribute("x");
 			d = d - SourceMinX;
 			d = d * scalingFactor;
 			d = d + xOffset;

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

@@ -458,7 +458,7 @@ public class GraphManager {
 	public void handleEdgeWeight() {
 		Edge e = null;
 		Iterator<Edge> allEdges = g.getEdgeIterator();
-		if(!Layer.UNDERLAY.equals(g.getAttribute("layer"))){
+		if (!Layer.UNDERLAY.equals(g.getAttribute("layer"))) {
 			return;
 		}
 

+ 3 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/MappingGraphManager.java

@@ -33,7 +33,7 @@ public class MappingGraphManager extends GraphManager implements EdgeCreatedList
 	private static final double OPERATOR_MOVE_Y = 1.5;
 	private static final double SCALE_WIDTH = 2;
 	private static final double SCALE_HEIGHT = 1;
-	
+
 	/** Variables to keep track of new Nodes in the underlay graph */
 	private boolean underlayNodesChanged = false;
 
@@ -515,7 +515,7 @@ public class MappingGraphManager extends GraphManager implements EdgeCreatedList
 			return super.selectNodeForEdgeCreation(nodeID);
 		return false;
 	}
-	
+
 	@Override
 	public void deleteEdge(final String id) {
 		Edge e = g.getEdge(id);
@@ -531,7 +531,7 @@ public class MappingGraphManager extends GraphManager implements EdgeCreatedList
 	public void deleteNode(String id) {
 		Debug.out("default delete Node prevented");
 	}
-	
+
 	@Override
 	public void undelete() {
 		super.undelete();

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

@@ -60,7 +60,7 @@ public class GraphMLImporter {
 	 */
 	private void handleAttributes(MyGraph g) {
 		for (Node n : g.getNodeSet()) {
-			if (!n.hasAttribute("ui.label")){
+			if (!n.hasAttribute("ui.label")) {
 				n.addAttribute("ui.label", "");
 			}
 			if (!n.hasAttribute("typeofNode") || n.getAttribute("typeofNode").equals("")) {

+ 44 - 43
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java

@@ -3,7 +3,6 @@ package de.tu_darmstadt.informatik.tk.scopviz.main;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.GraphDisplayManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.MyAnimationTimer;
@@ -129,26 +128,28 @@ public final class Main {
 		this.creationMode = creationMode;
 	}
 
-	//TODO replace throw by something better for debug
+	// TODO replace throw by something better for debug
 	/**
 	 * Converts a given Attribute into the type of result
 	 * 
-	 * @param attribute the Attribute to be converted.
-	 *  supported types: byte, short, integer, long, float, double, BigInteger, BigDecimal, String 
+	 * @param attribute
+	 *            the Attribute to be converted. supported types: byte, short,
+	 *            integer, long, float, double, BigInteger, BigDecimal, String
 	 * 
-	 * @param result the Attribute will be written in here after the conversion.
-	 *  the supported types are the same as above except for String 
+	 * @param result
+	 *            the Attribute will be written in here after the conversion.
+	 *            the supported types are the same as above except for String
 	 * 
 	 * @return the value of result
 	 */
-	//don't worry I checked all the conversions
+	// don't worry I checked all the conversions
 	@SuppressWarnings("unchecked")
-	public <T extends Number> T convertAttributeTypes (Object attribute, T result){
+	public <T extends Number> T convertAttributeTypes(Object attribute, T result) {
 		String currentType = attribute.getClass().getSimpleName().toLowerCase();
 		String targetType = result.getClass().getSimpleName().toLowerCase();
-		switch (targetType){
-		case "byte" :
-			switch (currentType){
+		switch (targetType) {
+		case "byte":
+			switch (currentType) {
 			case "byte":
 			case "short":
 			case "integer":
@@ -159,15 +160,15 @@ public final class Main {
 			case "bigdecimal":
 				result = (T) new Byte(((Number) attribute).byteValue());
 				break;
-			case "string" :
+			case "string":
 				result = (T) new Byte(new BigDecimal((String) attribute).byteValue());
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			break;
-		case "short" :
-			switch (currentType){
+		case "short":
+			switch (currentType) {
 			case "byte":
 			case "short":
 			case "integer":
@@ -178,15 +179,15 @@ public final class Main {
 			case "bigdecimal":
 				result = (T) new Short(((Number) attribute).shortValue());
 				break;
-			case "string" :
+			case "string":
 				result = (T) new Short(new BigDecimal((String) attribute).shortValue());
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			break;
-		case "integer" :
-			switch (currentType){
+		case "integer":
+			switch (currentType) {
 			case "byte":
 			case "short":
 			case "integer":
@@ -197,15 +198,15 @@ public final class Main {
 			case "bigdecimal":
 				result = (T) new Integer(((Number) attribute).intValue());
 				break;
-			case "string" :
+			case "string":
 				result = (T) new Integer(new BigDecimal((String) attribute).intValue());
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			break;
-		case "long" :
-			switch (currentType){
+		case "long":
+			switch (currentType) {
 			case "byte":
 			case "short":
 			case "integer":
@@ -216,16 +217,16 @@ public final class Main {
 			case "bigdecimal":
 				result = (T) new Long(((Number) attribute).longValue());
 				break;
-			case "string" :
+			case "string":
 				result = (T) new Long(new BigDecimal((String) attribute).longValue());
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			break;
-		case "biginteger" :
+		case "biginteger":
 			BigInteger integer;
-			switch (currentType){
+			switch (currentType) {
 			case "byte":
 				integer = new BigInteger(Byte.toString((byte) attribute));
 				break;
@@ -239,10 +240,10 @@ public final class Main {
 				integer = new BigInteger(Long.toString((long) attribute));
 				break;
 			case "float":
-				integer = new BigInteger(Integer.toString((int)(float) attribute));
+				integer = new BigInteger(Integer.toString((int) (float) attribute));
 				break;
 			case "double":
-				integer = new BigInteger(Long.toString((long)(double) attribute));
+				integer = new BigInteger(Long.toString((long) (double) attribute));
 				break;
 			case "biginteger":
 				integer = (BigInteger) attribute;
@@ -250,16 +251,16 @@ public final class Main {
 			case "bigdecimal":
 				integer = ((BigDecimal) attribute).toBigInteger();
 				break;
-			case "string" :
+			case "string":
 				integer = new BigDecimal((String) attribute).toBigInteger();
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			result = (T) integer;
 			break;
-		case "float" :
-			switch (currentType){
+		case "float":
+			switch (currentType) {
 			case "byte":
 			case "short":
 			case "integer":
@@ -270,15 +271,15 @@ public final class Main {
 			case "bigdecimal":
 				result = (T) new Float(((Number) attribute).floatValue());
 				break;
-			case "string" :
+			case "string":
 				result = (T) new Float(new BigDecimal((String) attribute).floatValue());
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			break;
-		case "double" :
-			switch (currentType){
+		case "double":
+			switch (currentType) {
 			case "byte":
 			case "short":
 			case "integer":
@@ -289,16 +290,16 @@ public final class Main {
 			case "bigdecimal":
 				result = (T) new Double(((Number) attribute).doubleValue());
 				break;
-			case "string" :
+			case "string":
 				result = (T) new Double(new BigDecimal((String) attribute).doubleValue());
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			break;
-		case "bigdecimal" :
+		case "bigdecimal":
 			BigDecimal decimal;
-			switch (currentType){
+			switch (currentType) {
 			case "byte":
 				decimal = new BigDecimal((byte) attribute);
 				break;
@@ -323,10 +324,10 @@ public final class Main {
 			case "bigdecimal":
 				decimal = (BigDecimal) attribute;
 				break;
-			case "string" :
+			case "string":
 				decimal = new BigDecimal((String) attribute);
 				break;
-			default :
+			default:
 				throw new IllegalArgumentException("invalid type: " + attribute.getClass());
 			}
 			result = (T) decimal;

+ 34 - 27
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/CommunicationCostMetric.java

@@ -15,20 +15,22 @@ import de.tu_darmstadt.informatik.tk.scopviz.metrics.interfaces.ScopvizGraphMetr
 import javafx.util.Pair;
 
 /**
- * Class to compute the communication cost metric.
- * The Metric is defined as the sum of the network traversal costs for each hop in the longest path in the operator graph.
- * wARNING: This might not work fully as intended with multiple Operator graphs!
+ * Class to compute the communication cost metric. The Metric is defined as the
+ * sum of the network traversal costs for each hop in the longest path in the
+ * operator graph. wARNING: This might not work fully as intended with multiple
+ * Operator graphs!
+ * 
  * @author Jan Enders
  * @version 0.9
  *
  */
 // TODO: make this work well with multiple operator graphs
-public class CommunicationCostMetric implements ScopvizGraphMetric{
+public class CommunicationCostMetric implements ScopvizGraphMetric {
 
 	/** Flag for when an error occurs during computation. */
 	// TODO: this is not yet being used for output and never reset
 	private boolean error = false;
-	
+
 	@Override
 	public boolean isSetupRequired() {
 		return false;
@@ -41,62 +43,67 @@ public class CommunicationCostMetric implements ScopvizGraphMetric{
 
 	@Override
 	public void setup() {
-		// No Setup required.		
+		// No Setup required.
 	}
 
 	@Override
 	public LinkedList<Pair<String, String>> calculate(MyGraph g) {
 		LinkedList<Pair<String, String>> results = new LinkedList<Pair<String, String>>();
-		
+
 		MyGraph operator = new MyGraph("opWithTime");
-		for (Node n : g.getNodeSet()){
-			if (n.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT) == MappingGraphManager.OPERATOR){
+		for (Node n : g.getNodeSet()) {
+			if (n.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT) == MappingGraphManager.OPERATOR) {
 				operator.addNode(n.getId());
 			}
-			
+
 		}
-		for (Edge e : g.getEdgeSet()){
-			if (e.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT) == MappingGraphManager.OPERATOR){
+		for (Edge e : g.getEdgeSet()) {
+			if (e.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT) == MappingGraphManager.OPERATOR) {
 				String newID = e.getId();
 				double cost = computeCost(e.getNode0(), e.getNode1(), g);
 				operator.addEdge(newID, e.getNode0().getId(), e.getNode1().getId(), true);
 				operator.getEdge(newID).addAttribute("cost", cost);
 			}
 		}
-		
-		//TODO: not fully sure if the diameter Method does exactly what we want, requires testing
+
+		// TODO: not fully sure if the diameter Method does exactly what we
+		// want, requires testing
 		double communicationCost = Toolkit.diameter(operator, "cost", true);
-		
-		results.add(new Pair<String,String>("Overall Cost", ""+communicationCost));
-		
+
+		results.add(new Pair<String, String>("Overall Cost", "" + communicationCost));
+
 		return results;
 	}
 
 	/**
-	 * Compute the Network traversal cost for the Communication between two given operator nodes.
+	 * Compute the Network traversal cost for the Communication between two
+	 * given operator nodes.
 	 * 
-	 * @param n1 The first operator node
-	 * @param n2 The second operator node
-	 * @param g the combined mapping graph
+	 * @param n1
+	 *            The first operator node
+	 * @param n2
+	 *            The second operator node
+	 * @param g
+	 *            the combined mapping graph
 	 * @return the cost
 	 */
-	private double computeCost(Node n1, Node n2, MyGraph g){
+	private double computeCost(Node n1, Node n2, MyGraph g) {
 		double cost = 0;
-		//find the underlay nodes that the operator nodes are mapped to
+		// find the underlay nodes that the operator nodes are mapped to
 		LinkedList<Edge> mappingEdges = new LinkedList<Edge>(g.getEdgeSet().stream()
 				.filter(e -> (((Boolean) e.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING)) == true))
 				.collect(Collectors.toList()));
 		Node target1 = null;
 		Node target2 = null;
-		for (Edge e : mappingEdges){
-			if(e.getNode0() == n1){
+		for (Edge e : mappingEdges) {
+			if (e.getNode0() == n1) {
 				target1 = e.getNode1();
-			} else if (e.getNode0() == n2){
+			} else if (e.getNode0() == n2) {
 				target2 = e.getNode1();
 			}
 		}
 		// Error if not both operator nodes have a valid mapping
-		if (target1 == null || target2 == null){
+		if (target1 == null || target2 == null) {
 			Debug.out("Could not find Mapping target for Operator Node " + n1.getId() + " or " + n2.getId());
 			error = true;
 		} else {

+ 18 - 20
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/PlacementCostMetric.java

@@ -19,9 +19,10 @@ import javafx.stage.FileChooser;
 import javafx.util.Pair;
 
 /**
- * Class to compute the placement cost Metric.
- * Placement Cost is defined as the sum of the costs of individual mapping placements.
- * These Costs are specified in operator node - underlay node pairs and are loaded from an external file during setup.
+ * Class to compute the placement cost Metric. Placement Cost is defined as the
+ * sum of the costs of individual mapping placements. These Costs are specified
+ * in operator node - underlay node pairs and are loaded from an external file
+ * during setup.
  * 
  * @author Jan Enders
  * @version 1.0
@@ -41,9 +42,11 @@ public class PlacementCostMetric implements ScopvizGraphMetric {
 	private static final String UNDERLAY_ID_PREFIX = "underlayIDs:";
 
 	/** The text to display in case of an error during computation. */
-	private static final Pair<String, String> ERROR_MESSAGE = new Pair<String, String>("Error", "ERROR: check Debug logs");
+	private static final Pair<String, String> ERROR_MESSAGE = new Pair<String, String>("Error",
+			"ERROR: check Debug logs");
 	/** The text to display if the Setup has not yet been done. */
-	private static final Pair<String, String> SETUP_NEEDED = new Pair<String, String>("Setup required!", "Setup required!");
+	private static final Pair<String, String> SETUP_NEEDED = new Pair<String, String>("Setup required!",
+			"Setup required!");
 
 	/** The Cost Matrix. */
 	private double[][] costs;
@@ -109,21 +112,17 @@ public class PlacementCostMetric implements ScopvizGraphMetric {
 			LinkedList<Edge> mappingEdges = new LinkedList<Edge>(g.getEdgeSet().stream()
 					.filter(e -> (((Boolean) e.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING)) == true))
 					.collect(Collectors.toList()));
-			for (Edge e: mappingEdges){
+			for (Edge e : mappingEdges) {
 				placementCostSum += placementCost(e.getNode0(), e.getNode1());
 			}
 			/*
-			for (Node n : g.getNodeSet()) {
-				if (n.getId().startsWith(MappingGraphManager.OPERATOR)) {
-					for (Edge e : n.getEdgeSet()) {
-						String edgeTargetParent = e.getNode1()
-								.getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT);
-						if (edgeTargetParent == MappingGraphManager.UNDERLAY) {
-							placementCostSum += placementCost(n, e.getNode1());
-						}
-					}
-				}
-			}*/
+			 * for (Node n : g.getNodeSet()) { if
+			 * (n.getId().startsWith(MappingGraphManager.OPERATOR)) { for (Edge
+			 * e : n.getEdgeSet()) { String edgeTargetParent = e.getNode1()
+			 * .getAttribute(MappingGraphManager.ATTRIBUTE_KEY_MAPPING_PARENT);
+			 * if (edgeTargetParent == MappingGraphManager.UNDERLAY) {
+			 * placementCostSum += placementCost(n, e.getNode1()); } } } }
+			 */
 			results.add(new Pair<String, String>("Overall Cost", "" + placementCostSum));
 		}
 		return results;
@@ -149,17 +148,16 @@ public class PlacementCostMetric implements ScopvizGraphMetric {
 			operatorIDs = new LinkedList<String>();
 			String data = line.substring(OPERATOR_ID_PREFIX.length()).trim();
 			String[] opIDs = data.split(",");
-			for (String s: opIDs){
+			for (String s : opIDs) {
 				operatorIDs.add(s.trim());
 			}
-			
 
 			// Read Underlay Node ID list
 		} else if (line.startsWith(UNDERLAY_ID_PREFIX)) {
 			underlayIDs = new LinkedList<String>();
 			String data = line.substring(UNDERLAY_ID_PREFIX.length()).trim();
 			String[] ulIDs = data.split(",");
-			for (String s: ulIDs){
+			for (String s : ulIDs) {
 				underlayIDs.add(s.trim());
 			}
 

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

@@ -1,11 +1,9 @@
 package de.tu_darmstadt.informatik.tk.scopviz.metrics;
 
 import java.util.LinkedList;
-import java.util.List;
 import java.util.stream.Collectors;
 
 import org.graphstream.graph.Edge;
-import org.graphstream.graph.Node;
 
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MappingGraphManager;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
@@ -37,6 +35,5 @@ public class TaskFulfillmentMetric implements ScopvizGraphMetric {
 				.collect(Collectors.toList()));
 		return null;
 	}
-	
-	
+
 }

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

@@ -15,7 +15,7 @@ public class TestMetric implements ScopvizGraphMetric {
 
 	@Override
 	public LinkedList<Pair<String, String>> calculate(MyGraph g) {
-		LinkedList<Pair<String, String>> test =  new LinkedList<Pair<String, String>>();
+		LinkedList<Pair<String, String>> test = new LinkedList<Pair<String, String>>();
 		test.add(new Pair<String, String>("Hi", "test"));
 		test.add(new Pair<String, String>("Hi2", "test2"));
 		return test;

+ 40 - 41
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -22,7 +22,8 @@ import javafx.scene.control.Button;
 /**
  * Manager to contain the various handlers for the buttons of the UI.
  * 
- * @author Jan Enders (jan.enders@stud.tu-darmstadt.de), Julian Ohl, Dominik Renkel
+ * @author Jan Enders (jan.enders@stud.tu-darmstadt.de), Julian Ohl, Dominik
+ *         Renkel
  * @version 1.2
  *
  */
@@ -93,14 +94,14 @@ public final class ButtonManager {
 
 			// show toolbox and hide VBox
 			controller.toolbox.setVisible(true);
-			
+
 			controller.topLeftAPane.getChildren().remove(controller.symbolToolVBox);
-			
+
 			controller.symbolToolVBox.setVisible(false);
-			
+
 			// make properties editable again
 			controller.propertiesObjectColumn.setEditable(true);
-			
+
 			// enabel context menu
 			controller.properties.setRowFactory(PropertiesManager.rightClickCallback);
 
@@ -115,14 +116,13 @@ public final class ButtonManager {
 			// make graph non mouse transparent
 			controller.pane.setMouseTransparent(false);
 			controller.swingNode.setMouseTransparent(false);
-			
+
 			// deselect graph element
 			PropertiesManager.showNewDataSet(null);
-			
+
 			// reset loaded images
 			MapViewFunctions.resetImageMap();
-			
-			
+
 		}
 	}
 
@@ -135,12 +135,12 @@ public final class ButtonManager {
 
 		GraphDisplayManager.setCurrentLayer(Layer.UNDERLAY);
 		GraphDisplayManager.switchActiveGraph();
-		
+
 		ToolboxManager.setUnderlayItems();
 		setBorderStyle((Button) arg0.getSource());
-		
+
 		controller.open.setText("Open...");
-		
+
 		controller.newItem.disableProperty().set(false);
 		controller.open.disableProperty().set(false);
 		controller.add.disableProperty().set(true);
@@ -149,8 +149,8 @@ public final class ButtonManager {
 		controller.delete.disableProperty().set(false);
 		controller.undelete.disableProperty().set(false);
 		controller.updateMetricMI.disableProperty().set(true);
-		
-		//hide metricbox/update button
+
+		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
 		controller.metricbox.setVisible(false);
 	}
@@ -164,12 +164,12 @@ public final class ButtonManager {
 
 		GraphDisplayManager.setCurrentLayer(Layer.OPERATOR);
 		GraphDisplayManager.switchActiveGraph();
-		
+
 		ToolboxManager.setOperatorItems();
 		setBorderStyle((Button) arg0.getSource());
 
 		controller.open.setText("Open...");
-		
+
 		controller.newItem.disableProperty().set(false);
 		controller.open.disableProperty().set(false);
 		controller.add.disableProperty().set(false);
@@ -178,8 +178,8 @@ public final class ButtonManager {
 		controller.delete.disableProperty().set(false);
 		controller.undelete.disableProperty().set(false);
 		controller.updateMetricMI.disableProperty().set(true);
-		
-		//hide metricbox/update button
+
+		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
 		controller.metricbox.setVisible(false);
 	}
@@ -188,23 +188,23 @@ public final class ButtonManager {
 	 * Handler for the Mapping Layer switch Button.
 	 */
 	public static void mappingAction(ActionEvent arg0) {
-		
-		//show metricbox/update button
-		if (!(GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING))){
+
+		// show metricbox/update button
+		if (!(GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING))) {
 			controller.rightSide.getChildren().add(controller.updateButtonAPane);
 			controller.metricbox.setVisible(true);
 		}
-				
+
 		switchfromSymbolLayer();
 
 		GraphDisplayManager.setCurrentLayer(Layer.MAPPING);
 		GraphDisplayManager.switchActiveGraph();
-		
+
 		ToolboxManager.setMappingItems();
 		setBorderStyle((Button) arg0.getSource());
 
 		controller.open.setText("Open Mapping...");
-		
+
 		controller.newItem.disableProperty().set(true);
 		controller.open.disableProperty().set(false);
 		controller.add.disableProperty().set(true);
@@ -213,7 +213,7 @@ public final class ButtonManager {
 		controller.delete.disableProperty().set(false);
 		controller.undelete.disableProperty().set(false);
 		controller.updateMetricMI.disableProperty().set(false);
-		
+
 	}
 
 	/**
@@ -230,27 +230,25 @@ public final class ButtonManager {
 			GraphDisplayManager.addGraph(gClone, true);
 			controller.topLeftAPane.getChildren().add(controller.symbolToolVBox);
 		}
-		
+
 		try {
-			// load world view 
+			// load world view
 			activateWorldView();
-			
-			
-			
-			
+
 		} catch (IOException e) {
-			
-			// problems with Internet connection, maybe host not reachable, maybe no Internet connection at all
+
+			// problems with Internet connection, maybe host not reachable,
+			// maybe no Internet connection at all
 			GraphDisplayManager.switchActiveGraph();
 			setBorderStyle((Button) arg0.getSource());
-			
+
 			// show "Connection Error" message
 			showConnectionErrorMsg();
-			
+
 			return;
 		}
-		
-		//hide metricbox/update button
+
+		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
 		controller.metricbox.setVisible(false);
 
@@ -258,7 +256,7 @@ public final class ButtonManager {
 		setBorderStyle((Button) arg0.getSource());
 
 		controller.open.setText("Open...");
-		
+
 		controller.newItem.disableProperty().set(true);
 		controller.open.disableProperty().set(true);
 		controller.add.disableProperty().set(true);
@@ -267,7 +265,7 @@ public final class ButtonManager {
 		controller.delete.disableProperty().set(true);
 		controller.undelete.disableProperty().set(true);
 		controller.updateMetricMI.disableProperty().set(true);
-		
+
 	}
 
 	/**
@@ -284,7 +282,8 @@ public final class ButtonManager {
 
 	/**
 	 * Initializes the WorldView, sets data and paints them.
-	 * @throws IOException 
+	 * 
+	 * @throws IOException
 	 */
 	private static void activateWorldView() throws IOException {
 
@@ -424,5 +423,5 @@ public final class ButtonManager {
 	public static void mapViewChoiceChange(ObservableValue<? extends String> ov, String oldVal, String newVal) {
 		MapViewFunctions.changeMapView();
 	}
-	
+
 }

+ 20 - 15
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ConsoleManager.java

@@ -14,39 +14,44 @@ public class ConsoleManager {
 	 * Reference to the GUI Controller for Access to various GUI Elements.
 	 */
 	private static GUIController controller;
-	
+
 	/**
 	 * Initialize console window by setting controller
 	 * 
-	 * @param c our GUIController 
+	 * @param c
+	 *            our GUIController
 	 */
-	public static void initialize(GUIController c){
+	public static void initialize(GUIController c) {
 		controller = c;
 	}
-	
+
 	/**
 	 * Add normal text to the console output
-	 * @param s the text, which should be displayed
+	 * 
+	 * @param s
+	 *            the text, which should be displayed
 	 */
-	public static void addNormalText(String s){
+	public static void addNormalText(String s) {
 		StringBuilder sb = new StringBuilder();
-		
+
 		sb.append(System.lineSeparator()).append(s);
-		
+
 		controller.consoleWindow.getChildren().add(new Text(sb.toString()));
 	}
-	
+
 	/**
 	 * Add error text to the console output
-	 * @param s the text, which should be displayed
+	 * 
+	 * @param s
+	 *            the text, which should be displayed
 	 */
-	public static void addErrorText(String s){
+	public static void addErrorText(String s) {
 		StringBuilder sb = new StringBuilder();
-		
+
 		sb.append(System.lineSeparator()).append(s);
-		
-		Text errorText = new Text(sb.toString()); 
-		
+
+		Text errorText = new Text(sb.toString());
+
 		errorText.setFill(Color.RED);
 		controller.consoleWindow.getChildren().add(errorText);
 	}

+ 44 - 48
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -13,16 +13,13 @@ import org.jxmapviewer.input.PanKeyListener;
 import org.jxmapviewer.input.PanMouseInputListener;
 import org.jxmapviewer.input.ZoomMouseWheelListenerCursor;
 
-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.metrics.TestMetric;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.KeyboardShortcuts;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.ResizeListener;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.WorldView;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
 import javafx.embed.swing.SwingNode;
 import javafx.fxml.FXML;
 import javafx.fxml.Initializable;
@@ -130,16 +127,16 @@ public class GUIController implements Initializable {
 
 	// The columns of the metricbox
 	@FXML
-	public TableColumn<MetricRowData,String> metricBoxMetricColumn;
+	public TableColumn<MetricRowData, String> metricBoxMetricColumn;
 	@FXML
-	public TableColumn<MetricRowData,String> metricBoxValueColumn;
+	public TableColumn<MetricRowData, String> metricBoxValueColumn;
 	@FXML
 	public TableColumn metricBoxUpdateColumn;
 
 	@FXML
 	public Button updateMetricButton;
-	
-	//The items of the top left box in the symbol visualization layer
+
+	// The items of the top left box in the symbol visualization layer
 	@FXML
 	public VBox symbolToolVBox;
 	@FXML
@@ -150,21 +147,22 @@ public class GUIController implements Initializable {
 	public CheckBox edgeWeightCheckbox;
 	@FXML
 	public ChoiceBox<String> mapViewChoiceBox;
-	
+
 	@FXML
 	public TextFlow consoleWindow;
-	
+
 	@FXML
 	public VBox rightSide;
-	
-	//The anchorpane of the top left box (toolbox, symbol visualization layer box)
+
+	// The anchorpane of the top left box (toolbox, symbol visualization layer
+	// box)
 	@FXML
 	public AnchorPane topLeftAPane;
-	
-	//The anchorpane of the metric update button
+
+	// The anchorpane of the metric update button
 	@FXML
 	public AnchorPane updateButtonAPane;
-	
+
 	/**
 	 * Initializes all the references to the UI elements specified in the FXML
 	 * file. Gets called during FXML loading. Asserts the correct injection of
@@ -186,7 +184,7 @@ public class GUIController implements Initializable {
 		ToolboxManager.initializeItems();
 		PropertiesManager.initializeItems(properties);
 		ConsoleManager.initialize(this);
-		
+
 		GraphDisplayManager.init(this);
 
 		// Bind all the handlers to their corresponding UI elements
@@ -201,7 +199,7 @@ public class GUIController implements Initializable {
 
 		// Setup the Keyboard Shortcuts
 		KeyboardShortcuts.initialize(Main.getInstance().getPrimaryStage());
-		
+
 	}
 
 	private void initializeWorldView() {
@@ -237,7 +235,8 @@ public class GUIController implements Initializable {
 		newItem.setOnAction((event) -> MenuBarManager.newAction(event));
 		open.setOnAction((event) -> MenuBarManager.openAction(event));
 		add.setOnAction((event) -> MenuBarManager.addAction(event));
-		add.setDisable(true);;
+		add.setDisable(true);
+		;
 		save.setOnAction((event) -> MenuBarManager.saveAction(event));
 		saveAs.setOnAction((event) -> MenuBarManager.saveAsAction(event));
 		preferences.setOnAction((event) -> MenuBarManager.preferencesAction(event));
@@ -264,7 +263,7 @@ public class GUIController implements Initializable {
 	private void initializeSymbolRepToolbox() {
 		// Hide SymbolRep Toolbox View
 		topLeftAPane.getChildren().remove(symbolToolVBox);
-		
+
 		edgesVisibleCheckbox.selectedProperty()
 				.addListener((ov, oldVal, newVal) -> ButtonManager.edgeVisibilitySwitcher(ov, oldVal, newVal));
 		nodeLabelCheckbox.selectedProperty()
@@ -276,9 +275,7 @@ public class GUIController implements Initializable {
 		mapViewChoiceBox.getSelectionModel().selectFirst();
 		mapViewChoiceBox.getSelectionModel().selectedItemProperty()
 				.addListener((ov, oldVal, newVal) -> ButtonManager.mapViewChoiceChange(ov, oldVal, newVal));
-		
-		
-		
+
 	}
 
 	/**
@@ -377,28 +374,27 @@ public class GUIController implements Initializable {
 		properties.getSelectionModel().clearSelection();
 
 	}
-	
+
 	/**
 	 * Initialize the metric box
 	 */
 	@SuppressWarnings("unchecked")
 	private void initializeMetricbox() {
-		
-		//TODO Möglicherweise auslagern
-		metricbox.setRowFactory( tv -> {
-		    TableRow<MetricRowData> row = new TableRow<>();
-		    row.setOnMouseClicked(event -> {
-		        if (event.getClickCount() == 2 && (! row.isEmpty()) ) {
-		        	
-		        	MetricRowData rowData = row.getItem();
-		        	if(rowData.getMetric().isSetupRequired()){
-		        		rowData.getMetric().setup();
-		        	}
-		            
-		            
-		        }   
-		    });
-		    return row ;
+
+		// TODO Möglicherweise auslagern
+		metricbox.setRowFactory(tv -> {
+			TableRow<MetricRowData> row = new TableRow<>();
+			row.setOnMouseClicked(event -> {
+				if (event.getClickCount() == 2 && (!row.isEmpty())) {
+
+					MetricRowData rowData = row.getItem();
+					if (rowData.getMetric().isSetupRequired()) {
+						rowData.getMetric().setup();
+					}
+
+				}
+			});
+			return row;
 		});
 
 		metricBoxMetricColumn.setResizable(true);
@@ -407,15 +403,15 @@ public class GUIController implements Initializable {
 		metricBoxMetricColumn.setCellValueFactory(new PropertyValueFactory<MetricRowData, String>("metricName"));
 		metricBoxValueColumn.setCellValueFactory(new PropertyValueFactory<MetricRowData, String>("value"));
 		metricBoxUpdateColumn.setCellValueFactory(new PropertyValueFactory<>("checked"));
-		
+
 		metricBoxUpdateColumn.setCellFactory(CheckBoxTableCell.forTableColumn(metricBoxUpdateColumn));
-		
+
 		metricbox.getColumns().setAll(metricBoxMetricColumn, metricBoxValueColumn, metricBoxUpdateColumn);
 		MetricboxManager.initialize(this);
-		
-		//Update button initialization
+
+		// Update button initialization
 		updateMetricButton.setOnAction((event) -> MetricboxManager.updateMetrics());
-		//TODO
+		// TODO
 		rightSide.getChildren().remove(updateButtonAPane);
 	}
 
@@ -482,22 +478,22 @@ public class GUIController implements Initializable {
 
 		assert rightSide != null : "fx:id=\"rightSide\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert consoleWindow != null : "fx:id=\"consoleWindow\" was not injected: check your FXML file 'MainWindow.fxml'.";
-		
+
 		assert metricBoxMetricColumn != null : "fx:id=\"metricBoxMetricColumn\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert metricBoxValueColumn != null : "fx:id=\"metricBoxValueColumn\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert metricBoxUpdateColumn != null : "fx:id=\"metricBoxUpdateColumn\" was not injected: check your FXML file 'MainWindow.fxml'.";
-		
+
 		assert updateMetricButton != null : "fx:id=\"updateMetricButton\" was not injected: check your FXML file 'MainWindow.fxml'.";
-		
+
 		assert topLeftAPane != null : "fx:id=\"topLeftAPane\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert updateButtonAPane != null : "fx:id=\"updateButton\" was not injected: check your FXML file 'MainWindow.fxml'.";
-		
+
 		assert symbolToolVBox != null : "fx:id=\"symbolToolVBox\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert edgesVisibleCheckbox != null : "fx:id=\"edgesVisibleCheckbox\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert nodeLabelCheckbox != null : "fx:id=\"nodeLabelCheckbox\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert edgeWeightCheckbox != null : "fx:id=\"egdeWeightCheckbox\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert mapViewChoiceBox != null : "fx:id=\"mapViewChoiceBox\" was not injected: check your FXML file 'MainWindow.fxml'.";
-		
+
 		assert stackPane != null : "fx:id=\"stackPane\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert swingNodeWorldView != null : "fx:id=\"swingNodeWorldView\" was not injected: check your FXML file 'MainWindow.fxml'.";
 	}

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

@@ -51,28 +51,34 @@ public final class GraphDisplayManager {
 
 	/** The currently active Layer. */
 	private static Layer currentLayer = Layer.UNDERLAY;
-	
-	
+
 	/**
-	 * Observable boolean value, true when currentLayer = symbol layer, false otherwise
+	 * Observable boolean value, true when currentLayer = symbol layer, false
+	 * otherwise
 	 */
-	private static BooleanProperty inSymbolLayer = new SimpleBooleanProperty(); 
-	
+	private static BooleanProperty inSymbolLayer = new SimpleBooleanProperty();
+
 	/**
 	 * set inSymbolLayer to true
 	 */
-	private static final void changeToSymbolLayer(){inSymbolLayer.set(true);};
-	
+	private static final void changeToSymbolLayer() {
+		inSymbolLayer.set(true);
+	};
+
 	/**
 	 * set inSymbolLayer to false
 	 */
-	private static final void changeToOtherLayer(){inSymbolLayer.set(false);};
-	
+	private static final void changeToOtherLayer() {
+		inSymbolLayer.set(false);
+	};
+
 	/**
 	 * 
-	 * @return inSymbolLayer property 
+	 * @return inSymbolLayer property
 	 */
-	public static BooleanProperty inSymbolLayerProperty(){return inSymbolLayer;};
+	public static BooleanProperty inSymbolLayerProperty() {
+		return inSymbolLayer;
+	};
 
 	/**
 	 * An empty GraphManager to use with Layers not yet filled with another
@@ -202,10 +208,12 @@ public final class GraphDisplayManager {
 			v.setStylesheet(StylesheetManager.DEFAULT_STYLESHEET);
 		} else {
 			v = getGraphManager();
-			Debug.out(v.getGraph().toString() + " Nodes: " + v.getGraph().getNodeCount() + " Edges: " + v.getGraph().getEdgeCount());
+			Debug.out(v.getGraph().toString() + " Nodes: " + v.getGraph().getNodeCount() + " Edges: "
+					+ v.getGraph().getEdgeCount());
 			GraphHelper.merge(v.getGraph(), g);
 			ret = currentGraphManager;
-			Debug.out(v.getGraph().toString() + " Nodes: " + v.getGraph().getNodeCount() + " Edges: " + v.getGraph().getEdgeCount());
+			Debug.out(v.getGraph().toString() + " Nodes: " + v.getGraph().getNodeCount() + " Edges: "
+					+ v.getGraph().getEdgeCount());
 		}
 
 		// set ui.class
@@ -317,10 +325,10 @@ public final class GraphDisplayManager {
 			initMappingLayer();
 		}
 		GraphDisplayManager.currentLayer = currentLayer;
-		
-		if(currentLayer.equals(Layer.SYMBOL)){
+
+		if (currentLayer.equals(Layer.SYMBOL)) {
 			changeToSymbolLayer();
-		}else{
+		} else {
 			changeToOtherLayer();
 		}
 	}
@@ -424,7 +432,7 @@ public final class GraphDisplayManager {
 		currentLayer = Layer.UNDERLAY;
 		addGraph(tempGraph, true);
 		GraphManager und = getGraphManager(Layer.UNDERLAY);
-		
+
 		// operator graph
 		MyGraph tempGraph2 = new MyGraph(getGraphStringID(count++));
 		count++;
@@ -453,7 +461,7 @@ public final class GraphDisplayManager {
 		currentLayer = Layer.OPERATOR;
 		addGraph(tempGraph2, true);
 		GraphManager op = getGraphManager(Layer.OPERATOR);
-		
+
 		// Mapping graph
 		MyGraph moreTempGraph = new MyGraph(getGraphStringID(count));
 		moreTempGraph.addAttribute("layer", Layer.MAPPING);

+ 28 - 31
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/MetricboxManager.java

@@ -15,20 +15,21 @@ import javafx.collections.ObservableList;
  * @version 1.3.0.0
  */
 public class MetricboxManager {
-	
+
 	private static GUIController controller;
 	private static ObservableList<MetricRowData> metrics;
-	
+
 	/**
 	 * Private Constructor to prevent Instantiation.
 	 */
-	private MetricboxManager(){
+	private MetricboxManager() {
 	}
-	
+
 	/**
-	 * Initialize metricbox by setting controller, initializing all metrics and set them as items
+	 * Initialize metricbox by setting controller, initializing all metrics and
+	 * set them as items
 	 * 
-	 * @param guiController 
+	 * @param guiController
 	 */
 	public static void initialize(GUIController guiController) {
 		controller = guiController;
@@ -39,42 +40,38 @@ public class MetricboxManager {
 	/**
 	 * Initializes all metrics for employment
 	 * 
-	 * ****Central method to add a new metric*****
-	 * Add line: 
-	 * metrics.add(new MetricRowData(new YourMetric()));
-	 * for using it in the metricbox
+	 * ****Central method to add a new metric***** Add line: metrics.add(new
+	 * MetricRowData(new YourMetric())); for using it in the metricbox
 	 * **************************************************************
 	 * 
 	 */
-	private static void initializeMetrics(){
-		 metrics = FXCollections.observableArrayList();
-		 
-		 metrics.add(new MetricRowData(new TestMetric()));
-		 metrics.add(new MetricRowData(new PlacementCostMetric()));
-		 metrics.add(new MetricRowData(new CommunicationCostMetric()));
+	private static void initializeMetrics() {
+		metrics = FXCollections.observableArrayList();
+
+		metrics.add(new MetricRowData(new TestMetric()));
+		metrics.add(new MetricRowData(new PlacementCostMetric()));
+		metrics.add(new MetricRowData(new CommunicationCostMetric()));
 	}
-	
-	
+
 	/**
-	 * if in mapping layer:
-	 * updates all values of all metrics that are checked and refreshes the metricbox
+	 * if in mapping layer: updates all values of all metrics that are checked
+	 * and refreshes the metricbox
 	 */
-	public static void updateMetrics(){
-		
-		if(GraphDisplayManager.getCurrentLayer() == Layer.MAPPING){
-			
-			for(MetricRowData d: metrics){
-				
-				if(d.getChecked()){
-					
+	public static void updateMetrics() {
+
+		if (GraphDisplayManager.getCurrentLayer() == Layer.MAPPING) {
+
+			for (MetricRowData d : metrics) {
+
+				if (d.getChecked()) {
+
 					d.updateMetric(Main.getInstance().getGraphManager().getGraph());
-					
+
 				}
 			}
 			controller.metricbox.refresh();
 		}
-		
+
 	}
-	
 
 }

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

@@ -2,11 +2,9 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 
 import javafx.application.Platform;
 import javafx.collections.FXCollections;
-import javafx.collections.ObservableArray;
 import javafx.collections.ObservableList;
 import javafx.geometry.Insets;
 import javafx.scene.control.ButtonBar.ButtonData;
@@ -67,9 +65,10 @@ public final class OptionsManager {
 
 		ChoiceBox<String> nodeGraphicsSelector = new ChoiceBox<String>();
 		if (StylesheetManager.getAllNodeGraphics() != null) {
-		ObservableList<String> styles = FXCollections.observableArrayList(Arrays.asList(StylesheetManager.getAllNodeGraphics()));
-		nodeGraphicsSelector.setItems(FXCollections.observableArrayList(styles));
-		nodeGraphicsSelector.getSelectionModel().select(StylesheetManager.getNodeGraphics());
+			ObservableList<String> styles = FXCollections
+					.observableArrayList(Arrays.asList(StylesheetManager.getAllNodeGraphics()));
+			nodeGraphicsSelector.setItems(FXCollections.observableArrayList(styles));
+			nodeGraphicsSelector.getSelectionModel().select(StylesheetManager.getNodeGraphics());
 		}
 
 		TextField defaultLatitudeField = new TextField(Double.toString(defaultLat));
@@ -84,9 +83,9 @@ public final class OptionsManager {
 		grid.add(showWeightButton, 1, row);
 		row++;
 		if (StylesheetManager.getAllNodeGraphics().length > 1) {
-		grid.add(new Label("Node display:"), 0, row);
-		grid.add(nodeGraphicsSelector, 1, row);
-		row++;
+			grid.add(new Label("Node display:"), 0, row);
+			grid.add(nodeGraphicsSelector, 1, row);
+			row++;
 		}
 		grid.add(new Label("Default Coordinates of Nodes without Coordinates" + (coordinatesChanged ? ":" : ".")), 0,
 				row);

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

@@ -57,8 +57,7 @@ public final class PropertiesManager {
 	public static boolean nameSet;
 	/** Flag whether the value has been set. */
 	public static boolean valueSet;
-	
-	
+
 	public static HashSet<TableRow<KeyValuePair>> tableRows = new HashSet<TableRow<KeyValuePair>>();
 
 	/**
@@ -174,15 +173,14 @@ public final class PropertiesManager {
 			});
 
 			// Disable MenuItem in symbol layer
-			//TODO
-			onlyAddPropMenuItem.disableProperty().bind(GraphDisplayManager.inSymbolLayerProperty()); 
-			addPropMenuItem.disableProperty().bind(GraphDisplayManager.inSymbolLayerProperty()); 
-			deletePropMenuItem.disableProperty().bind(GraphDisplayManager.inSymbolLayerProperty()); 
-			
+			// TODO
+			onlyAddPropMenuItem.disableProperty().bind(GraphDisplayManager.inSymbolLayerProperty());
+			addPropMenuItem.disableProperty().bind(GraphDisplayManager.inSymbolLayerProperty());
+			deletePropMenuItem.disableProperty().bind(GraphDisplayManager.inSymbolLayerProperty());
+
 			// add MenuItem to ContextMenu
 			menuOnEmptyRows.getItems().add(onlyAddPropMenuItem);
 			menuOnNonEmptyRows.getItems().addAll(addPropMenuItem, deletePropMenuItem);
-			
 
 			// when empty row right-clicked open special menu (only add),
 			// otherwise normal menu (add & delete)
@@ -225,12 +223,12 @@ public final class PropertiesManager {
 	public static void showNewDataSet(Element selected) {
 
 		ObservableList<KeyValuePair> newData = FXCollections.observableArrayList();
-		
+
 		if (selected == null) {
 			properties.setItems(newData);
 			return;
 		}
-		
+
 		// fix for concurrentModification exception
 		String[] temp = new String[0];
 		temp = selected.getAttributeKeySet().toArray(temp);

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

@@ -15,7 +15,7 @@ public class StylesheetManager {
 	/**
 	 * all available graphic styles
 	 */
-	private static String[] allNodeGraphics = {"Shapes"};
+	private static String[] allNodeGraphics = { "Shapes" };
 	/**
 	 * The Stylesheet that is given to every graph that is added to display
 	 * everything correctly.
@@ -27,7 +27,7 @@ public class StylesheetManager {
 	 */
 	public static final String STYLE_NODES_SHAPES = "node.standard{shape: diamond;}" + "node.source{shape: triangle;}"
 			+ "node.procEn{shape: circle;}" + "node.sink{shape: box;}" + "node.operator{shape: circle;}";
-	
+
 	/**
 	 * Part of the stylesheet that styles the different Nodes with sprites.
 	 */

+ 5 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java

@@ -119,7 +119,7 @@ public final class ToolboxManager {
 
 			if (node instanceof TableRow) {
 				row = (TableRow<Pair<Object, String>>) node;
-			} else if (node.getParent() instanceof TableRow){
+			} else if (node.getParent() instanceof TableRow) {
 				// clicking on text part
 				row = (TableRow<Pair<Object, String>>) node.getParent();
 			} else {
@@ -179,6 +179,7 @@ public final class ToolboxManager {
 
 	/**
 	 * create a pair object under given picture and name
+	 * 
 	 * @param picture
 	 * @param name
 	 * @return
@@ -215,8 +216,9 @@ public final class ToolboxManager {
 	}
 
 	/**
-	 * The actual TableCell, that renders the images of nodes and edges. (Image, String)-Cell
-	 * additional support for (String, String), (Integer, String), (Boolean, String), ("N/A", String) table cells
+	 * The actual TableCell, that renders the images of nodes and edges. (Image,
+	 * String)-Cell additional support for (String, String), (Integer, String),
+	 * (Boolean, String), ("N/A", String) table cells
 	 *
 	 */
 	public static class PairValueCell extends TableCell<Pair<Object, String>, Object> {

+ 0 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/mapView/CustomTileFactory.java

@@ -1,7 +1,5 @@
 package de.tu_darmstadt.informatik.tk.scopviz.ui.mapView;
 
-import java.awt.Color;
-import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -31,8 +29,6 @@ import org.jxmapviewer.viewer.TileCache;
 import org.jxmapviewer.viewer.TileFactoryInfo;
 import org.jxmapviewer.viewer.util.GeoUtil;
 
-import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
-
 /**
  * Custom tile factory for handling connection problems
  *