Vaadin 8 Sub Window by using an Addon messagebox
Code is as Follows
TextField name = new TextField("Name");
TextField country = new TextField("country");
TextField network = new TextField("Network");
SubWindow subWindow = new SubWindow();
subWindow.setCaption("Sub-window");
VerticalLayout subcontent = new VerticalLayout();
subWindow.setContent(subcontent);
subWindow.setHeight("350px");
subWindow.setWidth("500px");
subcontent.addComponents(name, country, network);
subWindow.center();
grid.addItemClickListener(e -> {
String putName = e.getItem().name.toString();
name.setValue(putName);
name.focus();
String putCountry = e.getItem().country.toString();
country.setValue(putCountry);
String putNetwork = e.getItem().network.toString();
network.setValue(putNetwork);
if (subWindow.isAttached()) {
UI.getCurrent().removeWindow(subWindow);
}
UI.getCurrent().addWindow(subWindow);
});
}
class SubWindow extends Window {
private static final long serialVersionUID = 1L;
@Override
public void close() {
MessageBox.createQuestion().withCaption("Do you want to Really close the Window")
.withMessage("Pakku ne ?").withYesButton(() -> super.close())
.withNoButton(() -> {})
.open();
}
}
How can I then write Multiline codes in .WithYesButton() ? oder returning a function like, .WithYesButton(()-> return RemoveAll())
ReplyDeleteRemoveAll() returns true or false
Thanks
Hello @Reza Payambari this is just the addon I used for generting close warning notification
ReplyDeleteYou can make your custom methods in order to implement multiline codes.