Example usage for org.springframework.web.servlet.support RequestContext getMessage

List of usage examples for org.springframework.web.servlet.support RequestContext getMessage

Introduction

In this page you can find the example usage for org.springframework.web.servlet.support RequestContext getMessage.

Prototype

public String getMessage(String code, @Nullable Object[] args, boolean htmlEscape)
        throws NoSuchMessageException 

Source Link

Document

Retrieve the message for the given code.

Usage

From source file:gov.nih.nci.calims2.taglib.form.ButtonTag.java

private void addLabel(Tag tag) {
    if (labelKey != null) {
        RequestContext rc = TagHelper.getRequestContext(pageContext);
        tag.addAttribute("label", rc.getMessage(labelKey, null, false));
    } else {//from w  w  w .  jav a2s  .c om
        if (label != null) {
            tag.addAttribute("label", label);
        } else {
            tag.addAttribute("showLabel", "false");
        }
    }
}

From source file:gov.nih.nci.calims2.taglib.form.ValidationTextBoxTag.java

/**
 * Adds the invalid and prompt message to the current tag.
 * @param tag The tag to which the messages must be added.
 */// ww w.j av  a2  s  .  c o  m
protected void addMessages(Tag tag) {
    RequestContext rc = TagHelper.getRequestContext(pageContext);
    if (invalidKey != null) {
        tag.addAttribute("invalidMessage", rc.getMessage(invalidKey, null, false));
    } else {
        if (invalidMessage != null) {
            tag.addAttribute("invalidMessage", invalidMessage);
        }
    }
    if (promptKey != null) {
        tag.addAttribute("promptMessage", rc.getMessage(promptKey, null, false));
    } else {
        if (promptMessage != null) {
            tag.addAttribute("promptMessage", promptMessage);
        }
    }
    tag.addAttribute("toolTipPosition", toolTipPosition);
}

From source file:gov.nih.nci.calims2.taglib.form.FormWidgetTag.java

/**
 * Adds the attributes to the given tag.
 * /*from   w  w  w  . j  a  v  a2s .c om*/
 * @param tag The Tag on which the attributes must be set.
 */
protected void addAttributes(Tag tag) {
    if (altKey != null) {
        RequestContext rc = TagHelper.getRequestContext(pageContext);
        tag.addAttribute("alt", rc.getMessage(altKey, null, false));
    } else {
        tag.addAttribute("alt", alt);
    }
    tag.addAttribute("class", styleClass);
    if (disabled) {
        tag.addAttribute("disabled", "true");
    }
    tag.addAttribute("id", id);
    tag.addAttribute("name", name);
    if (readOnly) {
        tag.addAttribute("readOnly", "true");
    }
    tag.addAttribute("style", style);
    if (tabIndex != null) {
        tag.addAttribute("tabIndex", tabIndex.toString());
    }
    tag.addAttribute("type", type);
    if (value != null) {
        tag.addAttribute("value", value.toString());
    }
}

From source file:gov.nih.nci.calims2.taglib.form.SingleSelectTag.java

/**
 * Adds the invalid and prompt message to the current tag.
 * //from  w ww  .  jav a2  s .  c  o m
 * @param tag The tag to which the messages must be added.
 */
protected void addMessages(Tag tag) {
    RequestContext rc = TagHelper.getRequestContext(pageContext);
    if (getInvalidKey() != null) {
        tag.addAttribute("missingMessage", rc.getMessage(getInvalidKey(), null, false));
    } else {
        tag.addAttribute("missingMessage", getInvalidMessage());
    }
    if (getPromptKey() != null) {
        tag.addAttribute("promptMessage", rc.getMessage(getPromptKey(), null, false));
    } else {
        tag.addAttribute("promptMessage", getPromptMessage());
    }
    tag.addAttribute("toolTipPosition", getToolTipPosition());
}