View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.pmfm.matrix.menu;
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.DaliBeanFactory;
28  import fr.ifremer.dali.dto.configuration.filter.FilterCriteriaDTO;
29  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
30  import fr.ifremer.dali.dto.referential.pmfm.MatrixDTO;
31  import fr.ifremer.dali.ui.swing.util.AbstractDaliBeanUIModel;
32  import org.nuiton.util.beans.Binder;
33  import org.nuiton.util.beans.BinderFactory;
34  
35  import java.util.Date;
36  import java.util.List;
37  
38  /**
39   * Modele du menu pour la gestion des Matrices au niveau local
40   */
41  public class ManageMatricesMenuUIModel extends AbstractDaliBeanUIModel<FilterCriteriaDTO, ManageMatricesMenuUIModel> implements FilterCriteriaDTO {
42  
43      /** Constant <code>PROPERTY_MATRIX="matrix"</code> */
44      public static final String PROPERTY_MATRIX = "matrix";
45      private static final Binder<ManageMatricesMenuUIModel, FilterCriteriaDTO> TO_BEAN_BINDER =
46              BinderFactory.newBinder(ManageMatricesMenuUIModel.class, FilterCriteriaDTO.class);
47      private static final Binder<FilterCriteriaDTO, ManageMatricesMenuUIModel> FROM_BEAN_BINDER =
48              BinderFactory.newBinder(FilterCriteriaDTO.class, ManageMatricesMenuUIModel.class);
49      private MatrixDTO matrix;
50  
51      /**
52       * <p>Constructor for ManageMatricesMenuUIModel.</p>
53       */
54      public ManageMatricesMenuUIModel() {
55          super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
56      }
57  
58      /**
59       * <p>getStatusCode.</p>
60       *
61       * @return a {@link java.lang.String} object.
62       */
63      public String getStatusCode() {
64          return getStatus() == null ? null : getStatus().getCode();
65      }
66  
67      /**
68       * <p>getMatrixId.</p>
69       *
70       * @return a {@link java.lang.Integer} object.
71       */
72      public Integer getMatrixId() {
73          return getMatrix() == null ? null : getMatrix().getId();
74      }
75  
76      /**
77       * <p>Getter for the field <code>matrix</code>.</p>
78       *
79       * @return a {@link fr.ifremer.dali.dto.referential.pmfm.MatrixDTO} object.
80       */
81      public MatrixDTO getMatrix() {
82          return matrix;
83      }
84  
85      /**
86       * <p>Setter for the field <code>matrix</code>.</p>
87       *
88       * @param matrix a {@link fr.ifremer.dali.dto.referential.pmfm.MatrixDTO} object.
89       */
90      public void setMatrix(MatrixDTO matrix) {
91          this.matrix = matrix;
92          firePropertyChange(PROPERTY_MATRIX, null, matrix);
93      }
94  
95      /** {@inheritDoc} */
96      @Override
97      public List<? extends QuadrigeBean> getResults() {
98          return delegateObject.getResults();
99      }
100 
101     /** {@inheritDoc} */
102     @Override
103     public void setResults(List<? extends QuadrigeBean> results) {
104         delegateObject.setResults(results);
105 //        firePropertyChange(PROPERTY_RESULTS, null, results);
106     }
107 
108     /** {@inheritDoc} */
109     @Override
110     protected FilterCriteriaDTO newBean() {
111         return DaliBeanFactory.newFilterCriteriaDTO();
112     }
113 
114     /** {@inheritDoc} */
115     @Override
116     public String getName() {
117         return delegateObject.getName();
118     }
119 
120     /** {@inheritDoc} */
121     @Override
122     public void setName(String name) {
123         delegateObject.setName(name);
124     }
125 
126     @Override
127     public boolean isDirty() {
128         return false;
129     }
130 
131     @Override
132     public void setDirty(boolean dirty) {
133 
134     }
135 
136     @Override
137     public boolean isReadOnly() {
138         return false;
139     }
140 
141     @Override
142     public void setReadOnly(boolean readOnly) {
143 
144     }
145 
146     @Override
147     public Date getCreationDate() {
148         return null;
149     }
150 
151     @Override
152     public void setCreationDate(Date date) {
153 
154     }
155 
156     @Override
157     public Date getUpdateDate() {
158         return null;
159     }
160 
161     @Override
162     public void setUpdateDate(Date date) {
163 
164     }
165 
166     /** {@inheritDoc} */
167     @Override
168     public StatusDTO getStatus() {
169         return delegateObject.getStatus();
170     }
171 
172     /** {@inheritDoc} */
173     @Override
174     public void setStatus(StatusDTO status) {
175         delegateObject.setStatus(status);
176     }
177 
178     /** {@inheritDoc} */
179     @Override
180     public boolean isStrictName() {
181         return delegateObject.isStrictName();
182     }
183 
184     /** {@inheritDoc} */
185     @Override
186     public void setStrictName(boolean strictName) {
187         delegateObject.setStrictName(strictName);
188     }
189 
190 }