import java.util.Set;
-import net.mograsim.logic.model.model.components.GUIComponent;
-import net.mograsim.logic.model.model.wires.GUIWire;
+import net.mograsim.logic.model.model.components.ModelComponent;
+import net.mograsim.logic.model.model.wires.ModelWire;
public class ViewModelModifiable extends ViewModel
{
- public String getDefaultComponentName(GUIComponent component)
+ public String getDefaultComponentName(ModelComponent 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;
}
@Override
- public void componentCreated(GUIComponent component)
+ public void componentCreated(ModelComponent component, Runnable destroyed)
{
- super.componentCreated(component);
+ super.componentCreated(component, destroyed);
}
@Override
- public void componentDestroyed(GUIComponent component)
+ public void destroyComponent(ModelComponent component)
{
- super.componentDestroyed(component);
+ super.destroyComponent(component);
}
@Override
- public void wireCreated(GUIWire wire)
+ public void wireCreated(ModelWire wire, Runnable destroyed)
{
- super.wireCreated(wire);
+ super.wireCreated(wire, destroyed);
}
@Override
- public void wireDestroyed(GUIWire wire)
+ public void destroyWire(ModelWire wire)
{
- super.wireDestroyed(wire);
+ super.destroyWire(wire);
}
}
\ No newline at end of file