View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.campaign.table;
2   
3   /*
4    * #%L
5    * Dali :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2015 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  import fr.ifremer.dali.dto.referential.PersonDTO;
27  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliTableModel;
28  import fr.ifremer.dali.ui.swing.util.table.DaliColumnIdentifier;
29  import fr.ifremer.quadrige3.ui.swing.table.SwingTableColumnModel;
30  
31  import java.util.Date;
32  
33  import static org.nuiton.i18n.I18n.n;
34  
35  /**
36   * Le modele pour le tableau des programmes.
37   */
38  public class CampaignsTableModel extends AbstractDaliTableModel<CampaignsTableRowModel> {
39  
40      /**
41       * Identifiant pour la colonne libelle.
42       */
43      public static final DaliColumnIdentifier<CampaignsTableRowModel> NAME = DaliColumnIdentifier.newId(
44              CampaignsTableRowModel.PROPERTY_NAME,
45              n("dali.property.name"),
46              n("dali.campaign.name.tip"),
47              String.class,
48              true);
49  
50      public static final DaliColumnIdentifier<CampaignsTableRowModel> START_DATE = DaliColumnIdentifier.newId(
51              CampaignsTableRowModel.PROPERTY_START_DATE,
52              n("dali.property.date.start"),
53              n("dali.campaign.date.start.tip"),
54              Date.class,
55              true);
56  
57      public static final DaliColumnIdentifier<CampaignsTableRowModel> END_DATE = DaliColumnIdentifier.newId(
58              CampaignsTableRowModel.PROPERTY_END_DATE,
59              n("dali.property.date.end"),
60              n("dali.campaign.date.end.tip"),
61              Date.class);
62  
63      public static final DaliColumnIdentifier<CampaignsTableRowModel> SISMER_LINK = DaliColumnIdentifier.newId(
64              CampaignsTableRowModel.PROPERTY_SISMER_LINK,
65              n("dali.property.sismer.link"),
66              n("dali.campaign.sismer.link.tip"),
67              String.class);
68  
69      public static final DaliColumnIdentifier<CampaignsTableRowModel> MANAGER = DaliColumnIdentifier.newId(
70              CampaignsTableRowModel.PROPERTY_MANAGER,
71              n("dali.property.manager"),
72              n("dali.campaign.manager.tip"),
73              PersonDTO.class,
74              true);
75  
76      public static final DaliColumnIdentifier<CampaignsTableRowModel> COMMENT = DaliColumnIdentifier.newId(
77              CampaignsTableRowModel.PROPERTY_COMMENT,
78              n("dali.property.comment"),
79              n("dali.campaign.comment.tip"),
80              String.class);
81  
82      public static final DaliColumnIdentifier<CampaignsTableRowModel> UPDATE_DATE = DaliColumnIdentifier.newReadOnlyId(
83          CampaignsTableRowModel.PROPERTY_UPDATE_DATE,
84          n("dali.property.date.modification"),
85          n("dali.property.date.modification"),
86          Date.class);
87  
88  
89      /**
90       * Constructor.
91       *
92       * @param columnModel Le modele pour les colonnes
93       */
94      public CampaignsTableModel(final SwingTableColumnModel columnModel) {
95          super(columnModel, true, false);
96      }
97  
98      /**
99       * {@inheritDoc}
100      */
101     @Override
102     public CampaignsTableRowModel createNewRow() {
103         return new CampaignsTableRowModel();
104     }
105 
106     /**
107      * {@inheritDoc}
108      */
109     @Override
110     public DaliColumnIdentifier<CampaignsTableRowModel> getFirstColumnEditing() {
111         return NAME;
112     }
113 
114 }