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

📄 abstractuicomponenttag.java

📁 Please read your package and describe it at least 40 bytes in English. System will automatically de
💻 JAVA
字号:
/* * Copyright 2002-2004 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package de.mindmatters.faces.taglib.jsp;import javax.faces.component.UIComponent;import javax.faces.webapp.UIComponentTag;/** * <strong>AbstractUIComponentTag</strong> is a convenience base class that * implements helper methods needed for any concrete jsp tag. *  * @author Andreas Kuhrwahl *  */public abstract class AbstractUIComponentTag extends UIComponentTag {    /**     * Adds a value binding for the property with name <code>propName</code>     * to the UIComponent <code>component</code> if and only if     * <code>value</code> is a reference expression.     *      * @param component     *            The associated UIComponent     * @param propName     *            The name of the property     * @param value     *            Maybe a reference expression     * @return <code>true</code> if <code>value</code> is a reference     *         expression <code>false</code> otherwise     */    protected final boolean addValueBindingIfNecessary(            final UIComponent component, final String propName,            final String value) {        boolean isValueReference = false;        if (value != null) {            isValueReference = isValueReference(value);            if (isValueReference) {                component.setValueBinding(propName, getFacesContext()                        .getApplication().createValueBinding(value));            }        }        return isValueReference;    }    /**     * Adds a value binding for the property with name <code>propName</code>     * to the UIComponent <code>component</code> if and only if     * <code>value</code> is a reference expression otherwise an attribute     * with key <code>propName</code> and value <code>value</code>.     *      * @param component     *            The associated UIComponent     * @param propName     *            The name of the property     * @param value     *            Maybe a reference expression     */    protected final void setStringProperty(final UIComponent component,            final String propName, final String value) {        if (value != null) {            if (isValueReference(value)) {                component.setValueBinding(propName, getFacesContext()                        .getApplication().createValueBinding(value));            } else {                component.getAttributes().put(propName, value);            }        }    }    /**     * Adds a value binding for the property with name <code>propName</code>     * to the UIComponent <code>component</code> if and only if     * <code>value</code> is a reference expression otherwise an boolean     * attribute with key <code>propName</code> and value <code>value</code>.     *      * @param component     *            The associated UIComponent     * @param propName     *            The name of the property     * @param value     *            Maybe a reference expression     */    protected final void setBooleanProperty(final UIComponent component,            final String propName, final String value) {        if (value != null) {            if (isValueReference(value)) {                component.setValueBinding(propName, getFacesContext()                        .getApplication().createValueBinding(value));            } else {                component.getAttributes().put(propName, Boolean.valueOf(value));            }        }    }}

⌨️ 快捷键说明

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