View Javadoc
1   package fr.ifremer.dali.ui.swing.content.extraction;
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.quadrige3.ui.swing.model.AbstractEmptyUIModel;
27  import fr.ifremer.dali.dto.configuration.context.ContextDTO;
28  import fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO;
29  import fr.ifremer.dali.dto.system.extraction.ExtractionDTO;
30  import fr.ifremer.dali.ui.swing.content.extraction.config.ExtractionConfigUIModel;
31  import fr.ifremer.dali.ui.swing.content.extraction.filters.ExtractionFiltersUIModel;
32  import fr.ifremer.dali.ui.swing.content.extraction.list.ExtractionsRowModel;
33  import fr.ifremer.dali.ui.swing.content.extraction.list.ExtractionsTableUIModel;
34  
35  /**
36   * Home model.
37   */
38  public class ExtractionUIModel extends AbstractEmptyUIModel<ExtractionUIModel> {
39  
40      /** Constant <code>PROPERTY_PROGRAM="program"</code> */
41      public static final String PROPERTY_PROGRAM = "program";
42      /** Constant <code>PROPERTY_CONTEXT="context"</code> */
43      public static final String PROPERTY_CONTEXT = "context";
44      private ProgramDTO program;
45      private ExtractionDTO extraction;
46      private ExtractionsTableUIModel extractionsTableUIModel;
47      private ExtractionFiltersUIModel extractionFiltersUIModel;
48      private ExtractionConfigUIModel extractionConfigUIModel;
49      private ContextDTO context;
50  
51      /** {@inheritDoc} */
52      @Override
53      public boolean isModify() {
54          return super.isModify();
55      }
56  
57      /** {@inheritDoc} */
58      @Override
59      public void setModify(boolean modify) {
60          super.setModify(modify);
61      }
62  
63      /**
64       * <p>Getter for the field <code>program</code>.</p>
65       *
66       * @return a {@link fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO} object.
67       */
68      public ProgramDTO getProgram() {
69          return program;
70      }
71  
72      /**
73       * <p>Setter for the field <code>program</code>.</p>
74       *
75       * @param program a {@link fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO} object.
76       */
77      public void setProgram(ProgramDTO program) {
78          ProgramDTO oldValue = getProgram();
79          this.program = program;
80          firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
81      }
82  
83      /**
84       * <p>getProgramCode.</p>
85       *
86       * @return a {@link java.lang.String} object.
87       */
88      public String getProgramCode() {
89          return getProgram() == null ? null : getProgram().getCode();
90      }
91  
92      /**
93       * <p>Getter for the field <code>extraction</code>.</p>
94       *
95       * @return a {@link fr.ifremer.dali.dto.system.extraction.ExtractionDTO} object.
96       */
97      public ExtractionDTO getExtraction() {
98          return extraction;
99      }
100 
101     /**
102      * <p>Setter for the field <code>extraction</code>.</p>
103      *
104      * @param extraction a {@link fr.ifremer.dali.dto.system.extraction.ExtractionDTO} object.
105      */
106     public void setExtraction(ExtractionDTO extraction) {
107         this.extraction = extraction;
108     }
109 
110     /**
111      * <p>getExtractionId.</p>
112      *
113      * @return a {@link java.lang.Integer} object.
114      */
115     public Integer getExtractionId() {
116         return extraction == null ? null : extraction.getId();
117     }
118 
119     /**
120      * <p>Getter for the field <code>selectedExtraction</code>.</p>
121      *
122      * @return a {@link fr.ifremer.dali.ui.swing.content.extraction.list.ExtractionsRowModel} object.
123      */
124     public ExtractionsRowModel getSelectedExtraction() {
125         return getExtractionsTableUIModel().getSingleSelectedRow();
126     }
127 
128     /**
129      * <p>Getter for the field <code>extractionsTableUIModel</code>.</p>
130      *
131      * @return a {@link fr.ifremer.dali.ui.swing.content.extraction.list.ExtractionsTableUIModel} object.
132      */
133     public ExtractionsTableUIModel getExtractionsTableUIModel() {
134         return extractionsTableUIModel;
135     }
136 
137     /**
138      * <p>Setter for the field <code>extractionsTableUIModel</code>.</p>
139      *
140      * @param extractionsTableUIModel a {@link fr.ifremer.dali.ui.swing.content.extraction.list.ExtractionsTableUIModel} object.
141      */
142     public void setExtractionsTableUIModel(ExtractionsTableUIModel extractionsTableUIModel) {
143         this.extractionsTableUIModel = extractionsTableUIModel;
144         extractionsTableUIModel.setExtractionUIModel(this);
145     }
146 
147     /**
148      * <p>Getter for the field <code>extractionFiltersUIModel</code>.</p>
149      *
150      * @return a {@link ExtractionFiltersUIModel} object.
151      */
152     public ExtractionFiltersUIModel getExtractionFiltersUIModel() {
153         return extractionFiltersUIModel;
154     }
155 
156     /**
157      * <p>Setter for the field <code>extractionFiltersUIModel</code>.</p>
158      *
159      * @param extractionFiltersUIModel a {@link ExtractionFiltersUIModel} object.
160      */
161     public void setExtractionFiltersUIModel(ExtractionFiltersUIModel extractionFiltersUIModel) {
162         this.extractionFiltersUIModel = extractionFiltersUIModel;
163         extractionFiltersUIModel.setExtractionUIModel(this);
164     }
165 
166     public ExtractionConfigUIModel getExtractionConfigUIModel() {
167         return extractionConfigUIModel;
168     }
169 
170     public void setExtractionConfigUIModel(ExtractionConfigUIModel extractionConfigUIModel) {
171         this.extractionConfigUIModel = extractionConfigUIModel;
172         extractionConfigUIModel.setExtractionUIModel(this);
173     }
174 
175     /**
176      * <p>Getter for the field <code>context</code>.</p>
177      *
178      * @return a {@link fr.ifremer.dali.dto.configuration.context.ContextDTO} object.
179      */
180     public ContextDTO getContext() {
181         return context;
182     }
183 
184     /**
185      * <p>Setter for the field <code>context</code>.</p>
186      *
187      * @param context a {@link fr.ifremer.dali.dto.configuration.context.ContextDTO} object.
188      */
189     public void setContext(ContextDTO context) {
190         ContextDTO oldContext = getContext();
191         this.context = context;
192         firePropertyChange(PROPERTY_CONTEXT, oldContext, context);
193     }
194 }