Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
URI perpetuum mobile
In this simple application uri events are generated infinitely after once triggered by pressing the button - why ?
No explicit URI changes are posted (apart from the initial push).
It is a simplified extract from a larger application where I have problem with phantom uri events after replacing components.
The URIFragmentUtility is at the same level as replaced components. Can it be the reason ?
package com.example.urierror;
import java.util.Date;
import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.UriFragmentUtility;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent;
import com.vaadin.ui.UriFragmentUtility.FragmentChangedListener;
public class UrierrorApplication extends Application
{
@Override
public void init()
{
AppWindow mainWindow = new AppWindow();
setMainWindow(mainWindow);
}
}
class AppWindow extends Window implements FragmentChangedListener
{
VerticalLayout layout1 = new VerticalLayout();
VerticalLayout layout2 = new VerticalLayout();
VerticalLayout layoutCurrent = null;
Button button;
UriFragmentUtility uriFragmentUtility;
Integer i = 0;
public AppWindow()
{
super();
uriFragmentUtility = new UriFragmentUtility();
uriFragmentUtility.addListener(this);
layout1.setCaption("1");
layout2.setCaption("2");
addComponent(layout1);
layoutCurrent = layout1;
addComponent(button = new Button("0 uri events", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
uriFragmentUtility.setFragment("F" + (new Date()).getTime());
}
}));
addComponent(uriFragmentUtility);
}
@Override
public void fragmentChanged(FragmentChangedEvent source)
{
button.setCaption(++i + " uri events");
VerticalLayout layoutNew = (layoutCurrent == layout1 ? layout2 : layout1);
replaceComponent(layoutCurrent, layoutNew);
layoutCurrent = layoutNew;
}
}
Hi again,
Does anybody know if URI events should by generated implicitly as in this case - by simple component replacing - potentially interfering with explicit workflow based on URI fragments ?
Should I post the bug report or this is normal & expected behaviour ?
Thanks
This looks strange. Which Vaadin version are you using? Is it really the replaceComponent() that triggers the behavior?
If this is reproducible with the current stable version, please file a bug report with the program to reproduce it.
I am using 6.7.9, also checked with 6.7.5 - same behaviour.
Yes, I think something with replaceComponent() may bo wrong...
I have filled the bug report: Ticket #8916