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.ResultField;
021import org.ametys.runtime.i18n.I18nizableText;
022import org.ametys.runtime.parameter.Validator;
023
024/**
025 * This class represents a result column.
026 */
027public interface SearchUIColumn extends ResultField
028{
029    
030    /**
031     * Retrieves the label.
032     * @return the label.
033     */
034    I18nizableText getLabel();
035    
036    /**
037     * Retrieves the description.
038     * @return the description.
039     */
040    I18nizableText getDescription();
041    
042    /**
043     * The column's width
044     * @return The width
045     */
046    int getWidth();
047    
048    /**
049     * Determines if the column is hidden by default
050     * @return <code>true</code> if the column is hidden by default  
051     */
052    boolean isHidden();
053    
054    /**
055     * Determines if the property is editable
056     * @return <code>true</code> if the property is editable
057     */
058    boolean isEditable();
059    
060    /**
061     * Determines if the column is sortable
062     * @return <code>true</code> if the column is sortable
063     */
064    boolean isSortable();
065    
066    /**
067     * If the column should be the default sorter 'ASC' or 'DESC'. Null otherwise. 
068     * @return 'ASC', 'DESC' or null
069     */
070    String getDefaultSorter();
071    
072    /**
073     * Get the JS class name for renderer
074     * @return The renderer
075     */
076    String getRenderer();
077    
078    /**
079     * Get the JS class name for converting field's value
080     * @return The convert JS class name
081     */
082    String getConverter();
083    
084    /**
085     * Retrieves the widget to use when editing.
086     * @return the widget or <code>null</code> if none is defined.
087     */
088    String getWidget();
089    
090    /**
091     * Get the widget parameters.
092     * @return the widget parameters.
093     */
094    Map<String, I18nizableText> getWidgetParameters();
095    
096    /**
097     * Get the validator.
098     * @return the validator or <code>null</code> if none is defined.
099     */
100    Validator getValidator();
101    
102}