Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
License Agreement. Rich Faces - Natural Ajax for Java Server Faces (JSF) Copyright (C) 2007 Exadel, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
package org.richfaces.component;
import  javax.faces.component.UIComponent;
import  javax.faces.context.ExternalContext;
import  javax.faces.context.FacesContext;
import  org.richfaces.log.Logger;
import  org.richfaces.log.RichfacesLogger;

Nick Belaevski
public final class QueueRegistry {
    public static final String QUEUE_SCRIPT_ID = "_org_richfaces_queue";
    private static final Logger LOGGER = RichfacesLogger.COMPONENTS.getLogger();
    private static final String REGISTRY_ATTRIBUTE_NAME = QueueRegistry.class.getName();
    private Map<String, UIComponent> queuesData = new LinkedHashMap<String, UIComponent>();
    private QueueRegistry() {
    public static QueueRegistry getInstance(FacesContext context) {
        ExternalContext externalContext = context.getExternalContext();
        Map<StringObjectrequestMap = externalContext.getRequestMap();
        QueueRegistry registry = (QueueRegistryrequestMap.get();
        if (registry == null) {
            registry = new QueueRegistry();
        return registry;
    public void addQueue(String clientName, UIComponent component) {
        if (!containsQueue(clientName)) {
        } else {
            .warn("Queue with name '" + clientName + "' has already been registered");
    public UIComponent removeQueue(String clientName) {
        return .remove(clientName);
    public boolean containsQueue(String name) {
        return .containsKey(name);
    public Map<String, UIComponent> getRegisteredQueues() {
        return ;
    public boolean hasQueuesToEncode() {
        if (.isEmpty()) {
            return false;
        for (Map.Entry<String, UIComponent> queue : .entrySet()) {
            if (queue.getValue().isRendered()) {
                return true;
        return false;
New to GrepCode? Check out our FAQ X