View Javadoc
1   package fr.ifremer.tutti.ui.swing.content.referential.replace;
2   
3   /*
4    * #%L
5    * Tutti :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2012 - 2014 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU General Public License as
13   * published by the Free Software Foundation, either version 3 of the
14   * License, or (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 General Public
22   * License along with this program.  If not, see
23   * <http://www.gnu.org/licenses/gpl-3.0.html>.
24   * #L%
25   */
26  
27  import fr.ifremer.tutti.persistence.entities.referential.TuttiReferentialEntity;
28  import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
29  
30  import java.util.List;
31  
32  /**
33   * Created on 7/6/14.
34   *
35   * @author Tony Chemit - chemit@codelutin.com
36   * @since 3.6
37   */
38  public class AbstractReplaceTemporaryUIModel<E extends TuttiReferentialEntity> extends AbstractTuttiBeanUIModel<E, AbstractReplaceTemporaryUIModel<E>> {
39  
40      private static final long serialVersionUID = 1L;
41  
42      public static final String PROPERTY_SOURCE_LIST = "sourceList";
43  
44      public static final String PROPERTY_TARGET_LIST = "targetList";
45  
46      public static final String PROPERTY_SELECTED_SOURCE = "selectedSource";
47  
48      public static final String PROPERTY_SELECTED_TARGET = "selectedTarget";
49  
50      public static final String PROPERTY_DELETE = "delete";
51  
52      protected List<E> sourceList;
53  
54      protected List<E> targetList;
55  
56      protected E selectedSource;
57  
58      protected E selectedTarget;
59  
60      protected boolean delete;
61  
62      public AbstractReplaceTemporaryUIModel() {
63          super(null, null);
64      }
65  
66      public List<E> getSourceList() {
67          return sourceList;
68      }
69  
70      public void setSourceList(List<E> sourceList) {
71          this.sourceList = sourceList;
72          firePropertyChange(PROPERTY_SOURCE_LIST, null, sourceList);
73      }
74  
75      public List<E> getTargetList() {
76          return targetList;
77      }
78  
79      public void setTargetList(List<E> targetList) {
80          this.targetList = targetList;
81          firePropertyChange(PROPERTY_TARGET_LIST, null, targetList);
82      }
83  
84      public E getSelectedTarget() {
85          return selectedTarget;
86      }
87  
88      public void setSelectedTarget(E selectedTarget) {
89          E oldvalue = getSelectedTarget();
90          this.selectedTarget = selectedTarget;
91          firePropertyChange(PROPERTY_SELECTED_TARGET, oldvalue, selectedTarget);
92      }
93  
94      public E getSelectedSource() {
95          return selectedSource;
96      }
97  
98      public void setSelectedSource(E selectedSource) {
99          E oldvalue = getSelectedSource();
100         this.selectedSource = selectedSource;
101         firePropertyChange(PROPERTY_SELECTED_SOURCE, oldvalue, selectedSource);
102     }
103 
104     public boolean isDelete() {
105         return delete;
106     }
107 
108     public void setDelete(boolean delete) {
109         this.delete = delete;
110         firePropertyChange(PROPERTY_DELETE, null/*force boolean propagation*/, delete);
111     }
112 
113     @Override
114     protected E newEntity() {
115         return null;
116     }
117 }