In one of our pages I've created a detail screen with some information divided in blocks. I've used HorizontalLayouts with setExpandRatio
for this. Here is how this is divided (all values made black for privacy reasons):
The final Label of the second row (now containing ---
) should actually be empty instead. All the blocks are basically Vaadin Labels, with values in it. However, these values can sometimes be null
, in which case I don't want to show anything in the Label.
When I use an empty String however instead of ---
, it will look like this:
As you can see at the final Label of the second row, it is now missing it's border (and possible other styles we might add in the future), because Vaadin automatically put the expandRatio
of Labels with an empty input to 0, turning the width to 0px
.
I know you can set the actual width of a Label as filler, but in this case it's simply a question whether the value that's supposed to be in that Label is or isn't null
.
I've also tried a space as value, but it just ignores it and behaves the same as the empty value. And when I " "
as value (without setting the Label to HTML-mode), it outputs this literally as
on the screen.
Is there any value I could use for the Label when the value is null
to still show the style with borders, but without value?
EDIT: Hmm, when I use
and set the ContentMode of the Label to HTML
it seems to work. Is this the intended work-around for this issue (which means I'll have to set ContentMode to HTML for all Labels with the potential of containing an empty value), or is there another workaround by changing this 'empty' value alone?