View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.rule.rulelist;
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.ErrorDTO;
27  import fr.ifremer.dali.dto.DaliBeanFactory;
28  import fr.ifremer.dali.dto.configuration.control.ControlRuleDTO;
29  import fr.ifremer.dali.dto.configuration.control.RuleListDTO;
30  import fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO;
31  import fr.ifremer.dali.dto.referential.DepartmentDTO;
32  import fr.ifremer.quadrige3.ui.core.dto.MonthDTO;
33  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
34  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliRowUIModel;
35  import org.nuiton.util.beans.Binder;
36  import org.nuiton.util.beans.BinderFactory;
37  
38  import java.util.Collection;
39  import java.util.Date;
40  
41  /**
42   * <p>RuleListRowModel class.</p>
43   *
44   * @author Antoine
45   */
46  public class RuleListRowModel extends AbstractDaliRowUIModel<RuleListDTO, RuleListRowModel> implements RuleListDTO {
47  
48      private static final Binder<RuleListDTO, RuleListRowModel> FROM_BEAN_BINDER =
49              BinderFactory.newBinder(RuleListDTO.class, RuleListRowModel.class);
50  
51      private static final Binder<RuleListRowModel, RuleListDTO> TO_BEAN_BINDER =
52              BinderFactory.newBinder(RuleListRowModel.class, RuleListDTO.class);
53  
54      /**
55       * <p>Constructor for RuleListRowModel.</p>
56       */
57      public RuleListRowModel() {
58          super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
59      }
60  
61      @Override
62      public boolean isEditable() {
63          // a rule list can be read only if not compatible
64          return super.isEditable() && !isReadOnly();
65      }
66  
67      /** {@inheritDoc} */
68      @Override
69      protected RuleListDTO newBean() {
70          return DaliBeanFactory.newRuleListDTO();
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public String getCode() {
76          return delegateObject.getCode();
77      }
78  
79      /** {@inheritDoc} */
80      @Override
81      public void setCode(String code) {
82          delegateObject.setCode(code);
83      }
84  
85      /** {@inheritDoc} */
86      @Override
87      public boolean isActive() {
88          return delegateObject.isActive();
89      }
90  
91      /** {@inheritDoc} */
92      @Override
93      public void setActive(boolean Active) {
94          delegateObject.setActive(Active);
95      }
96  
97      /** {@inheritDoc} */
98      @Override
99      public MonthDTO getStartMonth() {
100         return delegateObject.getStartMonth();
101     }
102 
103     /** {@inheritDoc} */
104     @Override
105     public void setStartMonth(MonthDTO StartMonth) {
106         delegateObject.setStartMonth(StartMonth);
107     }
108 
109     /** {@inheritDoc} */
110     @Override
111     public MonthDTO getEndMonth() {
112         return delegateObject.getEndMonth();
113     }
114 
115     /** {@inheritDoc} */
116     @Override
117     public void setEndMonth(MonthDTO EndMonth) {
118         delegateObject.setEndMonth(EndMonth);
119     }
120 
121     /** {@inheritDoc} */
122     @Override
123     public String getDescription() {
124         return delegateObject.getDescription();
125     }
126 
127     /** {@inheritDoc} */
128     @Override
129     public void setDescription(String description) {
130         delegateObject.setDescription(description);
131     }
132 
133     /** {@inheritDoc} */
134     @Override
135     public boolean isDirty() {
136         return delegateObject.isDirty();
137     }
138 
139     /** {@inheritDoc} */
140     @Override
141     public void setDirty(boolean dirty) {
142         delegateObject.setDirty(dirty);
143     }
144 
145     /** {@inheritDoc} */
146     @Override
147     public ProgramDTO getPrograms(int index) {
148         return delegateObject.getPrograms(index);
149     }
150 
151     /** {@inheritDoc} */
152     @Override
153     public boolean isProgramsEmpty() {
154         return delegateObject.isProgramsEmpty();
155     }
156 
157     /** {@inheritDoc} */
158     @Override
159     public int sizePrograms() {
160         return delegateObject.sizePrograms();
161     }
162 
163     /** {@inheritDoc} */
164     @Override
165     public void addPrograms(ProgramDTO Program) {
166         delegateObject.addPrograms(Program);
167     }
168 
169     /** {@inheritDoc} */
170     @Override
171     public void addAllPrograms(Collection<ProgramDTO> Program) {
172         delegateObject.addAllPrograms(Program);
173     }
174 
175     /** {@inheritDoc} */
176     @Override
177     public boolean removePrograms(ProgramDTO Program) {
178         return delegateObject.removePrograms(Program);
179     }
180 
181     /** {@inheritDoc} */
182     @Override
183     public boolean removeAllPrograms(Collection<ProgramDTO> Program) {
184         return delegateObject.removeAllPrograms(Program);
185     }
186 
187     /** {@inheritDoc} */
188     @Override
189     public boolean containsPrograms(ProgramDTO Program) {
190         return delegateObject.containsPrograms(Program);
191     }
192 
193     /** {@inheritDoc} */
194     @Override
195     public boolean containsAllPrograms(Collection<ProgramDTO> Program) {
196         return delegateObject.containsAllPrograms(Program);
197     }
198 
199     /** {@inheritDoc} */
200     @Override
201     public Collection<ProgramDTO> getPrograms() {
202         return delegateObject.getPrograms();
203     }
204 
205     /** {@inheritDoc} */
206     @Override
207     public void setPrograms(Collection<ProgramDTO> Program) {
208         delegateObject.setPrograms(Program);
209     }
210 
211     /** {@inheritDoc} */
212     @Override
213     public DepartmentDTO getDepartments(int index) {
214         return delegateObject.getDepartments(index);
215     }
216 
217     /** {@inheritDoc} */
218     @Override
219     public boolean isDepartmentsEmpty() {
220         return delegateObject.isDepartmentsEmpty();
221     }
222 
223     /** {@inheritDoc} */
224     @Override
225     public int sizeDepartments() {
226         return delegateObject.sizeDepartments();
227     }
228 
229     /** {@inheritDoc} */
230     @Override
231     public void addDepartments(DepartmentDTO service) {
232         delegateObject.addDepartments(service);
233     }
234 
235     /** {@inheritDoc} */
236     @Override
237     public void addAllDepartments(Collection<DepartmentDTO> service) {
238         delegateObject.addAllDepartments(service);
239     }
240 
241     /** {@inheritDoc} */
242     @Override
243     public boolean removeDepartments(DepartmentDTO service) {
244         return delegateObject.removeDepartments(service);
245     }
246 
247     /** {@inheritDoc} */
248     @Override
249     public boolean removeAllDepartments(Collection<DepartmentDTO> service) {
250         return delegateObject.removeAllDepartments(service);
251     }
252 
253     /** {@inheritDoc} */
254     @Override
255     public boolean containsDepartments(DepartmentDTO service) {
256         return delegateObject.containsDepartments(service);
257     }
258 
259     /** {@inheritDoc} */
260     @Override
261     public boolean containsAllDepartments(Collection<DepartmentDTO> service) {
262         return delegateObject.containsAllDepartments(service);
263     }
264 
265     /** {@inheritDoc} */
266     @Override
267     public Collection<DepartmentDTO> getDepartments() {
268         return delegateObject.getDepartments();
269     }
270 
271     /** {@inheritDoc} */
272     @Override
273     public void setDepartments(Collection<DepartmentDTO> service) {
274         delegateObject.setDepartments(service);
275     }
276 
277     /** {@inheritDoc} */
278     @Override
279     public ErrorDTO getErrors(int index) {
280         return delegateObject.getErrors(index);
281     }
282 
283     /** {@inheritDoc} */
284     @Override
285     public boolean isErrorsEmpty() {
286         return delegateObject.isErrorsEmpty();
287     }
288 
289     /** {@inheritDoc} */
290     @Override
291     public int sizeErrors() {
292         return delegateObject.sizeErrors();
293     }
294 
295     /** {@inheritDoc} */
296     @Override
297     public void addErrors(ErrorDTO errors) {
298         delegateObject.addErrors(errors);
299     }
300 
301     /** {@inheritDoc} */
302     @Override
303     public void addAllErrors(Collection<ErrorDTO> errors) {
304         delegateObject.addAllErrors(errors);
305     }
306 
307     /** {@inheritDoc} */
308     @Override
309     public boolean removeErrors(ErrorDTO errors) {
310         return delegateObject.removeErrors(errors);
311     }
312 
313     /** {@inheritDoc} */
314     @Override
315     public boolean removeAllErrors(Collection<ErrorDTO> errors) {
316         return delegateObject.removeAllErrors(errors);
317     }
318 
319     /** {@inheritDoc} */
320     @Override
321     public boolean containsErrors(ErrorDTO errors) {
322         return delegateObject.containsErrors(errors);
323     }
324 
325     /** {@inheritDoc} */
326     @Override
327     public boolean containsAllErrors(Collection<ErrorDTO> errors) {
328         return delegateObject.containsAllErrors(errors);
329     }
330 
331     /** {@inheritDoc} */
332     @Override
333     public Collection<ErrorDTO> getErrors() {
334         return delegateObject.getErrors();
335     }
336 
337     /** {@inheritDoc} */
338     @Override
339     public void setErrors(Collection<ErrorDTO> errors) {
340         delegateObject.setErrors(errors);
341     }
342 
343     /** {@inheritDoc} */
344     @Override
345     public ControlRuleDTO getControlRules(int index) {
346         return delegateObject.getControlRules(index);
347     }
348 
349     /** {@inheritDoc} */
350     @Override
351     public boolean isControlRulesEmpty() {
352         return delegateObject.isControlRulesEmpty();
353     }
354 
355     /** {@inheritDoc} */
356     @Override
357     public int sizeControlRules() {
358         return delegateObject.sizeControlRules();
359     }
360 
361     /** {@inheritDoc} */
362     @Override
363     public void addControlRules(ControlRuleDTO ControlRule) {
364         delegateObject.addControlRules(ControlRule);
365     }
366 
367     /** {@inheritDoc} */
368     @Override
369     public void addAllControlRules(Collection<ControlRuleDTO> ControlRule) {
370         delegateObject.addAllControlRules(ControlRule);
371     }
372 
373     /** {@inheritDoc} */
374     @Override
375     public boolean removeControlRules(ControlRuleDTO ControlRule) {
376         return delegateObject.removeControlRules(ControlRule);
377     }
378 
379     /** {@inheritDoc} */
380     @Override
381     public boolean removeAllControlRules(Collection<ControlRuleDTO> ControlRule) {
382         return delegateObject.removeAllControlRules(ControlRule);
383     }
384 
385     /** {@inheritDoc} */
386     @Override
387     public boolean containsControlRules(ControlRuleDTO ControlRule) {
388         return delegateObject.containsControlRules(ControlRule);
389     }
390 
391     /** {@inheritDoc} */
392     @Override
393     public boolean containsAllControlRules(Collection<ControlRuleDTO> ControlRule) {
394         return delegateObject.containsAllControlRules(ControlRule);
395     }
396 
397     /** {@inheritDoc} */
398     @Override
399     public Collection<ControlRuleDTO> getControlRules() {
400         return delegateObject.getControlRules();
401     }
402 
403     /** {@inheritDoc} */
404     @Override
405     public void setControlRules(Collection<ControlRuleDTO> ControlRule) {
406         delegateObject.setControlRules(ControlRule);
407     }
408 
409     /** {@inheritDoc} */
410     @Override
411     public boolean isNewCode() {
412         return delegateObject.isNewCode();
413     }
414 
415     /** {@inheritDoc} */
416     @Override
417     public void setNewCode(boolean newCode) {
418         delegateObject.setNewCode(newCode);
419     }
420 
421     @Override
422     public boolean isReadOnly() {
423         return delegateObject.isReadOnly();
424     }
425 
426     @Override
427     public void setReadOnly(boolean readOnly) {
428         delegateObject.setReadOnly(readOnly);
429     }
430 
431     @Override
432     public Date getCreationDate() {
433         return delegateObject.getCreationDate();
434     }
435 
436     @Override
437     public void setCreationDate(Date date) {
438         delegateObject.setCreationDate(date);
439     }
440 
441     @Override
442     public Date getUpdateDate() {
443         return delegateObject.getUpdateDate();
444     }
445 
446     @Override
447     public void setUpdateDate(Date date) {
448         delegateObject.setUpdateDate(date);
449     }
450 
451     @Override
452     public String getName() {
453         return delegateObject.getName();
454     }
455 
456     @Override
457     public void setName(String name) {
458         delegateObject.setName(name);
459     }
460 
461     @Override
462     public StatusDTO getStatus() {
463         return delegateObject.getStatus();
464     }
465 
466     @Override
467     public void setStatus(StatusDTO status) {
468         delegateObject.setStatus(status);
469     }
470 }