Make layer_selector node IDs deterministic.

Using a static int to generate uniqueIDs for nodes is problematic
when nodes are load in a different order. To make node IDs deterministic
we derive them from the text value and its position in the tree.