Package org.openfaces.renderkit.table

Source Code of org.openfaces.renderkit.table.CheckboxColumnRenderer

/*
* OpenFaces - JSF Component Library 2.0
* Copyright (C) 2007-2012, TeamDev Ltd.
* licensing@openfaces.org
* Unless agreed in writing the contents of this file are subject to
* the GNU Lesser General Public License Version 2.1 (the "LGPL" License).
* This library 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.
* Please visit http://openfaces.org/licensing/ for more details.
*/
package org.openfaces.renderkit.table;

import org.openfaces.component.table.CheckboxColumn;
import org.openfaces.util.Styles;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;

/**
* @author Dmitry Pikhulya
*/
public class CheckboxColumnRenderer extends BaseColumnRenderer {
    @Override
    public boolean getRendersChildren() {
        return true;
    }

    @Override
    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
        CheckboxColumn checkboxColumn = (CheckboxColumn) component;
        if (!component.isRendered() || !checkboxColumn.getVisible())
            return;

        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("input", component);
        writer.writeAttribute("type", "checkbox", null);
        if (checkboxColumn.isDisabled()) {
            writer.writeAttribute("disabled", "disabled", null);
        }
        Styles.renderStyleClasses(context, component);
        writer.endElement("input");
    }


}
TOP

Related Classes of org.openfaces.renderkit.table.CheckboxColumnRenderer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.