⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectvalueflowtag.java

📁 一个很好的开源项目管理系统源代码
💻 JAVA
字号:
package net.java.workeffort.infrastructure.jsptags;import java.util.Locale;import javax.servlet.jsp.JspException;import net.java.htmltag.BaseInputTag;import org.apache.commons.lang.StringUtils;import org.springframework.ui.context.Theme;import org.springframework.web.util.ExpressionEvaluationUtils;/** * Set value of field using page flow. * <p> * The image is picked up from the theme properties file. This file should have * an entry for 'pageFlowLov.img' See workeffort.tld for attribute details. * @author Antony Joseph */public class SelectValueFlowTag extends BaseInputTag {    /**     * @see javax.servlet.jsp.tagext.Tag#doStartTag()     */    public int doStartTagInternal() throws JspException {        setReadonly(ExpressionEvaluationUtils.evaluateString("readonly",                getReadonly(), pageContext));        setDisabled(ExpressionEvaluationUtils.evaluateString("disabled",                getDisabled(), pageContext));        // set the type of the input element.        setType("text");        StringBuffer js = new StringBuffer();        // The onclick should be rendered on the accompanying button of the        // page flow lov and *not* the text field.        String valOnclick = getOnclick();        setOnclick(null);        // render the text field.        js.append(renderInputElement());        valOnclick = ExpressionEvaluationUtils.evaluateString("onclick",                valOnclick, pageContext);        // render the accompanying button        //js.append("\n<input type=\"button\" onclick=\"");        js.append("\n<input type=\"image\" src=\"");        js.append(getImageSrc());        js.append("\" onclick=\"");        js.append(valOnclick);        js.append("\"");        // disable the button as needed        if ("true".equals(getReadonly()) || "true".equals(getDisabled())) {            js.append(" disabled=\"disabled\" ");        }        js.append(" id=\"");        js.append(createLovBtnId());        js.append("\"");        js.append("/>\n");        write(js.toString());        return SKIP_BODY;    }    private String createLovBtnId() {        String property = getProperty();        return StringUtils.replaceChars(property, "[].", null) + "SelectValue";    }    /**     * @return Returns the errorStyleClass.     */    public String getErrorStyleClass() {        return (getStyleClass() == null) ? null : getStyleClass() + "Error";    }    private String getImageSrc() {        Locale locale = getRequestContext().getLocale();        Theme theme = getRequestContext().getTheme();        if (theme != null)            return theme.getMessageSource().getMessage("pageFlowLov.img", null,                    locale);        else            return null;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -