View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.referential.location.local.replace;
2   
3   /*-
4    * #%L
5    * Reef DB :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2022 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  
27  import fr.ifremer.quadrige3.ui.swing.component.bean.ExtendedComboBox;
28  import fr.ifremer.reefdb.dto.referential.LocationDTO;
29  import fr.ifremer.reefdb.ui.swing.content.manage.referential.replace.AbstractReplaceUI;
30  import fr.ifremer.reefdb.ui.swing.util.ReefDbUI;
31  import java.awt.Dialog;
32  import java.awt.Dialog.ModalityType;
33  import java.awt.Frame;
34  import java.awt.GraphicsConfiguration;
35  import java.awt.Window;
36  import jaxx.runtime.JAXXContext;
37  import jaxx.runtime.JAXXObjectDescriptor;
38  import jaxx.runtime.JAXXUtil;
39  import org.apache.commons.logging.Log;
40  import org.apache.commons.logging.LogFactory;
41  import static org.nuiton.i18n.I18n.t;
42  
43  public class ReplaceLocationUI extends AbstractReplaceUI<LocationDTO, ReplaceLocationUIModel> implements ReefDbUI<ReplaceLocationUIModel, ReplaceLocationUIHandler> {
44  
45      /*-----------------------------------------------------------------------*/
46      /*------------------------- Other static fields -------------------------*/
47      /*-----------------------------------------------------------------------*/
48  
49      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAALVUTU8UQRCtXVlgQRTYSDCuCX7EY28iR/zgQ4mQRROQhLiJ2jvTuzTpnW66e2SI0fgT/Al692LizZPx4NmDF+NfMMaDV2P1zOzOgmPg4h5qJ11d772qeTVvvkPJaLiwQ6OI6DCwvMPI6sLW1r3mDvPsLWY8zZWVGpJfoQjFBoz6vXNj4VKj7spraXltSXaUDFjQVz1XhxFj9wUz24xZC+cPVnjG1DZ66blIhbqL2hOVh/rq54/iS//F6yJApFCda2XmqKqsk4E6FLlvYRKZntCaoEEbZWgetFHvmDtbEtSYu7TDduE5DNVhUFGNYBYuHr/lGCOuj5SFsmZKUI9trlh42NKEtzTrME00Yy2/SUJOzB4KIJ4MLOKRDg1om2G6xRwzp4II6VHLZRA/CJICkvXkv55mN1eUimkHLZQ60mfCgvd/CdccS8Y6aWSoMc+Nxfk05aKMLFzvk7AbUl/zNpvtV5EOkjQZDcjtCDX5zO/W94FbqtvM9oO7zER2YyzVuRhai71Bxb3QKOVZTU7xtoZzBxyDXiSZFzOzFBpQ0iEeW5hu/G3fdUwlxp0+ZFwHGGd/T1W+vP/2brnr1gHkPpN7tW/Z0EVKS8W05Y76dGLV0HJRW6NqrgFlwwRuaryJ1RxhG2kaxSHfhCsnrpzcoWYbIUpDXz98nHr8+QQUl2FESOovU3d/Bcp2W+MUpPAjdXM+VnRybxjjuNOGrrLcChxRNbWSPugHEqcjnEg1ZyI9Wc3yp1+Vjbfz3akUUOXZf17PJlN6AIM8EDxg8RanC5q7taPKsNCX2SLmrSb076ZKbVSN40xe95OPqFKCJ70ueC7id+3poaVIEsRzRM+i0KFdjpt0T1fgsEuPwTvsFuP+vsLBn7rmU0tnmjzw0dM3/oIvuDh+JKY7vurCbD5CBRH+AJncnlAoBgAA";
50      private static final Log log = LogFactory.getLog(ReplaceLocationUI.class);
51      private static final long serialVersionUID = 1L;
52  
53      /*-----------------------------------------------------------------------*/
54      /*--------------------------- Internal states ---------------------------*/
55      /*-----------------------------------------------------------------------*/
56  
57      private boolean allComponentsCreated;
58  
59      /*-----------------------------------------------------------------------*/
60      /*------------------------ Protected components  ------------------------*/
61      /*-----------------------------------------------------------------------*/
62  
63      protected final ReplaceLocationUIHandler handler = createHandler();
64      protected ReplaceLocationUI replaceUI = this;
65  
66      /*-----------------------------------------------------------------------*/
67      /*---------------------------- Constructors  ----------------------------*/
68      /*-----------------------------------------------------------------------*/
69  
70      public ReplaceLocationUI(Frame param0, String param1, boolean param2) {
71          super(param0 ,param1 ,param2);
72          $initialize();
73      }
74  
75      public ReplaceLocationUI(JAXXContext param0, Frame param1, String param2, boolean param3) {
76          super(param0 ,param1 ,param2 ,param3);
77          $initialize();
78      }
79  
80      public ReplaceLocationUI(Frame param0, String param1) {
81          super(param0 ,param1);
82          $initialize();
83      }
84  
85      public ReplaceLocationUI(JAXXContext param0, Frame param1, String param2) {
86          super(param0 ,param1 ,param2);
87          $initialize();
88      }
89  
90      public ReplaceLocationUI(Frame param0, String param1, boolean param2, GraphicsConfiguration param3) {
91          super(param0 ,param1 ,param2 ,param3);
92          $initialize();
93      }
94  
95      public ReplaceLocationUI(JAXXContext param0, Frame param1, String param2, boolean param3, GraphicsConfiguration param4) {
96          super(param0 ,param1 ,param2 ,param3 ,param4);
97          $initialize();
98      }
99  
100     public ReplaceLocationUI(Dialog param0) {
101         super(param0);
102         $initialize();
103     }
104 
105     public ReplaceLocationUI(JAXXContext param0, Dialog param1) {
106         super(param0 ,param1);
107         $initialize();
108     }
109 
110     public ReplaceLocationUI(Frame param0, boolean param1) {
111         super(param0 ,param1);
112         $initialize();
113     }
114 
115     public ReplaceLocationUI(JAXXContext param0, Frame param1, boolean param2) {
116         super(param0 ,param1 ,param2);
117         $initialize();
118     }
119 
120     public ReplaceLocationUI() {
121         $initialize();
122     }
123 
124     public ReplaceLocationUI(JAXXContext param0) {
125         super(param0);
126         $initialize();
127     }
128 
129     public ReplaceLocationUI(Frame param0) {
130         super(param0);
131         $initialize();
132     }
133 
134     public ReplaceLocationUI(JAXXContext param0, Frame param1) {
135         super(param0 ,param1);
136         $initialize();
137     }
138 
139     public ReplaceLocationUI(Dialog param0, String param1, boolean param2, GraphicsConfiguration param3) {
140         super(param0 ,param1 ,param2 ,param3);
141         $initialize();
142     }
143 
144     public ReplaceLocationUI(JAXXContext param0, Dialog param1, String param2, boolean param3, GraphicsConfiguration param4) {
145         super(param0 ,param1 ,param2 ,param3 ,param4);
146         $initialize();
147     }
148 
149     public ReplaceLocationUI(Window param0) {
150         super(param0);
151         $initialize();
152     }
153 
154     public ReplaceLocationUI(JAXXContext param0, Window param1) {
155         super(param0 ,param1);
156         $initialize();
157     }
158 
159     public ReplaceLocationUI(Window param0, ModalityType param1) {
160         super(param0 ,param1);
161         $initialize();
162     }
163 
164     public ReplaceLocationUI(JAXXContext param0, Window param1, ModalityType param2) {
165         super(param0 ,param1 ,param2);
166         $initialize();
167     }
168 
169     public ReplaceLocationUI(Window param0, String param1) {
170         super(param0 ,param1);
171         $initialize();
172     }
173 
174     public ReplaceLocationUI(JAXXContext param0, Window param1, String param2) {
175         super(param0 ,param1 ,param2);
176         $initialize();
177     }
178 
179     public ReplaceLocationUI(Window param0, String param1, ModalityType param2) {
180         super(param0 ,param1 ,param2);
181         $initialize();
182     }
183 
184     public ReplaceLocationUI(JAXXContext param0, Window param1, String param2, ModalityType param3) {
185         super(param0 ,param1 ,param2 ,param3);
186         $initialize();
187     }
188 
189     public ReplaceLocationUI(Window param0, String param1, ModalityType param2, GraphicsConfiguration param3) {
190         super(param0 ,param1 ,param2 ,param3);
191         $initialize();
192     }
193 
194     public ReplaceLocationUI(JAXXContext param0, Window param1, String param2, ModalityType param3, GraphicsConfiguration param4) {
195         super(param0 ,param1 ,param2 ,param3 ,param4);
196         $initialize();
197     }
198 
199     public ReplaceLocationUI(Dialog param0, boolean param1) {
200         super(param0 ,param1);
201         $initialize();
202     }
203 
204     public ReplaceLocationUI(JAXXContext param0, Dialog param1, boolean param2) {
205         super(param0 ,param1 ,param2);
206         $initialize();
207     }
208 
209     public ReplaceLocationUI(Dialog param0, String param1) {
210         super(param0 ,param1);
211         $initialize();
212     }
213 
214     public ReplaceLocationUI(JAXXContext param0, Dialog param1, String param2) {
215         super(param0 ,param1 ,param2);
216         $initialize();
217     }
218 
219     public ReplaceLocationUI(Dialog param0, String param1, boolean param2) {
220         super(param0 ,param1 ,param2);
221         $initialize();
222     }
223 
224     public ReplaceLocationUI(JAXXContext param0, Dialog param1, String param2, boolean param3) {
225         super(param0 ,param1 ,param2 ,param3);
226         $initialize();
227     }
228 
229     /*-----------------------------------------------------------------------*/
230     /*--------------------------- Statics methods ---------------------------*/
231     /*-----------------------------------------------------------------------*/
232 
233     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
234         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
235     }
236 
237     /*-----------------------------------------------------------------------*/
238     /*----------------------- Public acessor methods  -----------------------*/
239     /*-----------------------------------------------------------------------*/
240 
241     public ReplaceLocationUIHandler getHandler() {
242         return handler;
243     }
244 
245     @Override
246     public ReplaceLocationUIModel getModel() {
247         return (ReplaceLocationUIModel) super.getModel();
248     }
249 
250     /*-----------------------------------------------------------------------*/
251     /*--------------------- Components creation methods ---------------------*/
252     /*-----------------------------------------------------------------------*/
253 
254     protected ReplaceLocationUIHandler createHandler() {
255         return new ReplaceLocationUIHandler();
256     }
257 
258     @Override
259     protected void createModel() {
260         $objectMap.put("model", model = getContextValue(ReplaceLocationUIModel.class));
261     }
262 
263     @Override
264     protected void createReplaceButton() {
265         super.createReplaceButton();
266         replaceButton.setName("replaceButton");
267         replaceButton.putClientProperty("applicationAction", ReplaceLocationAction.class);
268     }
269 
270     @Override
271     protected void createSourceListComboBox() {
272         super.createSourceListComboBox();
273         sourceListComboBox.setName("sourceListComboBox");
274     }
275 
276     @Override
277     protected void createTargetListComboBox() {
278         super.createTargetListComboBox();
279         targetListComboBox.setName("targetListComboBox");
280     }
281 
282     /*-----------------------------------------------------------------------*/
283     /*------------------------ Internal jaxx methods ------------------------*/
284     /*-----------------------------------------------------------------------*/
285 
286     private void $completeSetup() {
287         allComponentsCreated = true;
288         if (log.isDebugEnabled()) {
289             log.debug(this);
290         }
291         
292         // apply 2 property setters
293         sourceListComboBox.setBeanType(LocationDTO.class);
294         targetListComboBox.setBeanType(LocationDTO.class);
295         // late initializer
296         replaceUI.pack();
297     }
298 
299     private void $initialize() {
300         if (allComponentsCreated) {
301             return;
302         }
303         if (log.isDebugEnabled()) {
304             log.debug(this);
305         }
306         handler.beforeInit(this);
307         $objectMap.put("replaceUI", replaceUI);
308         // inline creation of replaceUI
309         setName("replaceUI");
310         setTitle(t("reefdb.replaceLocation.title"));
311         
312         $completeSetup();
313         handler.afterInit(this);
314     }
315 
316 }