Added comments for LogicUI
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 16 May 2019 11:53:54 +0000 (13:53 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 16 May 2019 11:53:54 +0000 (13:53 +0200)
LogicUI/src/era/mi/gui/LogicUI.java

index 8cbb46c..f2fc5ce 100644 (file)
@@ -22,6 +22,11 @@ import net.haspamelodica.swt.helper.zoomablecanvas.ZoomableCanvas;
 import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasOverlay;\r
 import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput;\r
 \r
+/**\r
+ * Standalone simulation visualizer.\r
+ * \r
+ * @author Daniel Kirschten\r
+ */\r
 public class LogicUI\r
 {\r
        private final Display                                           display;\r
@@ -52,7 +57,10 @@ public class LogicUI
                canvas.addListener(SWT.MouseDown, this::mouseDown);\r
        }\r
        /**\r
+        * Add a component to be drawn.\r
         * Returns the given component for convenience.\r
+        * \r
+        * @author Daniel Kirschten\r
         */\r
        public <C extends BasicGUIComponent> C addComponent(C component, double x, double y)\r
        {\r
@@ -60,6 +68,12 @@ public class LogicUI
                componentPositions.put(component, new Point(x, y));\r
                return component;\r
        }\r
+       /**\r
+        * Add a graphical wire between the given connection points of the given components.\r
+        * The given components have to be added and the given connection points have to be connected logically first.\r
+        * \r
+        * @author Daniel Kirschten\r
+        */\r
        public void addWire(BasicGUIComponent component1, int component1ConnectionIndex, BasicGUIComponent component2, int component2ConnectionIndex, Point... path)\r
        {\r
                wires.add(new GUIWire(canvas::redrawThreadsafe, component1, component1ConnectionIndex, componentPositions.get(component1), component2, component2ConnectionIndex, componentPositions.get(component2), path));\r
@@ -69,12 +83,6 @@ public class LogicUI
                TranslatedGC tgc = new TranslatedGC(gc, componentPositions.get(component));\r
                component.render(tgc);\r
                tgc.setBackground(display.getSystemColor(SWT.COLOR_BLUE));\r
-//             for(int i = 0; i < component.getConnectedWireArraysCount(); i ++)\r
-//             {\r
-//                     Point connectionPoint = component.getWireArrayConnectionPoint(i);\r
-//                     if(connectionPoint != null)\r
-//                             tgc.fillOval(connectionPoint.x - 1, connectionPoint.y - 1, 2, 2);\r
-//             }\r
        }\r
        private void mouseDown(Event e)\r
        {\r
@@ -91,6 +99,10 @@ public class LogicUI
                }\r
        }\r
 \r
+       /**\r
+        * Start the simulation timeline, and open the UI shell.\r
+        * Returns when the shell is closed.\r
+        */\r
        public void run()\r
        {\r
                AtomicBoolean running = new AtomicBoolean(true);\r