Procházet zdrojové kódy

Added Visualizer, method for getting the view

Visualizer added
	Interface between Graph and GUI
	get<View Method that creates a View (JPanel)
	from a given Graph
	added javadoc
	used checkstyle
Jascha Bohne před 8 roky
rodič
revize
76b695d40c

+ 25 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/Visualizer.java

@@ -0,0 +1,25 @@
+package de.tu_darmstadt.informatik.tk.scopviz;
+
+import org.graphstream.graph.*;
+import org.graphstream.ui.view.*;
+
+/**
+ * Interface between GUI and internal Graph representation.
+ * @version 1.0.0.0
+ * @author jascha-b
+ *
+ */
+public class Visualizer {
+  
+  /**
+   * 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 View getView (final Graph g){
+    Viewer viewer = new Viewer(g, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
+    View view = viewer.addDefaultView(false);
+    return view;
+  }
+}