TwinColSelect get selected element

is there a way to get the new selected element on a TwinColSelect?

My problem is this:
I have to add some roles to a user, but there are some roles that mus be unique , example:

Left Column
roles:
rol A
rol D_1
rol D_3

Right Column
User Roles:
rol B
rol C
rol D_2

For the roles A, B, C there is no problem, but the roles of type D, only can be added once, so if I add rol D_1 or D_3, the rol D_2 must be removed. But I cant find a method to check the new rol.

A ValueChangeListener gets informed whenever a row is added or removed. There you could check your constraint and remove duplicate rows if necessary. You just need to be aware that removals from ValueChangeListener will trigger a ValueChangeEvent themself - so look out for infinite loops (although I do not expect one from your problem-description).

Hello, thank you for your comments, I was thinking on doing that, just wanted to check if there was method I may have overlooked that could had made the solution more easy.