Vaadin load another view via Link?

vaadin, vaadin7

Solution

You have two options:

Use Button instead of Link:

Button button = new Button("Click me!", new Button.ClickListener() {
    @Override
    public void buttonClick(ClickEvent clickEvent) {
        // Logic for opening correct view
    }
});
button.setStyleName(Reindeer.BUTTON_LINK);

Or listen URI fragment changes by using UriFragmentUtility (Vaadin 6) or UriFragmentChangedListener (Vaadin 7) and then you can use a normal link: Here's an example with Vaadin 7:

Page.getCurrent().addUriFragmentChangedListener(new Page.UriFragmentChangedListener() {
    @Override
    public void uriFragmentChanged(Page.UriFragmentChangedEvent e) {
         System.out.println("fragment changed: " + e.getUriFragment());
    }
});


new Link("click me!", new ExternalResource("#asdf"))

Problem

Please tell me, is it possible that. I have a Link. ``` Link jobNameLink = new Link(jobName, new ExternalResource("opla")); ``` I need to when you click on this link to download a different view. If not possible, what are the possible solutions to this problem?

Original source