private String formatResult(String id, Object... args) { return StrUtil.getLabel("org.fujion.console.cache." + id + ".result", args); }
/** * Returns a formatted message given a label identifier. * * @param id A label identifier. * @param args Optional replaceable parameters. * @return The formatted label. */ public static String getLabel(String id, Object... args) { return getLabel(id, null, args); }
/** * Returns the text for the specified label id. * * @param labelId The id of the label value to locate. If no prefix is present, the id is * prefixed with "patient.selection.demographic.label." to find the associated value. * @return Label text. */ protected String getDemographicLabel(String labelId) { return StrUtil.getLabel(labelId.contains(".") ? labelId : "patientselection.demographic.label." + labelId); }
/** * Returns the label value for the specified key. * * @param key Key for label. * @return The label value, or the original key value if no label value found. */ private String getLabel(String key) { String label = StrUtil.getLabel("cwf.shell.about." + key.toString()); return label == null ? key : label; } }
/** * Returns a label value given its id. Recognizes placeholders in label names, replacing them * with the default label prefix. * * @param labelId Id of the label sought. * @param placeholder Placeholder value to substitute. * @return The label value, or the default value if none found. */ protected String getLabel(String labelId, String placeholder) { return placeholder == null ? null : StrUtil.getLabel(labelId.replace("%", placeholder)); }
/** * Label names must be prefixed with "@msg." to be recognized as such. */ @Override public String getProperty(String name) { return name.startsWith(LABEL_PREFIX) ? StrUtil.getLabel(name.substring(LABEL_PREFIX.length())) : null; }
/** * Returns the value of the button's caption text. * * @return The button's caption text. */ public String getCaption() { return caption != null && caption.toLowerCase().startsWith("label:") ? StrUtil.getLabel(caption.substring(6)) : caption; }
/** * Returns a label from a label reference. * * @param label Label reference with placeholder for mode. * @param params Optional parameters. * @return Fully formatted label value. */ public String getLabel(String label, Object... params) { return StrUtil.getLabel(format(label), params); }
/** * 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; }
/** * Formats a message. If the message begins with "@", the remainder is assumed to be a label * name that is resolved. * * @param msg Message to format or, if starts with "@", a label reference. * @param locale Optional locale * @param args Optional replaceable parameters. * @return The formatted message. */ public static String formatMessage(String msg, Locale locale, Object... args) { if (msg == null || msg.isEmpty()) { return msg; } String message = msg.startsWith("@") ? getLabel(msg, locale, args) : null; if (message == null && args != null && args.length > 0) { message = String.format(locale == null ? Localizer.getDefaultLocale() : locale, msg, args); } return message == null ? msg : message; }
@EventHandler(value = "click", target = "btnLogout") private void onClick$btnLogout() { logout(StrUtil.getLabel("cwf.sessionmonitor.logout.reason.message")); }
/** * Sets the detail open state. * * @param doOpen The detail open state. */ private void setDetail(boolean doOpen) { detail.setOpen(doOpen); detail.setLabel( StrUtil.getLabel(doOpen ? "cwf.error.dialog.detail.open.label" : "cwf.error.dialog.detail.closed.label")); }
/** * Displays the specified message. The list box is hidden if the message is not empty. * * @param message Message to display. */ private void showMessage(String message) { message = message == null ? null : StrUtil.getLabel(message); lblNoResultsFound.setLabel(message); lblNoResultsFound.setVisible(!StringUtils.isEmpty(message)); tblSrchResults.setVisible(!lblNoResultsFound.isVisible()); }
/** * @param dataObject Data Object * @param drillDownDisplayClass Drill down display class * @param glyph1 Icon mouseout * @param glyph2 Icon mouseover * @param hint hint text */ public DrillDownIconBase(T dataObject, Class<?> drillDownDisplayClass, String glyph1, String glyph2, String hint) { this.dataObject = dataObject; this.drillDownDisplayClass = drillDownDisplayClass; setSrc(glyph1); //TODO: setHover(glyph2 == null ? glyph1 : glyph2); setHint(hint != null ? hint : StrUtil.getLabel(TOOLTIP)); addClass(Constants.SCLASS_DRILLDOWN_LINK); attachEventListener(); }
@Test public void testBundle() { Localizer.registerMessageSource(new BundleMessageSource()); Locale locale1 = new Locale("en"); Locale locale2 = new Locale("fr"); assertEquals("keyboard", StrUtil.getLabel("message.test1", locale1)); assertEquals("clavier", StrUtil.getLabel("message.test1", locale2)); }
private void refreshScenarios() { cboScenarios.setSelectedItem(null); model.clear(); model.addAll(scenarioRegistry.getAll()); cboScenarios.setPlaceholder( StrUtil.getLabel(model.isEmpty() ? "cwf.scenario.cbox.placeholder.none" : "cwf.scenario.cbox.placeholder")); Collections.sort(model, scenarioComparator); CWFUtil.disableChildren(scenarioButtons, true); }
/** * Aborts any shutdown in progress. * * @param message Optional message to send to user. */ public void abortShutdown(String message) { if (shutdown) { updateShutdown(0); message = StringUtils.isEmpty(message) ? StrUtil.getLabel("cwf.sessionmonitor.shutdown.abort.message") : message; MessageWindow mw = page.getChild(MessageWindow.class); if (mw != null) { MessagePane mp = new MessagePane(); mp.setTitle(StrUtil.getLabel("cwf.sessionmonitor.shutdown.abort.title")); mp.addClass("flavor:alert-success"); mp.addChild(new Label(message)); mw.addChild(mp); } else { DialogUtil.showInfo(message); } } }
@EventHandler(value = "click", target = "btnUnlock") private void onClick$btnUnlock() { String s = txtPassword.getValue(); txtPassword.setValue(null); lblInfo.setLabel(null); txtPassword.focus(); if (!StringUtils.isEmpty(s)) { if (securityService.validatePassword(s)) { setMode(Mode.BASELINE); } else { lblInfo.setLabel(StrUtil.getLabel("cwf.sessionmonitor.lock.badpassword.message")); } } }
protected PropertyEditorCustom() { super(new Popupbox()); //editor.setAutodrop(false); editor.setReadonly(true); editor.setPlaceholder(StrUtil.getLabel("cwf.shell.designer.propedit.custom.component.prompt")); editor.addEventListener(OpenEvent.class, (event) -> { doOpen(); }); editor.addEventListener(CloseEvent.class, (event) -> { doClose(); }); popup = new Popup(); editor.addChild(popup); }
category = StrUtil.getLabel("cwf.shell.plugin.category.default"); } else { return null;