/** * Show an error message with the default title. * * @param message Text message */ public static void showError(String message) { showError(message, "@fujion.prompt.error.title"); }
/** * Show an exception message with the default title. * * @param e Exception to display. */ public static void showError(Throwable e) { showError(CWFUtil.formatExceptionForDisplay(e)); }
/** * Invokes the property grid with this element as its target. */ public void editProperties() { try { PropertyGrid.create(this, null); } catch (Exception e) { DialogUtil.showError("Displaying property grid: \r\n" + e.toString()); } }
/** * Common entry point for displaying an about dialog. * * @param params Parameter map for about dialog. */ private static void showDialog(AboutParams params) { try { Map<String, Object> args = Collections.singletonMap("params", params); Window dlg = (Window) PageUtil.createPage(Constants.RESOURCE_PREFIX + "aboutDialog.fsp", null, args).get(0); dlg.modal(null); } catch (Exception e) { DialogUtil.showError(CWFUtil.formatExceptionForDisplay(e)); } }
/** * Commits all changes. * * @return True if the operation was successful. */ private boolean doCommit() { if (!hasRequired()) { return false; } populateDomainObject(domainObject); try { commit(domainObject); changeSet.clear(); return true; } catch (Exception e) { DialogUtil.showError(e); return false; } }
/** * Returns the patient selector factory based on the PATIENT.SELECTION.SELECTOR property. If * this property is not set, the first registered factory is returned. * * @return The patient selector factory. */ private static IPatientSelectorFactory getFactory() { String factoryBeanId; IPatientSelectorFactory factory; PatientSelectorRegistry registry = PatientSelectorRegistry.getInstance(); try { factoryBeanId = PropertyUtil.getValue("PATIENT.SELECTION.SELECTOR"); } catch (Exception e) { factoryBeanId = null; } factory = factoryBeanId == null ? null : registry.get(factoryBeanId); if (factory == null) { Iterator<IPatientSelectorFactory> iterator = registry.iterator(); if (iterator.hasNext()) { factory = iterator.next(); } else { DialogUtil.showError("@patientselection.error.no.selectors"); } } return factory; }
/** * Returns true if this user has patient selection privilege. * * @param showMessage If true and the user does not have the required privilege, displays an * error dialog. * @return True if user can select patients. */ public static boolean canSelect(boolean showMessage) { boolean result = SecurityUtil.isGranted("PRIV_PATIENT_SELECT"); if (!result && showMessage) { DialogUtil.showError(StrUtil.getLabel(Constants.LBL_CANNOT_SELECT_MESSAGE), StrUtil.getLabel(Constants.LBL_CANNOT_SELECT_TITLE)); } return result; }
/** * Show detail for specified component. * * @param item The component containing the model object. */ protected void showDetail(BaseComponent item) { @SuppressWarnings("unchecked") M modelObject = item == null ? null : (M) item.getData(); String detail = modelObject == null ? null : getDetail(modelObject); if (!StringUtils.isEmpty(detail)) { if (getShowDetailPane()) { detailView.setContent(detail); } else { Map<String, Object> map = new HashMap<>(); map.put("title", detailTitle); map.put("content", detail); map.put("allowPrint", getAllowPrint()); try { Window window = (Window) PageUtil .createPage(Constants.RESOURCE_PREFIX + "resourceListDetailPopup.fsp", null, map).get(0); window.modal(null); } catch (Exception e) { DialogUtil.showError(e); } } } }
/** * Loads a layout from the specified resource. * * @param resource The layout resource to load. * @throws Exception Unspecified exception. */ public void loadLayout(String resource) throws Exception { layout = LayoutParser.parseResource(resource); FrameworkUtil.setAppName(layout.getName()); if (layout.isEmpty()) { DialogUtil.showError(LBL_NO_LAYOUT); } else { buildUI(layout); } }
@EventHandler(value = "click", target = "@btnDelete") private void onClick$btnDelete() { IBaseResource resource = getSelectedResource(); DialogUtil.confirm("Delete " + FhirUtil.getResourceIdPath(resource, true) + "?", "Delete Resource", (confirm) -> { if (confirm) { try { fhirService.deleteResource(resource); model.remove(resource); root.setAttribute("modified", true); updateCaption(); displayResource(); } catch (Exception e) { DialogUtil.showError("Error deleting resource:\n\n" + CWFUtil.formatExceptionForDisplay(e)); } } }); }
DialogUtil.showError(e); log.error("Error materializing page", e);