View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.analysisinstruments.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.ui.swing.util.table.AbstractDaliTableModel;
27  import fr.ifremer.dali.ui.swing.util.table.DaliColumnIdentifier;
28  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
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   * Model.
37   */
38  public class AnalysisInstrumentsTableModel extends AbstractDaliTableModel<AnalysisInstrumentsTableRowModel> {
39  
40      /**
41       * <p>Constructor for AnalysisInstrumentsTableModel.</p>
42       *
43       * @param allowCreateNewRow a boolean.
44       */
45      public AnalysisInstrumentsTableModel(final SwingTableColumnModel columnModel, boolean allowCreateNewRow) {
46          super(columnModel, allowCreateNewRow, false);
47      }
48  
49      /** Constant <code>NAME</code> */
50      public static final DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> NAME = DaliColumnIdentifier.newId(
51              AnalysisInstrumentsTableRowModel.PROPERTY_NAME,
52              n("dali.property.name"),
53              n("dali.property.name"),
54              String.class, true);
55  
56      /** Constant <code>STATUS</code> */
57      public static final DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> STATUS = DaliColumnIdentifier.newId(
58              AnalysisInstrumentsTableRowModel.PROPERTY_STATUS,
59              n("dali.property.status"),
60              n("dali.property.status"),
61              StatusDTO.class, true);
62  
63      /** Constant <code>DESCRIPTION</code> */
64      public static final DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> DESCRIPTION = DaliColumnIdentifier.newId(
65              AnalysisInstrumentsTableRowModel.PROPERTY_DESCRIPTION,
66              n("dali.property.description"),
67              n("dali.property.description"),
68              String.class);
69  
70      public static final DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> COMMENT = DaliColumnIdentifier.newId(
71          AnalysisInstrumentsTableRowModel.PROPERTY_COMMENT,
72          n("dali.property.comment"),
73          n("dali.property.comment"),
74          String.class,
75          false);
76  
77      public static final DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> CREATION_DATE = DaliColumnIdentifier.newReadOnlyId(
78          AnalysisInstrumentsTableRowModel.PROPERTY_CREATION_DATE,
79          n("dali.property.date.creation"),
80          n("dali.property.date.creation"),
81          Date.class);
82  
83      public static final DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> UPDATE_DATE = DaliColumnIdentifier.newReadOnlyId(
84          AnalysisInstrumentsTableRowModel.PROPERTY_UPDATE_DATE,
85          n("dali.property.date.modification"),
86          n("dali.property.date.modification"),
87          Date.class);
88  
89  
90      /** {@inheritDoc} */
91      @Override
92      public AnalysisInstrumentsTableRowModel createNewRow() {
93          return new AnalysisInstrumentsTableRowModel();
94      }
95  
96      /** {@inheritDoc} */
97      @Override
98      public DaliColumnIdentifier<AnalysisInstrumentsTableRowModel> getFirstColumnEditing() {
99          return NAME;
100     }
101 }