Vaadin 12 标签字段内的超链接
Hyperlink inside label field in Vaadin 12
在 Vaadin 12 中,我似乎无法在标签字段内创建超链接(或就此而言,任何 "normal" 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 中似乎不可用。"right" 在 Vaadin 12 中满足此需求的方法是什么?
在 V10+ 中,Label
组件映射到 <label>
HTML 标记,这可能不是您想要的。在上面的示例中,使用 new Html()
会更合适。对于文本内容,Span
或 Text
是不错的选择。
在 Vaadin 12 中,我似乎无法在标签字段内创建超链接(或就此而言,任何 "normal" 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 中似乎不可用。"right" 在 Vaadin 12 中满足此需求的方法是什么?
在 V10+ 中,Label
组件映射到 <label>
HTML 标记,这可能不是您想要的。在上面的示例中,使用 new Html()
会更合适。对于文本内容,Span
或 Text
是不错的选择。