View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.unit.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.dali.dto.referential.UnitDTO;
29  import fr.ifremer.dali.ui.swing.content.manage.referential.menu.AbstractReferentialMenuUIModel;
30  import org.nuiton.util.beans.Binder;
31  import org.nuiton.util.beans.BinderFactory;
32  
33  /**
34   * Modele du menu pour la gestion des Units au niveau local
35   */
36  public class ReferentialUnitsMenuUIModel extends AbstractReferentialMenuUIModel<FilterCriteriaDTO, ReferentialUnitsMenuUIModel> implements FilterCriteriaDTO {
37  
38      /** Constant <code>PROPERTY_UNIT="unit"</code> */
39      public static final String PROPERTY_UNIT = "unit";
40      private static final Binder<ReferentialUnitsMenuUIModel, FilterCriteriaDTO> TO_BEAN_BINDER =
41              BinderFactory.newBinder(ReferentialUnitsMenuUIModel.class, FilterCriteriaDTO.class);
42      private static final Binder<FilterCriteriaDTO, ReferentialUnitsMenuUIModel> FROM_BEAN_BINDER =
43              BinderFactory.newBinder(FilterCriteriaDTO.class, ReferentialUnitsMenuUIModel.class);
44      private UnitDTO unit;
45  
46      /**
47       * <p>Constructor for ReferentialUnitsMenuUIModel.</p>
48       */
49      public ReferentialUnitsMenuUIModel() {
50          super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
51      }
52  
53      /**
54       * <p>getUnitId.</p>
55       *
56       * @return a {@link java.lang.Integer} object.
57       */
58      public Integer getUnitId() {
59          return getUnit() == null ? null : getUnit().getId();
60      }
61  
62      /**
63       * <p>Getter for the field <code>unit</code>.</p>
64       *
65       * @return a {@link fr.ifremer.dali.dto.referential.UnitDTO} object.
66       */
67      public UnitDTO getUnit() {
68          return unit;
69      }
70  
71      /**
72       * <p>Setter for the field <code>unit</code>.</p>
73       *
74       * @param unit a {@link fr.ifremer.dali.dto.referential.UnitDTO} object.
75       */
76      public void setUnit(UnitDTO unit) {
77          this.unit = unit;
78          firePropertyChange(PROPERTY_UNIT, null, unit);
79      }
80  
81      /** {@inheritDoc} */
82      @Override
83      protected FilterCriteriaDTO newBean() {
84          return DaliBeanFactory.newFilterCriteriaDTO();
85      }
86  
87      @Override
88      public boolean isDirty() {
89          return false;
90      }
91  
92      @Override
93      public void setDirty(boolean dirty) {
94  
95      }
96  
97      @Override
98      public boolean isReadOnly() {
99          return false;
100     }
101 
102     @Override
103     public void setReadOnly(boolean readOnly) {
104 
105     }
106 
107 }