Browse Source

Documented all new Code, updated documentation of older code.

Jan 7 years ago
parent
commit
7c43caeab1

+ 22 - 26
scopviz/.classpath

@@ -1,26 +1,22 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java">
-		<attributes>
-			<attribute name="optional" value="true"/>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
-		<attributes>
-			<attribute name="optional" value="true"/>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
-		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
-		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

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

@@ -1,18 +1,29 @@
 package de.tu_darmstadt.informatik.tk.scopviz.debug;
 
+/**
+ * Debug class to allow easy, static access to console output.
+ * 
+ * @author Matthias Wilhelm
+ * @version 1.0
+ *
+ */
 public class Debug {
-	
+
 	/**
-	 * System.out.println(s); in kurz
-	 * @param s Wird in der Konsole ausgegeben
+	 * Short form for System.out.println().
+	 * 
+	 * @param s
+	 *            String to be printed on the console
 	 */
 	public static void out(String s) {
 		System.out.println(s);
 	}
-	
+
 	/**
-	 * System.out.println(s); in kurz
-	 * @param s Wird in der Konsole ausgegeben
+	 * Short form for System.out.println().
+	 * 
+	 * @param s
+	 *            Integer to be printed on the console
 	 */
 	public static void out(int s) {
 		System.out.println(s);

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

@@ -6,11 +6,14 @@ import org.graphstream.graph.Graph;
 import org.graphstream.stream.file.FileSinkGraphML;
 
 /**
+ * Exporter to write a given Graph object to a GraphML file on disk.
+ * 
+ * @author Jascha Bohne
  * @version 1.0
- * @author jascha-b
  * 
  */
 public class GraphMLExporter {
+
 	/**
 	 * Exports the current state of the Graph to a GraphML file.
 	 * 

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

@@ -9,9 +9,11 @@ import org.graphstream.stream.file.FileSource;
 import org.graphstream.stream.file.FileSourceGraphML;
 
 /**
- * @version 1.1
+ * Importer to import a graph from a GraphML file and return it as a Graph
+ * object.
+ * 
  * @author jascha-b
- *
+ * @version 1.1
  */
 public class GraphMLImporter {
 

+ 0 - 8
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/package-info.java

@@ -1,8 +0,0 @@
-/**
- * 
- */
-/**
- * @author jascha-b
- *
- */
-package de.tu_darmstadt.informatik.tk.scopviz.io;

+ 71 - 14
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java

@@ -7,21 +7,56 @@ 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 {
+/**
+ * Main Class to contain all core functionality. Built as a Singleton, use
+ * getInstance() to get access to the functionality
+ * 
+ * @author Jan Enders (jan.enders@stud.tu-darmstadt.de)
+ * @version 1.0
+ *
+ */
+public final class Main {
 
+	/**
+	 * Singular instance of the Class, facilitates Singleton pattern.
+	 */
 	private static Main instance;
 
+	/**
+	 * The Graph currently used by the Application. Only a reference, the actual
+	 * graph management is done by the visualizer.
+	 */
 	private Graph graph;
+
+	/**
+	 * The Visualizer that manages the Graph instance and provides the View to
+	 * access the Graph.
+	 */
 	private Visualizer visualizer;
-	
+
+	/**
+	 * Current mode of the application for things like creating new Nodes and
+	 * Edges.
+	 */
 	private Modus modus = Modus.NORMAL;
-	
+
+	/**
+	 * Private constructor to prevent initialization, facilitates Singleton
+	 * pattern. Loads a Graph from a GraphML file and creates a visualizer to
+	 * manage it
+	 */
 	private Main() {
 		GraphMLImporter importer = new GraphMLImporter();
 		graph = importer.readGraph(Main.class.getResource("/Example.graphml"));
-		visualizer = new Visualizer (graph);
+		visualizer = new Visualizer(graph);
 	}
 
+	/**
+	 * Returns the singular instance of the Class, grants access to the
+	 * Singleton. Initializes the instance when called for the first time.
+	 * 
+	 * @return the singular instance of the class
+	 */
 	public static Main getInstance() {
 		if (instance == null) {
 			initialize();
@@ -29,24 +64,46 @@ public class Main {
 		return instance;
 	}
 
+	/**
+	 * Initializes the singular instance.
+	 */
 	private static void initialize() {
-		instance = new Main();	
-		
-		//TODO: initialize EVERYTHING!
+		instance = new Main();
 	}
-	
-	public Visualizer getVisualizer(){
+
+	/**
+	 * Returns a reference to the visualizer object used by the app.
+	 * 
+	 * @return the visualizer in use
+	 */
+	public Visualizer getVisualizer() {
 		return visualizer;
 	}
-	
-	public Modus getModus(){
+
+	/**
+	 * Returns the current mode of the app.
+	 * 
+	 * @return the current mode
+	 */
+	public Modus getModus() {
 		return modus;
 	}
-	
-	public void setModus(Modus newMod){
+
+	/**
+	 * Sets the mode of the app.
+	 * 
+	 * @param newMod
+	 *            the new Mode to set
+	 */
+	public void setModus(Modus newMod) {
 		modus = newMod;
 	}
-	
+
+	/**
+	 * Returns a unique id for a new node not yet used by the graph.
+	 * 
+	 * @return a new unused id as a String
+	 */
 	public String getUnusedID() {
 		// TODO gescheite implementierung
 		Random rand = new Random();

+ 8 - 13
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainApp.java

@@ -1,7 +1,6 @@
 package de.tu_darmstadt.informatik.tk.scopviz.main;
 
 import java.io.IOException;
-import org.graphstream.ui.swingViewer.ViewPanel;
 import javafx.application.Application;
 import javafx.event.EventHandler;
 import javafx.fxml.FXMLLoader;
@@ -11,7 +10,7 @@ import javafx.stage.Stage;
 import javafx.stage.WindowEvent;
 
 /**
- * Main Class, initializes Graph, displays UI.
+ * Main UI Class, loads GUI from FXML file and initializes all UI Elements.
  * 
  * @author Jan Enders (jan.enders@stud.tu-darmstadt.de)
  * @version 1.2
@@ -19,8 +18,6 @@ import javafx.stage.WindowEvent;
  */
 public class MainApp extends Application {
 
-	private Main main;
-
 	/**
 	 * Primary Stage for the UI Scene.
 	 */
@@ -30,8 +27,6 @@ public class MainApp extends Application {
 	 */
 	private VBox rootLayout;
 
-	public static ViewPanel view;
-
 	/**
 	 * Main Method, launches the Application.
 	 * 
@@ -44,11 +39,11 @@ public class MainApp extends Application {
 	}
 
 	/**
-	 * Initializes the Graph by importing it from a GraphML file.
+	 * Initializes the Main Class by invoking getInstance() for the first time.
 	 */
 	@Override
 	public void init() {
-		main = Main.getInstance();
+		Main.getInstance();
 	}
 
 	/**
@@ -57,13 +52,12 @@ public class MainApp extends Application {
 	@Override
 	public void start(final Stage stage) {
 		this.primaryStage = stage;
-
 		initRootLayout();
-
 	}
 
 	/**
-	 * initializes the UI Layout by loading it from a FXML file.
+	 * Initializes the UI Layout by loading it from a FXML file.
+	 * Implicitly calls GUIController.initialize through the FXML loading process.
 	 */
 	public void initRootLayout() {
 
@@ -77,15 +71,16 @@ public class MainApp extends Application {
 			e.printStackTrace();
 		}
 
+		// Make the full program exit on clicking the close button
 		primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
 			@Override
 			public void handle(WindowEvent event) {
 				System.exit(0);
 			}
 		});
-		
+
 		// Show the scene containing the root layout.
-		Scene scene = new Scene(rootLayout);		
+		Scene scene = new Scene(rootLayout);
 		primaryStage.setMinHeight(400);
 		primaryStage.setMinWidth(640);
 		primaryStage.setScene(scene);

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

@@ -1,5 +1,13 @@
 package de.tu_darmstadt.informatik.tk.scopviz.main;
 
+/**
+ * Enum describing the various modes the program can be in for creating new
+ * nodes, edges etc.
+ * 
+ * @author Matthias Wilhelm
+ * @version 1.0
+ *
+ */
 public enum Modus {
 	NORMAL, CREATE_NODE, CREATE_EDGE, FIRST_NODE_SELECTED
 }

+ 58 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -14,28 +14,60 @@ import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import javafx.scene.input.MouseEvent;
 
+/**
+ * Manager to contain the various handlers for the buttons of the UI.
+ * 
+ * @author Jan Enders (jan.enders@stud.tu-darmstadt.de)
+ * @version 1.0
+ *
+ */
 public class ButtonManager {
 
+	/**
+	 * Reference to the GUIController used by the app for access to UI Elements.
+	 */
 	private static GUIController guiController;
 
+	/**
+	 * Initializes the ButtonManager by getting access to the GUIController.
+	 * 
+	 * @param guiCon
+	 *            a reference to the GUIController used by the App
+	 */
 	public static void initialize(GUIController guiCon) {
 		guiController = guiCon;
 	}
 
+	/**
+	 * Handler for the "Create Node" button.
+	 */
 	public static EventHandler<ActionEvent> createNodeHandler = new EventHandler<ActionEvent>() {
+
+		/**
+		 * Handle method gets called when the button is pressed.
+		 * 
+		 * @param arg0
+		 *            the event that occurred to the button
+		 */
 		@Override
 		public void handle(ActionEvent arg0) {
 			switch (Main.getInstance().getModus()) {
+			// end create node mode when the button is clicked while in create
+			// node mode
 			case CREATE_NODE:
 				Main.getInstance().setModus(Modus.NORMAL);
 				Debug.out("Modus set to Normal");
 				guiController.createNode.setText("Knoten hinzufügen");
 				break;
+			// enter create node mode when the button is clicked while in normal
+			// mode
 			case NORMAL:
 				Main.getInstance().setModus(Modus.CREATE_NODE);
 				Debug.out("Modus set to Create Node");
 				guiController.createNode.setText("Ende");
 				break;
+			// enter create node mode when button is clicked in any other
+			// situation
 			default:
 				Main.getInstance().setModus(Modus.CREATE_NODE);
 				Debug.out("Modus set to Create Node");
@@ -47,22 +79,38 @@ public class ButtonManager {
 		}
 	};
 
+	/**
+	 * Handler for the "Create Edge" button.
+	 */
 	public static EventHandler<ActionEvent> createEdgeHandler = new EventHandler<ActionEvent>() {
+
+		/**
+		 * Handle method gets called when the button is pressed.
+		 * 
+		 * @param arg0
+		 *            the event that occurred to the button
+		 */
 		@Override
 		public void handle(ActionEvent arg0) {
+			// Deselect any previously selected nodes or edges
 			Main.getInstance().getVisualizer().deselect();
 			switch (Main.getInstance().getModus()) {
+			// end create edge mode when the button is clicked in create edge
+			// mode
 			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;
+			// enter create edge mode when button is clicked in normal mode
 			case NORMAL:
 				Main.getInstance().setModus(Modus.CREATE_EDGE);
 				Debug.out("Modus set to Create Edge");
 				guiController.createEdge.setText("Ende");
 				break;
+			// enter create edge mode when button is clicked in any other
+			// situation
 			default:
 				Main.getInstance().setModus(Modus.CREATE_EDGE);
 				Debug.out("Modus set to Create Edge");
@@ -73,9 +121,19 @@ public class ButtonManager {
 		}
 	};
 
+	/**
+	 * Handler for clicks on the graph viewer.
+	 */
 	public static EventHandler<MouseEvent> clickedHandler = new EventHandler<MouseEvent>() {
 
 		// TODO: make this not terrible
+		/**
+		 * Handle method gets called whenever a click is registered within the
+		 * graph viewer
+		 * 
+		 * @param event
+		 *            the click event that occurred to the graph viewer
+		 */
 		@Override
 		public void handle(MouseEvent event) {
 			Visualizer visualizer = Main.getInstance().getVisualizer();
@@ -137,6 +195,5 @@ public class ButtonManager {
 				}
 			}
 		}
-
 	};
 }

+ 32 - 8
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -17,13 +17,24 @@ import javafx.scene.control.ListView;
 import javafx.scene.control.ScrollPane;
 import javafx.scene.layout.Pane;
 
+/**
+ * Controller class for the various GUI elements, gets instanced and initialized
+ * by the FXML loading process. Can access GUI elements specified in the FXML
+ * file through matching variable name here and id attribute in the FXML,
+ * 
+ * @author Dominik Renkel, Jan Enders
+ * @version 1.1
+ *
+ */
 public class GUIController implements Initializable {
 
+	// The SwingNode and its containing Pane that house the graph viewer
 	@FXML
 	public SwingNode swingNode;
 	@FXML
 	public Pane pane;
 
+	// The Button present in the UI
 	@FXML
 	public Button zoomIn;
 	@FXML
@@ -33,6 +44,8 @@ public class GUIController implements Initializable {
 	@FXML
 	public Button createEdge;
 
+	// The ScrollPanes surrounding the graph viewer, containing most
+	// functionality
 	@FXML
 	public ScrollPane toolboxScrollPane;
 	@FXML
@@ -42,43 +55,48 @@ public class GUIController implements Initializable {
 	@FXML
 	public ScrollPane metricScrollPane;
 
+	// The contents of the corresponding ScrollPanes
 	@FXML
 	public ListView<String> toolbox;
 	@FXML
 	public ListView<String> properties;
 
+	/**
+	 * Initializes all the references to the UI elements specified in the FXML
+	 * file. Gets called during FXML loading. Asserts the correct injection of
+	 * all referenced UI elements and initializes them.
+	 */
 	@Override
 	public void initialize(URL arg0, ResourceBundle arg1) {
+		// Assert the correct injection of all references from FXML
 		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'.";
 
+		// Initialize the Managers for the various managers for UI elements
 		ToolboxManager.initialize(toolbox);
-
 		PropertiesManager.initialize(properties);
-
 		ButtonManager.initialize(this);
 
+		// Bind all the handlers to their corresponding UI elements
 		initializeZoomButtons();
 		initializeCreateButtons();
-		
 		initializeDisplayPane();
 
 	}
 
+	/**
+	 * Sets the handlers for the zoomin and zoomout buttons.
+	 */
 	private void initializeZoomButtons() {
 		zoomIn.setOnAction(new EventHandler<ActionEvent>() {
 			public void handle(ActionEvent evt) {
@@ -93,13 +111,19 @@ public class GUIController implements Initializable {
 		});
 	}
 
+	/**
+	 * Sets the Handlers for the create node and create edge buttons.
+	 */
 	private void initializeCreateButtons() {
 		createNode.setOnAction(ButtonManager.createNodeHandler);
 		createEdge.setOnAction(ButtonManager.createEdgeHandler);
 		swingNode.setOnMouseClicked(ButtonManager.clickedHandler);
 	}
 
-	private void initializeDisplayPane(){
+	/**
+	 * Sets the minimum size and adds the handlers to the graph display.
+	 */
+	private void initializeDisplayPane() {
 		pane.heightProperty().addListener(new ResizeListener(swingNode, pane));
 		pane.widthProperty().addListener(new ResizeListener(swingNode, pane));
 		swingNode.setContent((JPanel) Main.getInstance().getVisualizer().getView());

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

@@ -8,33 +8,55 @@ import javafx.scene.control.ListView;
 import javafx.scene.control.TextField;
 import javafx.util.Callback;
 
+/**
+ * Manager for the Properties pane and its contents.
+ * 
+ * @author Julian Ohl
+ * @version 1.0
+ *
+ */
 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();
-	                }
-	            }
-	        );
+	/**
+	 * Initializes the Manager by adding the List of properties to display into
+	 * the properties pane.
+	 * 
+	 * @param properties
+	 *            The list of properties to display
+	 */
+	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();
+			}
+		});
 	}
+
+	/**
+	 * Internal Class to represent a Cell containing a label. Needed for factory
+	 * pattern.
+	 * 
+	 * @author Julian Ohl
+	 * @version 1.0
+	 *
+	 */
 	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));
-	            }
-            }
-        }
-    }
+
+		@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));
+				}
+			}
+		}
+	}
 }

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

@@ -4,8 +4,22 @@ import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
 import javafx.scene.control.ListView;
 
+/**
+ * Manager for the Toolbox pane.
+ * 
+ * @author Dominik Renkel
+ * @version 0.9
+ *
+ */
 public class ToolboxManager {
-	public static void initialize(ListView<String> toolbox){
+
+	/**
+	 * Initializes the toolbox to contain the specified list of entries.
+	 * 
+	 * @param toolbox
+	 *            the list of entries to add to the toolbox
+	 */
+	public static void initialize(ListView<String> toolbox) {
 
 		ObservableList<String> dataToolbox = FXCollections.observableArrayList("toolbox");
 		toolbox.setItems(dataToolbox);

+ 122 - 88
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/Visualizer.java

@@ -13,31 +13,38 @@ import org.graphstream.ui.view.ViewerPipe;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.MyViewerListener;
 
 /**
- * Interface between GUI and internal Graph representation.
+ * Interface between GUI and internal Graph representation. Manages internal
+ * representation of the Graph to accommodate creation and deletion of nodes and
+ * edges.
  * 
+ * @author Jascha Bohne
  * @version 3.0.0.0
- * @author jascha-b
  *
  */
 public class Visualizer {
-	//The graph of this Visualizer
+	// The graph of this Visualizer
 	Graph g;
-	
-	//last deleted elements for undelete
+
+	// 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
+
+	// Currently selected Edge or Node at least on of these is always null
 	private String selectedNodeID = null;
-	//TODO figure out how to do this
+	// TODO figure out how to do this
 	private String selectedEdgeID = null;
-	
-	//View Panel of the Graph
+
+	// View Panel of the Graph
 	private ViewPanel view;
-	
-	
-	public Visualizer(Graph graph){
-		g=graph;
+
+	/**
+	 * Creates a new visualizer for the given graph.
+	 * 
+	 * @param graph
+	 *            the graph this visualizer should handle
+	 */
+	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);
@@ -46,93 +53,97 @@ public class Visualizer {
 		fromViewer.addSink(graph);
 	}
 
-	
-	
-	
 	/**
-	 * 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
+	 * 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 
+	 * @param g
+	 *            the Graph with the Node that shall be removed
+	 * @param id
+	 *            the ID of the node that will be removed
 	 */
-	public void deleteNode (final String id) {
+	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
+		// 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);
 	}
-	
+
 	/**
-	 * 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
+	 * 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 
+	 * @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) {
+	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
+	 * Deletes all Edges connected to the given Node. The referenced Graph is
+	 * modified directly. Will throw an ElementNotFoundException if the Node
+	 * is not Found
 	 * 
-	 * @param g the Graph containing the Node
-	 * @param id the Id of the Node, whose Edges shall be removed
+	 * @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); 
+	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 
+
+		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
+		}
+	}
+
+	// TODO make undelete 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
+	 * Undoes the last deleting operation on the given Graph. Deleting operations
+	 * are: deleteNode, deleteEdge and deleteEdgesOfNode. Only undoes 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()){
+	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){
+
+		for (Edge e : deletedEdges) {
 			attributes = new HashMap<String, Object>();
-			for (String s : e.getAttributeKeySet()){
+			for (String s : e.getAttributeKeySet()) {
 				attributes.put(s, e.getAttribute(s));
 			}
-			g.addEdge(e.getId(),(Node) e.getSourceNode(),(Node) e.getTargetNode());
+			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.
@@ -140,56 +151,79 @@ public class Visualizer {
 	 * 
 	 * @return a View of the Graph, inheriting from JPanel
 	 */
-	public ViewPanel getView (){
+	public ViewPanel getView() {
 		return view;
 	}
 
-
-
-
+	/**
+	 * Returns the ID of the currently selected Node.
+	 * 
+	 * @return the node's ID
+	 */
 	public String getSelectedNodeID() {
 		return selectedNodeID;
 	}
 
-
-
-
+	/**
+	 * Sets the ID for the currently selected node, effectively selecting the
+	 * node with that ID.
+	 * 
+	 * @param selectedNodeID
+	 *            the ID of the node to select
+	 */
 	public void setSelectedNodeID(String selectedNodeID) {
 		this.selectedNodeID = selectedNodeID;
 	}
 
-
-
-
+	/**
+	 * Returns the ID of the currently selected Edge.
+	 * 
+	 * @return the edge's ID
+	 */
 	public String getSelectedEdgeID() {
 		return selectedEdgeID;
 	}
 
-
-
-
+	/**
+	 * Sets the ID for the currently selected edge, effectively selecting the
+	 * edge with that ID.
+	 * 
+	 * @param selectedEdgeID
+	 *            the ID of the edge to select
+	 */
 	public void setSelectedEdgeID(String selectedEdgeID) {
 		this.selectedEdgeID = selectedEdgeID;
 	}
 
-
-	public void deselect(){
+	/**
+	 * Deselect any currently selected nodes or edges.
+	 */
+	public void deselect() {
 		this.selectedNodeID = null;
 		this.selectedEdgeID = null;
 	}
 
-
+	/**
+	 * Returns a reference to the Graph object managed by this visualizer.
+	 * 
+	 * @return the graph
+	 */
 	public Graph getGraph() {
 		return g;
 	}
-	
-	public void zoomIn(){
-		view.getCamera().setViewPercent(view.getCamera().getViewPercent()*0.95);
+
+	/**
+	 * Zooms in the view of the graph by 5 percent.
+	 */
+	public void zoomIn() {
+		view.getCamera().setViewPercent(view.getCamera().getViewPercent() * 0.95);
 	}
-	
-	public void zoomOut(){
-		view.getCamera().setViewPercent(view.getCamera().getViewPercent()*1.05);
+
+	/**
+	 * Zooms out the view of the graph by 5 percent.
+	 */
+	public void zoomOut() {
+		view.getCamera().setViewPercent(view.getCamera().getViewPercent() * 1.05);
 	}
-	
-	
+
 }

+ 33 - 3
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/MyViewerListener.java

@@ -4,27 +4,57 @@ import org.graphstream.ui.view.ViewerListener;
 
 import de.tu_darmstadt.informatik.tk.scopviz.ui.Visualizer;
 
+/**
+ * Listener to react to changes in the graph viewer.
+ * 
+ * @author Jascha Bohne
+ * @version 1.0
+ *
+ */
 public class MyViewerListener implements ViewerListener {
+
+	/**
+	 * Reference to the visualizer for easier access.
+	 */
 	private Visualizer v;
+
+	/**
+	 * Creates a new MyViewerListener object.
+	 * 
+	 * @param viz
+	 *            the visualizer that manages the view this listener listens to
+	 */
 	public MyViewerListener(Visualizer viz) {
-		v=viz;
+		v = viz;
 	}
 
+	/**
+	 * Gets called whenever one of the nodes within the viewer is clicked.
+	 * 
+	 * @param id
+	 *            the id of the Node that was clicked
+	 */
 	@Override
 	public void buttonPushed(String id) {
 		v.setSelectedNodeID(id);
 	}
 
+	/**
+	 * Gets called whenever the click on the node is released.
+	 */
 	@Override
 	public void buttonReleased(String id) {
 		// TODO Auto-generated method stub
-		
+
 	}
 
+	/**
+	 * Gets called whenever the view is closed.
+	 */
 	@Override
 	public void viewClosed(String viewName) {
 		// TODO Auto-generated method stub
-		
+
 	}
 
 }

+ 34 - 10
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/handlers/ResizeListener.java

@@ -8,20 +8,44 @@ import javafx.beans.value.ObservableValue;
 import javafx.embed.swing.SwingNode;
 import javafx.scene.layout.Pane;
 
-public class ResizeListener implements ChangeListener<Number>{
+/**
+ * The Listener to resize the graph view manually whenever its parent pane is
+ * resized.
+ * 
+ * @author Jan Enders (jan.enders@stud.tu-darmstadt.de)
+ * @version 1.0
+ *
+ */
+public class ResizeListener implements ChangeListener<Number> {
 
+	/**
+	 * The SwingNode containing the graph view.
+	 */
 	private SwingNode swingNode;
+	/**
+	 * The parent Pane of the swingnode.
+	 */
 	private Pane pane;
-	
-	public ResizeListener(SwingNode swingNode, Pane pane){
-		this.swingNode = swingNode;
-		this.pane = pane;
+
+	/**
+	 * Creates a new ResizeListener for a swingNode and its parent Pane.
+	 * 
+	 * @param swingNode
+	 *            the SwingNode
+	 * @param pane
+	 *            the Pane
+	 */
+	public ResizeListener(SwingNode swingNod, Pane pan) {
+		this.swingNode = swingNod;
+		this.pane = pan;
 	}
-	
+
 	@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());
-		}
+	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());
+	}
 
 }