GUIComponents now serialize and deserialize parameters (where needed)
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / atomic / GUIOrGate.java
1 package net.mograsim.logic.ui.model.components.atomic;
2
3 import net.mograsim.logic.core.components.gates.OrGate;
4 import net.mograsim.logic.ui.model.ViewModelModifiable;
5 import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter;
6 import net.mograsim.logic.ui.modeladapter.componentadapters.SimpleGateAdapter;
7 import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
8
9 public class GUIOrGate extends SimpleRectangularGUIGate
10 {
11         public GUIOrGate(ViewModelModifiable model, int logicWidth)
12         {
13                 super(model, logicWidth, "\u22651", false);// ">=1"
14                 setInputCount(2);
15         }
16
17         static
18         {
19                 ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(GUIOrGate.class, OrGate::new));
20                 IndirectGUIComponentCreator.setComponentProvider(GUIOrGate.class.getCanonicalName(), (m, p) -> new GUIOrGate(m, p.getAsInt()));
21         }
22 }