I am trying to take input from the below screen and open Birt Report direct

Problem: My Anchor/Button is not opening any link on the first click every time this UI gets loaded. But After clicking once from the second click onward, it is working fine. Any Idea what can be the issue and what mistake I’ve made?

Below are my global Variables:

final Button                    printButton                     =
    new Button("Print Report", VaadinIcon.PRINT.create());
String                          url                             = null;
final Anchor                    anchorReport                    = new Anchor();

My Consutructor:

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

I have also noticed: It is always taking the previous Value. For example, In the initial click, it doesn’t set anything and then changes the date it picks the previous values and not the current.

Solved by not using Anchor but by using executeJavaScript (although it is depricated but working fine):

UI.getCurrent().getPage().executeJavaScript("window.open(\"" + this.reportURL + "\", \"_blank\");");