super(id);
final WebMarkupContainer dialogContainer = new WebMarkupContainer("dialogContainer");
dialogContainer.setOutputMarkupId(true);
add(dialogContainer);
final Dialog dialog = new Dialog("dialog");
dialog.setResizable(true);
dialog.setTitle("Dialog title");
dialog.setPosition(new PositionOptions()
.setAt(new PositionAlignmentOptions(PositionRelation.TOP))
.setMy(new PositionAlignmentOptions(PositionRelation.TOP))
.setOf("#" + dialogContainer.getMarkupId())
);
dialog.setShow(new DialogAnimateOption("fold"));
dialog.setHide(new DialogAnimateOption(100));
dialog.setButtons(new DialogButton("Close", JsScope.quickScope(dialog.close()))
.setIcons(UiIcon.CLOSE, null)
);
dialogContainer.add(dialog);
final AjaxLink<Void> openDialog = new AjaxLink<Void>("openDialog") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavaScript(dialog.open().render().toString());
}
};
dialogContainer.add(openDialog);
}