Hello,
Below I attached simple Vaadin application which extracts the problem I cannot resolve up to now.
First ENTER is set to be the shortcut key for the OK button, which is the only component of the application.
After clicking this button (or pressing ENTER key) we switch to another view containing textArea.
Although the shortcut has been removed the textArea does not accept the ENTER key (one cannot break lines using ENTER) - why ? In real application this problem may propagate to many succesive forms containing textfields. What is interesting, refreshing the page helps and ENTER starts to work correctly.
What I am doing wrong ? Or is it a bug ?
package com.example.vaadintests;
import com.vaadin.Application;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.ui.Button;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
public class VaadintestsApplication extends Application {
@Override
public void init() {
final Window mainWindow = new Window("Shortcut ...");
final Button button = new Button("Ok");
button.setClickShortcut(KeyCode.ENTER);
button.addListener(new ClickListener()
{
@Override
public void buttonClick(ClickEvent event)
{
button.removeClickShortcut();
mainWindow.removeAllComponents();
TextField textArea = new TextField("Enter key malfunctioning below");
textArea.setRows(5);
textArea.setColumns(20);
textArea.focus();
mainWindow.addComponent(textArea);
}
});
mainWindow.addComponent(button);
setMainWindow(mainWindow);
}
}