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.Optional; 019 020import org.ametys.runtime.model.ModelItem; 021import org.ametys.runtime.model.ModelViewItem; 022 023/** 024 * This class represents a result column. 025 * @param <T> type of the referenced model item 026 */ 027public interface SearchUIColumn<T extends ModelItem> extends ModelViewItem<T> 028{ 029 /** 030 * The column's width 031 * @return The width 032 */ 033 public int getWidth(); 034 035 /** 036 * Set the column's width 037 * @param width The width to set 038 */ 039 public void setWidth (int width); 040 041 /** 042 * Determines if the column is hidden by default 043 * @return <code>true</code> if the column is hidden by default 044 */ 045 public boolean isHidden(); 046 047 /** 048 * Set the hidden property 049 * @param hidden <code>true</code> to hidden the columns by default 050 */ 051 public void setHidden (boolean hidden); 052 053 /** 054 * Determines if the property is editable 055 * @return <code>true</code> if the property is editable 056 */ 057 public boolean isEditable(); 058 059 /** 060 * Set the editable property 061 * @param editable <code>true</code> to authorized edition 062 */ 063 public void setEditable (boolean editable); 064 065 /** 066 * Determines if the column is sortable 067 * @return <code>true</code> if the column is sortable 068 */ 069 public boolean isSortable(); 070 071 /** 072 * Set the sortable property 073 * @param sortable <code>true</code> to authorized sort 074 */ 075 public void setSortable (boolean sortable); 076 077 /** 078 * Determines if sort is allowed on multiple join 079 * @return <code>true</code> if sort is allowed on multiple join, <code>false</code> otherwise 080 */ 081 public boolean allowSortOnMultipleJoin(); 082 083 /** 084 * Set the allowSortOnMultipleJoin property 085 * @param allowSortOnMultipleJoin <code>true</code> to authorized sort on multiple join 086 */ 087 public void setAllowSortOnMultipleJoin(boolean allowSortOnMultipleJoin); 088 089 /** 090 * If the column should be the default sorter 'ASC' or 'DESC'. Null otherwise. 091 * @return 'ASC', 'DESC' or null 092 */ 093 public String getDefaultSorter(); 094 095 /** 096 * Set the default sorter property 097 * @param defaultSorter If the column should be a default sorter, 'ASC' for ascending 'DESC' for descending. Null otherwise. 098 */ 099 public void setDefaultSorter(Optional<String> defaultSorter); 100 101 /** 102 * Get the JS class name for renderer 103 * @return The renderer 104 */ 105 public String getRenderer(); 106 107 /** 108 * Set the JS class name for renderer 109 * @param renderer The renderer 110 */ 111 public void setRenderer(Optional<String> renderer); 112 113 /** 114 * Get the JS class name for converting field's value 115 * @return The convert JS class name 116 */ 117 public String getConverter(); 118 119 /** 120 * Set the JS class name for converting field's value 121 * @param converter The convert JS class name 122 */ 123 public void setConverter(Optional<String> converter); 124}