Small improvements in IndirectGUIComponentCreator
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / examples / ReserializeJSONsSettingUsages.java
index d5faf7e..179265b 100644 (file)
@@ -50,7 +50,7 @@ public class ReserializeJSONsSettingUsages
                try
                {
                        DeserializedSubmodelComponent comp = (DeserializedSubmodelComponent) IndirectGUIComponentCreator
-                                       .createComponent(new ViewModelModifiable(), "file:" + json.toString());
+                                       .createComponent(new ViewModelModifiable(), "jsonfile:" + json.toString());
                        System.out.println("Reserializing " + json);
                        comp.getSupermodelPins().entrySet().stream().sorted(Comparator.comparing(Entry::getKey)).map(Entry::getValue).forEach(pin ->
                        {
@@ -75,7 +75,7 @@ public class ReserializeJSONsSettingUsages
        {
                Set<GUIWire> wiresConnectedToPin = comp.submodel.getWiresByName().values().stream()
                                .filter(w -> w.getPin1() == interfacePin || w.getPin2() == interfacePin).collect(Collectors.toSet());
-               wiresConnectedToPin.forEach(GUIWire::destroy);
+               wiresConnectedToPin.forEach(comp.getSubmodelModifiable()::destroyWire);
                comp.removeSubmodelInterface(interfacePin.name);
                comp.addSubmodelInterface(
                                new MovablePin(comp, interfacePin.name, interfacePin.logicWidth, usage, interfacePin.getRelX(), interfacePin.getRelY()));