View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.pmfm.method.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.FilterCriteriaDTO;
28  import fr.ifremer.quadrige3.ui.core.dto.QuadrigeBean;
29  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
30  import fr.ifremer.dali.dto.referential.pmfm.MethodDTO;
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 Methods au niveau local
40   */
41  public class ManageMethodsMenuUIModel extends AbstractDaliBeanUIModel<FilterCriteriaDTO, ManageMethodsMenuUIModel> implements FilterCriteriaDTO {
42  
43      /** Constant <code>PROPERTY_METHOD="method"</code> */
44      public static final String PROPERTY_METHOD = "method";
45      private static final Binder<ManageMethodsMenuUIModel, FilterCriteriaDTO> TO_BEAN_BINDER =
46              BinderFactory.newBinder(ManageMethodsMenuUIModel.class, FilterCriteriaDTO.class);
47      private static final Binder<FilterCriteriaDTO, ManageMethodsMenuUIModel> FROM_BEAN_BINDER =
48              BinderFactory.newBinder(FilterCriteriaDTO.class, ManageMethodsMenuUIModel.class);
49      private MethodDTO method;
50  
51      /**
52       * <p>Constructor for ManageMethodsMenuUIModel.</p>
53       */
54      public ManageMethodsMenuUIModel() {
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>getMethodId.</p>
69       *
70       * @return a {@link java.lang.Integer} object.
71       */
72      public Integer getMethodId() {
73          return getMethod() == null ? null : getMethod().getId();
74      }
75  
76      /**
77       * <p>Getter for the field <code>method</code>.</p>
78       *
79       * @return a {@link fr.ifremer.dali.dto.referential.pmfm.MethodDTO} object.
80       */
81      public MethodDTO getMethod() {
82          return method;
83      }
84  
85      /**
86       * <p>Setter for the field <code>method</code>.</p>
87       *
88       * @param method a {@link fr.ifremer.dali.dto.referential.pmfm.MethodDTO} object.
89       */
90      public void setMethod(MethodDTO method) {
91          this.method = method;
92          firePropertyChange(PROPERTY_METHOD, null, method);
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     }
106 
107     /** {@inheritDoc} */
108     @Override
109     protected FilterCriteriaDTO newBean() {
110         return DaliBeanFactory.newFilterCriteriaDTO();
111     }
112 
113     /** {@inheritDoc} */
114     @Override
115     public String getName() {
116         return delegateObject.getName();
117     }
118 
119     /** {@inheritDoc} */
120     @Override
121     public void setName(String name) {
122         delegateObject.setName(name);
123     }
124 
125     @Override
126     public boolean isDirty() {
127         return delegateObject.isDirty();
128     }
129 
130     @Override
131     public void setDirty(boolean dirty) {
132         delegateObject.setDirty(dirty);
133     }
134 
135     @Override
136     public boolean isReadOnly() {
137         return false;
138     }
139 
140     @Override
141     public void setReadOnly(boolean b) {
142 
143     }
144 
145     @Override
146     public Date getCreationDate() {
147         return null;
148     }
149 
150     @Override
151     public void setCreationDate(Date date) {
152 
153     }
154 
155     @Override
156     public Date getUpdateDate() {
157         return null;
158     }
159 
160     @Override
161     public void setUpdateDate(Date date) {
162 
163     }
164 
165     /** {@inheritDoc} */
166     @Override
167     public StatusDTO getStatus() {
168         return delegateObject.getStatus();
169     }
170 
171     /** {@inheritDoc} */
172     @Override
173     public void setStatus(StatusDTO status) {
174         delegateObject.setStatus(status);
175     }
176 
177     /** {@inheritDoc} */
178     @Override
179     public boolean isStrictName() {
180         return delegateObject.isStrictName();
181     }
182 
183     /** {@inheritDoc} */
184     @Override
185     public void setStrictName(boolean strictName) {
186         delegateObject.setStrictName(strictName);
187     }
188 
189 }