View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.pmfm.matrix.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.decorator.DecoratorService;
27  import fr.ifremer.dali.dto.referential.pmfm.FractionDTO;
28  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliTableModel;
29  import fr.ifremer.dali.ui.swing.util.table.DaliColumnIdentifier;
30  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
31  import fr.ifremer.quadrige3.ui.swing.table.SwingTableColumnModel;
32  
33  import java.util.Date;
34  
35  import static org.nuiton.i18n.I18n.n;
36  
37  /**
38   * Model.
39   */
40  public class MatricesTableModel extends AbstractDaliTableModel<MatricesTableRowModel> {
41  
42      /** Constant <code>NAME</code> */
43      public static final DaliColumnIdentifier<MatricesTableRowModel> NAME = DaliColumnIdentifier.newId(
44              MatricesTableRowModel.PROPERTY_NAME,
45              n("dali.property.name"),
46              n("dali.property.name"),
47              String.class,
48              true);
49  
50      /** Constant <code>DESCRIPTION</code> */
51      public static final DaliColumnIdentifier<MatricesTableRowModel> DESCRIPTION = DaliColumnIdentifier.newId(
52              MatricesTableRowModel.PROPERTY_DESCRIPTION,
53              n("dali.property.description"),
54              n("dali.property.description"),
55              String.class);
56  
57      /** Constant <code>STATUS</code> */
58      public static final DaliColumnIdentifier<MatricesTableRowModel> STATUS = DaliColumnIdentifier.newId(
59              MatricesTableRowModel.PROPERTY_STATUS,
60              n("dali.property.status"),
61              n("dali.property.status"),
62              StatusDTO.class,
63              true);
64  
65      /** Constant <code>ASSOCIATED_FRACTIONS</code> */
66      public static final DaliColumnIdentifier<MatricesTableRowModel> ASSOCIATED_FRACTIONS = DaliColumnIdentifier.newId(
67              MatricesTableRowModel.PROPERTY_FRACTIONS,
68              n("dali.property.pmfm.matrix.associatedFractions"),
69              n("dali.property.pmfm.matrix.associatedFractions"),
70              FractionDTO.class,
71              DecoratorService.COLLECTION_SIZE,
72              true);
73  
74      public static final DaliColumnIdentifier<MatricesTableRowModel> COMMENT = DaliColumnIdentifier.newId(
75          MatricesTableRowModel.PROPERTY_COMMENT,
76          n("dali.property.comment"),
77          n("dali.property.comment"),
78          String.class,
79          false);
80  
81      public static final DaliColumnIdentifier<MatricesTableRowModel> CREATION_DATE = DaliColumnIdentifier.newReadOnlyId(
82          MatricesTableRowModel.PROPERTY_CREATION_DATE,
83          n("dali.property.date.creation"),
84          n("dali.property.date.creation"),
85          Date.class);
86  
87      public static final DaliColumnIdentifier<MatricesTableRowModel> UPDATE_DATE = DaliColumnIdentifier.newReadOnlyId(
88          MatricesTableRowModel.PROPERTY_UPDATE_DATE,
89          n("dali.property.date.modification"),
90          n("dali.property.date.modification"),
91          Date.class);
92  
93  
94      /**
95       * <p>Constructor for MatricesTableModel.</p>
96       *
97       * @param createNewRowAllowed a boolean.
98       */
99      public MatricesTableModel(final SwingTableColumnModel columnModel, boolean createNewRowAllowed) {
100         super(columnModel, createNewRowAllowed, false);
101     }
102 
103     /** {@inheritDoc} */
104     @Override
105     public MatricesTableRowModel createNewRow() {
106         return new MatricesTableRowModel();
107     }
108 
109     /** {@inheritDoc} */
110     @Override
111     public DaliColumnIdentifier<MatricesTableRowModel> getFirstColumnEditing() {
112         return NAME;
113     }
114 }