View Javadoc
1   
2   package fr.ifremer.tutti.ui.swing.content.operation.fishing;
3   
4   /*
5    * #%L
6    * Tutti :: UI
7    * %%
8    * Copyright (C) 2012 - 2014 Ifremer
9    * %%
10   * This program is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as
12   * published by the Free Software Foundation, either version 3 of the 
13   * License, or (at your option) any later version.
14   * 
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Public 
21   * License along with this program.  If not, see
22   * <http://www.gnu.org/licenses/gpl-3.0.html>.
23   * #L%
24   */
25  
26  import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
27  import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
28  
29  import java.io.Serializable;
30  
31  /**
32   * @author Kevin Morin - kmorin@codelutin.com
33   * @since 1.0
34   */
35  public abstract class AbstractCaracteristicRowModel<RM extends AbstractCaracteristicRowModel<RM>> extends AbstractTuttiBeanUIModel<Serializable, RM> {
36  
37      private static final long serialVersionUID = 1L;
38  
39      public static final String PROPERTY_KEY = "key";
40  
41      public static final String PROPERTY_VALUE = "value";
42  
43      protected Caracteristic key;
44  
45      protected Serializable value;
46  
47      public AbstractCaracteristicRowModel() {
48          super(null, null);
49      }
50  
51  //    public AbstractCaracteristicRowModel(Caracteristic key, Serializable value) {
52  //        this();
53  //        this.key = key;
54  //        this.value = value;
55  //    }
56  
57      public Caracteristic getKey() {
58          return key;
59      }
60  
61      public void setKey(Caracteristic key) {
62          Object oldValue = getKey();
63          this.key = key;
64          firePropertyChange(PROPERTY_KEY, oldValue, key);
65      }
66  
67      public Serializable getValue() {
68          return value;
69      }
70  
71      public void setValue(Serializable value) {
72          Object oldValue = getValue();
73          this.value = value;
74          firePropertyChange(PROPERTY_VALUE, oldValue, value);
75      }
76  
77      @Override
78      protected Serializable newEntity() {
79          return null;
80      }
81  }