@Override public void setId(String id) { String property = getLevel() == 1 ? TreeNodeChangeEvent.name : TreeNodeChangeEvent.id; String oldId = this.id; IdManager idManager = getIdManager(this); if (idManager != null) { // (oldId != null) // As the register and unregister are recursive, we need to call the unregister all the time until we have a non recursive method // Delete previous identifier only if defined. idManager.unregister(this); // TODO - do we need non recursive method on the IdManager interface ?? } if ((id == null) || (id.trim().length() == 0)) { this.id = null; } else if (checkIdentifier(id)) { this.id = id; } if ((idManager != null) && !idManager.register(this)) { IdentifierException exc = IdentifierException.createIdentifierExceptionForId(this, this.id); this.id = oldId; // restore the previous setting! throw new IllegalArgumentException(exc); } firePropertyChange(property, oldId, this.id); }