GUIComponents now have names
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / atomic / GUIOrGate.java
index fc88509..e9c2d0b 100644 (file)
@@ -4,17 +4,25 @@ import net.mograsim.logic.core.components.gates.OrGate;
 import net.mograsim.logic.ui.model.ViewModelModifiable;
 import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter;
 import net.mograsim.logic.ui.modeladapter.componentadapters.SimpleGateAdapter;
+import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
 
 public class GUIOrGate extends SimpleRectangularGUIGate
 {
        public GUIOrGate(ViewModelModifiable model, int logicWidth)
        {
-               super(model, logicWidth, "\u22651", false);// ">=1"
+               this(model, logicWidth, null);
+       }
+
+       public GUIOrGate(ViewModelModifiable model, int logicWidth, String name)
+       {
+               super(model, "\u22651", false, logicWidth, name);// ">=1"
                setInputCount(2);
        }
 
        static
        {
                ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(GUIOrGate.class, OrGate::new));
+               IndirectGUIComponentCreator.setComponentSupplier(GUIOrGate.class.getCanonicalName(),
+                               (m, p, n) -> new GUIOrGate(m, p.getAsInt(), n));
        }
 }
\ No newline at end of file