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