In Vaadin 12, I can't seem to create a hyperlink (or for that matter, any "normal" http entries) inside a label field. It just ends up displaying my commands as text. Here's my code:
final Label lblRunMs = new Label("<ol><li>Please now run your mass spectrometer (MS) using the gs-DIA method files built in the previous step.</li><li>While the MS is running, the generated MS files will be automatically and in near real-time imported (eg ~60 seconds after the MS files have been created) imported into the " + Constants.MAIN_APP_NAME + " system.</li> <li>Once one or more of the MS files have been generated by the MS and imported into the " + Constants.MAIN_APP_NAME + " system, you can then move on the next step, namely \"Run " + Constants.MAIN_APP_NAME + " which is the next tab. In that next tab, you can select one or more of those imported MS files to undergo the " + Constants.MAIN_APP_NAME + " processing.</li></ol>");
add(lblRunMs);
Based on googling, I can see that earlier version of Vaadin allowed you to specifying ContentMode, as in:
Label htmlLabel = new Label(
"In HTML mode, all HTML formatting tags, such as \n" +
"<ul>"+
" <li><b>bold</b></li>"+
" <li>itemized lists</li>"+
" <li>etc.</li>"+
"</ul> "+
"are preserved.",
ContentMode.HTML);
but that option doesn't seem available in Vaadin 12. What's the "right" way to address this need in Vaadin 12?
In V10+, the Label
component maps to a <label>
HTML tag, which is probably not what you want here. In your example above, using new Html()
would be more appropriate. For text content, Span
or Text
are good options.