protected void addCostEditModalDialog() { costEditModalDialog = new CostEditModalDialog(); final String title = (isNew() == true) ? "create" : "update"; costEditModalDialog.setCloseButtonLabel(getString(title)).setOutputMarkupId(true); parentPage.add(costEditModalDialog); costEditModalDialog.init(); }
private ModalQuestionDialog createSaveChangesDialog(final AbstractEditPage<?, ?, ?> parentPage) { ModalQuestionDialog modal = new ModalQuestionDialog( parentPage.newModalDialogId(), new ResourceModel("attr.savemodal.heading"), new ResourceModel("attr.savemodal.question")) { @Override protected boolean onCloseButtonSubmit(final AjaxRequestTarget target) { final boolean result = super.onCloseButtonSubmit(target); // this flag is read after the submit saveChangesDialogExitedWithYes = true; // click the update and stay button which is invisible for the user target.appendJavaScript("$('#" + AbstractEditForm.UPDATE_AND_STAY_BUTTON_MARKUP_ID + "').click();"); return result; } }; parentPage.add(modal); modal.init(); modal.setEscapeModelStringsInQuestion(false); return modal; }
private ModalQuestionDialog createDeleteDialog(final AbstractEditPage<?, ?, ?> parentPage) { ModalQuestionDialog modal = new ModalQuestionDialog( parentPage.newModalDialogId(), new ResourceModel("attr.deletemodal.heading"), new ResourceModel("attr.deletemodal.question")) { @Override protected boolean onCloseButtonSubmit(final AjaxRequestTarget target) { final boolean result = super.onCloseButtonSubmit(target); // create a backup of the deleted attr row to restore it in case there is a validation error on submit backupOfDeletedAttrRow = selectedAttrRowModel.getObject(); entity.getTimeableAttributes().remove(backupOfDeletedAttrRow); // clear the content area to avoid the validation of input which will be deleted container.addOrReplace(new WebMarkupContainer("content")); // click the update and stay button which is invisible for the user target.appendJavaScript("$('#" + AbstractEditForm.UPDATE_AND_STAY_BUTTON_MARKUP_ID + "').click();"); return result; } }; parentPage.add(modal); modal.init(); modal.setEscapeModelStringsInQuestion(false); return modal; }