societyNames.remove(societyComponent.getSocietyName()); societyNames.add(newName); societyComponent.setName(newName); model.nodeChanged(node);
societyNames.remove(originalName); Object o = parentNode.getUserObject(); if (o instanceof Experiment) { Experiment experiment = (Experiment)o; model.removeNodeFromParent(node); experiment.removeSocietyComponent(); SocietyComponent societyCopy = (SocietyComponent)society.copy(newName); experiment.addSocietyComponent(societyCopy); societyCopy.saveToDatabase(); addSocietyToWorkspace(societyCopy, parentNode); } else { societyNames.add(newName); society.setName(newName); society.saveToDatabase(); Enumeration nodes = root.depthFirstEnumeration(); while (nodes.hasMoreElements()) { node = (DefaultMutableTreeNode)nodes.nextElement(); if (node.getUserObject().equals(society)) model.nodeChanged(node); } displayExperiments(society); }
  public void renameSociety() {    String newName = getUniqueName("New society name",                                   "Society Name Not Unique",                                   societyNames);    if (newName == null)      return;    DefaultMutableTreeNode node = getSelectedNode();    SocietyComponent societyComponent =       (SocietyComponent) node.getUserObject();    if (newName.equals(societyComponent.getSocietyName()))      return;    societyNames.remove(societyComponent.getSocietyName());    societyNames.add(newName);    societyComponent.setName(newName);    model.nodeChanged(node);  }