View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.pmfm.matrix.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.dto.DaliBeanFactory;
29  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
30  import fr.ifremer.dali.dto.referential.pmfm.FractionDTO;
31  import fr.ifremer.dali.dto.referential.pmfm.MatrixDTO;
32  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliRowUIModel;
33  import org.nuiton.util.beans.Binder;
34  import org.nuiton.util.beans.BinderFactory;
35  
36  import java.util.*;
37  
38  /**
39   * <p>MatricesTableRowModel class.</p>
40   *
41   * @author Antoine
42   */
43  public class MatricesTableRowModel extends AbstractDaliRowUIModel<MatrixDTO, MatricesTableRowModel> implements MatrixDTO, ErrorAware {
44  
45      private static final Binder<MatrixDTO, MatricesTableRowModel> FROM_BEAN_BINDER =
46              BinderFactory.newBinder(MatrixDTO.class, MatricesTableRowModel.class);
47  
48      private static final Binder<MatricesTableRowModel, MatrixDTO> TO_BEAN_BINDER =
49              BinderFactory.newBinder(MatricesTableRowModel.class, MatrixDTO.class);
50  
51      private final List<ErrorDTO> errors;
52  
53      /**
54       * <p>Constructor for MatricesTableRowModel.</p>
55       */
56      public MatricesTableRowModel() {
57          super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
58          errors = new ArrayList<>();
59      }
60  
61      /** {@inheritDoc} */
62      @Override
63      protected MatrixDTO newBean() {
64          return DaliBeanFactory.newMatrixDTO();
65      }
66  
67      /** {@inheritDoc} */
68      @Override
69      public StatusDTO getStatus() {
70          return delegateObject.getStatus();
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public void setStatus(StatusDTO status) {
76          delegateObject.setStatus(status);
77      }
78  
79      /** {@inheritDoc} */
80      @Override
81      public String getDescription() {
82          return delegateObject.getDescription();
83      }
84  
85      /** {@inheritDoc} */
86      @Override
87      public void setDescription(String description) {
88          delegateObject.setDescription(description);
89      }
90  
91      @Override
92      public String getComment() {
93          return delegateObject.getComment();
94      }
95  
96      @Override
97      public void setComment(String comment) {
98          delegateObject.setComment(comment);
99      }
100 
101     /** {@inheritDoc} */
102     @Override
103     public String getName() {
104         return delegateObject.getName();
105     }
106 
107     /** {@inheritDoc} */
108     @Override
109     public void setName(String mnemonique) {
110         delegateObject.setName(mnemonique);
111     }
112 
113     /** {@inheritDoc} */
114     @Override
115     public FractionDTO getFractions(int index) {
116         return delegateObject.getFractions(index);
117     }
118 
119     /** {@inheritDoc} */
120     @Override
121     public boolean isFractionsEmpty() {
122         return delegateObject.isFractionsEmpty();
123     }
124 
125     /** {@inheritDoc} */
126     @Override
127     public int sizeFractions() {
128         return delegateObject.sizeFractions();
129     }
130 
131     /** {@inheritDoc} */
132     @Override
133     public void addFractions(FractionDTO Fractions) {
134         delegateObject.addFractions(Fractions);
135     }
136 
137     /** {@inheritDoc} */
138     @Override
139     public void addAllFractions(Collection<FractionDTO> Fractions) {
140         delegateObject.addAllFractions(Fractions);
141     }
142 
143     /** {@inheritDoc} */
144     @Override
145     public boolean removeFractions(FractionDTO Fractions) {
146         return delegateObject.removeFractions(Fractions);
147     }
148 
149     /** {@inheritDoc} */
150     @Override
151     public boolean removeAllFractions(Collection<FractionDTO> Fractions) {
152         return delegateObject.removeAllFractions(Fractions);
153     }
154 
155     /** {@inheritDoc} */
156     @Override
157     public boolean containsFractions(FractionDTO Fractions) {
158         return delegateObject.containsFractions(Fractions);
159     }
160 
161     /** {@inheritDoc} */
162     @Override
163     public boolean containsAllFractions(Collection<FractionDTO> Fractions) {
164         return delegateObject.containsAllFractions(Fractions);
165     }
166 
167     /** {@inheritDoc} */
168     @Override
169     public Set<FractionDTO> getFractions() {
170         return delegateObject.getFractions();
171     }
172 
173     /** {@inheritDoc} */
174     @Override
175     public void setFractions(Set<FractionDTO> Fractions) {
176         delegateObject.setFractions(Fractions);
177     }
178 
179     /** {@inheritDoc} */
180     @Override
181     public boolean isDirty() {
182         return delegateObject.isDirty();
183     }
184 
185     /** {@inheritDoc} */
186     @Override
187     public void setDirty(boolean dirty) {
188         delegateObject.setDirty(dirty);
189     }
190 
191     @Override
192     public boolean isReadOnly() {
193         return delegateObject.isReadOnly();
194     }
195 
196     @Override
197     public void setReadOnly(boolean readOnly) {
198         delegateObject.setReadOnly(readOnly);
199     }
200 
201     @Override
202     public Date getCreationDate() {
203         return delegateObject.getCreationDate();
204     }
205 
206     @Override
207     public void setCreationDate(Date date) {
208         delegateObject.setCreationDate(date);
209     }
210 
211     @Override
212     public Date getUpdateDate() {
213         return delegateObject.getUpdateDate();
214     }
215 
216     @Override
217     public void setUpdateDate(Date date) {
218         delegateObject.setUpdateDate(date);
219     }
220 
221     /** {@inheritDoc} */
222     @Override
223     public Collection<ErrorDTO> getErrors() {
224         return errors;
225     }
226 }