Guaranteeing unique name when using setName

GraphComponent.setName() wasn't properly guaranteeing that the names were unique.

I've fixed the bug and added a test for it.