jakarta.faces.component.search.SearchKeywordResolver Maven / Gradle / Ivy
Show all versions of jakarta.faces Show documentation
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.component.search;
import jakarta.faces.component.UIComponent;
/**
*
* A SearchKeywordResolver is responsible for resolving a single keyword. Implementations must support
* the following set of {@code 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 {@link jakarta.faces.component.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 {@link jakarta.faces.component.UIViewRoot}
*
*
*
* @this
*
* The base component
*
*
*
*
*
* New {@link SearchKeywordResolver}s can be registered via
* {@link jakarta.faces.application.Application#addSearchKeywordResolver(jakarta.faces.component.search.SearchKeywordResolver)}
* or in the application configuration resources.
*
*
*
*
* <application>
* <search-keyword-resolver>...</search-keyword-resolver>
* </application>
*
*
*
*
*
* @since 2.3
*/
public abstract class SearchKeywordResolver {
/**
*
* Try to resolve one or multiple {@link UIComponent}s based on the keyword and calls
* {@link SearchKeywordContext#invokeContextCallback(jakarta.faces.component.UIComponent)} for each resolved component.
*
*
* @param searchKeywordContext the {@code SearchKeywordContext}
* @param current the previous resolved component or the source component (if called for the first keyword in the chain)
* @param keyword the keyword
*
* @since 2.3
*/
public abstract void resolve(SearchKeywordContext searchKeywordContext, UIComponent current, String keyword);
/**
*
* Checks if the current instance of the {@link SearchKeywordResolver} is responsible for resolving the keyword.
*
*
* @param searchExpressionContext the {@link SearchExpressionContext}
* @param keyword the keyword
*
* @return true
if it's responsible for resolving this keyword
*
* @since 2.3
*/
public abstract boolean isResolverForKeyword(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.
*
*
* @param searchExpressionContext the {@link SearchExpressionContext}
* @param keyword the keyword
*
* @return true
if it's passthrough keyword.
*
* @since 2.3
*/
public boolean isPassthrough(SearchExpressionContext searchExpressionContext, String keyword) {
return false;
}
/**
*
* 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.
*
*
* @param searchExpressionContext the {@link SearchExpressionContext}
* @param keyword the keyword
*
* @return true
if it's leaf keyword.
*
* @since 2.3
*/
public boolean isLeaf(SearchExpressionContext searchExpressionContext, String keyword) {
return false;
}
}