MW пре 7 година
родитељ
комит
ef21966473

+ 94 - 1
scopviz/.settings/org.eclipse.jdt.core.prefs

@@ -1,8 +1,101 @@
 eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
 org.eclipse.jdt.core.compiler.source=1.8

+ 193 - 10
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainApp.java

@@ -1,21 +1,38 @@
 package de.tu_darmstadt.informatik.tk.scopviz.main;
 
 import java.awt.Dimension;
+import java.awt.event.MouseListener;
 import java.io.IOException;
+import java.util.Iterator;
+import java.util.Random;
+
 import javax.swing.JPanel;
 
 import org.graphstream.graph.Graph;
+import org.graphstream.graph.Node;
+import org.graphstream.ui.geom.Vector3;
 import org.graphstream.ui.swingViewer.ViewPanel;
+import org.graphstream.ui.swingViewer.util.GraphMetrics;
+import org.graphstream.ui.view.View;
+
 import javafx.application.Application;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
 import javafx.embed.swing.SwingNode;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Scene;
+import javafx.scene.control.SplitPane;
+import javafx.scene.control.Button;
+import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.AnchorPane;
 import javafx.scene.layout.Pane;
 import javafx.scene.layout.VBox;
 import javafx.stage.Stage;
-
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.io.GraphMLImporter;
+import de.tu_darmstadt.informatik.tk.scopviz.ui.GUIController;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.Visualizer;
 
 /**
@@ -42,7 +59,20 @@ public class MainApp extends Application {
 	/**
 	 * Preferred size for the Graph Viewer.
 	 */
-	private final Dimension preferredViewerSize = new Dimension(300, 300);
+	private final Dimension preferredViewerSize = new Dimension(425, 367);
+
+	private Visualizer visualizer;
+	private ViewPanel view;
+
+	private static GUIController guiController;
+
+	private enum Mod {
+		NORMAL, CREATE_NODE, CREATE_EDGE, FIRST_NODE_SELECTED
+	}
+
+	private String firstNode;
+
+	private Mod modus = Mod.NORMAL;
 
 	/**
 	 * Main Method, launches the Application.
@@ -62,6 +92,7 @@ public class MainApp extends Application {
 	public void init() {
 		GraphMLImporter importer = new GraphMLImporter();
 		graph = importer.readGraph(MainApp.class.getResource("/Example.graphml"));
+		visualizer = new Visualizer(graph);
 	}
 
 	/**
@@ -83,7 +114,7 @@ public class MainApp extends Application {
 		// Load root layout from fxml file.
 		try {
 			FXMLLoader loader = new FXMLLoader();
-			loader.setLocation(MainApp.class.getResource("/MainWindow.fxml"));
+			loader.setLocation(MainApp.class.getResource("/NewBetterCoolerWindowTest.fxml"));
 			rootLayout = (VBox) loader.load();
 		} catch (IOException e) {
 			System.err.println("FXML File could not be loaded. Could the Path be incorrect?");
@@ -93,20 +124,172 @@ public class MainApp extends Application {
 		// Show the scene containing the root layout.
 		Scene scene = new Scene(rootLayout);
 
-		// Get Access to the SwingNode within the UI
-		// TODO: Make this not terrible
-		AnchorPane anchor = (AnchorPane) rootLayout.getChildren().get(1);
-		Pane pane = (Pane) anchor.getChildren().get(1);
-		SwingNode swingNode = (SwingNode) pane.getChildren().get(0);
+		SwingNode swingNode = guiController.swingNode;
+		Pane pane = guiController.pane;
+		Button createNodeButton = guiController.createNode;
+		Button createEdgeButton = guiController.createEdge;
 
-		// TODO: remove magic numbers
-		ViewPanel view = Visualizer.getView(graph);
+		view = visualizer.getView();
 		view.setPreferredSize(preferredViewerSize);
+
 		swingNode.setContent((JPanel) view);
+		pane.setMinSize(200, 200);
+
+		ChangeListener<Number> resizeListener = new ChangeListener<Number>() {
+
+			@Override
+			public void changed(ObservableValue<? extends Number> arg0, Number arg1, Number arg2) {
+				view.setPreferredSize(new Dimension((int) pane.getWidth() - 10, (int) pane.getHeight() - 10));
+
+				swingNode.setContent(view);
+			}
+
+		};
+
+		pane.heightProperty().addListener(resizeListener);
+		pane.widthProperty().addListener(resizeListener);
 
+		guiController.zoomIn.setOnAction(new EventHandler<ActionEvent>() {
+			public void handle(ActionEvent evt) {
+				view.getCamera().setViewPercent(view.getCamera().getViewPercent() * 0.95);
+			}
+		});
+
+		guiController.zoomOut.setOnAction(new EventHandler<ActionEvent>() {
+			public void handle(ActionEvent evt) {
+				view.getCamera().setViewPercent(view.getCamera().getViewPercent() * 1.05);
+			}
+		});
+
+		createNodeButton.setOnAction(new EventHandler<ActionEvent>() {
+			@Override
+			public void handle(ActionEvent arg0) {
+				switch (modus) {
+				case CREATE_NODE:
+					modus = Mod.NORMAL;
+					Debug.out("Modus set to Normal");
+					createNodeButton.setText("Knoten hinzufügen");
+					break;
+				case NORMAL:
+					modus = Mod.CREATE_NODE;
+					Debug.out("Modus set to Create Node");
+					createNodeButton.setText("Ende");
+					break;
+				default:
+					modus = Mod.CREATE_NODE;
+					Debug.out("Modus set to Create Node");
+					createNodeButton.setText("Ende");
+					createEdgeButton.setText("Kante hinzufügen");
+					firstNode = "";
+					break;
+				}
+			}
+		});
+
+		createEdgeButton.setOnAction(new EventHandler<ActionEvent>() {
+			@Override
+			public void handle(ActionEvent arg0) {
+				firstNode = "";
+				switch (modus) {
+				case CREATE_EDGE:
+				case FIRST_NODE_SELECTED:
+					modus = Mod.NORMAL;
+					Debug.out("Modus set to Normal");
+					createEdgeButton.setText("Kante hinzufügen");
+					break;
+				case NORMAL:
+					modus = Mod.CREATE_EDGE;
+					Debug.out("Modus set to Create Edge");
+					createEdgeButton.setText("Ende");
+					break;
+				default:
+					modus = Mod.CREATE_EDGE;
+					Debug.out("Modus set to Create Edge");
+					createEdgeButton.setText("Ende");
+					createNodeButton.setText("Knoten hinzufügen");
+					break;
+				}
+			}
+		});
+
+		swingNode.setOnMouseClicked(new EventHandler<MouseEvent>() {
+
+			@Override
+			public void handle(MouseEvent event) {
+				double x = event.getX();
+				double trueX = (x - 45) / 3 + 100;
+				double y = event.getY();
+				double trueY = (y - 30) / (-3)  +200;
+					Debug.out("-M (" + trueX + "/" + trueY + ")");
+				if (modus == Mod.CREATE_NODE) {
+					Node n = graph.addNode(getUnusedID());
+					GraphMetrics gm = view.getCamera().getMetrics();
+					Vector3 vc3 = gm.getSize();
+					Debug.out("(x/y): " + vc3.x() + "/" + vc3.y());
+					vc3.x();
+					vc3.y();
+					n.setAttribute("x", trueX);
+					n.setAttribute("y", trueY);
+					Debug.out("Created a dot on (" + trueX + "/" + trueY + ")");
+				} else if (modus == Mod.CREATE_EDGE || modus == Mod.FIRST_NODE_SELECTED) {
+					Iterator<Node> itr = graph.getNodeIterator();
+					double d = Double.MAX_VALUE;
+					String id = null;
+					while (itr.hasNext()) {
+						Node curN = itr.next();
+						double nodeX = curN.getAttribute("x");
+						double nodeY =  curN.getAttribute("y");
+						double curD = Math.sqrt(Math.pow(nodeX - trueX, 2.0) + Math.pow(nodeY - trueY, 2.0));
+						Debug.out("+" + curN.getId() + " (" + nodeX + "/" + nodeY + ")");
+						if (curD < d) {
+							d = curD;
+							id = curN.getId();
+						}
+					}
+
+					Debug.out(id + " pressed");
+
+					if (id == null) {
+						Debug.out("nothing selected");
+						return;
+					}
+					switch (modus) {
+					case CREATE_EDGE:
+						firstNode = id;
+						modus = Mod.FIRST_NODE_SELECTED;
+						break;
+					case FIRST_NODE_SELECTED:
+						if (!id.matches(firstNode)) {
+							graph.addEdge(getUnusedID(), firstNode, id);
+							Debug.out("Created a edge between " + firstNode + " and " + id);
+						}
+						firstNode = "";
+						modus = Mod.CREATE_EDGE;
+						break;
+					default:
+						break;
+
+					}
+				}
+			}
+
+		});
+
+		primaryStage.setMinHeight(400);
+		primaryStage.setMinWidth(640);
 		primaryStage.setScene(scene);
 		primaryStage.show();
 
 	}
 
+	private String getUnusedID() {
+		// TODO gescheite implementierung
+		Random rand = new Random();
+		return rand.nextInt() + "";
+	}
+
+	public static void setGUIController(GUIController toSet) {
+		guiController = toSet;
+	}
+
 }

+ 93 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -0,0 +1,93 @@
+package de.tu_darmstadt.informatik.tk.scopviz.ui;
+
+import java.net.URL;
+import java.util.ResourceBundle;
+
+import de.tu_darmstadt.informatik.tk.scopviz.main.MainApp;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.embed.swing.SwingNode;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.Pane;
+import javafx.util.Callback;
+
+public class GUIController implements Initializable{
+	
+	@FXML public SwingNode swingNode;
+	@FXML public Pane pane;
+	
+	@FXML public Button zoomIn;
+	@FXML public Button zoomOut;
+	@FXML public Button createNode;
+	@FXML public Button createEdge;
+	
+	@FXML public ScrollPane toolboxScrollPane;
+	@FXML public ScrollPane layerScrollPane;
+	@FXML public ScrollPane propertiesScrollPane;
+	@FXML public ScrollPane metricScrollPane;
+	
+	@FXML public ListView<String> toolbox;
+	@FXML public ListView<String> properties;
+
+	@Override
+	public void initialize(URL arg0, ResourceBundle arg1) {
+		assert swingNode != null : "fx:id=\"swingNode\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		
+		assert pane != null : "fx:id=\"pane\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		
+		assert zoomIn != null : "fx:id=\"zoomIn\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert zoomOut != null : "fx:id=\"zoomOut\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert createNode != null : "fx:id=\"createNode\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert createEdge != null : "fx:id=\"createEdge\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		
+		assert layerScrollPane != null : "fx:id=\"layerScrollPane\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert propertiesScrollPane != null : "fx:id=\"propertiesScrollPane\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert metricScrollPane != null : "fx:id=\"metricSrollPane\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert toolboxScrollPane != null : "fx:id=\"toolboxScrollPane\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		
+		assert toolbox != null : "fx:id=\"toolbox\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert properties != null : "fx:id=\"properties\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		
+		MainApp.setGUIController(this);
+		
+		ObservableList<String> dataToolbox = FXCollections.observableArrayList("toolbox");
+		toolbox.setItems(dataToolbox);
+		
+		ObservableList<String> dataProperties = FXCollections.observableArrayList("CPU", "OPS");
+		properties.setItems(dataProperties);
+		
+		properties.setCellFactory(new Callback<ListView<String>, 
+		            ListCell<String>>() {
+		                @Override 
+		                public ListCell<String> call(ListView<String> properties) {
+		                    return new LabelCell();
+		                }
+		            }
+		        );
+	}
+	
+	static class LabelCell extends ListCell<String> {
+        @Override
+        public void updateItem(String item, boolean empty) {
+            super.updateItem(item, empty);
+            if(item != null){
+	            if(item.equals("CPU")){
+	            	setGraphic(new TextField(item));
+	            }
+	            if(item.equals("OPS")){
+	            	setGraphic(new Label(item));
+	            }
+            }
+        }
+    }
+
+}

+ 156 - 11
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/Visualizer.java

@@ -1,36 +1,181 @@
 package de.tu_darmstadt.informatik.tk.scopviz.ui;
 
+import java.util.LinkedList;
+import java.util.*;
+
+import org.graphstream.graph.Edge;
 import org.graphstream.graph.Graph;
+import org.graphstream.graph.Node;
 import org.graphstream.ui.swingViewer.ViewPanel;
 import org.graphstream.ui.view.Viewer;
+import org.graphstream.ui.view.ViewerPipe;
+
+import de.tu_darmstadt.informatik.tk.scopviz.main.MyViewerListener;
 
 /**
  * Interface between GUI and internal Graph representation.
  * 
- * @version 1.0.0.0
+ * @version 3.0.0.0
  * @author jascha-b
  *
  */
-public final class Visualizer {
+public class Visualizer {
+	//The graph of this Visualizer
+	Graph g;
+	
+	//last deleted elements for undelete
+	private Node deletedNode;
+	private LinkedList<Edge> deletedEdges = new LinkedList<>();
+	
+	//Currently selected Edge or Node at least on of these is always null
+	private String selectedNodeID = null;
+	//TODO figure out how to do this
+	private String selectedEdgeID = null;
+	
+	//View Panel of the Graph
+	private ViewPanel view;
+	
+	
+	public Visualizer(Graph graph){
+		g=graph;
+		Viewer viewer = new Viewer(g, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
+		view = viewer.addDefaultView(false);
+		viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.EXIT);
+		ViewerPipe fromViewer = viewer.newViewerPipe();
+		fromViewer.addViewerListener(new MyViewerListener(this));
+		fromViewer.addSink(graph);
+	}
 
+	
+	
+	
 	/**
-	 * Private Constructor to prevent instantiation.
+	 * deletes the Node corresponding to the given ID from the Graph.
+	 * The referenced Graph is  modified directly.
+	 * Will throw an ElementNotFoundException, when the Node is not Found
+	 * Will also remove all Edges connected to the given Node
+	 * 
+	 * @param g the Graph with the Node that shall be removed
+	 * @param id the ID of the node that will be removed 
 	 */
-	private Visualizer() {
+	public void deleteNode (final String id) {
+		deletedEdges.removeAll(deletedEdges);
+		deletedNode = null;
+		//Edges have to be deleted first because they clear deletedNode 
+		//and need the Node to still be in the Graph
+		deleteEdgesOfNode(id);
+		deletedNode = g.removeNode(id);
 	}
-
-	// TODO add getview with size
+	
+	/**
+	 * deletes the Edge corresponding to the given ID from the Graph.
+	 * The referenced Graph is  modified directly.
+	 * Will throw an ElementNotFoundException, when the Edge is not Found
+	 * 
+	 * @param g the Graph with the Edge that shall be removed
+	 * @param id the ID of the Edge that will be removed 
+	 */
+	public void deleteEdge (final String id) {
+		deletedEdges.removeAll(deletedEdges);
+		deletedNode = null;
+		deletedEdges.add(g.removeEdge(id));
+	}
+	
+	/**
+	 * deletes all Edges connected to the given Node
+	 * The referenced Graph is modified Directly
+	 * Will throw an ElementNotFoundException, when the Node is not Found
+	 * 
+	 * @param g the Graph containing the Node
+	 * @param id the Id of the Node, whose Edges shall be removed
+	 */
+	public void deleteEdgesOfNode (final String id) {
+		Node node = g.getNode(id); 
+		deletedEdges.removeAll(deletedEdges);
+		deletedNode = null;
+		Edge[] temp = new Edge[0];
+		temp = g.getEdgeSet().toArray(temp);
+		
+		for (Edge e : temp){
+			if (e.getSourceNode().equals(node) || e.getTargetNode().equals(node)){
+				//adds the Edge to the list of deleted Edges and remove sit from the Graph 
+				deletedEdges.add(g.removeEdge(e));
+			}
+		} 
+	 }
+	
+	//TODO make undeletes Graph specific
+	/**
+	 * Undos the last deleting operation on the given Graph
+	 * Deleting operations are: deleteNode, deleteEdge and deleteEdgesOfNode
+	 * only undos the last deleting operation even if that operation didn't change the Graph
+	 *  
+	 * @param g the Graph, whose Elements shall be undeleted
+	 */
+	public void undelete () {
+		HashMap<String, Object> attributes =  new HashMap<String, Object>();
+		if(deletedNode!=null){
+			for (String s : deletedNode.getAttributeKeySet()){
+				attributes.put(s, deletedNode.getAttribute(s));
+			}
+			g.addNode(deletedNode.getId());
+			g.getNode(deletedNode.getId()).addAttributes(attributes);
+		}
+		
+		for (Edge e : deletedEdges){
+			attributes = new HashMap<String, Object>();
+			for (String s : e.getAttributeKeySet()){
+				attributes.put(s, e.getAttribute(s));
+			}
+			g.addEdge(e.getId(),(Node) e.getSourceNode(),(Node) e.getTargetNode());
+			g.getEdge(e.getId()).addAttributes(attributes);
+		}
+	}
+	
+	
 	/**
 	 * returns a View of the Graph. The View is in the Swing Thread and the
 	 * Graph in the Main thread.
 	 * 
-	 * @param g
-	 *            the Graph that the view is based on
+	 * 
 	 * @return a View of the Graph, inheriting from JPanel
 	 */
-	public static ViewPanel getView(final Graph g) {
-		Viewer viewer = new Viewer(g, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
-		ViewPanel view = viewer.addDefaultView(false);
+	public ViewPanel getView (){
 		return view;
 	}
+
+
+
+
+	public String getSelectedNodeID() {
+		return selectedNodeID;
+	}
+
+
+
+
+	public void setSelectedNodeID(String selectedNodeID) {
+		this.selectedNodeID = selectedNodeID;
+	}
+
+
+
+
+	public String getSelectedEdgeID() {
+		return selectedEdgeID;
+	}
+
+
+
+
+	public void setSelectedEdgeID(String selectedEdgeID) {
+		this.selectedEdgeID = selectedEdgeID;
+	}
+
+
+
+
+	public Graph getGraph() {
+		return g;
+	}
 }

+ 2 - 2
scopviz/src/main/resources/Example.graphml

@@ -5,8 +5,8 @@
 	   http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
 	<key id="attr0000" for="node" attr.name="Eigenschaft" attr.type="string"/>
 	<key id="attr0001" for="node" attr.name="ui.label" attr.type="string"/>
-	<key id="attr0002" for="node" attr.name="y" attr.type="int"/>
-	<key id="attr0003" for="node" attr.name="x" 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"/>
 	<graph id="Example" edgedefault="undirected">
 		<node id="A">
 			<data key="attr0000">test</data>

+ 122 - 0
scopviz/src/main/resources/NewBetterCoolerWindowTest.fxml

@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.embed.swing.SwingNode?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ListView?>
+<?import javafx.scene.control.Menu?>
+<?import javafx.scene.control.MenuBar?>
+<?import javafx.scene.control.MenuItem?>
+<?import javafx.scene.control.ScrollPane?>
+<?import javafx.scene.control.SeparatorMenuItem?>
+<?import javafx.scene.control.SplitPane?>
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.layout.Pane?>
+<?import javafx.scene.layout.VBox?>
+
+<VBox minHeight="400.0" minWidth="640.0" prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.tu_darmstadt.informatik.tk.scopviz.ui.GUIController">
+  <children>
+    <MenuBar VBox.vgrow="NEVER">
+      <menus>
+        <Menu mnemonicParsing="false" text="File">
+          <items>
+            <MenuItem mnemonicParsing="false" text="New" />
+            <MenuItem mnemonicParsing="false" text="Open…" />
+            <Menu mnemonicParsing="false" text="Open Recent" />
+            <SeparatorMenuItem mnemonicParsing="false" />
+            <MenuItem mnemonicParsing="false" text="Close" />
+            <MenuItem mnemonicParsing="false" text="Save" />
+            <MenuItem mnemonicParsing="false" text="Save As…" />
+            <MenuItem mnemonicParsing="false" text="Revert" />
+            <SeparatorMenuItem mnemonicParsing="false" />
+            <MenuItem mnemonicParsing="false" text="Preferences…" />
+            <SeparatorMenuItem mnemonicParsing="false" />
+            <MenuItem mnemonicParsing="false" text="Quit" />
+          </items>
+        </Menu>
+        <Menu mnemonicParsing="false" text="Edit">
+          <items>
+            <MenuItem mnemonicParsing="false" text="Undo" />
+            <MenuItem mnemonicParsing="false" text="Redo" />
+            <SeparatorMenuItem mnemonicParsing="false" />
+            <MenuItem mnemonicParsing="false" text="Cut" />
+            <MenuItem mnemonicParsing="false" text="Copy" />
+            <MenuItem mnemonicParsing="false" text="Paste" />
+            <MenuItem mnemonicParsing="false" text="Delete" />
+            <SeparatorMenuItem mnemonicParsing="false" />
+            <MenuItem mnemonicParsing="false" text="Select All" />
+            <MenuItem mnemonicParsing="false" text="Unselect All" />
+          </items>
+        </Menu>
+        <Menu mnemonicParsing="false" text="Help">
+          <items>
+            <MenuItem mnemonicParsing="false" text="About MyHelloApp" />
+          </items>
+        </Menu>
+      </menus>
+    </MenuBar>
+    <AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
+         <children>
+            <SplitPane dividerPositions="0.15" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+              <items>
+                <AnchorPane SplitPane.resizableWithParent="false">
+                     <children>
+                        <SplitPane dividerPositions="0.5" orientation="VERTICAL" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                          <items>
+                            <AnchorPane>
+                                 <children>
+                                    <ListView fx:id="toolbox" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
+                                 </children>
+                              </AnchorPane>
+                            <AnchorPane>
+                                 <children>
+                                    <ScrollPane fx:id="metricScrollPane" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
+                                    <Button fx:id="createNode" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="120.0" text="Knoten hinzufügen" textAlignment="JUSTIFY" AnchorPane.bottomAnchor="45.0" AnchorPane.rightAnchor="0" />
+                                    <Button fx:id="createEdge" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="120.0" text="Kante hinzufügen" textAlignment="JUSTIFY" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="0" />
+                                 </children>
+                              </AnchorPane>
+                          </items>
+                        </SplitPane>
+                     </children>
+                  </AnchorPane>
+                <AnchorPane SplitPane.resizableWithParent="false">
+                     <children>
+                        <SplitPane dividerPositions="0.8" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                          <items>
+                            <AnchorPane SplitPane.resizableWithParent="false">
+                                 <children>
+                                    <Pane fx:id="pane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                                       <children>
+                                          <SwingNode fx:id="swingNode" />
+                                       </children></Pane>
+                                    <Button fx:id="zoomOut" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="30.0" text="-" textAlignment="JUSTIFY" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0" />
+                                    <Button fx:id="zoomIn" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="30.0" text="+" textAlignment="JUSTIFY" AnchorPane.bottomAnchor="45.0" AnchorPane.rightAnchor="10.0" />
+                                 </children>
+                              </AnchorPane>
+                            <AnchorPane SplitPane.resizableWithParent="false">
+                                 <children>
+                                    <SplitPane dividerPositions="0.5" orientation="VERTICAL" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
+                                      <items>
+                                        <AnchorPane>
+                                             <children>
+                                                <ScrollPane fx:id="layerScrollPane" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
+                                             </children>
+                                          </AnchorPane>
+                                        <AnchorPane>
+                                             <children>
+                                                <ListView fx:id="properties" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
+                                             </children>
+                                          </AnchorPane>
+                                      </items>
+                                    </SplitPane>
+                                 </children>
+                              </AnchorPane>
+                          </items>
+                        </SplitPane>
+                     </children>
+                  </AnchorPane>
+              </items>
+            </SplitPane>
+         </children>
+    </AnchorPane>
+  </children>
+</VBox>