View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.program.strategies;
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.configuration.programStrategy.StrategyDTO;
27  import fr.ifremer.dali.ui.swing.content.manage.program.ProgramsUIModel;
28  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
29  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliTableUIModel;
30  
31  import java.util.List;
32  
33  /**
34   * Modele pour la zone des programmes.
35   */
36  public class StrategiesTableUIModel extends AbstractDaliTableUIModel<StrategyDTO, StrategiesTableRowModel, StrategiesTableUIModel> {
37  
38      /** Constant <code>PROPERTY_LOADED="loaded"</code> */
39      public static final String PROPERTY_LOADED = "loaded";
40      /** Constant <code>PROPERTY_EDITABLE="editable"</code> */
41      public static final String PROPERTY_EDITABLE = "editable";
42      private static final long serialVersionUID = 3992314434806850926L;
43      private boolean loaded;
44      private boolean editable;
45      private StatusDTO programStatus;
46      private ProgramsUIModel parentModel;
47      public static final String EVENT_SAVE_APPLIED_STRATEGIES = "saveAppliedStrategies";
48      public static final String EVENT_SAVE_PMFM_STRATEGIES = "savePMFMStrategies";
49      public static final String EVENT_VALIDATE_ROWS = "validateRows";
50      public static final String EVENT_REMOVE_LOCATIONS = "removeLocations";
51  
52      /**
53       * Constructor.
54       */
55      public StrategiesTableUIModel() {
56          super();
57      }
58  
59      /**
60       * <p>isLoaded.</p>
61       *
62       * @return a boolean.
63       */
64      public boolean isLoaded() {
65          return loaded;
66      }
67  
68      /**
69       * <p>Setter for the field <code>loaded</code>.</p>
70       *
71       * @param loaded a boolean.
72       */
73      public void setLoaded(boolean loaded) {
74          this.loaded = loaded;
75          firePropertyChange(PROPERTY_LOADED, null, loaded);
76      }
77  
78      /**
79       * <p>isEditable.</p>
80       *
81       * @return a boolean.
82       */
83      public boolean isEditable() {
84          return editable;
85      }
86  
87      /**
88       * <p>Setter for the field <code>editable</code>.</p>
89       *
90       * @param editable a boolean.
91       */
92      public void setEditable(boolean editable) {
93          this.editable = editable;
94          firePropertyChange(PROPERTY_EDITABLE, null, editable);
95      }
96  
97      /**
98       * <p>Getter for the field <code>programStatus</code>.</p>
99       *
100      * @return a {@link fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO} object.
101      */
102     public StatusDTO getProgramStatus() {
103         return programStatus;
104     }
105 
106     /**
107      * <p>Setter for the field <code>programStatus</code>.</p>
108      *
109      * @param programStatus a {@link fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO} object.
110      */
111     public void setProgramStatus(StatusDTO programStatus) {
112         this.programStatus = programStatus;
113     }
114 
115     public ProgramsUIModel getParentModel() {
116         return parentModel;
117     }
118 
119     public void setParentModel(ProgramsUIModel parentModel) {
120         this.parentModel = parentModel;
121     }
122 
123     public void fireSaveAppliedStrategies() {
124         firePropertyChange(EVENT_SAVE_APPLIED_STRATEGIES, null, null);
125     }
126 
127     public void fireSavePmfmStrategies() {
128         firePropertyChange(EVENT_SAVE_PMFM_STRATEGIES, null, null);
129     }
130 
131     public void fireValidateRows() {
132         firePropertyChange(EVENT_VALIDATE_ROWS, null, null);
133     }
134 
135     public void fireRemoveLocations(List<Integer> locationIds) {
136         firePropertyChange(EVENT_REMOVE_LOCATIONS, null, locationIds);
137     }
138 
139     public void clear() {
140         setBeans(null);
141         setLoaded(false);
142     }
143 
144 }