Class SearchKeywordResolver

java.lang.Object
javax.faces.component.search.SearchKeywordResolver

public abstract class SearchKeywordResolver extends Object

A SearchKeywordResolver is responsible for resolving a single keyword. Implementations must support the following set of SearchKeywordResolver implementations, each with the associated behavior.

List of required supported keywords and their behaviors
Search Keyword Behavior
@all All components in the view
@child(n) The nth child of the base component
@composite The composite component parent of the base component
@form The closest form ancestor of the base component
@id(id) Resolves to the components with the specified component id (not clientId). This is useful when the exact location of the component tree is unknown, but must be used with caution when there multiple occurrences of the given id within the view.
@namingcontainer The closest NamingContainer ancestor component of the base component
@next The next component in the view after the base component
@none No component
@parent The parent of the base component
@previous The previous component to the base component
@root The UIViewRoot
@this The base component

New SearchKeywordResolvers can be registered via Application.addSearchKeywordResolver(javax.faces.component.search.SearchKeywordResolver) or in the application configuration resources.


 <application>
   <search-keyword-resolver>...</search-keyword-resolver>
 </application>
 
Since:
2.3
  • Constructor Details

    • SearchKeywordResolver

      public SearchKeywordResolver()
  • Method Details

    • resolve

      public abstract void resolve(SearchKeywordContext searchKeywordContext, UIComponent current, String keyword)

      Try to resolve one or multiple UIComponents based on the keyword and calls SearchKeywordContext.invokeContextCallback(javax.faces.component.UIComponent) for each resolved component.

      Parameters:
      searchKeywordContext - the SearchKeywordContext
      current - the previous resolved component or the source component (if called for the first keyword in the chain)
      keyword - the keyword
      Since:
      2.3
    • isResolverForKeyword

      public abstract boolean isResolverForKeyword(SearchExpressionContext searchExpressionContext, String keyword)

      Checks if the current instance of the SearchKeywordResolver is responsible for resolving the keyword.

      Parameters:
      searchExpressionContext - the SearchExpressionContext
      keyword - the keyword
      Returns:
      true if it's responsible for resolving this keyword
      Since:
      2.3
    • isPassthrough

      public boolean isPassthrough(SearchExpressionContext searchExpressionContext, String keyword)

      A passthrough keyword is a keyword, that according to the context, does not require to be resolved on the server, and can be passed "unresolved" to the client.

      Parameters:
      searchExpressionContext - the SearchExpressionContext
      keyword - the keyword
      Returns:
      true if it's passthrough keyword.
      Since:
      2.3
    • isLeaf

      public boolean isLeaf(SearchExpressionContext searchExpressionContext, String keyword)

      A leaf keyword is a keyword that does not allow to be combined with keywords or id chains to the right. For example: @none:@parent.

      Parameters:
      searchExpressionContext - the SearchExpressionContext
      keyword - the keyword
      Returns:
      true if it's leaf keyword.
      Since:
      2.3