Commits

Karsten Schmidt  committed 684922c

switching UUIDs for generated GUI controllers to avoid naming conflicts

  • Participants
  • Parent commits 564133c

Comments (0)

Files changed (1)

File src/toxi/gui/GUIManager.java

 import java.util.LinkedList;
 import java.util.List;
 import java.util.StringTokenizer;
+import java.util.UUID;
 import java.util.logging.Logger;
 
 import toxi.geom.Vec2D;
                         if (builder != null) {
                             List<Controller> items =
                                     builder.createElementsFor(subContext, ff,
-                                            currPos, ff.getName(), label + " ("
+                                            currPos, getUUID(), label + " ("
                                                     + ff.getName() + ")", this);
                             for (Controller c : items) {
                                 if (tab != null) {
                         Vec2D pos = getPositionFor(a);
                         List<Controller> items =
                                 builder.createElementsFor(context, f, pos,
-                                        f.getName(), label, this);
+                                        getUUID(), label, this);
                         for (Controller c : items) {
                             if (tab != null) {
                                 c.setTab(tab);
         return new Vec2D(x, y);
     }
 
+    protected String getUUID() {
+        return UUID.randomUUID().toString();
+    }
+
     protected void registerController(String id, Controller ctrl) {
         controllers.put(id, ctrl);
     }