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