Search in sources :

Example 1 with LabelTagUtils

use of org.mifos.framework.util.helpers.LabelTagUtils in project head by mifos.

the class Column method getLabelText.

private String getLabelText(PageContext pageContext, String key, String bundle) {
    UserContext userContext = (UserContext) pageContext.getSession().getAttribute(Constants.USER_CONTEXT_KEY);
    LabelTagUtils labelTagUtils = LabelTagUtils.getInstance();
    String labelText = null;
    try {
        labelText = labelTagUtils.getLabel(pageContext, bundle, userContext.getPreferredLocale(), key, null);
    } catch (Exception e) {
    }
    if (StringUtils.isBlank(labelText)) {
        labelText = ApplicationContextProvider.getBean(MessageLookup.class).lookup(key);
    }
    if (StringUtils.isBlank(labelText)) {
        try {
            char[] charArray = bundle.toCharArray();
            charArray[0] = Character.toUpperCase(charArray[0]);
            String newBundle = new String(charArray);
            labelText = labelTagUtils.getLabel(pageContext, newBundle, userContext.getPreferredLocale(), key, null);
        } catch (Exception e) {
            labelText = key;
        }
    }
    return labelText;
}
Also used : UserContext(org.mifos.security.util.UserContext) LabelTagUtils(org.mifos.framework.util.helpers.LabelTagUtils) InvocationTargetException(java.lang.reflect.InvocationTargetException) TableTagParseException(org.mifos.framework.exceptions.TableTagParseException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 TableTagParseException (org.mifos.framework.exceptions.TableTagParseException)1 LabelTagUtils (org.mifos.framework.util.helpers.LabelTagUtils)1 UserContext (org.mifos.security.util.UserContext)1