Not readable fields

Sometimes, like for password field, some fields are not enabled to be readable from some users (not all).
I know I can setVisible(false) however in some situation, in order to avoid changes in the layout, it would be preferable to make the field only “not readable” like passwords.
I can’t use PasswordFields because I need to apply such property also to combobox and other fields.
Is there any way to obtain such result ?
Tks
Tullio

I can’t imagine what sort of use case you have if you want to hide the field contents. Normally, when you don’t want to allow user to edit a field in some state, you use setEnabled(false) for the irrelevant components.

ComboBox is intended for selecting an item from a list of items, so it doesn’t make much sense to have it “non-readable”. If you disable it, the user won’t be able to open the selections, so it’s about the same thing. For most other components, disabled state doesn’t hide much.

As I tried to explain I need it because some users can’t read the content of a field (e.g. the manager salary) and then setEnabled is not a solution.
SetVisible could be a solution, however the layout would be difficult to make coherent and pretty if some fields are not visible, mainly if the behaviour is different for every type of user.
Tks

If the value is sent to the client, one must assume the end user is able to read it even if it is not displayed to the user.

The only setting in Vaadin that prevents the value from being sent to the client is setVisible(false), so you might need to construct your layouts so that they can survive this. Otherwise, one idea that comes to my mind woud be wrapping the properties in some kind of permission-checking properties that just return an empty string or null of the user should not have access to that property. You need to intercept the linking of properties to fields for this to work, though, which might be tricky in some cases - you could use e.g. a customized FieldGroup to do that for a form.