Reserialized all components to version 0.1.5 and set correct PinUsages
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / ViewModelModifiable.java
index 55d0d72..97993a7 100644 (file)
@@ -5,12 +5,22 @@ import java.util.Set;
 import net.mograsim.logic.model.model.components.GUIComponent;
 import net.mograsim.logic.model.model.wires.GUIWire;
 
+//TODO a ViewModel is modifiable without casting to ViewModelModifiable via GUIWire::destroy and GUIComponent::destroy
 public class ViewModelModifiable extends ViewModel
 {
        public String getDefaultComponentName(GUIComponent component)
        {
                Set<String> 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;