1 package fr.ifremer.reefdb.ui.swing.content.manage.referential.pmfm.matrix.table;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 import fr.ifremer.reefdb.decorator.DecoratorService;
27 import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
28 import fr.ifremer.reefdb.dto.referential.pmfm.FractionDTO;
29 import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableModel;
30 import fr.ifremer.reefdb.ui.swing.util.table.ReefDbColumnIdentifier;
31 import org.jdesktop.swingx.table.TableColumnModelExt;
32
33 import java.util.Date;
34
35 import static org.nuiton.i18n.I18n.n;
36
37
38
39
40 public class MatricesTableModel extends AbstractReefDbTableModel<MatricesTableRowModel> {
41
42
43 public static final ReefDbColumnIdentifier<MatricesTableRowModel> NAME = ReefDbColumnIdentifier.newId(
44 MatricesTableRowModel.PROPERTY_NAME,
45 n("reefdb.property.name"),
46 n("reefdb.property.name"),
47 String.class,
48 true);
49
50
51 public static final ReefDbColumnIdentifier<MatricesTableRowModel> DESCRIPTION = ReefDbColumnIdentifier.newId(
52 MatricesTableRowModel.PROPERTY_DESCRIPTION,
53 n("reefdb.property.description"),
54 n("reefdb.property.description"),
55 String.class);
56
57
58 public static final ReefDbColumnIdentifier<MatricesTableRowModel> STATUS = ReefDbColumnIdentifier.newId(
59 MatricesTableRowModel.PROPERTY_STATUS,
60 n("reefdb.property.status"),
61 n("reefdb.property.status"),
62 StatusDTO.class,
63 true);
64
65
66 public static final ReefDbColumnIdentifier<MatricesTableRowModel> ASSOCIATED_FRACTIONS = ReefDbColumnIdentifier.newId(
67 MatricesTableRowModel.PROPERTY_FRACTIONS,
68 n("reefdb.property.pmfm.matrix.associatedFractions"),
69 n("reefdb.property.pmfm.matrix.associatedFractions"),
70 FractionDTO.class,
71 DecoratorService.COLLECTION_SIZE,
72 true);
73
74
75 public static final ReefDbColumnIdentifier<MatricesTableRowModel> COMMENT = ReefDbColumnIdentifier.newId(
76 MatricesTableRowModel.PROPERTY_COMMENT,
77 n("reefdb.property.comment"),
78 n("reefdb.property.comment"),
79 String.class,
80 false);
81
82 public static final ReefDbColumnIdentifier<MatricesTableRowModel> CREATION_DATE = ReefDbColumnIdentifier.newReadOnlyId(
83 MatricesTableRowModel.PROPERTY_CREATION_DATE,
84 n("reefdb.property.date.creation"),
85 n("reefdb.property.date.creation"),
86 Date.class);
87
88 public static final ReefDbColumnIdentifier<MatricesTableRowModel> UPDATE_DATE = ReefDbColumnIdentifier.newReadOnlyId(
89 MatricesTableRowModel.PROPERTY_UPDATE_DATE,
90 n("reefdb.property.date.modification"),
91 n("reefdb.property.date.modification"),
92 Date.class);
93
94
95
96
97
98
99
100 public MatricesTableModel(final TableColumnModelExt columnModel, boolean createNewRowAllowed) {
101 super(columnModel, createNewRowAllowed, false);
102 }
103
104
105 @Override
106 public MatricesTableRowModel createNewRow() {
107 return new MatricesTableRowModel();
108 }
109
110
111 @Override
112 public ReefDbColumnIdentifier<MatricesTableRowModel> getFirstColumnEditing() {
113 return NAME;
114 }
115 }