View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.referential.pmfm.method.table;
2   
3   /*
4    * #%L
5    * Reef DB :: 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.quadrige3.ui.core.dto.referential.StatusDTO;
27  import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableModel;
28  import fr.ifremer.reefdb.ui.swing.util.table.ReefDbColumnIdentifier;
29  import org.jdesktop.swingx.table.TableColumnModelExt;
30  
31  import java.util.Date;
32  
33  import static org.nuiton.i18n.I18n.n;
34  
35  /**
36   * Model.
37   */
38  public class MethodsTableModel extends AbstractReefDbTableModel<MethodsTableRowModel> {
39  
40      /** Constant <code>NAME</code> */
41      public static final ReefDbColumnIdentifier<MethodsTableRowModel> NAME = ReefDbColumnIdentifier.newId(
42              MethodsTableRowModel.PROPERTY_NAME,
43              n("reefdb.property.name"),
44              n("reefdb.property.name"),
45              String.class, true);
46      /** Constant <code>REFERENCE</code> */
47      public static final ReefDbColumnIdentifier<MethodsTableRowModel> REFERENCE = ReefDbColumnIdentifier.newId(
48              MethodsTableRowModel.PROPERTY_REFERENCE,
49              n("reefdb.property.pmfm.method.reference"),
50              n("reefdb.property.pmfm.method.reference"),
51              String.class);
52      /** Constant <code>NUMBER</code> */
53      public static final ReefDbColumnIdentifier<MethodsTableRowModel> NUMBER = ReefDbColumnIdentifier.newId(
54              MethodsTableRowModel.PROPERTY_NUMBER,
55              n("reefdb.property.pmfm.method.number"),
56              n("reefdb.property.pmfm.method.number"),
57              String.class);
58      /** Constant <code>STATUS</code> */
59      public static final ReefDbColumnIdentifier<MethodsTableRowModel> STATUS = ReefDbColumnIdentifier.newId(
60              MethodsTableRowModel.PROPERTY_STATUS,
61              n("reefdb.property.status"),
62              n("reefdb.property.status"),
63              StatusDTO.class, true);
64      /** Constant <code>DESCRIPTION</code> */
65      public static final ReefDbColumnIdentifier<MethodsTableRowModel> DESCRIPTION = ReefDbColumnIdentifier.newId(
66              MethodsTableRowModel.PROPERTY_DESCRIPTION,
67              n("reefdb.property.description"),
68              n("reefdb.property.description"),
69              String.class, true);
70      /** Constant <code>DESCRIPTIONPACKAGING</code> */
71      public static final ReefDbColumnIdentifier<MethodsTableRowModel> DESCRIPTIONPACKAGING = ReefDbColumnIdentifier.newId(
72              MethodsTableRowModel.PROPERTY_DESCRIPTION_PACKAGING,
73              n("reefdb.property.pmfm.method.descriptionPackaging"),
74              n("reefdb.property.pmfm.method.descriptionPackaging"),
75              String.class);
76      /** Constant <code>DESCRIPTIONPREPARATION</code> */
77      public static final ReefDbColumnIdentifier<MethodsTableRowModel> DESCRIPTIONPREPARATION = ReefDbColumnIdentifier.newId(
78              MethodsTableRowModel.PROPERTY_DESCRIPTION_PREPARATION,
79              n("reefdb.property.pmfm.method.descriptionPreparation"),
80              n("reefdb.property.pmfm.method.descriptionPreparation"),
81              String.class);
82      /** Constant <code>DESCRIPTIONPRESERVATION</code> */
83      public static final ReefDbColumnIdentifier<MethodsTableRowModel> DESCRIPTIONPRESERVATION = ReefDbColumnIdentifier.newId(
84              MethodsTableRowModel.PROPERTY_DESCRIPTION_PRESERVATION,
85              n("reefdb.property.pmfm.method.descriptionPreservation"),
86              n("reefdb.property.pmfm.method.descriptionPreservation"),
87              String.class);
88  
89      public static final ReefDbColumnIdentifier<MethodsTableRowModel> COMMENT = ReefDbColumnIdentifier.newId(
90          MethodsTableRowModel.PROPERTY_COMMENT,
91          n("reefdb.property.comment"),
92          n("reefdb.property.comment"),
93          String.class,
94          false);
95  
96      public static final ReefDbColumnIdentifier<MethodsTableRowModel> CREATION_DATE = ReefDbColumnIdentifier.newReadOnlyId(
97          MethodsTableRowModel.PROPERTY_CREATION_DATE,
98          n("reefdb.property.date.creation"),
99          n("reefdb.property.date.creation"),
100         Date.class);
101 
102     public static final ReefDbColumnIdentifier<MethodsTableRowModel> UPDATE_DATE = ReefDbColumnIdentifier.newReadOnlyId(
103         MethodsTableRowModel.PROPERTY_UPDATE_DATE,
104         n("reefdb.property.date.modification"),
105         n("reefdb.property.date.modification"),
106         Date.class);
107 
108 
109 
110     /**
111      * <p>Constructor for MethodsTableModel.</p>
112      *
113      * @param columnModel a {@link org.jdesktop.swingx.table.TableColumnModelExt} object.
114      * @param createNewRowAllowed a boolean.
115      */
116     public MethodsTableModel(final TableColumnModelExt columnModel, boolean createNewRowAllowed) {
117         super(columnModel, createNewRowAllowed, false);
118     }
119 
120     /** {@inheritDoc} */
121     @Override
122     public MethodsTableRowModel createNewRow() {
123         return new MethodsTableRowModel();
124     }
125 
126     /** {@inheritDoc} */
127     @Override
128     public ReefDbColumnIdentifier<MethodsTableRowModel> getFirstColumnEditing() {
129         return NAME;
130     }
131 }