Renamed core components to have the common prefix Core
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / components / atomic / SimpleRectangularHardcodedGUIComponent.java
index c06ec14..431240d 100644 (file)
@@ -5,14 +5,14 @@ import java.util.concurrent.atomic.AtomicReference;
 
 import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
-import net.mograsim.logic.core.wires.Wire.ReadEnd;
-import net.mograsim.logic.core.wires.Wire.ReadWriteEnd;
+import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
+import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.GUIComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleRectangularHardcodedGUIComponentAdapter;
-import net.mograsim.logic.model.serializing.IdentifierGetter;
+import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.HighLevelStateHandler;
 import net.mograsim.logic.model.snippets.outlinerenderers.DefaultOutlineRenderer;
 import net.mograsim.logic.model.snippets.symbolrenderers.CenteredTextSymbolRenderer;
@@ -27,6 +27,8 @@ public abstract class SimpleRectangularHardcodedGUIComponent extends GUIComponen
        private static final double pinNamesHeight = 3.5;
        private static final double pinNamesMargin = .5;
 
+       private final String id;
+
        private final DefaultOutlineRenderer outlineRenderer;
        private final CenteredTextSymbolRenderer centerTextRenderer;
        private final PinNamesSymbolRenderer pinNamesRenderer;
@@ -36,9 +38,10 @@ public abstract class SimpleRectangularHardcodedGUIComponent extends GUIComponen
 
        // creation and destruction
 
-       public SimpleRectangularHardcodedGUIComponent(ViewModelModifiable model, String name, String centerText)
+       public SimpleRectangularHardcodedGUIComponent(ViewModelModifiable model, String id, String name, String centerText)
        {
                super(model, name);
+               this.id = id;
                this.outlineRenderer = new DefaultOutlineRenderer(this);
                CenteredTextParams centeredTextParams = new CenteredTextParams();
                centeredTextParams.text = centerText;
@@ -52,7 +55,13 @@ public abstract class SimpleRectangularHardcodedGUIComponent extends GUIComponen
                setHighLevelStateHandler(new HighLevelStateHandler()
                {
                        @Override
-                       public Object getParamsForSerializing(IdentifierGetter idGetter)
+                       public String getIDForSerializing(IdentifyParams idParams)
+                       {
+                               return null;// we don't need to serialize this; it's implicit since we are a SimpleRectangularHardcodedGUIComponent
+                       }
+
+                       @Override
+                       public Object getParamsForSerializing(IdentifyParams idParams)
                        {
                                return null;
                        }
@@ -121,6 +130,14 @@ public abstract class SimpleRectangularHardcodedGUIComponent extends GUIComponen
                pinNamesRenderer.render(gc, visibleRegion);
        }
 
+       // serializing
+
+       @Override
+       public String getIDForSerializing(IdentifyParams idParams)
+       {
+               return id;
+       }
+
        // operations no longer supported
 
        @Override