View Javadoc
1   package fr.ifremer.dali.ui.swing.content.extraction.list;
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.enums.ExtractionOutputType;
27  import fr.ifremer.dali.dto.system.extraction.ExtractionParameterDTO;
28  
29  import static org.nuiton.i18n.I18n.t;
30  
31  /**
32   * Created by Ludovic on 03/12/2015.
33   */
34  public class ExtractAggregatedCompleteAction extends AbstractInternalExtractAction {
35      /**
36       * Constructor.
37       *
38       * @param handler Handler
39       */
40      public ExtractAggregatedCompleteAction(ExtractionsTableUIHandler handler) {
41          super(handler);
42      }
43  
44      /**
45       * {@inheritDoc}
46       */
47      @Override
48      protected ExtractionOutputType getOutputType() {
49          return ExtractionOutputType.AGGREGATED_COMPLETE;
50      }
51  
52      @Override
53      public boolean prepareAction() throws Exception {
54  
55          // check configuration is filled
56          ExtractionParameterDTO parameter = getSelectedExtraction().getParameter();
57          if (parameter == null || parameter.isPmfmResultsEmpty() || parameter.isPmfmPresetsEmpty()) {
58              getHandler().getContext().getDialogHelper().showWarningDialog(
59                      t("dali.extraction.config.empty.message"),
60                      getActionDescription()
61              );
62              return false;
63          }
64  
65          return super.prepareAction();
66      }
67  }