X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2FViewModelModifiable.java;h=b4fa4f530500ddcd3cab55d1621d1e4df4e906cf;hb=95a225aed8eae0fc080440dba779abfdf867ff3d;hp=55d0d729f61a8ff153ea2ae7302503ef93579d0a;hpb=a86976434d00dce2652d93256cc12b6e3a0f324a;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/ViewModelModifiable.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/ViewModelModifiable.java index 55d0d729..b4fa4f53 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/ViewModelModifiable.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/ViewModelModifiable.java @@ -10,7 +10,16 @@ public class ViewModelModifiable extends ViewModel public String getDefaultComponentName(GUIComponent component) { Set componentNames = getComponentsByName().keySet(); - String nameBase = component.getClass().getSimpleName() + '#'; + // TODO get the ID of component + // The following does not work because this method is called in the constructor of DeserializedSubmodelComponent at a time where + // idForSerializingOverride is not yet set +// String componentID = null; +// if (component instanceof DeserializedSubmodelComponent) +// componentID = ((DeserializedSubmodelComponent) component).idForSerializingOverride; +// if (componentID == null) +// componentID = component.getClass().getSimpleName(); + String componentID = component.getClass().getSimpleName(); + String nameBase = componentID + '#'; for (int i = 0;; i++) { String nameCandidate = nameBase + i; @@ -31,26 +40,26 @@ public class ViewModelModifiable extends ViewModel } @Override - public void componentCreated(GUIComponent component) + public void componentCreated(GUIComponent component, Runnable destroyed) { - super.componentCreated(component); + super.componentCreated(component, destroyed); } @Override - public void componentDestroyed(GUIComponent component) + public void destroyComponent(GUIComponent component) { - super.componentDestroyed(component); + super.destroyComponent(component); } @Override - public void wireCreated(GUIWire wire) + public void wireCreated(GUIWire wire, Runnable destroyed) { - super.wireCreated(wire); + super.wireCreated(wire, destroyed); } @Override - public void wireDestroyed(GUIWire wire) + public void destroyWire(GUIWire wire) { - super.wireDestroyed(wire); + super.destroyWire(wire); } } \ No newline at end of file