Гиперссылка внутри поля меток в Ваадин 12

В Vaadin 12 я не могу создать гиперссылку (или, если на то пошло, любые "нормальные" записи http) внутри поля метки. В итоге мои команды отображаются в виде текста. Вот мой код:

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);

Основываясь на поиске, я вижу, что более ранняя версия Vaadin позволяла вам указать ContentMode, как в:

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);

но этот вариант не доступен в Vaadin 12. Каков "правильный" способ удовлетворить эту потребность в Vaadin 12?

1 ответ

Решение

В V10+ Label Компонент отображается на <label> HTML-тег, который, вероятно, не то, что вы хотите здесь. В вашем примере выше, используя new Html() было бы более уместным. Для текстового контента, Span или же Text хорошие варианты.

Другие вопросы по тегам