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
43 = (VisitContextFactory) FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY);
44 return factory.getVisitContext(context, null, null);
45 }
46
47 public static VisitContext createVisitContext(FacesContext context, Collection<String> ids, Set<VisitHint> hints)
48 {
49 VisitContextFactory factory
50 = (VisitContextFactory) FactoryFinder.getFactory(FactoryFinder.VISIT_CONTEXT_FACTORY);
51 return factory.getVisitContext(context, ids, hints);
52 }
53
54 public abstract FacesContext getFacesContext();
55
56 public abstract Set<VisitHint> getHints();
57
58 public abstract Collection<String> getIdsToVisit();
59
60 public abstract Collection<String> getSubtreeIdsToVisit(UIComponent component);
61
62 public abstract VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback);
63
64 private static class AllIdsCollection implements Collection<String>, Serializable
65 {
66 public boolean add(String e)
67 {
68 throw new UnsupportedOperationException();
69 }
70
71 public boolean addAll(Collection<? extends String> c)
72 {
73 throw new UnsupportedOperationException();
74 }
75
76 public void clear()
77 {
78 throw new UnsupportedOperationException();
79 }
80
81 public boolean contains(Object o)
82 {
83 throw new UnsupportedOperationException();
84 }
85
86 public boolean containsAll(Collection<?> c)
87 {
88 throw new UnsupportedOperationException();
89 }
90
91 public boolean isEmpty()
92 {
93 return false;
94 }
95
96 public Iterator<String> iterator()
97 {
98 throw new UnsupportedOperationException();
99 }
100
101 public boolean remove(Object o)
102 {
103 throw new UnsupportedOperationException();
104 }
105
106 public boolean removeAll(Collection<?> c)
107 {
108 throw new UnsupportedOperationException();
109 }
110
111 public boolean retainAll(Collection<?> c)
112 {
113 throw new UnsupportedOperationException();
114 }
115
116 public int size()
117 {
118 throw new UnsupportedOperationException();
119 }
120
121 public Object[] toArray()
122 {
123 throw new UnsupportedOperationException();
124 }
125
126 public <T> T[] toArray(T[] a)
127 {
128 throw new UnsupportedOperationException();
129 }
130 }
131 }