【发布时间】:2021-02-17 04:47:58
【问题描述】:
我正在尝试从下面的屏幕中获取输入并将 Birt Report 直接打开为 PDF。 (我正在使用 Vaadin 14)
问题: 每次加载此 UI 时,我的锚点/按钮都不会在第一次单击时打开任何链接。但是从第二次单击开始单击一次后,它工作正常。任何想法可能是什么问题以及我犯了什么错误?
以下是我的全局变量:
final Button printButton =
new Button("Print Report", VaadinIcon.PRINT.create());
String url = null;
final Anchor anchorReport = new Anchor();
我的委托人:
public AssignmentCompletedAllRPTView()
{
super();
this.initUI();
this.radioButtonGroup.setItems("Yes", "No");
this.printButton.addClickListener(new ComponentEventListener<ClickEvent<Button>>()
{
@Override
public void onComponentEvent(final ClickEvent<Button> event)
{
AssignmentCompletedAllRPTView.this.printButton();
}
});
this.ConfigureReportButton();
}
ConfigureReportButton():
private void ConfigureReportButton()
{
this.anchorReport.setTarget("_blank");
this.anchorReport.add(this.printButton);
this.buttonHorizontalLayout.add(this.anchorReport);
}
printButton():
private void printButton()
{
final String reportURL = //--URL
this.anchorReport.setHref(reportURL);
}
【问题讨论】:
-
您能否最小化您的代码示例以仅包含重现问题所需的行?现在有大量的代码我认为与手头的问题无关,就像所有的日志记录一样。
-
我实际上不知道在第一次点击时出现问题的地方。我很抱歉,但会缩短 printButton() 方法。删除所有日志。我做到了。
-
重现问题是否需要这些通知?
-
我删除了所有不必要的代码。我希望有人能回复我,我在编码中做错了什么而不是在发布中:( .
-
我也注意到:它总是取之前的值。例如,在初始点击中,它不设置任何内容,然后更改它选择以前的值而不是当前值的日期。
标签: vaadin vaadin-flow rapidclipse