GUIComponents now have names
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIdemux2.java
index 6d9057f..1198dde 100644 (file)
@@ -2,17 +2,23 @@ package net.mograsim.logic.ui.model.components.mi.nandbased;
 
 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
 import net.mograsim.logic.ui.model.ViewModelModifiable;
-import net.mograsim.logic.ui.model.components.GUINandGate;
-import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
+import net.mograsim.logic.ui.model.components.atomic.GUINandGate;
+import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent;
 import net.mograsim.logic.ui.model.wires.GUIWire;
 import net.mograsim.logic.ui.model.wires.Pin;
 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
+import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
 
 public class GUIdemux2 extends SimpleRectangularSubmodelComponent
 {
        public GUIdemux2(ViewModelModifiable model)
        {
-               super(model, 1, "GUIdemux2");
+               this(model, null);
+       }
+
+       public GUIdemux2(ViewModelModifiable model, String name)
+       {
+               super(model, 1, "GUIdemux2", name);
                setSubmodelScale(.4);
                setInputPins("S0", "S1");
                setOutputPins("Y00", "Y01", "Y10", "Y11");
@@ -85,4 +91,9 @@ public class GUIdemux2 extends SimpleRectangularSubmodelComponent
                new GUIWire(submodelModifiable, andY10.getPin("Y"), Y10);
                new GUIWire(submodelModifiable, andY11.getPin("Y"), Y11);
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIdemux2.class.getCanonicalName(), (m, p, n) -> new GUIdemux2(m, n));
+       }
 }
\ No newline at end of file