001/*
002 *  Copyright 2013 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.cms.search.ui.model;
017
018import java.util.Map;
019
020import org.ametys.cms.search.model.SearchCriterion;
021import org.ametys.cms.search.model.SearchModel;
022import org.ametys.runtime.i18n.I18nizableText;
023import org.ametys.runtime.parameter.Validator;
024
025/**
026 * This class represents a search criterion of a {@link SearchModel}
027 */
028public interface SearchUICriterion extends SearchCriterion
029{
030    /**
031     * Get the field identifier.
032     * Used to match standard, advanced and faceted criterion (even if the operator is different), whatever their ID is.
033     * @return the field identifier.
034     */
035    String getFieldId();
036    
037    /**
038     * Get the group of the search criterion
039     * @return <code>null</code> if the search criterion does not belong to any group, the name of the group otherwise
040     */
041    I18nizableText getGroup();
042    
043    /**
044     * Get the JS class name to execute on 'init' event
045     * @return the JS class name to execute on 'init' event
046     */
047    String getInitClassName();
048    
049    /**
050     * Get the JS class name to execute on 'submit' event
051     * @return the JS class name to execute on 'submit' event
052     */
053    String getSubmitClassName();
054    
055    /**
056     * Get the JS class name to execute on 'change' event
057     * @return the JS class name to execute on 'change' event
058     */
059    String getChangeClassName();
060    
061    /**
062     * Determines if the criterion is hidden
063     * @return <code>true</code> if the criterion is hidden
064     */
065    boolean isHidden();
066    
067    /**
068     * Retrieves the widget to use for rendering.
069     * @return the widget or <code>null</code> if none is defined.
070     */
071    String getWidget();
072    
073    /**
074     * Get the widget's parameters
075     * @return the widget's parameters
076     */
077    Map<String, I18nizableText> getWidgetParameters();
078    
079    /**
080     * Retrieves the validator.
081     * @return the validator or <code>null</code> if none is defined.
082     */
083    Validator getValidator();
084
085    /**
086     * Retrieves the default value.<br>
087     * If the criterion is hidden, this represents a fixed value for the criterion.
088     * @return the default value or <code>null</code> if none is defined.
089     */
090    Object getDefaultValue();
091    
092//    /**
093//     * Get the fixed value of the criterion (in case of a hidden criterion).
094//     * @return the fixed value of the criterion or <code>null</code> if none is defined.
095//     */
096//    Object getValue();
097}