1 package fr.ifremer.reefdb.ui.swing.content.manage.program;
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.reefdb.ui.swing.content.manage.program.locations.LocationsTableUIModel;
27 import fr.ifremer.reefdb.ui.swing.content.manage.program.pmfms.PmfmsTableUIModel;
28 import fr.ifremer.reefdb.ui.swing.content.manage.program.programs.ProgramsTableUIModel;
29 import fr.ifremer.reefdb.ui.swing.content.manage.program.strategies.StrategiesTableUIModel;
30 import fr.ifremer.quadrige3.ui.swing.model.AbstractEmptyUIModel;
31
32 /**
33 * Modele pour l administration de contextes.
34 */
35 public class ProgramsUIModel extends AbstractEmptyUIModel<ProgramsUIModel> {
36
37 /**
38 * Programmes UI model.
39 */
40 private ProgramsTableUIModel programsUIModel;
41
42 /**
43 * Strategies UI model.
44 */
45 private StrategiesTableUIModel strategiesUIModel;
46
47 /**
48 * Lieux UI model.
49 */
50 private LocationsTableUIModel locationsUIModel;
51
52 /**
53 * PSFMs UI model.
54 */
55 private PmfmsTableUIModel pmfmsUIModel;
56
57 private boolean saveEnabled;
58 public static final String PROPERTY_SAVE_ENABLED = "saveEnabled";
59
60 /** {@inheritDoc} */
61 @Override
62 public void setModify(boolean modify) {
63
64 if (!modify) {
65 programsUIModel.setModify(false);
66 strategiesUIModel.setModify(false);
67 locationsUIModel.setModify(false);
68 pmfmsUIModel.setModify(false);
69 }
70
71 super.setModify(modify);
72 }
73
74 /**
75 * <p>Getter for the field <code>programsUIModel</code>.</p>
76 *
77 * @return a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.programs.ProgramsTableUIModel} object.
78 */
79 public ProgramsTableUIModel getProgramsUIModel() {
80 return programsUIModel;
81 }
82
83 /**
84 * <p>Setter for the field <code>programsUIModel</code>.</p>
85 *
86 * @param programsUIModel a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.programs.ProgramsTableUIModel} object.
87 */
88 public void setProgramsUIModel(ProgramsTableUIModel programsUIModel) {
89 this.programsUIModel = programsUIModel;
90 }
91
92 /**
93 * <p>Getter for the field <code>strategiesUIModel</code>.</p>
94 *
95 * @return a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.strategies.StrategiesTableUIModel} object.
96 */
97 public StrategiesTableUIModel getStrategiesUIModel() {
98 return strategiesUIModel;
99 }
100
101 /**
102 * <p>Setter for the field <code>strategiesUIModel</code>.</p>
103 *
104 * @param strategiesUIModel a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.strategies.StrategiesTableUIModel} object.
105 */
106 public void setStrategiesUIModel(StrategiesTableUIModel strategiesUIModel) {
107 this.strategiesUIModel = strategiesUIModel;
108 }
109
110 /**
111 * <p>Getter for the field <code>locationsUIModel</code>.</p>
112 *
113 * @return a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.locations.LocationsTableUIModel} object.
114 */
115 public LocationsTableUIModel getLocationsUIModel() {
116 return locationsUIModel;
117 }
118
119 /**
120 * <p>Setter for the field <code>locationsUIModel</code>.</p>
121 *
122 * @param locationsUIModel a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.locations.LocationsTableUIModel} object.
123 */
124 public void setLocationsUIModel(LocationsTableUIModel locationsUIModel) {
125 this.locationsUIModel = locationsUIModel;
126 }
127
128 /**
129 * <p>Getter for the field <code>pmfmsUIModel</code>.</p>
130 *
131 * @return a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.pmfms.PmfmsTableUIModel} object.
132 */
133 public PmfmsTableUIModel getPmfmsUIModel() {
134 return pmfmsUIModel;
135 }
136
137 /**
138 * <p>Setter for the field <code>pmfmsUIModel</code>.</p>
139 *
140 * @param pmfmsUIModel a {@link fr.ifremer.reefdb.ui.swing.content.manage.program.pmfms.PmfmsTableUIModel} object.
141 */
142 public void setPmfmsUIModel(PmfmsTableUIModel pmfmsUIModel) {
143 this.pmfmsUIModel = pmfmsUIModel;
144 }
145
146 public boolean isSaveEnabled() {
147 return saveEnabled;
148 }
149
150 public void setSaveEnabled(boolean saveEnabled) {
151 boolean oldValue = isSaveEnabled();
152 this.saveEnabled = saveEnabled;
153 firePropertyChange(PROPERTY_SAVE_ENABLED, oldValue, saveEnabled);
154 }
155 }