Package org.openfaces.taglib

Source Code of org.openfaces.taglib.TagUtil

/*
* 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.taglib;

import org.openfaces.component.CompoundComponent;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.util.Map;

/**
* @author Dmitry Pikhulya
*/
public class TagUtil {

    private TagUtil() {
    }

    public static void initComponentChildren(FacesContext facesContext, UIComponent component) {
        if (!(component instanceof CompoundComponent))
            return;

        Map<String, Object> attributes = component.getAttributes();
        if (attributes.containsKey("_of_childrenCreated"))
            return; // avoid repetitive initializations under Facelets (Facelets tag handlers are processed on each rendering)
        attributes.put("_of_childrenCreated", Boolean.TRUE);

        CompoundComponent compoundComponent = ((CompoundComponent) component);
        compoundComponent.createSubComponents(facesContext);
    }
}
TOP

Related Classes of org.openfaces.taglib.TagUtil

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.