Simple template based Dialog:
Java Code:
ShowDialogAction dAction = new ShowDialogAction(user, "News Popup", null, 600, 500, TemplateConstants.TEMPL_NEWS_POPUP, true); dAction.putTemplateVar("time", (user != null ? user.getLocale().formatDateTimeShort(new Date(note.getCreatedTime())) : new Date(note.getCreatedTime()).toString())); dAction.putTemplateVar("classification", note.getMessageClassification()); dAction.putTemplateVar("title", subject); dAction.putTemplateVar("text", text); GeneralTool.getSession(request).getAJAXResponse(request.hashCode()).addAction(dAction);
Template: NewsPopup.html
<div style="height: 100%"> <div id="popupDialogContent_DIV" class="jax-popup-content-area"> <div class="jax-popup-title"><span>${title!""}</span><span style="position:relative;float: right;"><img title="${NLS_button_close}" src="_images/cancel_16x16.gif" onclick="javascript:modalMessage.close();"></img></span> </div> <div id="popupDialogHolder_DIV" class="jax-popup-content-holder-area"> <div id="popupDialogVisualizer_DIV" class="jax-popup-content-visualizer-area"> ${text!""} </div> <div id="popupDialogControlButtons_DIV" class="jax-popup-control-button-area"> <table> <tr> <td width="100%" align="right" style="vAlign:bottom;"> </td> <td style="${cancelStyle!""}" align="left"><input type="button" onclick="javascript:modalMessage.close();${okAction!""}" title="${NLS_button_ok}" value="${NLS_button_ok}" name="DEFAULT_ENTER_BUTTON_POPUP"/> </td> </tr> </table> </div> </div> </div>
Extended Dialog using ContentProvider
HTMLFieldDialogContentProvider cp = new ReceipedOKDialogContentProvider(TemplateConstants.TEMPL_STANDARD_CONFIRM_DIALOG_CONTROL_HTML);// TemplateConstants.TEMPL_STANDARD_CONFIRM_DIALOG_CONTROL_HTML cp.setTitle(title); cp.addDialogActionButton(new DialogActionButton(ShowDialogAction.ACTION_ID_OK_DIALOG, user.getNLS("button_listDialog_ok"), null, 0) { @Override public boolean perform(HttpServletRequest request, DialogContentProvider provider) { if (hasAccess) { HttpRequestCopy requestCopy = new HttpRequestCopy(request); requestCopy.setParameter("uuid", ArrayUtil.toString(((AbstractSearchHandler) handler).getSelectedRowIds(), ";")); ApplicationServlet.doPerformAction(requestCopy, response, getDeleteActionName()); ProtokolAction.clickHTMLSearchButton(handler.getDOM(), 100); } else { NotificationManager.showStatusBarMessage(request, "Deletion not allowed!.", NOTIFY_CLASSES.ERROR); } return super.perform(request, provider); } }); cp.addDialogActionButton(new DialogActionButton(ShowDialogAction.ACTION_ID_CANCEL_DIALOG, user.getNLS("button_cancel"), null, 1)); cp.setContentHandler(handler); ShowDialogAction.showOKCancelUserRequestedServerSideMessage(request, title, cp);