1 24 package org.riotfamily.forms; 25 26 27 28 29 public class MessageUtils { 30 31 public static String getMessage(Element element, String key) { 32 return getMessage(element, key, null, key); 33 } 34 35 public static String getMessage(Element element, String key, 36 Object [] args, String defaultMessage) { 37 38 FormContext context = element.getForm().getFormContext(); 39 return context.getMessageResolver().getMessage( 40 key, args, defaultMessage); 41 } 42 43 public static String getLabel(Element element, EditorBinding binding) { 44 FormContext context = element.getForm().getFormContext(); 45 return context.getMessageResolver().getPropertyLabel( 46 element.getForm().getId(), binding.getBeanClass(), 47 binding.getProperty()); 48 } 49 50 public static String getHint(Element element, EditorBinding binding) { 51 FormContext context = element.getForm().getFormContext(); 52 return context.getMessageResolver().getPropertyHint( 53 element.getForm().getId(), binding.getBeanClass(), 54 binding.getProperty()); 55 } 56 57 public static String getHint(Form form, Class beanClass) { 58 FormContext context = form.getFormContext(); 59 return context.getMessageResolver().getPropertyHint( 60 form.getId(), beanClass, null); 61 } 62 } 63 | Popular Tags |