1 /* 2 * Copyright (c) 2002-2014, Mairie de 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 /** 40 * Data table column 41 */ 42 public class DataTableColumn implements Serializable 43 { 44 private static final long serialVersionUID = 7018948403682749643L; 45 private String _strTitleKey; 46 private String _strParameterName; 47 private boolean _bSortable; 48 private DataTableColumnType _columnType; 49 private String _strLabelTrue; 50 private String _strLabelFalse; 51 52 /** 53 * Creates a new DataTableColumn 54 * @param strTitleKey I18n key of the title of this column 55 * @param strParameterName Name of the object to insert into this cells of this column 56 * @param bSortable True of the column is sortable, false otherwise 57 * @param typeColumn The type of data displayed by the column 58 */ 59 public DataTableColumn( String strTitleKey, String strParameterName, boolean bSortable, 60 DataTableColumnType typeColumn ) 61 { 62 _strTitleKey = strTitleKey; 63 _strParameterName = strParameterName; 64 _bSortable = bSortable; 65 _columnType = typeColumn; 66 } 67 68 /** 69 * Creates a new boolean DataTableColumn 70 * @param strTitleKey I18n key of the title of this column 71 * @param strParameterName Name of the object to insert into this cells of this column 72 * @param bSortable True of the column is sortable, false otherwise 73 * @param columnType The type of data displayed by the column 74 * @param strLabelTrue The label to display in a cell if the value is true 75 * @param strLabelFalse The label to display in a cell if the value is false 76 */ 77 public DataTableColumn( String strTitleKey, String strParameterName, boolean bSortable, 78 DataTableColumnType columnType, String strLabelTrue, String strLabelFalse ) 79 { 80 _strTitleKey = strTitleKey; 81 _strParameterName = strParameterName; 82 _bSortable = bSortable; 83 _columnType = columnType; 84 _strLabelTrue = strLabelTrue; 85 _strLabelFalse = strLabelFalse; 86 } 87 88 /** 89 * Get the I18n key of the title of this column 90 * @return The I18n key of the title of this column 91 */ 92 public String getTitleKey( ) 93 { 94 return _strTitleKey; 95 } 96 97 /** 98 * Set the I18n key of the title of this column 99 * @param strTitleKey The I18n key of the title of this column 100 */ 101 public void setTitleKey( String strTitleKey ) 102 { 103 _strTitleKey = strTitleKey; 104 } 105 106 /** 107 * Get the name of the object to insert into this cells of this column 108 * @return The name of the object to insert into this cells of this column 109 */ 110 public String getParameterName( ) 111 { 112 return _strParameterName; 113 } 114 115 /** 116 * Set the name of the object to insert into this cells of this column 117 * @param strParameterName The name of the object to insert into this cells of this column 118 */ 119 public void setParameterName( String strParameterName ) 120 { 121 _strParameterName = strParameterName; 122 } 123 124 /** 125 * Get the sortable boolean of this column 126 * @return true if the column is sortable, false otherwise 127 */ 128 public boolean getSortable( ) 129 { 130 return _bSortable; 131 } 132 133 /** 134 * Set the sortable boolean of this column 135 * @param bSortable true if the column is sortable, false otherwise 136 */ 137 public void setSortable( boolean bSortable ) 138 { 139 _bSortable = bSortable; 140 } 141 142 /** 143 * Get the type of the column 144 * @return The type of the column 145 */ 146 public DataTableColumnType getTypeColumn( ) 147 { 148 return _columnType; 149 } 150 151 /** 152 * Set the type of the column 153 * @param columnType The type of the column 154 */ 155 public void setTypeColumn( DataTableColumnType columnType ) 156 { 157 _columnType = columnType; 158 } 159 160 /** 161 * Get the label to print in a cell if the boolean value is true 162 * @return The label to print in a cell if the boolean value is true 163 */ 164 public String getLabelTrue( ) 165 { 166 return _strLabelTrue; 167 } 168 169 /** 170 * Set the label to print in a cell if the boolean value is true 171 * @param strLabelTrue The label to print in a cell if the boolean value is true 172 */ 173 public void setLabelTrue( String strLabelTrue ) 174 { 175 _strLabelTrue = strLabelTrue; 176 } 177 178 /** 179 * Get the label to print in a cell if the boolean value is false 180 * @return The label to print in a cell if the boolean value is false 181 */ 182 public String getLabelFalse( ) 183 { 184 return _strLabelFalse; 185 } 186 187 /** 188 * Set the label to print in a cell if the boolean value is false 189 * @param strLabelFalse The label to print in a cell if the boolean value is false 190 */ 191 public void setLabelFalse( String strLabelFalse ) 192 { 193 _strLabelFalse = strLabelFalse; 194 } 195 }