View Javadoc
1   package fr.ifremer.dali.ui.swing.util.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.dto.referential.pmfm.PmfmDTO;
27  import fr.ifremer.quadrige3.ui.core.dto.QuadrigeBean;
28  import fr.ifremer.quadrige3.ui.swing.table.AbstractTableUIModel;
29  
30  import java.util.ArrayList;
31  import java.util.List;
32  
33  /**
34   * <p>Abstract AbstractDaliTableUIModel 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 AbstractDaliTableUIModel<B extends QuadrigeBean, R extends AbstractDaliRowUIModel, M extends AbstractDaliTableUIModel<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          return pmfms;
59      }
60  
61      /**
62       * <p>Setter for the field <code>pmfms</code>.</p>
63       *
64       * @param pmfms a {@link java.util.List} object.
65       */
66      public void setPmfms(List<PmfmDTO> pmfms) {
67          this.pmfms = pmfms;
68      }
69  
70      /**
71       * <p>Getter for the field <code>pmfmColumns</code>.</p>
72       *
73       * @return a {@link java.util.List} object.
74       */
75      public List<PmfmTableColumn> getPmfmColumns() {
76          if (pmfmColumns == null) {
77              pmfmColumns = new ArrayList<>();
78          }
79          return pmfmColumns;
80      }
81  
82      public void addPmfmColumn(PmfmTableColumn pmfmColumn) {
83          getPmfmColumns().add(pmfmColumn);
84          firePropertyChange(PROPERTY_PMFM_COLUMNS, null, getPmfmColumns());
85      }
86  
87  }