View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.program.locations;
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.AppliedStrategyDTO;
27  import fr.ifremer.dali.ui.swing.content.manage.program.ProgramsUIModel;
28  import fr.ifremer.dali.ui.swing.content.manage.program.programs.ProgramsTableRowModel;
29  import fr.ifremer.dali.ui.swing.content.manage.program.strategies.StrategiesTableRowModel;
30  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliTableUIModel;
31  
32  /**
33   * Modele pour la zone des lieux.
34   */
35  public class LocationsTableUIModel extends AbstractDaliTableUIModel<AppliedStrategyDTO, LocationsTableRowModel, LocationsTableUIModel> {
36  
37      public static final String PROPERTY_PERIODS_ENABLED = "periodsEnabled";
38      public static final String PROPERTY_LOADED = "loaded";
39      public static final String PROPERTY_EDITABLE = "editable";
40      private boolean periodsEnabled;
41      private boolean loaded;
42      private boolean editable;
43      private ProgramsTableRowModel selectedProgram;
44  
45      private StrategiesTableRowModel selectedStrategy;
46  
47      private ProgramsUIModel parentModel;
48      public static final String EVENT_VALIDATE_ROWS = "validateRows";
49  
50      /**
51       * Constructor.
52       */
53      public LocationsTableUIModel() {
54          super();
55      }
56  
57      /**
58       * <p>isPeriodsEnabled.</p>
59       *
60       * @return a boolean.
61       */
62      public boolean isPeriodsEnabled() {
63          return periodsEnabled;
64      }
65  
66      /**
67       * <p>Setter for the field <code>periodsEnabled</code>.</p>
68       *
69       * @param periodsEnabled a boolean.
70       */
71      public void setPeriodsEnabled(boolean periodsEnabled) {
72          this.periodsEnabled = periodsEnabled;
73          firePropertyChange(PROPERTY_PERIODS_ENABLED, null, periodsEnabled);
74      }
75  
76      /**
77       * <p>isLoaded.</p>
78       *
79       * @return a boolean.
80       */
81      public boolean isLoaded() {
82          return loaded;
83      }
84  
85      /**
86       * <p>Setter for the field <code>loaded</code>.</p>
87       *
88       * @param loaded a boolean.
89       */
90      public void setLoaded(boolean loaded) {
91          this.loaded = loaded;
92          firePropertyChange(PROPERTY_LOADED, null, loaded);
93      }
94  
95      /**
96       * <p>isEditable.</p>
97       *
98       * @return a boolean.
99       */
100     public boolean isEditable() {
101         return editable;
102     }
103 
104     /**
105      * <p>Setter for the field <code>editable</code>.</p>
106      *
107      * @param editable a boolean.
108      */
109     public void setEditable(boolean editable) {
110         this.editable = editable;
111         firePropertyChange(PROPERTY_EDITABLE, null, editable);
112     }
113 
114     /**
115      * <p>Getter for the field <code>selectedProgram</code>.</p>
116      *
117      * @return a {@link fr.ifremer.dali.ui.swing.content.manage.program.programs.ProgramsTableRowModel} object.
118      */
119     public ProgramsTableRowModel getSelectedProgram() {
120         return selectedProgram;
121     }
122 
123     /**
124      * <p>Setter for the field <code>selectedProgram</code>.</p>
125      *
126      * @param selectedProgram a {@link fr.ifremer.dali.ui.swing.content.manage.program.programs.ProgramsTableRowModel} object.
127      */
128     public void setSelectedProgram(ProgramsTableRowModel selectedProgram) {
129         this.selectedProgram = selectedProgram;
130     }
131 
132     /**
133      * <p>Getter for the field <code>selectedStrategy</code>.</p>
134      *
135      * @return a {@link fr.ifremer.dali.ui.swing.content.manage.program.strategies.StrategiesTableRowModel} object.
136      */
137     public StrategiesTableRowModel getSelectedStrategy() {
138         return selectedStrategy;
139     }
140 
141     /**
142      * <p>Setter for the field <code>selectedStrategy</code>.</p>
143      *
144      * @param selectedStrategy a {@link fr.ifremer.dali.ui.swing.content.manage.program.strategies.StrategiesTableRowModel} object.
145      */
146     public void setSelectedStrategy(StrategiesTableRowModel selectedStrategy) {
147         this.selectedStrategy = selectedStrategy;
148     }
149 
150     public ProgramsUIModel getParentModel() {
151         return parentModel;
152     }
153 
154     public void setParentModel(ProgramsUIModel parentModel) {
155         this.parentModel = parentModel;
156     }
157 
158     public void fireValidateRows() {
159         firePropertyChange(EVENT_VALIDATE_ROWS, null, null);
160     }
161 
162     public void clear() {
163         setBeans(null);
164         setLoaded(false);
165     }
166 
167 }