1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.component.visit;
20
21 import java.io.Serializable;
22 import java.util.Collection;
23 import java.util.Iterator;
24 import java.util.Set;
25
26 import javax.faces.FactoryFinder;
27 import javax.faces.component.UIComponent;
28 import javax.faces.context.FacesContext;
29
30
31
32
33
34
35
36 public abstract class VisitContext
37 {
38 public static final Collection<String> ALL_IDS = new AllIdsCollection();
39
40 public static VisitContext createVisitContext(FacesContext context)
41 {
42 VisitContextFactory factory = (VisitContextFactory) FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY);
43 return factory.getVisitContext(context, null, null);
44 }
45
46 public static VisitContext createVisitContext(FacesContext context, Collection<String> ids, Set<VisitHint> hints)
47 {
48 VisitContextFactory factory = (VisitContextFactory) FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY);
49 return factory.getVisitContext(context, ids, hints);
50 }
51
52 public abstract FacesContext getFacesContext();
53
54 public abstract Set<VisitHint> getHints();
55
56 public abstract Collection<String> getIdsToVisit();
57
58 public abstract Collection<String> getSubtreeIdsToVisit(UIComponent component);
59
60 public abstract VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback);
61
62 private static class AllIdsCollection implements Collection<String>, Serializable
63 {
64 public boolean add(String e)
65 {
66 throw new UnsupportedOperationException();
67 }
68
69 public boolean addAll(Collection<? extends String> c)
70 {
71 throw new UnsupportedOperationException();
72 }
73
74 public void clear()
75 {
76 throw new UnsupportedOperationException();
77 }
78
79 public boolean contains(Object o)
80 {
81 throw new UnsupportedOperationException();
82 }
83
84 public boolean containsAll(Collection<?> c)
85 {
86 throw new UnsupportedOperationException();
87 }
88
89 public boolean isEmpty()
90 {
91 return false;
92 }
93
94 public Iterator<String> iterator()
95 {
96 throw new UnsupportedOperationException();
97 }
98
99 public boolean remove(Object o)
100 {
101 throw new UnsupportedOperationException();
102 }
103
104 public boolean removeAll(Collection<?> c)
105 {
106 throw new UnsupportedOperationException();
107 }
108
109 public boolean retainAll(Collection<?> c)
110 {
111 throw new UnsupportedOperationException();
112 }
113
114 public int size()
115 {
116 throw new UnsupportedOperationException();
117 }
118
119 public Object[] toArray()
120 {
121 throw new UnsupportedOperationException();
122 }
123
124 public <T> T[] toArray(T[] a)
125 {
126 throw new UnsupportedOperationException();
127 }
128 }
129 }