Ok, here is my controller using Wicket 1.5M2:
public class Users extends WebPage {
private static final List<User> users = Collections.synchronizedList(new ArrayList<User>());
public Users() {
final UserForm userForm = new UserForm("userForm");
add(userForm);
add(new ListView<User>("users", users) {
@Override
protected void populateItem(ListItem<User> item) {
final User user = item.getModelObject();
item.add(new Label("name", user.getName()));
item.add(DateLabel.forDatePattern("dateOfBirth", new Model(user.getDateOfBirth()), "dd.MM.yyyy"));
item.add(new Label("email", user.getEmail()));
item.add(new Link("editLink") {
@Override
public void onClick() {
userForm.setModelObject(user);
}
});
item.add(new Link("removeLink") {
@Override
public void onClick() {
users.remove(user);
}
});
}
});
setVersioned(false);
}
private class UserForm extends Form<User> {
public UserForm(String id) {
super(id, new CompoundPropertyModel<User>(new User()));
add(new TextField<String>("name"));
add(DateTextField.forDatePattern("dateOfBirth", "dd.MM.yyyy"));
add(new TextField<String>("email"));
}
@Override
protected void onSubmit() {
User user = getModelObject();
users.remove(user);
users.add(user);
setModelObject(new User());
}
}
}
It works when I use only one browser window at a time for CRUD operations. If I use two windows, the list of users does not update, unless I input the base address again to the address field to reload the page.
CLARIFICATION: Using different browsers simultaneously in same computer works good. Only when using multiple windows in same browser it does not work.
What is happening behind the scenes?
I set setVersioned(false) for the whole page, why is it that my address bar shows addresses like: http://localhost:8080/wicket/bookmarkable/package.name.Users?2 Isn't that number 2 the version of the page?
Most importantly what do I need to do to make this behave like a desktop GUI app, so one browser window == one instance of the app.