1 package fr.ifremer.reefdb.ui.swing.util.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.swing.table.AbstractTableUIModel;
27 import fr.ifremer.quadrige3.ui.core.dto.QuadrigeBean;
28 import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
29
30 import java.util.ArrayList;
31 import java.util.List;
32
33 /**
34 * <p>Abstract AbstractReefDbTableUIModel class.</p>
35 *
36 * @param <B> type of incoming bean to edit
37 * @param <R> type of the row of the table model
38 * @param <M> type of this model
39 * @author Ludovic Pecquot <ludovic.pecquot@e-is.pro>
40 */
41 public abstract class AbstractReefDbTableUIModel<B extends QuadrigeBean, R extends AbstractReefDbRowUIModel, M extends AbstractReefDbTableUIModel<B, R, M>>
42 extends AbstractTableUIModel<B, R, M> {
43
44 /**
45 * Property pour les colonnes dynamiques.
46 */
47 private List<PmfmDTO> pmfms;
48
49 private List<PmfmTableColumn> pmfmColumns;
50 public static final String PROPERTY_PMFM_COLUMNS = "pmfmColumns";
51
52 /**
53 * <p>Getter for the field <code>pmfms</code>.</p>
54 *
55 * @return a {@link java.util.List} object.
56 */
57 public List<PmfmDTO> getPmfms() {
58 if (pmfms == null) {
59 pmfms = new ArrayList<>();
60 }
61 return pmfms;
62 }
63
64 /**
65 * <p>Setter for the field <code>pmfms</code>.</p>
66 *
67 * @param pmfms a {@link java.util.List} object.
68 */
69 public void setPmfms(List<PmfmDTO> pmfms) {
70 this.pmfms = pmfms;
71 }
72
73 /**
74 * <p>Getter for the field <code>pmfmColumns</code>.</p>
75 *
76 * @return a {@link java.util.List} object.
77 */
78 public List<PmfmTableColumn> getPmfmColumns() {
79 if (pmfmColumns == null) {
80 pmfmColumns = new ArrayList<>();
81 }
82 return pmfmColumns;
83 }
84
85 public void addPmfmColumn(PmfmTableColumn pmfmColumn) {
86 getPmfmColumns().add(pmfmColumn);
87 firePropertyChange(PROPERTY_PMFM_COLUMNS, null, getPmfmColumns());
88 }
89
90 }