/* * Copyright (C) 2007 Jonathan Craven * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package fr.craven.test.jsf; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.webapp.UIComponentTag; /** * Exemple d'une classe tag pour un composant JSF fait à la main. * * @author Jonathan Craven */ public class TableauTag extends UIComponentTag { /** Creates a new instance of TableauTag */ public TableauTag() { } private String contenu; private String styleClass; public String getContenu() { return contenu; } public void setContenu(String contenu) { this.contenu = contenu; } public String getStyleClass() { return styleClass; } public void setStyleClass(String styleClass) { this.styleClass = styleClass; } public String getComponentType() { return "fr.craven.test.jsf.Tableau"; } public String getRendererType() { return null; } public void setProperties(UIComponent uic) { super.setProperties(uic); if (styleClass != null) setProperty(uic, "styleClass", styleClass); if (contenu != null) setProperty(uic, "contenu", contenu); return; } private void setProperty(UIComponent uic, String attribute, String value) { if (isValueReference(value)) uic.setValueBinding(attribute, FacesContext.getCurrentInstance().getApplication().createValueBinding(value)); else uic.getAttributes().put(attribute, value); return; } public void release() { super.release(); styleClass = null; contenu = null; return; } }