View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.pmfm.method.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 MethodsTableModel extends AbstractDaliTableModel<MethodsTableRowModel> {
39  
40      /** Constant <code>NAME</code> */
41      public static final DaliColumnIdentifier<MethodsTableRowModel> NAME = DaliColumnIdentifier.newId(
42              MethodsTableRowModel.PROPERTY_NAME,
43              n("dali.property.name"),
44              n("dali.property.name"),
45              String.class, true);
46      /** Constant <code>REFERENCE</code> */
47      public static final DaliColumnIdentifier<MethodsTableRowModel> REFERENCE = DaliColumnIdentifier.newId(
48              MethodsTableRowModel.PROPERTY_REFERENCE,
49              n("dali.property.pmfm.method.reference"),
50              n("dali.property.pmfm.method.reference"),
51              String.class);
52      /** Constant <code>NUMBER</code> */
53      public static final DaliColumnIdentifier<MethodsTableRowModel> NUMBER = DaliColumnIdentifier.newId(
54              MethodsTableRowModel.PROPERTY_NUMBER,
55              n("dali.property.pmfm.method.number"),
56              n("dali.property.pmfm.method.number"),
57              String.class);
58      /** Constant <code>STATUS</code> */
59      public static final DaliColumnIdentifier<MethodsTableRowModel> STATUS = DaliColumnIdentifier.newId(
60              MethodsTableRowModel.PROPERTY_STATUS,
61              n("dali.property.status"),
62              n("dali.property.status"),
63              StatusDTO.class, true);
64      /** Constant <code>DESCRIPTION</code> */
65      public static final DaliColumnIdentifier<MethodsTableRowModel> DESCRIPTION = DaliColumnIdentifier.newId(
66              MethodsTableRowModel.PROPERTY_DESCRIPTION,
67              n("dali.property.description"),
68              n("dali.property.description"),
69              String.class, true);
70      /** Constant <code>DESCRIPTIONPACKAGING</code> */
71      public static final DaliColumnIdentifier<MethodsTableRowModel> DESCRIPTIONPACKAGING = DaliColumnIdentifier.newId(
72              MethodsTableRowModel.PROPERTY_DESCRIPTION_PACKAGING,
73              n("dali.property.pmfm.method.descriptionPackaging"),
74              n("dali.property.pmfm.method.descriptionPackaging"),
75              String.class);
76      /** Constant <code>DESCRIPTIONPREPARATION</code> */
77      public static final DaliColumnIdentifier<MethodsTableRowModel> DESCRIPTIONPREPARATION = DaliColumnIdentifier.newId(
78              MethodsTableRowModel.PROPERTY_DESCRIPTION_PREPARATION,
79              n("dali.property.pmfm.method.descriptionPreparation"),
80              n("dali.property.pmfm.method.descriptionPreparation"),
81              String.class);
82      /** Constant <code>DESCRIPTIONPRESERVATION</code> */
83      public static final DaliColumnIdentifier<MethodsTableRowModel> DESCRIPTIONPRESERVATION = DaliColumnIdentifier.newId(
84              MethodsTableRowModel.PROPERTY_DESCRIPTION_PRESERVATION,
85              n("dali.property.pmfm.method.descriptionPreservation"),
86              n("dali.property.pmfm.method.descriptionPreservation"),
87              String.class);
88  
89      public static final DaliColumnIdentifier<MethodsTableRowModel> COMMENT = DaliColumnIdentifier.newId(
90          MethodsTableRowModel.PROPERTY_COMMENT,
91          n("dali.property.comment"),
92          n("dali.property.comment"),
93          String.class,
94          false);
95  
96      public static final DaliColumnIdentifier<MethodsTableRowModel> CREATION_DATE = DaliColumnIdentifier.newReadOnlyId(
97          MethodsTableRowModel.PROPERTY_CREATION_DATE,
98          n("dali.property.date.creation"),
99          n("dali.property.date.creation"),
100         Date.class);
101 
102     public static final DaliColumnIdentifier<MethodsTableRowModel> UPDATE_DATE = DaliColumnIdentifier.newReadOnlyId(
103         MethodsTableRowModel.PROPERTY_UPDATE_DATE,
104         n("dali.property.date.modification"),
105         n("dali.property.date.modification"),
106         Date.class);
107 
108 
109     /**
110      * <p>Constructor for MethodsTableModel.</p>
111      *
112      * @param createNewRowAllowed a boolean.
113      */
114     public MethodsTableModel(final SwingTableColumnModel columnModel, boolean createNewRowAllowed) {
115         super(columnModel, createNewRowAllowed, false);
116     }
117 
118     /** {@inheritDoc} */
119     @Override
120     public MethodsTableRowModel createNewRow() {
121         return new MethodsTableRowModel();
122     }
123 
124     /** {@inheritDoc} */
125     @Override
126     public DaliColumnIdentifier<MethodsTableRowModel> getFirstColumnEditing() {
127         return NAME;
128     }
129 }