DataTableColumn.java

  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. import java.io.Serializable;

  36. /**
  37.  * Data table column
  38.  */
  39. public class DataTableColumn implements Serializable
  40. {
  41.     private static final long serialVersionUID = 7018948403682749643L;
  42.     private String _strTitleKey;
  43.     private String _strParameterName;
  44.     private boolean _bSortable;
  45.     private DataTableColumnType _columnType;
  46.     private String _strLabelTrue;
  47.     private String _strLabelFalse;

  48.     /**
  49.      * Creates a new DataTableColumn
  50.      *
  51.      * @param strTitleKey
  52.      *            I18n key of the title of this column
  53.      * @param strParameterName
  54.      *            Name of the object to insert into this cells of this column
  55.      * @param bSortable
  56.      *            True of the column is sortable, false otherwise
  57.      * @param typeColumn
  58.      *            The type of data displayed by the column
  59.      */
  60.     public DataTableColumn( String strTitleKey, String strParameterName, boolean bSortable, DataTableColumnType typeColumn )
  61.     {
  62.         _strTitleKey = strTitleKey;
  63.         _strParameterName = strParameterName;
  64.         _bSortable = bSortable;
  65.         _columnType = typeColumn;
  66.     }

  67.     /**
  68.      * Creates a new boolean DataTableColumn
  69.      *
  70.      * @param strTitleKey
  71.      *            I18n key of the title of this column
  72.      * @param strParameterName
  73.      *            Name of the object to insert into this cells of this column
  74.      * @param bSortable
  75.      *            True of the column is sortable, false otherwise
  76.      * @param columnType
  77.      *            The type of data displayed by the column
  78.      * @param strLabelTrue
  79.      *            The label to display in a cell if the value is true
  80.      * @param strLabelFalse
  81.      *            The label to display in a cell if the value is false
  82.      */
  83.     public DataTableColumn( String strTitleKey, String strParameterName, boolean bSortable, DataTableColumnType columnType, String strLabelTrue,
  84.             String strLabelFalse )
  85.     {
  86.         _strTitleKey = strTitleKey;
  87.         _strParameterName = strParameterName;
  88.         _bSortable = bSortable;
  89.         _columnType = columnType;
  90.         _strLabelTrue = strLabelTrue;
  91.         _strLabelFalse = strLabelFalse;
  92.     }

  93.     /**
  94.      * Get the I18n key of the title of this column
  95.      *
  96.      * @return The I18n key of the title of this column
  97.      */
  98.     public String getTitleKey( )
  99.     {
  100.         return _strTitleKey;
  101.     }

  102.     /**
  103.      * Set the I18n key of the title of this column
  104.      *
  105.      * @param strTitleKey
  106.      *            The I18n key of the title of this column
  107.      */
  108.     public void setTitleKey( String strTitleKey )
  109.     {
  110.         _strTitleKey = strTitleKey;
  111.     }

  112.     /**
  113.      * Get the name of the object to insert into this cells of this column
  114.      *
  115.      * @return The name of the object to insert into this cells of this column
  116.      */
  117.     public String getParameterName( )
  118.     {
  119.         return _strParameterName;
  120.     }

  121.     /**
  122.      * Set the name of the object to insert into this cells of this column
  123.      *
  124.      * @param strParameterName
  125.      *            The name of the object to insert into this cells of this column
  126.      */
  127.     public void setParameterName( String strParameterName )
  128.     {
  129.         _strParameterName = strParameterName;
  130.     }

  131.     /**
  132.      * Get the sortable boolean of this column
  133.      *
  134.      * @return true if the column is sortable, false otherwise
  135.      */
  136.     public boolean getSortable( )
  137.     {
  138.         return _bSortable;
  139.     }

  140.     /**
  141.      * Set the sortable boolean of this column
  142.      *
  143.      * @param bSortable
  144.      *            true if the column is sortable, false otherwise
  145.      */
  146.     public void setSortable( boolean bSortable )
  147.     {
  148.         _bSortable = bSortable;
  149.     }

  150.     /**
  151.      * Get the type of the column
  152.      *
  153.      * @return The type of the column
  154.      */
  155.     public DataTableColumnType getTypeColumn( )
  156.     {
  157.         return _columnType;
  158.     }

  159.     /**
  160.      * Set the type of the column
  161.      *
  162.      * @param columnType
  163.      *            The type of the column
  164.      */
  165.     public void setTypeColumn( DataTableColumnType columnType )
  166.     {
  167.         _columnType = columnType;
  168.     }

  169.     /**
  170.      * Get the label to print in a cell if the boolean value is true
  171.      *
  172.      * @return The label to print in a cell if the boolean value is true
  173.      */
  174.     public String getLabelTrue( )
  175.     {
  176.         return _strLabelTrue;
  177.     }

  178.     /**
  179.      * Set the label to print in a cell if the boolean value is true
  180.      *
  181.      * @param strLabelTrue
  182.      *            The label to print in a cell if the boolean value is true
  183.      */
  184.     public void setLabelTrue( String strLabelTrue )
  185.     {
  186.         _strLabelTrue = strLabelTrue;
  187.     }

  188.     /**
  189.      * Get the label to print in a cell if the boolean value is false
  190.      *
  191.      * @return The label to print in a cell if the boolean value is false
  192.      */
  193.     public String getLabelFalse( )
  194.     {
  195.         return _strLabelFalse;
  196.     }

  197.     /**
  198.      * Set the label to print in a cell if the boolean value is false
  199.      *
  200.      * @param strLabelFalse
  201.      *            The label to print in a cell if the boolean value is false
  202.      */
  203.     public void setLabelFalse( String strLabelFalse )
  204.     {
  205.         _strLabelFalse = strLabelFalse;
  206.     }
  207. }