View Javadoc
1   package fr.ifremer.dali.ui.swing.content.observation.operation.measurement.grouped.initGrid;
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.quadrige3.ui.core.dto.QuadrigeBean;
27  import fr.ifremer.dali.dto.referential.pmfm.PmfmDTO;
28  import fr.ifremer.dali.dto.referential.pmfm.QualitativeValueDTO;
29  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliTableUIModel;
30  import fr.ifremer.dali.vo.PresetVO;
31  import org.apache.commons.collections4.CollectionUtils;
32  
33  import java.util.List;
34  
35  /**
36   * Created by Ludovic on 26/05/2015.
37   */
38  public class InitGridUIModel extends AbstractDaliTableUIModel<QuadrigeBean, InitGridRowModel, InitGridUIModel> {
39  
40      private List<PmfmDTO> availablePmfms;
41      public static final String PROPERTY_AVAILABLE_PMFMS = "availablePmfms";
42  
43      private List<QualitativeValueDTO> selectedValues;
44      public static final String PROPERTY_SELECTED_VALUES = "selectedValues";
45  
46      private PresetVO preset;
47      public static final String PROPERTY_PRESET = "preset";
48  
49      public List<PmfmDTO> getAvailablePmfms() {
50          return availablePmfms;
51      }
52  
53      public void setAvailablePmfms(List<PmfmDTO> availablePmfms) {
54          this.availablePmfms = availablePmfms;
55          firePropertyChange(PROPERTY_AVAILABLE_PMFMS, null, availablePmfms);
56      }
57  
58      public List<QualitativeValueDTO> getSelectedValues() {
59          return selectedValues;
60      }
61  
62      public void setSelectedValues(List<QualitativeValueDTO> selectedValues) {
63          this.selectedValues = selectedValues;
64          firePropertyChange(PROPERTY_SELECTED_VALUES, null, selectedValues);
65      }
66  
67      public PresetVO getPreset() {
68          return preset;
69      }
70  
71      public void setPreset(PresetVO preset) {
72          this.preset = preset;
73          firePropertyChange(PROPERTY_PRESET, null, preset);
74      }
75  
76      public boolean isValuesValid() {
77          for (InitGridRowModel rowModel : getRows()) {
78              if (CollectionUtils.isNotEmpty(rowModel.getQualitativeValues())) return true;
79          }
80          return false;
81      }
82  
83      public void setValuesValid(boolean valuesValid) {
84          // dummy setter
85      }
86  
87  }