1 package net.mograsim.logic.model.model;
5 import net.mograsim.logic.model.model.components.GUIComponent;
6 import net.mograsim.logic.model.model.wires.GUIWire;
8 public class ViewModelModifiable extends ViewModel
10 public String getDefaultComponentName(GUIComponent component)
12 Set<String> componentNames = getComponentsByName().keySet();
13 // TODO get the ID of component
14 // The following does not work because this method is called in the constructor of DeserializedSubmodelComponent at a time where
15 // idForSerializingOverride is not yet set
16 // String componentID = null;
17 // if (component instanceof DeserializedSubmodelComponent)
18 // componentID = ((DeserializedSubmodelComponent) component).idForSerializingOverride;
19 // if (componentID == null)
20 // componentID = component.getClass().getSimpleName();
21 String componentID = component.getClass().getSimpleName();
22 String nameBase = componentID + '#';
25 String nameCandidate = nameBase + i;
26 if (!componentNames.contains(nameCandidate))
31 public String getDefaultWireName()
33 Set<String> wireNames = getWiresByName().keySet();
36 String nameCandidate = "unnamedWire#" + i;
37 if (!wireNames.contains(nameCandidate))
43 public void componentCreated(GUIComponent component)
45 super.componentCreated(component);
49 public void componentDestroyed(GUIComponent component)
51 super.componentDestroyed(component);
55 public void wireCreated(GUIWire wire)
57 super.wireCreated(wire);
61 public void wireDestroyed(GUIWire wire)
63 super.wireDestroyed(wire);