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.Locale; 019import java.util.Map; 020 021import org.ametys.cms.search.model.SearchCriterion; 022import org.ametys.cms.search.model.SearchModel; 023import org.ametys.runtime.i18n.I18nizableText; 024import org.ametys.runtime.parameter.Validator; 025 026/** 027 * This class represents a search criterion of a {@link SearchModel} 028 */ 029public interface SearchUICriterion extends SearchCriterion 030{ 031 032 /** 033 * Retrieves the label. 034 * @return the label. 035 */ 036 I18nizableText getLabel(); 037 038 /** 039 * Retrieves the description. 040 * @return the description. 041 */ 042 I18nizableText getDescription(); 043 044 /** 045 * Get the field identifier. 046 * Used to match standard, advanced and faceted criterion (even if the operator is different), whatever their ID is. 047 * @return the field identifier. 048 */ 049 String getFieldId(); 050 051 /** 052 * Get the group of the search criterion 053 * @return <code>null</code> if the search criterion does not belong to any group, the name of the group otherwise 054 */ 055 I18nizableText getGroup(); 056 057 /** 058 * Get the JS class name to execute on 'init' event 059 * @return the JS class name to execute on 'init' event 060 */ 061 String getInitClassName(); 062 063 /** 064 * Get the JS class name to execute on 'submit' event 065 * @return the JS class name to execute on 'submit' event 066 */ 067 String getSubmitClassName(); 068 069 /** 070 * Get the JS class name to execute on 'change' event 071 * @return the JS class name to execute on 'change' event 072 */ 073 String getChangeClassName(); 074 075 /** 076 * Determines if the criterion is hidden 077 * @return <code>true</code> if the criterion is hidden 078 */ 079 boolean isHidden(); 080 081 /** 082 * Retrieves the widget to use for rendering. 083 * @return the widget or <code>null</code> if none is defined. 084 */ 085 String getWidget(); 086 087 /** 088 * Get the widget's parameters 089 * @return the widget's parameters 090 */ 091 Map<String, I18nizableText> getWidgetParameters(); 092 093 /** 094 * Retrieves the validator. 095 * @return the validator or <code>null</code> if none is defined. 096 */ 097 Validator getValidator(); 098 099 /** 100 * Retrieves the default value.<br> 101 * If the criterion is hidden, this represents a fixed value for the criterion. 102 * @return the default value or <code>null</code> if none is defined. 103 */ 104 Object getDefaultValue(); 105 106// /** 107// * Get the fixed value of the criterion (in case of a hidden criterion). 108// * @return the fixed value of the criterion or <code>null</code> if none is defined. 109// */ 110// Object getValue(); 111 112 /** 113 * Get the label of a facet value. 114 * @param value the facet value. 115 * @param currentLocale the current locale 116 * @return the label, or null if the value does not exist. 117 */ 118 I18nizableText getFacetLabel(String value, Locale currentLocale); 119 120}