Renamed logic.ui to logic.model
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / examples / ClickableSubmodelComponentsTest.java
diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/examples/ClickableSubmodelComponentsTest.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/examples/ClickableSubmodelComponentsTest.java
new file mode 100644 (file)
index 0000000..4ac98e3
--- /dev/null
@@ -0,0 +1,38 @@
+package net.mograsim.logic.model.examples;
+
+import net.mograsim.logic.model.SimpleLogicUIStandalone;
+import net.mograsim.logic.model.model.ViewModelModifiable;
+import net.mograsim.logic.model.model.components.atomic.GUIBitDisplay;
+import net.mograsim.logic.model.model.components.atomic.GUIManualSwitch;
+import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent;
+import net.mograsim.logic.model.model.wires.GUIWire;
+
+public class ClickableSubmodelComponentsTest
+{
+       public static void main(String[] args)
+       {
+               SimpleLogicUIStandalone.executeVisualisation(ClickableSubmodelComponentsTest::createExample);
+       }
+
+       public static void createExample(ViewModelModifiable model)
+       {
+               @SuppressWarnings("unused") // GUIWire
+               SimpleRectangularSubmodelComponent comp = new SimpleRectangularSubmodelComponent(model, 1, "")
+               {
+                       {
+                               setSubmodelScale(.4);
+                               setOutputPins("O0");
+
+                               GUIManualSwitch sw = new GUIManualSwitch(submodelModifiable);
+                               GUIBitDisplay bd = new GUIBitDisplay(submodelModifiable);
+
+                               sw.moveTo(10, 5);
+                               bd.moveTo(50, 5);
+
+                               new GUIWire(submodelModifiable, sw.getOutputPin(), bd.getInputPin());
+
+                       }
+               };
+               comp.moveTo(10, 10);
+       }
+}
\ No newline at end of file