GUIComponents now have names
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIdemux2.java
index 5365e92..1198dde 100644 (file)
@@ -7,12 +7,18 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode
 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