View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package javax.faces.component.search;
20  
21  import java.util.List;
22  import javax.faces.component.ContextCallback;
23  import javax.faces.component.UIComponent;
24  import javax.faces.context.FacesContext;
25  
26  /**
27   *
28   */
29  public abstract class SearchExpressionHandler
30  {
31  
32      protected static final char[] EXPRESSION_SEPARATOR_CHARS = new char[]
33      {
34          ',', ' '
35      };
36      public static final String KEYWORD_PREFIX = "@";
37  
38      public abstract String resolveClientId(SearchExpressionContext searchExpressionContext, String expression);
39  
40      public abstract List<String> resolveClientIds(
41              SearchExpressionContext searchExpressionContext, String expressions);
42  
43      public abstract void resolveComponent(SearchExpressionContext searchExpressionContext, String expression,
44              ContextCallback callback);
45  
46      public abstract void resolveComponents(SearchExpressionContext searchExpressionContext, String expressions,
47              ContextCallback callback);
48  
49      public void invokeOnComponent(SearchExpressionContext searchExpressionContext,
50              String expressions, ContextCallback topCallback)
51      {
52          invokeOnComponent(searchExpressionContext, searchExpressionContext.getSource(), expressions, topCallback);
53      }
54  
55      public abstract void invokeOnComponent(SearchExpressionContext searchExpressionContext,
56              UIComponent previous, String expression, ContextCallback topCallback);
57  
58      public abstract String[] splitExpressions(FacesContext context, String expressions);
59  
60      public abstract boolean isPassthroughExpression(SearchExpressionContext searchExpressionContext, String expression);
61  
62      public abstract boolean isValidExpression(SearchExpressionContext searchExpressionContext, String expression);
63      
64      public char[] getExpressionSeperatorChars(FacesContext context)
65      {
66          return EXPRESSION_SEPARATOR_CHARS;
67      }
68  
69  }