1 /* 2 * Copyright (c) 2002-2022, City of Paris 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice 10 * and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice 13 * and the following disclaimer in the documentation and/or other materials 14 * provided with the distribution. 15 * 16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * License 1.0 33 */ 34 package fr.paris.lutece.util.datatable; 35 36 import java.io.Serializable; 37 38 /** 39 * Data table column 40 */ 41 public class DataTableColumn implements Serializable 42 { 43 private static final long serialVersionUID = 7018948403682749643L; 44 private String _strTitleKey; 45 private String _strParameterName; 46 private boolean _bSortable; 47 private DataTableColumnType _columnType; 48 private String _strLabelTrue; 49 private String _strLabelFalse; 50 51 /** 52 * Creates a new DataTableColumn 53 * 54 * @param strTitleKey 55 * I18n key of the title of this column 56 * @param strParameterName 57 * Name of the object to insert into this cells of this column 58 * @param bSortable 59 * True of the column is sortable, false otherwise 60 * @param typeColumn 61 * The type of data displayed by the column 62 */ 63 public DataTableColumn( String strTitleKey, String strParameterName, boolean bSortable, DataTableColumnType typeColumn ) 64 { 65 _strTitleKey = strTitleKey; 66 _strParameterName = strParameterName; 67 _bSortable = bSortable; 68 _columnType = typeColumn; 69 } 70 71 /** 72 * Creates a new boolean DataTableColumn 73 * 74 * @param strTitleKey 75 * I18n key of the title of this column 76 * @param strParameterName 77 * Name of the object to insert into this cells of this column 78 * @param bSortable 79 * True of the column is sortable, false otherwise 80 * @param columnType 81 * The type of data displayed by the column 82 * @param strLabelTrue 83 * The label to display in a cell if the value is true 84 * @param strLabelFalse 85 * The label to display in a cell if the value is false 86 */ 87 public DataTableColumn( String strTitleKey, String strParameterName, boolean bSortable, DataTableColumnType columnType, String strLabelTrue, 88 String strLabelFalse ) 89 { 90 _strTitleKey = strTitleKey; 91 _strParameterName = strParameterName; 92 _bSortable = bSortable; 93 _columnType = columnType; 94 _strLabelTrue = strLabelTrue; 95 _strLabelFalse = strLabelFalse; 96 } 97 98 /** 99 * Get the I18n key of the title of this column 100 * 101 * @return The I18n key of the title of this column 102 */ 103 public String getTitleKey( ) 104 { 105 return _strTitleKey; 106 } 107 108 /** 109 * Set the I18n key of the title of this column 110 * 111 * @param strTitleKey 112 * The I18n key of the title of this column 113 */ 114 public void setTitleKey( String strTitleKey ) 115 { 116 _strTitleKey = strTitleKey; 117 } 118 119 /** 120 * Get the name of the object to insert into this cells of this column 121 * 122 * @return The name of the object to insert into this cells of this column 123 */ 124 public String getParameterName( ) 125 { 126 return _strParameterName; 127 } 128 129 /** 130 * Set the name of the object to insert into this cells of this column 131 * 132 * @param strParameterName 133 * The name of the object to insert into this cells of this column 134 */ 135 public void setParameterName( String strParameterName ) 136 { 137 _strParameterName = strParameterName; 138 } 139 140 /** 141 * Get the sortable boolean of this column 142 * 143 * @return true if the column is sortable, false otherwise 144 */ 145 public boolean getSortable( ) 146 { 147 return _bSortable; 148 } 149 150 /** 151 * Set the sortable boolean of this column 152 * 153 * @param bSortable 154 * true if the column is sortable, false otherwise 155 */ 156 public void setSortable( boolean bSortable ) 157 { 158 _bSortable = bSortable; 159 } 160 161 /** 162 * Get the type of the column 163 * 164 * @return The type of the column 165 */ 166 public DataTableColumnType getTypeColumn( ) 167 { 168 return _columnType; 169 } 170 171 /** 172 * Set the type of the column 173 * 174 * @param columnType 175 * The type of the column 176 */ 177 public void setTypeColumn( DataTableColumnType columnType ) 178 { 179 _columnType = columnType; 180 } 181 182 /** 183 * Get the label to print in a cell if the boolean value is true 184 * 185 * @return The label to print in a cell if the boolean value is true 186 */ 187 public String getLabelTrue( ) 188 { 189 return _strLabelTrue; 190 } 191 192 /** 193 * Set the label to print in a cell if the boolean value is true 194 * 195 * @param strLabelTrue 196 * The label to print in a cell if the boolean value is true 197 */ 198 public void setLabelTrue( String strLabelTrue ) 199 { 200 _strLabelTrue = strLabelTrue; 201 } 202 203 /** 204 * Get the label to print in a cell if the boolean value is false 205 * 206 * @return The label to print in a cell if the boolean value is false 207 */ 208 public String getLabelFalse( ) 209 { 210 return _strLabelFalse; 211 } 212 213 /** 214 * Set the label to print in a cell if the boolean value is false 215 * 216 * @param strLabelFalse 217 * The label to print in a cell if the boolean value is false 218 */ 219 public void setLabelFalse( String strLabelFalse ) 220 { 221 _strLabelFalse = strLabelFalse; 222 } 223 }