[ovirt-devel] Automatic highlighting of invalid tabs

Alexander Wels awels at redhat.com
Wed Sep 3 13:55:53 UTC 2014


Hi,

I just committed a patch that makes it a lot easier to mark invalid tabs in 
popup windows for instance the new VM window. Before when you added a new tab 
you would have to create a isXXXTabValid boolean in the model, and add a 
propertyChangeEvent to that boolean. Then in the view you needed to listen to 
changes in a giant if/else statement for all the different tabs in the view.

Then in your validation routine you would call setIsXXXTabValid(true/false) to 
set the tab valid or invalid. Now all you have to do is the following. In your 
validation routine call setTabValid(TabName, true/false). The TabName is an 
enum that lists all known tabs. If you make a new tab that is not already 
there, just add it.

There is no need to create/listen to property change events, as at the end of 
the validation routine a validation complete event is called and this causes 
some code to run to evaluate all the tab states at once, and it highlights all 
invalid tabs at once. It also selects the first invalid tab and makes it 
active. This should greatly improve the user experience as it is now evident 
which tabs have problems and the first problem is active by default.

Alexander



More information about the Devel mailing list