GUIComponents now have names
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / am2901 / GUIAm2901SourceDecode.java
index 832d995..f579a83 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 GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
 {
        public GUIAm2901SourceDecode(ViewModelModifiable model)
        {
-               super(model, 1, "Am2901SourceDecode");
+               this(model, null);
+       }
+
+       public GUIAm2901SourceDecode(ViewModelModifiable model, String name)
+       {
+               super(model, 1, "Am2901SourceDecode", name);
                setSubmodelScale(.25);
                setInputPins("I2", "I1", "I0");
                setOutputPins("SQ", "RA", "SB", "SA", "RD");
@@ -111,8 +117,7 @@ public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
                new GUIWire(submodelModifiable, cpI01, notI0.getPin("A"), new Point(7.5, 95));
                new GUIWire(submodelModifiable, cpI01, cpI02, new Point[0]);
                new GUIWire(submodelModifiable, cpI02, notI0.getPin("B"), new Point[0]);
-               new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5),
-                               new Point(32.5, 105));
+               new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5), new Point(32.5, 105));
                new GUIWire(submodelModifiable, notI2.getPin("Y"), cpNotI2, new Point(32.5, 20));
                new GUIWire(submodelModifiable, cpNotI2, nand22.getPin("A"), new Point[0]);
                new GUIWire(submodelModifiable, cpNotI2, nand23.getPin("A"), new Point(32.5, 95));
@@ -149,4 +154,10 @@ public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
                new GUIWire(submodelModifiable, nand41.getPin("Y"), SQ, new Point[0]);
                new GUIWire(submodelModifiable, nand42.getPin("Y"), RD, new Point[0]);
        }
+
+       static
+       {
+               IndirectGUIComponentCreator.setComponentSupplier(GUIAm2901SourceDecode.class.getCanonicalName(),
+                               (m, p, n) -> new GUIAm2901SourceDecode(m, n));
+       }
 }
\ No newline at end of file