View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.analysisinstruments.table;
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.ErrorAware;
27  import fr.ifremer.dali.dto.ErrorDTO;
28  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliRowUIModel;
29  import org.nuiton.util.beans.Binder;
30  import org.nuiton.util.beans.BinderFactory;
31  
32  import fr.ifremer.dali.dto.DaliBeanFactory;
33  import fr.ifremer.dali.dto.referential.AnalysisInstrumentDTO;
34  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
35  
36  import java.util.ArrayList;
37  import java.util.Collection;
38  import java.util.Date;
39  import java.util.List;
40  
41  /**
42   * <p>AnalysisInstrumentsTableRowModel class.</p>
43   *
44   * @author Antoine
45   */
46  public class AnalysisInstrumentsTableRowModel extends AbstractDaliRowUIModel<AnalysisInstrumentDTO, AnalysisInstrumentsTableRowModel> implements AnalysisInstrumentDTO, ErrorAware {
47  
48      private static final Binder<AnalysisInstrumentDTO, AnalysisInstrumentsTableRowModel> FROM_BEAN_BINDER =
49              BinderFactory.newBinder(AnalysisInstrumentDTO.class, AnalysisInstrumentsTableRowModel.class);
50  
51      private static final Binder<AnalysisInstrumentsTableRowModel, AnalysisInstrumentDTO> TO_BEAN_BINDER =
52              BinderFactory.newBinder(AnalysisInstrumentsTableRowModel.class, AnalysisInstrumentDTO.class);
53  
54      private final List<ErrorDTO> errors;
55  
56      /**
57       * <p>Constructor for AnalysisInstrumentsTableRowModel.</p>
58       */
59      public AnalysisInstrumentsTableRowModel() {
60          super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
61          errors = new ArrayList<>();
62      }
63  
64      /** {@inheritDoc} */
65      @Override
66      protected AnalysisInstrumentDTO newBean() {
67          return DaliBeanFactory.newAnalysisInstrumentDTO();
68      }
69  
70      /** {@inheritDoc} */
71      @Override
72      public String getName() {
73          return delegateObject.getName();
74      }
75  
76      /** {@inheritDoc} */
77      @Override
78      public void setName(String mnemonic) {
79          delegateObject.setName(mnemonic);
80      }
81  
82      /** {@inheritDoc} */
83      @Override
84      public String getDescription() {
85          return delegateObject.getDescription();
86      }
87  
88      /** {@inheritDoc} */
89      @Override
90      public void setDescription(String description) {
91          delegateObject.setDescription(description);
92      }
93  
94      @Override
95      public String getComment() {
96          return delegateObject.getComment();
97      }
98  
99      @Override
100     public void setComment(String comment) {
101         delegateObject.setComment(comment);
102     }
103 
104     /** {@inheritDoc} */
105     @Override
106     public boolean isDirty() {
107         return delegateObject.isDirty();
108     }
109 
110     /** {@inheritDoc} */
111     @Override
112     public void setDirty(boolean dirty) {
113         delegateObject.setDirty(dirty);
114     }
115 
116     @Override
117     public boolean isReadOnly() {
118         return delegateObject.isReadOnly();
119     }
120 
121     @Override
122     public void setReadOnly(boolean readOnly) {
123         delegateObject.setReadOnly(readOnly);
124     }
125 
126     @Override
127     public Date getCreationDate() {
128         return delegateObject.getCreationDate();
129     }
130 
131     @Override
132     public void setCreationDate(Date date) {
133         delegateObject.setCreationDate(date);
134     }
135 
136     @Override
137     public Date getUpdateDate() {
138         return delegateObject.getUpdateDate();
139     }
140 
141     @Override
142     public void setUpdateDate(Date date) {
143         delegateObject.setUpdateDate(date);
144     }
145 
146     /** {@inheritDoc} */
147     @Override
148     public StatusDTO getStatus() {
149         return delegateObject.getStatus();
150     }
151 
152     /** {@inheritDoc} */
153     @Override
154     public void setStatus(StatusDTO status) {
155         delegateObject.setStatus(status);
156     }
157 
158     /** {@inheritDoc} */
159     @Override
160     public Collection<ErrorDTO> getErrors() {
161         return errors;
162     }
163 }