@Override public void afterInitialized(BaseComponent comp) { this.root = (Window) comp; root.setAttribute("controller", this); root.setTitle(root.getAttribute("title", "")); root.addClass("flavor:" + root.getAttribute("panelClass", "panel-primary")); prompt.setLabel(root.getAttribute("prompt", "")); textbox.setValue(root.getAttribute("oldValue", null)); textbox.selectAll(); updateState(); }
/** * Creates a property grid for the given target UI element. * * @param target UI element whose properties are to be edited. * @param parent Parent component for property grid (may be null). * @param embedded If true, the property grid is embedded within another component. * @return Newly created PropertyGrid instance. */ public static PropertyGrid create(ElementBase target, BaseComponent parent, boolean embedded) { Map<String, Object> args = new HashMap<>(); args.put("target", target); args.put("embedded", embedded); Window window = (Window) PageUtil.createPage(DesignConstants.RESOURCE_PREFIX + "propertyGrid.fsp", parent, args) .get(0); if (parent == null) { window.modal(null); } return window.getAttribute("controller", PropertyGrid.class); }
/** * Invokes the patient match dialog, displaying the specified list of patients. * * @param patientList List of patients from which to select. * @param callback Callback to receive the patient selected by the user or null if the operation * was canceled. */ public static void selectFromList(List<Patient> patientList, IResponseCallback<Patient> callback) { Map<String, Object> args = new HashMap<>(); args.put(Constants.RESULT_ATTRIB, patientList); Window window = (Window) PageUtil.createPage(Constants.RESOURCE_PREFIX + "patientMatches.fsp", null, args).get(0); window.modal(callback == null ? null : (event) -> { callback.onComplete(window.getAttribute(Constants.RESULT_ATTRIB, Patient.class)); }); }
/** * Displays the date range dialog. * * @param dateRange The initial date range. * @param callback Callback for returning a date range reflecting the inputs from the dialog. * This will be null if the input is cancelled or if an unexpected error occurs. */ public static void show(DateRange dateRange, IResponseCallback<DateRange> callback) { Map<String, Object> args = new HashMap<>(); args.put("dateRange", dateRange); Window dlg = (Window) PageUtil.createPage(DialogConstants.RESOURCE_PREFIX + "dateRangeDialog.fsp", null, args) .get(0); dlg.modal((event) -> { callback.onComplete((DateRange) dlg.getAttribute("result")); }); }
/** * Display the Layout Manager dialog * * @param rootElement The root UI element. */ public static void execute(ElementBase rootElement) { Window dlg = getInstance(true); dlg.getAttribute("controller", LayoutDesigner.class).init(rootElement); dlg.popup(null); }
/** * Prompt user for input. * * @param args The argument map. * @param callback The callback to receive the text input. If the dialog was cancelled, the text * input will be returned as null. */ public static void show(Map<String, Object> args, IInputCallback callback) { Window dialog = (Window) PageUtil .createPage(DialogConstants.RESOURCE_PREFIX + "inputDialog.fsp", ExecutionContext.getPage(), args).get(0); dialog.modal(callback == null ? null : (event) -> { callback.onComplete(dialog.getAttribute("result", String.class)); }); }
@Override public void afterInitialized(BaseComponent comp) { this.root = (Window) comp; root.setAttribute("controller", this); control = (DialogControl<?>) root.getAttribute("control"); root.setTitle(control.getTitle()); icon.addClass(control.getIconClass()); message.addClass(control.getTextClass()); message.setLabel(control.getMessage()); root.addClass(control.getPanelClass()); chkRemember.setVisible(root.hasAttribute("remember")); root.setOnCanClose(() -> { control.callback(response); return true; }); if (control.getFormat() == ChoiceFormat.BUTTONS) { processButtonResponses(); } else { processListResponses(); } }