View Javadoc
1   package fr.ifremer.dali.ui.swing.content.home;
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.configuration.programStrategy.ProgramDTO;
27  import fr.ifremer.dali.dto.data.survey.CampaignDTO;
28  import fr.ifremer.dali.dto.data.survey.SurveyFilterDTO;
29  import fr.ifremer.dali.dto.enums.FilterTypeValues;
30  import fr.ifremer.dali.dto.enums.SearchDateValues;
31  import fr.ifremer.dali.dto.referential.LocationDTO;
32  import fr.ifremer.dali.service.DaliTechnicalException;
33  import fr.ifremer.dali.ui.swing.action.QuitScreenAction;
34  import fr.ifremer.dali.ui.swing.content.home.map.SurveysMapUI;
35  import fr.ifremer.dali.ui.swing.content.home.operation.OperationsTableUIModel;
36  import fr.ifremer.dali.ui.swing.content.home.survey.SurveysTableRowModel;
37  import fr.ifremer.dali.ui.swing.content.home.survey.SurveysTableUIModel;
38  import fr.ifremer.dali.ui.swing.util.AbstractDaliBeanUIModel;
39  import fr.ifremer.dali.ui.swing.util.AbstractDaliUIHandler;
40  import fr.ifremer.dali.ui.swing.util.DaliUIs;
41  import fr.ifremer.dali.ui.swing.util.map.MapParentUIModel;
42  import jaxx.runtime.SwingUtil;
43  import jaxx.runtime.validator.swing.SwingValidator;
44  import org.apache.commons.logging.Log;
45  import org.apache.commons.logging.LogFactory;
46  import org.nuiton.jaxx.application.swing.util.CloseableUI;
47  
48  import javax.swing.JFrame;
49  import javax.swing.SwingUtilities;
50  import java.util.List;
51  
52  import static org.nuiton.i18n.I18n.t;
53  
54  /**
55   * Home handler.
56   */
57  public class HomeUIHandler extends AbstractDaliUIHandler<HomeUIModel, HomeUI> implements CloseableUI {
58  
59      /**
60       * Logger.
61       */
62      private static final Log LOG = LogFactory.getLog(HomeUIHandler.class);
63  
64      public static final String SAMPLING_OPERATIONS_CARD = "samplingOperationsCard";
65      public static final String SURVEYS_MAP_CARD = "surveysMapCard";
66  
67      /**
68       * {@inheritDoc}
69       */
70      @Override
71      public void beforeInit(final HomeUI ui) {
72          super.beforeInit(ui);
73  
74          // Ajout du model pour la page d acceuil
75          ui.setContextValue(new HomeUIModel());
76  
77          ui.setContextValue(SwingUtil.createActionIcon("home"));
78      }
79  
80      /**
81       * {@inheritDoc}
82       */
83      @Override
84      public void afterInit(HomeUI ui) {
85          initUI(ui);
86          ui.getCampaignLabel().setForeground(getConfig().getColorThematicLabel());
87          ui.getProgramLabel().setForeground(getConfig().getColorThematicLabel());
88          ui.getLocationLabel().setForeground(getConfig().getColorThematicLabel());
89          ui.getStateLabel().setForeground(getConfig().getColorThematicLabel());
90          ui.getSynchronizationStatusLabel().setForeground(getConfig().getColorThematicLabel());
91          ui.getCommentLabel().setForeground(getConfig().getColorThematicLabel());
92          ui.getMnemonicLabel().setForeground(getConfig().getColorThematicLabel());
93          ui.getStartDateLabel().setForeground(getConfig().getColorThematicLabel());
94  
95          // Save models
96          getModel().setSurveysTableUIModel(getUI().getSurveysTableUI().getModel());
97          getModel().setOperationsTableUIModel(getUI().getOperationsTableUI().getModel());
98          getModel().setMapUIModel(getUI().getSurveysMapUI().getModel());
99  
100         // Init map model
101         initMap();
102 
103         // Initialisation des combobox
104         initComboBox();
105         applyContext();
106 
107         // Initialisation des listeners
108         initListeners();
109 
110         // Register validator
111         registerValidators(getValidator());
112         listenValidatorValid(getValidator(), getModel());
113 
114         // init image
115         SwingUtil.setComponentWidth(getUI().getLeftImage(), ui.getHomeMenu().getPreferredSize().width * 9 / 10);
116         getUI().getLeftImage().setScaled(true);
117 
118         showSamplingOperations();
119 
120         // Chargement des donnees de recherche, sauvegardees
121         runLastSearch();
122     }
123 
124     private void initMap() {
125 
126         // Set the selection model
127         getModel().getMapUIModel().setSelectionModel(getModel().getSurveysTableUIModel());
128 
129         // Listen to model event
130         getModel().addPropertyChangeListener(MapParentUIModel.EVENT_OPEN_FULLSCREEN, evt -> showSurveysMapFullScreen());
131         getModel().addPropertyChangeListener(MapParentUIModel.EVENT_CLOSE_FULLSCREEN, evt -> restoreSurveysMap());
132     }
133 
134     /**
135      * Initialisation des composants de gauche
136      */
137     private void initComboBox() {
138 
139         // Initialisation des contextes
140         initBeanFilterableComboBox(
141             getUI().getContextCombobox(),
142             getContext().getContextService().getAllContexts(),
143             getContext().getSelectedContext());
144 
145         // Intialisation des campagnes
146         initBeanFilterableComboBox(
147             getUI().getCampaignCombo(),
148             null,
149             null);
150 
151         // Initailisation des programmes
152         initBeanFilterableComboBox(
153             getUI().getProgramCombo(),
154             null,
155             null);
156 
157         // Initialisation des lieux
158         initBeanFilterableComboBox(
159             getUI().getLocationCombo(),
160             null,
161             null);
162 
163         // Initialisation de la recherche des dates
164         initBeanFilterableComboBox(
165             getUI().getSearchDateCombo(),
166             getContext().getSystemService().getSearchDates(),
167             null);
168 
169         // On désactive les champs date étant donne qu'il faut en premier selectionner la contrainte
170         getUI().getStartDateEditor().setEnabled(false);
171         getUI().getEndDateEditor().setEnabled(false);
172         getUI().getAndLabel().setVisible(false);
173         getUI().getEndDateEditor().setVisible(false);
174 
175         // Initialisation de la recherche par controle et validation
176         initBeanFilterableComboBox(
177             getUI().getStateCombo(),
178             getContext().getSystemService().getStates(),
179             null);
180 
181         // Initialisation de la recherche par controle et validation
182         initBeanFilterableComboBox(
183             getUI().getSynchronizationStatusCombo(),
184             getContext().getSystemService().getAllSynchronizationStatus(false) /*mantis 26500*/,
185             null);
186 
187         // Initialisation de la recherche par etat de synchro (=partage)
188 //		initBeanFilterableComboBox(
189 //				getUI().getSelectionSharingCombo(),
190 //				   Lists.newArrayList(SharingEnum.values()),
191 //				null);
192 
193         // Modification des largeurs des combobox
194         DaliUIs.forceComponentSize(getUI().getContextCombobox());
195         DaliUIs.forceComponentSize(getUI().getCampaignCombo());
196         DaliUIs.forceComponentSize(getUI().getProgramCombo());
197         DaliUIs.forceComponentSize(getUI().getLocationCombo());
198         DaliUIs.forceComponentSize(getUI().getStateCombo());
199         DaliUIs.forceComponentSize(getUI().getSynchronizationStatusCombo());
200         DaliUIs.forceComponentSize(getUI().getSearchDateCombo(), 82);
201         DaliUIs.forceComponentSize(getUI().getStartDateEditor(), 120);
202         DaliUIs.forceComponentSize(getUI().getEndDateEditor(), 120);
203 //        DaliUIs.forceComponentSize(getUI().getCommentEditor());
204 //        DaliUIs.forceComponentSize(getUI().getMnemonicEditor());
205     }
206 
207     /**
208      * Initialiser les listeners.
209      */
210     private void initListeners() {
211 
212         // Listener sur la selection de la campagne
213 //        getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_CAMPAIGN, new PropertyChangeListener() {
214 //            @Override
215 //            public void propertyChange(PropertyChangeEvent evt) {
216 //
217 //                // update other combo
218 //                updatePrograms();
219 //                updateLocations();
220 //                getUI().getSelectionProgrammeCombo().requestFocus();
221 //            }
222 //        });
223 
224         // Listener on remove filter on campaigns
225         getUI().getCampaignCombo().setActionListener(e -> {
226             if (!askBefore(t("dali.common.unfilter"), t("dali.common.unfilter.confirmation"))) {
227                 return;
228             }
229             getUI().getCampaignCombo().setActionEnabled(false);
230             getModel().setForceNoCampaignFilter(true);
231             applyContext();
232         });
233 
234         // Listener sur la selection du programme
235         getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_PROGRAM, evt -> {
236             // update locations
237             updateLocations();
238             getUI().getLocationCombo().requestFocus();
239         });
240 
241         // Listener sur le défiltrage des programmes
242         getUI().getProgramCombo().setActionListener(e -> {
243             if (!askBefore(t("dali.common.unfilter"), t("dali.common.unfilter.confirmation"))) {
244                 return;
245             }
246             getUI().getProgramCombo().setActionEnabled(false);
247             getModel().setForceNoProgramFilter(true);
248             applyContext();
249         });
250 
251         // Listener sur la selection du lieu
252         getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_LOCATION, evt -> {
253             // update programs
254             updatePrograms();
255             getUI().getStateCombo().requestFocus();
256         });
257 
258         // Listener sur le défiltrage des lieux
259         getUI().getLocationCombo().setActionListener(e -> {
260             if (!askBefore(t("dali.common.unfilter"), t("dali.common.unfilter.confirmation"))) {
261                 return;
262             }
263             getUI().getLocationCombo().setActionEnabled(false);
264             getModel().setForceNoLocationFilter(true);
265             applyContext();
266         });
267 
268         // Listener sur la selection du type de recherche sur les dates
269         getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_SEARCH_DATE, evt -> {
270 
271             if (getModel().getSearchDateId() != null) {
272 
273                 // Si on fait une recherche sur les dates on active les champs de selection de date.
274                 getUI().getStartDateEditor().setEnabled(true);
275                 getUI().getEndDateEditor().setEnabled(true);
276 
277                 // Traitement suivant la valeur sélectionnée
278                 final SearchDateValues searchDateValue = SearchDateValues.values()[getModel().getSearchDateId()];
279                 switch (searchDateValue) {
280                     case BETWEEN:
281 
282                         // Les champs dateFin et label ET visible
283                         getUI().getAndLabel().setVisible(true);
284                         getUI().getEndDateEditor().setVisible(true);
285                         break;
286 
287                     default:
288 
289                         // Les champs date 1 et label ET invisible
290                         getUI().getEndDateEditor().setVisible(false);
291                         getUI().getEndDateEditor().setLocalDate(null);
292                         getUI().getAndLabel().setVisible(false);
293                         break;
294                 }
295             } else {
296 
297                 //Si on efface le critère de recherche alors on efface les dates
298                 getUI().getStartDateEditor().setLocalDate(null);
299                 getUI().getStartDateEditor().setEnabled(false);
300                 getUI().getEndDateEditor().setLocalDate(null);
301                 getUI().getEndDateEditor().setEnabled(false);
302                 getUI().getEndDateEditor().setVisible(false);
303                 getUI().getAndLabel().setVisible(false);
304             }
305         });
306 
307         // Change context value
308         getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_CONTEXT, evt -> {
309 
310             getContext().setSelectedContext(getModel().getContext());
311             applyContext();
312         });
313 
314         getModel().getOperationsTableUIModel().addPropertyChangeListener(OperationsTableUIModel.PROPERTY_LOADING, evt -> {
315 
316             if (evt.getNewValue() instanceof Boolean) {
317                 getModel().getSurveysTableUIModel().setSamplingOperationsLoading((Boolean) evt.getNewValue());
318             }
319         });
320 
321         // Listen modify property and set dirty to the selected survey
322         listenModelModify(getModel().getSurveysTableUIModel());
323         getModel().getOperationsTableUIModel().addPropertyChangeListener(AbstractDaliBeanUIModel.PROPERTY_MODIFY, evt -> {
324             Boolean modify = (Boolean) evt.getNewValue();
325             if (modify != null) {
326                 getModel().setModify(modify);
327                 // Apply dirty state on selected survey in model, not from selected row (Mantis #45515)
328                 if (modify && getModel().getSelectedSurvey() != null) {
329                     getModel().getSelectedSurvey().setDirty(true);
330                 }
331             }
332         });
333 
334         // Listen to survey selection
335         getModel().getSurveysTableUIModel().addPropertyChangeListener(SurveysTableUIModel.PROPERTY_SINGLE_ROW_SELECTED, evt -> {
336 
337             // Check previous survey valid state (Mantis #45515)
338             if (evt.getOldValue() instanceof SurveysTableRowModel) {
339                 SurveysTableRowModel previousSelectedSurvey = (SurveysTableRowModel) evt.getOldValue();
340                 getUI().getOperationsTableUI().getHandler().stopCellEditing();
341                 getUI().getOperationsTableUI().getHandler().recomputeRowsValidState();
342                 previousSelectedSurvey.setOperationsValid(getModel().getOperationsTableUIModel().isValid());
343                 getUI().getSurveysTableUI().getHandler().recomputeRowValidState(previousSelectedSurvey);
344                 getUI().getSurveysTableUI().getHandler().forceRevalidateModel();
345             }
346 
347             // Get selected survey
348             final SurveysTableRowModel survey = (SurveysTableRowModel) evt.getNewValue();
349 
350             // is survey editable ?
351             getModel().getSurveysTableUIModel().setSelectedSurveyEditable(survey != null && survey.isEditable());
352 
353             // save observation id in context
354             getContext().setSelectedSurveyId(survey == null ? null : survey.getId());
355 
356             // set selected survey in main model
357             getModel().setSelectedSurvey(survey);
358 
359         });
360 
361         getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_SELECTED_SURVEY, evt -> {
362 
363             // load operations from new selected survey
364             getUI().getOperationsTableUI().getHandler().loadOperations(getModel().getSelectedSurvey());
365         });
366 
367         // Listen to valid state
368         getModel().getSurveysTableUIModel().addPropertyChangeListener(AbstractDaliBeanUIModel.PROPERTY_VALID, evt -> getValidator().doValidate());
369         getModel().getOperationsTableUIModel().addPropertyChangeListener(AbstractDaliBeanUIModel.PROPERTY_VALID, evt -> {
370 
371             if (getModel().getSelectedSurvey() != null) {
372 
373                 // set operations valid state on current selected survey
374                 getModel().getSelectedSurvey().setOperationsValid(getModel().getOperationsTableUIModel().isValid());
375                 if (!getUI().getSurveysTableUI().getSurveysTable().isEditing()) {
376                     getUI().getSurveysTableUI().getHandler().recomputeRowValidState(getModel().getSelectedSurvey());
377                 }
378                 getValidator().doValidate();
379                 getUI().getSurveysTableUI().getHandler().forceRevalidateModel();
380                 forceRevalidateModel();
381             }
382         });
383 
384     }
385 
386     private void updatePrograms() {
387 
388         if (getModel().isAdjusting()) {
389             return;
390         }
391         getModel().setAdjusting(true);
392 
393         ProgramDTO oldProgram = getModel().getProgram();
394         getModel().setProgram(null);
395 
396         List<ProgramDTO> programs = getContext().getObservationService().getAvailablePrograms(
397             getModel().getLocationId(),
398             null,
399             getModel().isForceNoProgramFilter());
400 
401         getUI().getProgramCombo().setData(programs);
402 
403         if (programs.size() == 1) {
404             getModel().setProgram(programs.get(0));
405         } else if (getModel().isProgramsFiltered() // Select previous program only if new filter is applied (Mantis #52561)
406             && oldProgram != null && programs.contains(oldProgram)) {
407             getModel().setProgram(oldProgram);
408         }
409 
410         getModel().setAdjusting(false);
411     }
412 
413     private void updateCampaigns() {
414 
415         if (getModel().isAdjusting()) {
416             return;
417         }
418         getModel().setAdjusting(true);
419 
420         CampaignDTO oldCampaign = getModel().getCampaign();
421         getModel().setCampaign(null);
422 
423         List<CampaignDTO> campaigns = getContext().getObservationService().getAvailableCampaigns(null, getModel().isForceNoCampaignFilter());
424 
425         getUI().getCampaignCombo().setData(campaigns);
426 
427         if (campaigns.size() == 1) {
428             getModel().setCampaign(campaigns.get(0));
429         } else if (getModel().isCampaignsFiltered() // Select previous campaign only if new filter is applied (Mantis #52561)
430             && oldCampaign != null && campaigns.contains(oldCampaign)) {
431             getModel().setCampaign(oldCampaign);
432         }
433 
434         getModel().setAdjusting(false);
435     }
436 
437     private void updateLocations() {
438 
439         if (getModel().isAdjusting()) {
440             return;
441         }
442         getModel().setAdjusting(true);
443 
444         LocationDTO oldLocation = getModel().getLocation();
445         getModel().setLocation(null);
446 
447         List<LocationDTO> locations = getContext().getObservationService().getAvailableLocations(
448             null, //getModel().getCampaignId(),     // Mantis #0027030 Remove campaigns
449             getModel().getProgramCode(),
450             getModel().isForceNoLocationFilter());
451 
452         getUI().getLocationCombo().setData(locations);
453 
454         if (locations.size() == 1) {
455             getModel().setLocation(locations.get(0));
456         } else if (getModel().isLocationsFiltered() // Select previous location only if new filter is applied (Mantis #52561)
457             && oldLocation != null && locations.contains(oldLocation)) {
458             getModel().setLocation(oldLocation);
459         }
460 
461         getModel().setAdjusting(false);
462     }
463 
464     /**
465      * Change current context.
466      */
467     private void applyContext() {
468 
469         getModel().setProgramsFiltered(getContext().getDataContext().isContextFiltered(FilterTypeValues.PROGRAM));
470         getModel().setCampaignsFiltered(getContext().getDataContext().isContextFiltered(FilterTypeValues.CAMPAIGN));
471         getModel().setLocationsFiltered(getContext().getDataContext().isContextFiltered(FilterTypeValues.LOCATION));
472 
473         // reload combos
474         updatePrograms();
475         updateCampaigns();
476         updateLocations();
477     }
478 
479     /**
480      * Try to run the last search
481      */
482     private void runLastSearch() {
483 
484         final SurveyFilterDTO surveyFilter = getContext().getSurveyFilter();
485         if (surveyFilter != null) {
486 
487             if (surveyFilter.getCampaignId() != null) {
488                 getUI().getCampaignCombo().getData().stream()
489                     .filter(campaign -> campaign.getId().equals(surveyFilter.getCampaignId()))
490                     .findFirst().ifPresent(campaign -> getModel().setCampaign(campaign));
491             }
492             if (surveyFilter.getProgramCode() != null) {
493                 getUI().getProgramCombo().getData().stream()
494                     .filter(program -> program.getCode().equals(surveyFilter.getProgramCode()))
495                     .findFirst().ifPresent(program -> getModel().setProgram(program));
496             }
497             if (surveyFilter.getLocationId() != null) {
498                 getUI().getLocationCombo().getData().stream()
499                     .filter(location -> location.getId().equals(surveyFilter.getLocationId()))
500                     .findFirst().ifPresent(location -> getModel().setLocation(location));
501             }
502             if (surveyFilter.getStateId() != null) {
503                 getUI().getStateCombo().getData().stream()
504                     .filter(state -> state.getId().equals(surveyFilter.getStateId()))
505                     .findFirst().ifPresent(state -> getModel().setState(state));
506             }
507             if (surveyFilter.getShareId() != null) {
508                 getUI().getSynchronizationStatusCombo().getData().stream()
509                     .filter(synchronizationStatus -> synchronizationStatus.getId().equals(surveyFilter.getShareId()))
510                     .findFirst().ifPresent(synchronizationStatus -> getModel().setSynchronizationStatus(synchronizationStatus));
511             }
512             if (surveyFilter.getSearchDateId() != null) {
513                 getUI().getSearchDateCombo().getData().stream()
514                     .filter(searchDate -> searchDate.getId().equals(surveyFilter.getSearchDateId()))
515                     .findFirst().ifPresent(searchDate -> getModel().setSearchDate(searchDate));
516             }
517 
518             getModel().setStartDate(surveyFilter.getDate1());
519             getModel().setEndDate(surveyFilter.getDate2());
520             getModel().setName(surveyFilter.getName());
521             getModel().setComment(surveyFilter.getComment());
522 
523             // do search
524             SearchAction searchAction = getContext().getActionFactory().createLogicAction(HomeUIHandler.this, SearchAction.class);
525             searchAction.setControlAfterSelect(true);
526             SwingUtilities.invokeLater(() -> getContext().getActionEngine().runAction(searchAction));
527         }
528 
529     }
530 
531     public void showSurveysMap() {
532         getUI().getBottomPanelLayout().setSelected(SURVEYS_MAP_CARD);
533 
534         SwingUtilities.invokeLater(() -> getUI().getSurveysTableUI().getShowMapButton().setVisible(false));
535         getUI().getSurveysMapUI().getHandler().openMap();
536     }
537 
538     private JFrame mapFrame;
539 
540     public void showSurveysMapFullScreen() {
541 
542         if (mapFrame != null) {
543             mapFrame.dispose();
544         }
545 
546         getUI().getBottomPanelLayout().setSelected(SAMPLING_OPERATIONS_CARD);
547 
548         SurveysMapUI mapUI = getUI().getSurveysMapUI();
549         mapFrame = createFrame(mapUI, t("dali.home.map.title"), null, mapUI.getBounds());
550 
551         SwingUtilities.invokeLater(() -> {
552             mapFrame.setExtendedState(mapFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
553             mapFrame.setVisible(true);
554         });
555 
556     }
557 
558     public void restoreSurveysMap() {
559 
560         if (mapFrame == null || !(mapFrame.getContentPane() instanceof SurveysMapUI)) {
561             throw new DaliTechnicalException("Cannot restore map from the frame");
562         }
563 
564         SurveysMapUI mapUI = (SurveysMapUI) mapFrame.getContentPane();
565         getUI().getBottomPanel().add(mapUI, HomeUIHandler.SURVEYS_MAP_CARD);
566 
567         SwingUtilities.invokeLater(() -> getUI().getSurveysTableUI().getShowMapButton().setVisible(true));
568     }
569 
570     public void showSamplingOperations() {
571         getUI().getBottomPanelLayout().setSelected(SAMPLING_OPERATIONS_CARD);
572         SwingUtilities.invokeLater(() -> getUI().getSurveysTableUI().getShowMapButton().setVisible(true));
573 
574         if (mapFrame != null) {
575             restoreSurveysMap();
576             getUI().getSurveysMapUI().getFullScreenButton().setVisible(true);
577             mapFrame.dispose();
578             mapFrame = null;
579         }
580 
581         getUI().getSurveysMapUI().getHandler().closeMap();
582     }
583 
584     /**
585      * {@inheritDoc}
586      */
587     @Override
588     public SwingValidator<HomeUIModel> getValidator() {
589         return getUI().getValidator();
590     }
591 
592     /**
593      * {@inheritDoc}
594      */
595     @Override
596     @SuppressWarnings("unchecked")
597     public boolean quitUI() {
598         try {
599             QuitScreenAction action = new QuitScreenAction(this, false, SaveAction.class);
600             if (action.prepareAction()) {
601                 return true;
602             }
603         } catch (Exception e) {
604             LOG.error(e.getLocalizedMessage(), e);
605         }
606         return false;
607     }
608 
609     @Override
610     public void onCloseUI() {
611 
612         if (mapFrame != null) {
613             mapFrame.dispose();
614         }
615 
616         super.onCloseUI();
617     }
618 }