final PButton anchor3 = addButton("Open");
anchor3.addClickHandler(new PClickHandler() {
@Override
public void onClick(final PClickEvent clickEvent) {
final PClosableDialogBox dialogBox = new PClosableDialogBox("Custom caption");
dialogBox.setDraggable(true);
dialogBox.setContent(new PLabel("Content of a popup"));
dialogBox.center();
}
});
addLabel("A confirm dialog listenening on the close event");
final PButton anchor4 = addButton("Open");
anchor4.addClickHandler(new PClickHandler() {
@Override
public void onClick(final PClickEvent clickEvent) {
final POptionPane dialodBox = POptionPane.showConfirmDialog(new PActionHandler() {
@Override
public void onAction(final PDialogBox dialogBox, final String option) {
dialogBox.hide();
}
}, "Your custom text");
dialodBox.getDialogBox().addCloseHandler(new PCloseHandler() {
@Override
public void onClose(final PCloseEvent closeEvent) {
final DemoBusinessEvent event = new DemoBusinessEvent(this);
event.setBusinessMessage("Dialog box closed");
fireEvent(event);
}
});
}
});
addLabel("A confirm dialog listenening on the close event");
final PButton anchor5 = addButton("Open");
anchor5.addClickHandler(new PClickHandler() {
@Override
public void onClick(final PClickEvent clickEvent) {
POptionPane.showConfirmDialog(new PActionHandler() {
@Override
public void onAction(final PDialogBox dialogBox, final String option) {
dialogBox.hide();
final DemoBusinessEvent event = new DemoBusinessEvent(this);
event.setBusinessMessage("Option selected #" + option);
fireEvent(event);
}
}, "Your custom text", "Your title", POptionType.YES_NO_CANCEL_OPTION);