GUIComponents now have names
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIdlatch.java
index 39b1f71..e0a6038 100644 (file)
@@ -7,6 +7,7 @@ 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 GUIdlatch extends SimpleRectangularSubmodelComponent
 {
@@ -14,7 +15,12 @@ public class GUIdlatch extends SimpleRectangularSubmodelComponent
 
        public GUIdlatch(ViewModelModifiable model)
        {
-               super(model, 1, "GUIdlatch");
+               this(model, null);
+       }
+
+       public GUIdlatch(ViewModelModifiable model, String name)
+       {
+               super(model, 1, "GUIdlatch", name);
                setSubmodelScale(.4);
                setInputPins("D", "E");
                setOutputPins("Q", "_Q");
@@ -82,4 +88,9 @@ public class GUIdlatch extends SimpleRectangularSubmodelComponent
                        throw new IllegalStateException("Illegal atomic state ID: " + stateID);
                }
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIdlatch.class.getCanonicalName(), (m, p, n) -> new GUIdlatch(m, n));
+       }
 }
\ No newline at end of file