package net.mograsim.logic.ui.model;
+import java.util.Set;
+
import net.mograsim.logic.ui.model.components.GUIComponent;
import net.mograsim.logic.ui.model.wires.GUIWire;
public class ViewModelModifiable extends ViewModel
{
+ public String getDefaultComponentName(GUIComponent component)
+ {
+ Set<String> componentNames = getComponentsByName().keySet();
+ String nameBase = component.getClass().getSimpleName() + '#';
+ for (int i = 0;; i++)
+ {
+ String nameCandidate = nameBase + i;
+ if (!componentNames.contains(nameCandidate))
+ return nameCandidate;
+ }
+ }
+
@Override
public void componentCreated(GUIComponent component)
{