mainLayout.setSecondComponent(form);
form.setImmediate(true);
- // TODO this is critical for the problem to occur
+ // this is critical for the problem to occur
form.setWriteThrough(false);
HorizontalLayout footer = new HorizontalLayout();
.replaceAll("[^0-9]", "");
if (!fragment.equals(previousFragment)) {
navigateTo(fragment);
- previousFragment = fragment;
}
}
}
entity.setId(index++);
toppings.put(entity.getId(), entity);
}
+ refreshTable();
navigateTo(null);
}
});
// create new entity at the beginning
+ refreshTable();
navigateTo("new");
}
public void navigateTo(String requestedDataId) {
- // refresh table
- BeanContainer<Long, Topping> container = new BeanContainer<Long, Topping>(
- Topping.class);
- container.setBeanIdProperty("id");
- for (Topping entity : toppings.values()) {
- container.addBean(entity);
- }
- table.setContainerDataSource(container);
+ previousFragment = requestedDataId;
if ("new".equals(requestedDataId)) {
table.setValue(null);
}
}
+ private void refreshTable() {
+ // refresh table
+ BeanContainer<Long, Topping> container = new BeanContainer<Long, Topping>(
+ Topping.class);
+ container.setBeanIdProperty("id");
+ for (Topping entity : toppings.values()) {
+ container.addBean(entity);
+ }
+ table.setContainerDataSource(container);
+ }
+
protected void setCurrentEntity(Topping entity) {
form.setVisible(entity != null);
if (entity != null) {
@Override
protected String getDescription() {
- return "Open the toppings view and create a new topping \"ham\".\n"
- + "Select the topping in the table to edit it (might require two clicks due to #6833).\n"
- + "Edit the name to \"ahm\" and press ENTER without first moving the focus out of the field. This triggers the Save button.\n"
- + "Deselect the row in the table (needed because of #6833).\n"
- + "An out of sync error is displayed, as there is a variable change for the text field that is no longer on the screen.";
+ return "Focus the text field and press ENTER.\n"
+ + "Click on the table row to edit it, change the text to \"ahm\" using the keyboard and press ENTER again.\n"
+ + "Then select the table row again.\n"
+ + "This causes an Out of Sync error if the cursor position for the text field is sent too late to a component that is no longer in the layout.";
}
@Override