All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.faces.component.visit.VisitContext Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 javax.faces.component.visit;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

import javax.faces.FactoryFinder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

/**
 * @author Simon Lessard (latest modification by $Author: bommel $)
 * @version $Revision: 1187700 $ $Date: 2011-10-22 07:19:37 -0500 (Sat, 22 Oct 2011) $
 * 
 * @since 2.0
 */
public abstract class VisitContext
{
    public static final Collection ALL_IDS = new AllIdsCollection();

    public static VisitContext createVisitContext(FacesContext context)
    {
        VisitContextFactory factory = (VisitContextFactory) FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY);
        return factory.getVisitContext(context, null, null);
    }

    public static VisitContext createVisitContext(FacesContext context, Collection ids, Set hints)
    {
        VisitContextFactory factory = (VisitContextFactory) FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY);
        return factory.getVisitContext(context, ids, hints);
    }

    public abstract FacesContext getFacesContext();

    public abstract Set getHints();

    public abstract Collection getIdsToVisit();

    public abstract Collection getSubtreeIdsToVisit(UIComponent component);

    public abstract VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback);

    private static class AllIdsCollection implements Collection, Serializable
    {
        public boolean add(String e)
        {
            throw new UnsupportedOperationException();
        }

        public boolean addAll(Collection c)
        {
            throw new UnsupportedOperationException();
        }

        public void clear()
        {
            throw new UnsupportedOperationException();
        }

        public boolean contains(Object o)
        {
            throw new UnsupportedOperationException();
        }

        public boolean containsAll(Collection c)
        {
            throw new UnsupportedOperationException();
        }

        public boolean isEmpty()
        {
            return false;
        }

        public Iterator iterator()
        {
            throw new UnsupportedOperationException();
        }

        public boolean remove(Object o)
        {
            throw new UnsupportedOperationException();
        }

        public boolean removeAll(Collection c)
        {
            throw new UnsupportedOperationException();
        }

        public boolean retainAll(Collection c)
        {
            throw new UnsupportedOperationException();
        }

        public int size()
        {
            throw new UnsupportedOperationException();
        }

        public Object[] toArray()
        {
            throw new UnsupportedOperationException();
        }

        public  T[] toArray(T[] a)
        {
            throw new UnsupportedOperationException();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy