vaadin - Vaadin 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 中解决此需求的“正确”方法是什么?
解决方案
在 V10+ 中,Label
组件映射到<label>
HTML 标记,这可能不是您想要的。在上面的示例中, usingnew Html()
会更合适。对于文字内容,Span
还是Text
不错的选择。
推荐阅读
- orm - 解决微服务之间的设计依赖
- angular - 版本 7 的 Angular 应用程序未运行
- linux - 如何在 linux 中强制使具有 's' 权限的命令崩溃?
- jooq - 未加载模式:请检查您的连接设置,以及您的数据库(和您的数据库版本!)是否真的受 jOOQ 支持
- python - 如何在 Python 中使用 OpenCV 将背景的阴影部分计为背景(下图)?
- mysql - MYSQL 搜索返回错误和重复的值
- javascript - 在脚本标签 node.js 中传递 mongoose 文档以查看和使用
- php - 使用 PHP 进行 Google 身份验证
- protractor - 在量角器中,我希望代码根据是否触发 OTP 来处理,如果没有,我可以登录到主页或任何页面并继续工作
- php - Laravel,使用选择框的条件来指示表单验证