GUIComponents now have names
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / atomic / GUIBitDisplay.java
index 9abb9e8..cd643db 100644 (file)
@@ -14,6 +14,7 @@ import net.mograsim.logic.ui.model.components.GUIComponent;
 import net.mograsim.logic.ui.model.wires.Pin;
 import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter;
 import net.mograsim.logic.ui.modeladapter.componentadapters.BitDisplayAdapter;
+import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
 import net.mograsim.preferences.Preferences;
 
 public class GUIBitDisplay extends GUIComponent
@@ -29,7 +30,12 @@ public class GUIBitDisplay extends GUIComponent
 
        public GUIBitDisplay(ViewModelModifiable model)
        {
-               super(model);
+               this(model, null);
+       }
+
+       public GUIBitDisplay(ViewModelModifiable model, String name)
+       {
+               super(model, name);
                logicObs = (i) -> requestRedraw();
 
                setSize(width, height);
@@ -83,5 +89,6 @@ public class GUIBitDisplay extends GUIComponent
        static
        {
                ViewLogicModelAdapter.addComponentAdapter(new BitDisplayAdapter());
+               IndirectGUIComponentCreator.setComponentSupplier(GUIBitDisplay.class.getCanonicalName(), (m, p, n) -> new GUIBitDisplay(m, n));
        }
 }
\ No newline at end of file