View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.pmfm.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.dali.dto.DaliBeanFactory;
27  import fr.ifremer.dali.dto.configuration.filter.pmfm.PmfmCriteriaDTO;
28  import fr.ifremer.dali.dto.referential.UnitDTO;
29  import fr.ifremer.dali.dto.referential.pmfm.FractionDTO;
30  import fr.ifremer.dali.dto.referential.pmfm.MatrixDTO;
31  import fr.ifremer.dali.dto.referential.pmfm.MethodDTO;
32  import fr.ifremer.dali.dto.referential.pmfm.ParameterDTO;
33  import fr.ifremer.dali.ui.swing.content.manage.referential.menu.AbstractReferentialMenuUIModel;
34  import org.nuiton.util.beans.Binder;
35  import org.nuiton.util.beans.BinderFactory;
36  
37  /**
38   * Modele du menu pour la gestion des Quadruplets au niveau National
39   */
40  public class PmfmMenuUIModel extends AbstractReferentialMenuUIModel<PmfmCriteriaDTO, PmfmMenuUIModel> implements PmfmCriteriaDTO {
41  
42      private static final Binder<PmfmMenuUIModel, PmfmCriteriaDTO> TO_BEAN_BINDER =
43              BinderFactory.newBinder(PmfmMenuUIModel.class, PmfmCriteriaDTO.class);
44  
45      private static final Binder<PmfmCriteriaDTO, PmfmMenuUIModel> FROM_BEAN_BINDER =
46              BinderFactory.newBinder(PmfmCriteriaDTO.class, PmfmMenuUIModel.class);
47  
48      /**
49       * Constructor.
50       */
51      public PmfmMenuUIModel() {
52          super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
53      }
54  
55      /** {@inheritDoc} */
56      @Override
57      protected PmfmCriteriaDTO newBean() {
58          return DaliBeanFactory.newPmfmCriteriaDTO();
59      }
60  
61      /** {@inheritDoc} */
62      @Override
63      public ParameterDTO getParameter() {
64          return delegateObject.getParameter();
65      }
66  
67      /** {@inheritDoc} */
68      @Override
69      public void setParameter(ParameterDTO parameter) {
70          delegateObject.setParameter(parameter);
71      }
72  
73      /**
74       * <p>getParameterCode.</p>
75       *
76       * @return a {@link java.lang.String} object.
77       */
78      public String getParameterCode() {
79          return getParameter() != null ? getParameter().getCode() : null;
80      }
81  
82      /** {@inheritDoc} */
83      @Override
84      public MatrixDTO getMatrix() {
85          return delegateObject.getMatrix();
86      }
87  
88      /** {@inheritDoc} */
89      @Override
90      public void setMatrix(MatrixDTO matrix) {
91          delegateObject.setMatrix(matrix);
92      }
93  
94      /**
95       * <p>getMatrixId.</p>
96       *
97       * @return a {@link java.lang.Integer} object.
98       */
99      public Integer getMatrixId() {
100         return getMatrix() != null ? getMatrix().getId() : null;
101     }
102 
103     /** {@inheritDoc} */
104     @Override
105     public FractionDTO getFraction() {
106         return delegateObject.getFraction();
107     }
108 
109     /** {@inheritDoc} */
110     @Override
111     public void setFraction(FractionDTO fraction) {
112         delegateObject.setFraction(fraction);
113     }
114 
115     /**
116      * <p>getFractionId.</p>
117      *
118      * @return a {@link java.lang.Integer} object.
119      */
120     public Integer getFractionId() {
121         return getFraction() != null ? getFraction().getId() : null;
122     }
123 
124     /** {@inheritDoc} */
125     @Override
126     public MethodDTO getMethod() {
127         return delegateObject.getMethod();
128     }
129 
130     /** {@inheritDoc} */
131     @Override
132     public void setMethod(MethodDTO method) {
133         delegateObject.setMethod(method);
134     }
135 
136     /**
137      * <p>getMethodId.</p>
138      *
139      * @return a {@link java.lang.Integer} object.
140      */
141     public Integer getMethodId() {
142         return getMethod() != null ? getMethod().getId() : null;
143     }
144 
145     @Override
146     public UnitDTO getUnit() {
147         return delegateObject.getUnit();
148     }
149 
150     @Override
151     public void setUnit(UnitDTO unit) {
152         delegateObject.setUnit(unit);
153     }
154 
155     public Integer getUnitId() {
156         return getUnit() != null ? getUnit().getId() : null;
157     }
158 
159     /** {@inheritDoc} */
160     @Override
161     public void clear() {
162         super.clear();
163         setParameter(null);
164         setMatrix(null);
165         setFraction(null);
166         setMethod(null);
167         setUnit(null);
168     }
169 
170     @Override
171     public boolean isDirty() {
172         return false;
173     }
174 
175     @Override
176     public void setDirty(boolean dirty) {
177 
178     }
179 
180     @Override
181     public boolean isReadOnly() {
182         return false;
183     }
184 
185     @Override
186     public void setReadOnly(boolean readOnly) {
187 
188     }
189 }