Table Row Selection

I have selectable Vaadin table. But I have a requirement that whenever a user clicks on a given row, I want to capture and perform some validation before allowing user to click. I have ItemClickListener where I get the clicked row, but by that time it is too later and my row color is already changed to blue (elected).
I need some preRowSelected hook kind of stuff.

Please suggest how to achieve this in Vaadin table?



I haven’t tried it out, but overriding the Table.changeVariables(…) might help here.

Edit: it’s not very pretty, and leaves you with no selection at all, but as a quick hack something like this seems to work:

public void changeVariables(Object source, Map<String, Object> variables) {
	if (<your condition>) {
        if (variables.containsKey("selected")) {
            variables = new HashMap<String, Object>(variables);
	super.changeVariables(source, variables);

If I remember correctly, the color is actually changed on the client side before a call is made to the server for responsiveness - it actually does make a big difference in user experience if the server is even slightly slow.

this thread
which suggests some workarounds - it is for the Tree component, but the same should apply to Table.