You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Vaadin 8 migration, if I use a Stepper (manual input allowed) in a window with a button and a key shortcut, when the user set a value manually and use the shortcut to validate, the stepper value is wrong (initial value).
Could it be possible to have a "ValueChangeMode" like TextField component to control this behavior ? Or any other way to achieve this ?
There may be a workaround I did not find ?
The current behavior seems to correspond to the "ValueChangeMode.BLUR" and I'm looking for the "ValueChangeMode.EAGER". I think the "setImmediate" method did the trick before migration.
Here is an example to illustrate the issue:
public class StepperDialog {
private final UI parentWindow;
private final Window stepperWindow;
private IntStepper stepper;
public StepperDialog(UI parentWindow) {
this.parentWindow = parentWindow;
this.stepperWindow = createWindow();
}
public void show() {
parentWindow.addWindow(stepperWindow);
stepper.focus();
}
private void hide() {
parentWindow.removeWindow(stepperWindow);
}
private Window createWindow() {
// Create window
Window window = new Window("StepperDialog");
window.setModal(true);
window.setWidth("250px");
window.setHeight("175px");
// Root window layout
VerticalLayout rootLayout = new VerticalLayout();
window.setContent(rootLayout);
// Add basic Integer stepper
stepper = new IntStepper("Stepper");
stepper.setMinValue(1);
stepper.setValue(1);
rootLayout.addComponent(stepper);
// Add ok and cancel buttons with shortcut
Button okButton = new Button("OK", event -> validate());
Button cancelButton = new Button("CANCEL", event -> hide());
okButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
cancelButton.setClickShortcut(ShortcutAction.KeyCode.ESCAPE);
HorizontalLayout buttons = new HorizontalLayout(okButton, cancelButton);
rootLayout.addComponent(buttons);
return window;
}
private void validate() {
Integer value = stepper.getValue();
System.out.println("value=" + value);
/**
* Here, the value is correct if the user click on button and incorrect
* if he uses the "ENTER" key shortcut.
*/
hide();
}
}
The text was updated successfully, but these errors were encountered:
Since Vaadin 8 migration, if I use a Stepper (manual input allowed) in a window with a button and a key shortcut, when the user set a value manually and use the shortcut to validate, the stepper value is wrong (initial value).
Could it be possible to have a "ValueChangeMode" like TextField component to control this behavior ? Or any other way to achieve this ?
There may be a workaround I did not find ?
The current behavior seems to correspond to the "ValueChangeMode.BLUR" and I'm looking for the "ValueChangeMode.EAGER". I think the "setImmediate" method did the trick before migration.
Here is an example to illustrate the issue:
The text was updated successfully, but these errors were encountered: