View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.program;
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.ui.swing.content.manage.program.locations.LocationsTableUIModel;
27  import fr.ifremer.dali.ui.swing.content.manage.program.pmfms.PmfmsTableUIModel;
28  import fr.ifremer.dali.ui.swing.content.manage.program.programs.ProgramsTableUIModel;
29  import fr.ifremer.dali.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.dali.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.dali.ui.swing.content.manage.program.programs.ProgramsTableUIModel} object.
87  	 */
88  	public void setProgramsUIModel(ProgramsTableUIModel programsUIModel) {
89  		this.programsUIModel = programsUIModel;
90  		this.programsUIModel.setParentModel(this);
91  	}
92  
93  	/**
94  	 * <p>Getter for the field <code>strategiesUIModel</code>.</p>
95  	 *
96  	 * @return a {@link fr.ifremer.dali.ui.swing.content.manage.program.strategies.StrategiesTableUIModel} object.
97  	 */
98  	public StrategiesTableUIModel getStrategiesUIModel() {
99  		return strategiesUIModel;
100 	}
101 
102 	/**
103 	 * <p>Setter for the field <code>strategiesUIModel</code>.</p>
104 	 *
105 	 * @param strategiesUIModel a {@link fr.ifremer.dali.ui.swing.content.manage.program.strategies.StrategiesTableUIModel} object.
106 	 */
107 	public void setStrategiesUIModel(StrategiesTableUIModel strategiesUIModel) {
108 		this.strategiesUIModel = strategiesUIModel;
109 		this.strategiesUIModel.setParentModel(this);
110 	}
111 
112 	/**
113 	 * <p>Getter for the field <code>locationsUIModel</code>.</p>
114 	 *
115 	 * @return a {@link fr.ifremer.dali.ui.swing.content.manage.program.locations.LocationsTableUIModel} object.
116 	 */
117 	public LocationsTableUIModel getLocationsUIModel() {
118 		return locationsUIModel;
119 	}
120 
121 	/**
122 	 * <p>Setter for the field <code>locationsUIModel</code>.</p>
123 	 *
124 	 * @param locationsUIModel a {@link fr.ifremer.dali.ui.swing.content.manage.program.locations.LocationsTableUIModel} object.
125 	 */
126 	public void setLocationsUIModel(LocationsTableUIModel locationsUIModel) {
127 		this.locationsUIModel = locationsUIModel;
128 		this.locationsUIModel.setParentModel(this);
129 	}
130 
131 	/**
132 	 * <p>Getter for the field <code>pmfmsUIModel</code>.</p>
133 	 *
134 	 * @return a {@link fr.ifremer.dali.ui.swing.content.manage.program.pmfms.PmfmsTableUIModel} object.
135 	 */
136 	public PmfmsTableUIModel getPmfmsUIModel() {
137 		return pmfmsUIModel;
138 	}
139 
140 	/**
141 	 * <p>Setter for the field <code>pmfmsUIModel</code>.</p>
142 	 *
143 	 * @param pmfmsUIModel a {@link fr.ifremer.dali.ui.swing.content.manage.program.pmfms.PmfmsTableUIModel} object.
144 	 */
145 	public void setPmfmsUIModel(PmfmsTableUIModel pmfmsUIModel) {
146 		this.pmfmsUIModel = pmfmsUIModel;
147 		this.pmfmsUIModel.setParentModel(this);
148 	}
149 
150 	public boolean isSaveEnabled() {
151 		return saveEnabled;
152 	}
153 
154 	public void setSaveEnabled(boolean saveEnabled) {
155 		boolean oldValue = isSaveEnabled();
156 		this.saveEnabled = saveEnabled;
157 		firePropertyChange(PROPERTY_SAVE_ENABLED, oldValue, saveEnabled);
158 	}
159 }