Просмотр исходного кода

Fixed A LOT. Refactored MainApp into several Classes.

MERGE CONFLICTS INCOMING, REBASE SUGGESTED!
Jan Enders 8 лет назад
Родитель
Сommit
b15227a086

+ 56 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java

@@ -0,0 +1,56 @@
+package de.tu_darmstadt.informatik.tk.scopviz.main;
+
+import java.util.Random;
+
+import org.graphstream.graph.Graph;
+
+import de.tu_darmstadt.informatik.tk.scopviz.io.GraphMLImporter;
+import de.tu_darmstadt.informatik.tk.scopviz.ui.Visualizer;
+
+public class Main {
+
+	private static Main instance;
+
+	private Graph graph;
+	private Visualizer visualizer;
+	
+	private Modus modus = Modus.NORMAL;
+	
+	private Main() {
+		GraphMLImporter importer = new GraphMLImporter();
+		graph = importer.readGraph(Main.class.getResource("/Example.graphml"));
+		visualizer = new Visualizer (graph);
+	}
+
+	public static Main getInstance() {
+		if (instance == null) {
+			initialize();
+		}
+		return instance;
+	}
+
+	private static void initialize() {
+		instance = new Main();	
+		
+		//TODO: initialize EVERYTHING!
+	}
+	
+	public Visualizer getVisualizer(){
+		return visualizer;
+	}
+	
+	public Modus getModus(){
+		return modus;
+	}
+	
+	public void setModus(Modus newMod){
+		modus = newMod;
+	}
+	
+	public String getUnusedID() {
+		// TODO gescheite implementierung
+		Random rand = new Random();
+		return rand.nextInt() + "";
+	}
+
+}

+ 11 - 217
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainApp.java

@@ -1,49 +1,26 @@
 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;
+import javafx.stage.WindowEvent;
 
 /**
  * Main Class, initializes Graph, displays UI.
  * 
  * @author Jan Enders (jan.enders@stud.tu-darmstadt.de)
- * @version 1.0
+ * @version 1.2
  *
  */
 public class MainApp extends Application {
 
+	private Main main;
+
 	/**
 	 * Primary Stage for the UI Scene.
 	 */
@@ -52,27 +29,8 @@ public class MainApp extends Application {
 	 * Root Object of the Scene Graph.
 	 */
 	private VBox rootLayout;
-	/**
-	 * Graph (Network or Operator Graph) to display.
-	 */
-	private Graph graph;
-	/**
-	 * Preferred size for the Graph Viewer.
-	 */
-	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;
+	public static ViewPanel view;
 
 	/**
 	 * Main Method, launches the Application.
@@ -90,9 +48,7 @@ public class MainApp extends Application {
 	 */
 	@Override
 	public void init() {
-		GraphMLImporter importer = new GraphMLImporter();
-		graph = importer.readGraph(MainApp.class.getResource("/Example.graphml"));
-		visualizer =  new Visualizer(graph);
+		main = Main.getInstance();
 	}
 
 	/**
@@ -121,181 +77,19 @@ public class MainApp extends Application {
 			e.printStackTrace();
 		}
 
-		// Show the scene containing the root layout.
-		Scene scene = new Scene(rootLayout);
-
-		SwingNode swingNode = guiController.swingNode;
-		Pane pane = guiController.pane;
-		Button createNodeButton = guiController.createNode;
-		Button createEdgeButton = guiController.createEdge;
-		
-		
-		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>() {
-
+		primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
 			@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;
-
-					}
-				}
+			public void handle(WindowEvent event) {
+				System.exit(0);
 			}
-
 		});
 		
-		
+		// Show the scene containing the root layout.
+		Scene scene = new Scene(rootLayout);		
 		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;
-	}
-	
-	
-
 }

+ 5 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Modus.java

@@ -0,0 +1,5 @@
+package de.tu_darmstadt.informatik.tk.scopviz.main;
+
+public enum Modus {
+	NORMAL, CREATE_NODE, CREATE_EDGE, FIRST_NODE_SELECTED
+}

+ 142 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -0,0 +1,142 @@
+package de.tu_darmstadt.informatik.tk.scopviz.ui;
+
+import java.util.Iterator;
+
+import org.graphstream.graph.Graph;
+import org.graphstream.graph.Node;
+import org.graphstream.ui.geom.Vector3;
+import org.graphstream.ui.swingViewer.util.GraphMetrics;
+
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
+import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
+import de.tu_darmstadt.informatik.tk.scopviz.main.Modus;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.scene.input.MouseEvent;
+
+public class ButtonManager {
+
+	private static GUIController guiController;
+
+	public static void initialize(GUIController guiCon) {
+		guiController = guiCon;
+	}
+
+	public static EventHandler<ActionEvent> createNodeHandler = new EventHandler<ActionEvent>() {
+		@Override
+		public void handle(ActionEvent arg0) {
+			switch (Main.getInstance().getModus()) {
+			case CREATE_NODE:
+				Main.getInstance().setModus(Modus.NORMAL);
+				Debug.out("Modus set to Normal");
+				guiController.createNode.setText("Knoten hinzufügen");
+				break;
+			case NORMAL:
+				Main.getInstance().setModus(Modus.CREATE_NODE);
+				Debug.out("Modus set to Create Node");
+				guiController.createNode.setText("Ende");
+				break;
+			default:
+				Main.getInstance().setModus(Modus.CREATE_NODE);
+				Debug.out("Modus set to Create Node");
+				guiController.createNode.setText("Ende");
+				guiController.createEdge.setText("Kante hinzufügen");
+				Main.getInstance().getVisualizer().deselect();
+				break;
+			}
+		}
+	};
+
+	public static EventHandler<ActionEvent> createEdgeHandler = new EventHandler<ActionEvent>() {
+		@Override
+		public void handle(ActionEvent arg0) {
+			Main.getInstance().getVisualizer().deselect();
+			switch (Main.getInstance().getModus()) {
+			case CREATE_EDGE:
+			case FIRST_NODE_SELECTED:
+				Main.getInstance().setModus(Modus.NORMAL);
+				Debug.out("Modus set to Normal");
+				guiController.createEdge.setText("Kante hinzufügen");
+				break;
+			case NORMAL:
+				Main.getInstance().setModus(Modus.CREATE_EDGE);
+				Debug.out("Modus set to Create Edge");
+				guiController.createEdge.setText("Ende");
+				break;
+			default:
+				Main.getInstance().setModus(Modus.CREATE_EDGE);
+				Debug.out("Modus set to Create Edge");
+				guiController.createEdge.setText("Ende");
+				guiController.createNode.setText("Knoten hinzufügen");
+				break;
+			}
+		}
+	};
+
+	public static EventHandler<MouseEvent> clickedHandler = new EventHandler<MouseEvent>() {
+
+		// TODO: make this not terrible
+		@Override
+		public void handle(MouseEvent event) {
+			Visualizer visualizer = Main.getInstance().getVisualizer();
+			Modus currentMod = Main.getInstance().getModus();
+			Graph graph = visualizer.getGraph();
+			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 (currentMod == Modus.CREATE_NODE) {
+				Node n = graph.addNode(Main.getInstance().getUnusedID());
+				GraphMetrics gm = visualizer.getView().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 (currentMod == Modus.CREATE_EDGE || currentMod == Modus.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 (currentMod) {
+				case CREATE_EDGE:
+					visualizer.setSelectedNodeID(id);
+					Main.getInstance().setModus(Modus.FIRST_NODE_SELECTED);
+					break;
+				case FIRST_NODE_SELECTED:
+					if (!id.matches(visualizer.getSelectedNodeID())) {
+						graph.addEdge(Main.getInstance().getUnusedID(), visualizer.getSelectedNodeID(), id);
+						Debug.out("Created a edge between " + visualizer.getSelectedNodeID() + " and " + id);
+					}
+					visualizer.deselect();
+					Main.getInstance().setModus(Modus.CREATE_EDGE);
+					break;
+				default:
+					break;
+
+				}
+			}
+		}
+
+	};
+}

+ 75 - 60
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -3,91 +3,106 @@ 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 javax.swing.JPanel;
+
+import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
+import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.ResizeListener;
 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;
+
+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'.";
+
+		ToolboxManager.initialize(toolbox);
+
+		PropertiesManager.initialize(properties);
+
+		ButtonManager.initialize(this);
+
+		initializeZoomButtons();
+		initializeCreateButtons();
 		
-		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();
-		                }
-		            }
-		        );
+		initializeDisplayPane();
+
+	}
+
+	private void initializeZoomButtons() {
+		zoomIn.setOnAction(new EventHandler<ActionEvent>() {
+			public void handle(ActionEvent evt) {
+				Main.getInstance().getVisualizer().zoomIn();
+			}
+		});
+
+		zoomOut.setOnAction(new EventHandler<ActionEvent>() {
+			public void handle(ActionEvent evt) {
+				Main.getInstance().getVisualizer().zoomOut();
+			}
+		});
 	}
-	
-	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));
-	            }
-            }
-        }
-    }
 
+	private void initializeCreateButtons() {
+		createNode.setOnAction(ButtonManager.createNodeHandler);
+		createEdge.setOnAction(ButtonManager.createEdgeHandler);
+		swingNode.setOnMouseClicked(ButtonManager.clickedHandler);
+	}
+
+	private void initializeDisplayPane(){
+		pane.heightProperty().addListener(new ResizeListener(swingNode, pane));
+		pane.widthProperty().addListener(new ResizeListener(swingNode, pane));
+		swingNode.setContent((JPanel) Main.getInstance().getVisualizer().getView());
+		pane.setMinSize(200, 200);
+	}
 }

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

@@ -0,0 +1,40 @@
+package de.tu_darmstadt.informatik.tk.scopviz.ui;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TextField;
+import javafx.util.Callback;
+
+public class PropertiesManager {
+
+	public static void initialize(ListView<String> properties){
+	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 PropertiesManager.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));
+	            }
+            }
+        }
+    }
+}

+ 13 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java

@@ -0,0 +1,13 @@
+package de.tu_darmstadt.informatik.tk.scopviz.ui;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.ListView;
+
+public class ToolboxManager {
+	public static void initialize(ListView<String> toolbox){
+
+		ObservableList<String> dataToolbox = FXCollections.observableArrayList("toolbox");
+		toolbox.setItems(dataToolbox);
+	}
+}

+ 15 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/Visualizer.java

@@ -10,7 +10,7 @@ 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;
+import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.MyViewerListener;
 
 /**
  * Interface between GUI and internal Graph representation.
@@ -173,9 +173,23 @@ public class Visualizer {
 	}
 
 
+	public void deselect(){
+		this.selectedNodeID = null;
+		this.selectedEdgeID = null;
+	}
 
 
 	public Graph getGraph() {
 		return g;
 	}
+	
+	public void zoomIn(){
+		view.getCamera().setViewPercent(view.getCamera().getViewPercent()*0.95);
+	}
+	
+	public void zoomOut(){
+		view.getCamera().setViewPercent(view.getCamera().getViewPercent()*1.05);
+	}
+	
+	
 }

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MyViewerListener.java → scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/MyViewerListener.java

@@ -1,4 +1,4 @@
-package de.tu_darmstadt.informatik.tk.scopviz.main;
+package de.tu_darmstadt.informatik.tk.scopviz.ui.handlers;
 
 import org.graphstream.ui.view.ViewerListener;
 

+ 27 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/ResizeListener.java

@@ -0,0 +1,27 @@
+package de.tu_darmstadt.informatik.tk.scopviz.ui.handlers;
+
+import java.awt.Dimension;
+
+import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.embed.swing.SwingNode;
+import javafx.scene.layout.Pane;
+
+public class ResizeListener implements ChangeListener<Number>{
+
+	private SwingNode swingNode;
+	private Pane pane;
+	
+	public ResizeListener(SwingNode swingNode, Pane pane){
+		this.swingNode = swingNode;
+		this.pane = pane;
+	}
+	
+	@Override
+		public void changed(ObservableValue<? extends Number> arg0, Number arg1, Number arg2) {
+			Main.getInstance().getVisualizer().getView().setPreferredSize(new Dimension((int) pane.getWidth() - 5, (int) pane.getHeight() - 5));
+			swingNode.setContent(Main.getInstance().getVisualizer().getView());
+		}
+
+}