hello,every one,i found a problem that ,i create a popup window with a button to close the window.
when double click the button on the window quickly,the page will dead.
code:
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
Button btn = new Button();
//
btn.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
VerticalLayout layout = new VerticalLayout();
Button btn2 = new Button();
layout.addComponent(btn2);
Window window = new Window("test", layout);
// window.setDraggable(false);
V7UI.this.addWindow(window);
window.center();
btn2.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
window.close();
}
});
window.bringToFront();
}
});
layout.addComponent(btn);
}
i found this is because when i double click the button ,vaadin will think as i will drag the window , so that the method
private void beginMovingWindow(Event event) {
if (draggable) {
showDraggingCurtain();
dragging = true;
startX = WidgetUtil.getTouchOrMouseClientX(event);
startY = WidgetUtil.getTouchOrMouseClientY(event);
origX = DOM.getAbsoluteLeft(getElement());
origY = DOM.getAbsoluteTop(getElement());
DOM.setCapture(getElement());
DOM.eventPreventDefault(event);
}
}
of Class VWindow will be called ,will create a DIV draggingCurtain,which cause the problem,how do i solve or avoid this problem,thank you very much,forgive my poor english