Label value wrapping without white spaces


I’ve encountered this problem and I can’t seem to get over it.

I’ve tried multiple things, but none worked. Label2 can take values without any spaces/white spaces, such as “aaaa…200charactersMore…zzz”. The problem is with breaking it into multiple lines.

The aim is simple, I have layouts as in the attachement. The problem occurs with HorizontalLayout, each one consists of two labels and a button. Wheher I set the label2.setWidth(“100px”) or not the long text is always under the button and gets way ou of the screen. Setting label2.setWidth(“100%”) pushes the button also far outside the screen.

All views are in my classes extending CustomComponents and setting setCompostionRoot. Now, all layouts have defined setWidth(“100%”).

Maybe someone could help me with this thing.

Ok, Ive managed this way:

Created a style for labels:

.v-label-wrap { white-space: normal; word-wrap: break-word; text-wrap: unrestricted; width: 75px; } and added it to the labels:

label2.addStyleName("wrap"); I didn’t find any other solution to break too long string without whitespaces.

Maybe it will help someone.