Project in java, vaadin 7 I have trouble finding a way to prevent my window to be closed before a button inside is clicked. I want the window to stay on top of the other screen content as well. My code so far :
private void handleButtonCancelBatches() {
if (projectBatchTeller > 0) {
Button btnYes = new Button("Yes");
Button btnNo = new Button("No");
// toDo add click listeners to the buttons
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.addComponents(btnYes, btnNo);
// toDo add extra informative content to the horizontalLayout
Window window = new Window( //
"Cancel "+ projectBatchTeller + " selected batches ?", horizontalLayout);
window.setWidth(50f, Unit.PERCENTAGE);
window.setHeight(50f, Unit.PERCENTAGE);
window.setPosition((int) getUI().getWidth() / 2, (int) getUI().getHeight() / 2);
getUI().getCurrent().addWindow(window);
} else {
Notification.show("No batches selected to cancel");
}
}
// toDo add listeners / handlers for the buttons
What I really need is the behavior from a typical Messagebox, but I'm not allowed to add extra dependencies in the pom nor can I upgrade to a newer version of Vaadin.
If it's not possible, I want to close the window automatically after 60 seconds, sending a Notifaction informing doing the default path, witch is not processing the batches
Any suggestions ? Thanks
I found a workable solution for it myself. Quite simple actualy, problem was that I didn't know the word "modal" (I speak dutch)
It gives behavior like a msgbox (like in C# ...)
window.setModal(true);
window.setClosable(false);