/** Resolve a defaultible message which takes no arguments * @see #getMessage(String[], Object[]) * @param code An array of potential message codes to be looked up, in order * of priority. Each code will be looked up in turn and the resolved message * from the first which is found will be returned, if any. This strategy * matches that of Spring's MessageSourceResolvable. * @return message */ public String getMessage(String[] code) { return getMessage(code, null); }
/** @see BeanLocator#locateBean(String) */ public Object locateBean(String path) { return getMessage(new String[] { path }, null); }
/** @see BeanResolver#resolveBean(Object) */ public String resolveBean(Object bean) { return getMessage((String) bean, null); }
public String getMessage(String[] code, Object param) { return getMessage(code, new Object[] { param }); }
/** * @param code the code to lookup up, such as 'calculator.noRateSet' * @param args Array of arguments that will be filled in for params within the * message (params look like "{0}", "{1,date}", "{2,time}" within a * message), or <code>null</code> if none. * @return the resolved message, or a default message if not found. */ public String getMessage(String code, Object[] args) { return getMessage(new String[] { code }, args); }
public String resolve(MessageLocator locator) { return message == null? locator.getMessage(messagecodes, args) : message; }
public String getMessage(String code) { return getMessage(code, (Object[]) null); }
public String getMessage(String code, Object param) { return getMessage(new String[] { code }, new Object[] { param }); }
public void processComponent(UIComponent toprocesso) { if (toprocesso instanceof UIMessage) { UIMessage toprocess = (UIMessage) toprocesso; toprocess.setValue(messagelocator.getMessage(toprocess.messagekeys, toprocess.arguments)); } }
/** * Renders the entire contents of this message list into a list of localised * messages, using the supplied <code>MessageLocator</code> * @param locator messages * @return localized messages */ public StringList render(MessageLocator locator) { StringList togo = new StringList(); for (int i = 0; i < size(); ++i) { TargettedMessage message = messageAt(i); togo.add(message.message != null? message.message : locator.getMessage(message.messagecodes, message.args)); } return togo; }
public void fillComponents(UIContainer tofill, ViewParameters viewparamso, ComponentChecker checker) { if (uvbbean.paths != null && uvbbean.values != null) { for (int i = 0; i < uvbbean.paths.length; ++i) { String path = uvbbean.paths[i]; Object bean = uvbbean.values[i]; UIOutput out = UIOutput.make(tofill, ":" + i, jsonProvider.toString(bean)); out.decorators = new DecoratorList(new UIIDStrategyDecorator(path)); } } for (int i = 0; i < tml.size(); ++i) { TargettedMessage message = tml.messageAt(i); String rendered = message.message != null? message.message : messageLocator.getMessage(message.messagecodes, message.args); UIOutput out = UIOutput.make(tofill, "tml:" + i, rendered); Map attrmap = new HashMap(); attrmap.put("target", message.targetid); attrmap.put("severity", message.severity == TargettedMessage.SEVERITY_ERROR ? "error" : "info"); out.decorators = new DecoratorList(new UIFreeAttributeDecorator(attrmap)); out.decorators.add(UIIDStrategyDecorator.ID_FULL); } }
/** Render a template message into an "ad hoc" UIMessage component * */ public UIMessage renderMessage(UIContainer basecontainer, String id, String key) { // attach to base container so that full ID can be computed by default algorithm - // RSF-71 String addId = id == null? "" : id; UIComponent existing = basecontainer.getComponent(addId); if (existing != null) { basecontainer.remove(existing); } UIMessage togo = UIMessage.make(basecontainer, addId, key); String message = messagelocator.getMessage(togo.messagekeys, togo.arguments); if (message == null) { message = MessageUtil.renderDefaultMessage(key); } togo.setValue(message); return togo; }
toprocess.setValue(messagelocator.getMessage(toprocess.messagekeys, toprocess.arguments));