View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.referential.replace;
2   
3   /*
4    * #%L
5    * Reef DB :: 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  
27  import fr.ifremer.quadrige3.ui.core.dto.referential.BaseReferentialDTO;
28  import fr.ifremer.reefdb.ui.swing.util.AbstractReefDbBeanUIModel;
29  
30  import java.util.List;
31  
32  /**
33   * Created on 7/6/14.
34   *
35   * @since 3.6
36   */
37  public class AbstractReplaceUIModel<E extends BaseReferentialDTO> extends AbstractReefDbBeanUIModel<E, AbstractReplaceUIModel<E>> {
38  
39      private static final long serialVersionUID = 1L;
40  
41      /** Constant <code>PROPERTY_SOURCE_LIST="sourceList"</code> */
42      public static final String PROPERTY_SOURCE_LIST = "sourceList";
43  
44      /** Constant <code>PROPERTY_TARGET_LIST="targetList"</code> */
45      public static final String PROPERTY_TARGET_LIST = "targetList";
46  
47      /** Constant <code>PROPERTY_SELECTED_SOURCE="selectedSource"</code> */
48      public static final String PROPERTY_SELECTED_SOURCE = "selectedSource";
49  
50      /** Constant <code>PROPERTY_SELECTED_TARGET="selectedTarget"</code> */
51      public static final String PROPERTY_SELECTED_TARGET = "selectedTarget";
52  
53      /** Constant <code>PROPERTY_DELETE="delete"</code> */
54      public static final String PROPERTY_DELETE = "delete";
55  
56      protected List<E> sourceList;
57  
58      protected List<E> targetList;
59  
60      protected E selectedSource;
61  
62      protected E selectedTarget;
63  
64      protected boolean delete = true;
65  
66      protected String decoratorContext = null;
67  
68      /**
69       * <p>Constructor for AbstractReplaceUIModel.</p>
70       */
71      public AbstractReplaceUIModel() {
72          super(null, null);
73      }
74  
75      /**
76       * <p>Getter for the field <code>sourceList</code>.</p>
77       *
78       * @return a {@link java.util.List} object.
79       */
80      public List<E> getSourceList() {
81          return sourceList;
82      }
83  
84      /**
85       * <p>Setter for the field <code>sourceList</code>.</p>
86       *
87       * @param sourceList a {@link java.util.List} object.
88       */
89      public void setSourceList(List<E> sourceList) {
90          this.sourceList = sourceList;
91          firePropertyChange(PROPERTY_SOURCE_LIST, null, sourceList);
92      }
93  
94      /**
95       * <p>Getter for the field <code>targetList</code>.</p>
96       *
97       * @return a {@link java.util.List} object.
98       */
99      public List<E> getTargetList() {
100         return targetList;
101     }
102 
103     /**
104      * <p>Setter for the field <code>targetList</code>.</p>
105      *
106      * @param targetList a {@link java.util.List} object.
107      */
108     public void setTargetList(List<E> targetList) {
109         this.targetList = targetList;
110         firePropertyChange(PROPERTY_TARGET_LIST, null, targetList);
111     }
112 
113     /**
114      * <p>Getter for the field <code>selectedTarget</code>.</p>
115      *
116      * @return a E object.
117      */
118     public E getSelectedTarget() {
119         return selectedTarget;
120     }
121 
122     /**
123      * <p>Setter for the field <code>selectedTarget</code>.</p>
124      *
125      * @param selectedTarget a E object.
126      */
127     public void setSelectedTarget(E selectedTarget) {
128         E oldvalue = getSelectedTarget();
129         this.selectedTarget = selectedTarget;
130         firePropertyChange(PROPERTY_SELECTED_TARGET, oldvalue, selectedTarget);
131     }
132 
133     /**
134      * <p>Getter for the field <code>selectedSource</code>.</p>
135      *
136      * @return a E object.
137      */
138     public E getSelectedSource() {
139         return selectedSource;
140     }
141 
142     /**
143      * <p>Setter for the field <code>selectedSource</code>.</p>
144      *
145      * @param selectedSource a E object.
146      */
147     public void setSelectedSource(E selectedSource) {
148         E oldvalue = getSelectedSource();
149         this.selectedSource = selectedSource;
150         firePropertyChange(PROPERTY_SELECTED_SOURCE, oldvalue, selectedSource);
151     }
152 
153     /**
154      * <p>isDelete.</p>
155      *
156      * @return a boolean.
157      */
158     public boolean isDelete() {
159         return delete;
160     }
161 
162     /**
163      * <p>Setter for the field <code>delete</code>.</p>
164      *
165      * @param delete a boolean.
166      */
167     public void setDelete(boolean delete) {
168         this.delete = delete;
169     }
170 
171     /**
172      * <p>Getter for the field <code>decoratorContext</code>.</p>
173      *
174      * @return a {@link java.lang.String} object.
175      */
176     public String getDecoratorContext() {
177         return decoratorContext;
178     }
179 
180     /**
181      * <p>Setter for the field <code>decoratorContext</code>.</p>
182      *
183      * @param decoratorContext a {@link java.lang.String} object.
184      */
185     public void setDecoratorContext(String decoratorContext) {
186         this.decoratorContext = decoratorContext;
187     }
188 
189     /** {@inheritDoc} */
190     @Override
191     protected E newBean() {
192         return null;
193     }
194 }