mailman.cloud.codelutin.com
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Observe-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2013 -----
  • December
  • November
  • October
  • September
observe-commits@list.forge.codelutin.com

June 2017

  • 1 participants
  • 99 discussions
[Git][ultreiaio/ird-observe][develop-5.x] libellés dans Exporter les données (See #730)
by Tony CHEMIT 12 Jun '17

12 Jun '17
Tony CHEMIT pushed to branch develop-5.x at ultreiaio / ird-observe Commits: c307bf30 by Tony CHEMIT at 2017-06-12T18:02:25+02:00 libellés dans Exporter les données (See #730) - - - - - 4 changed files: - application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java - application-swing/src/main/resources/i18n/application-swing_en_GB.properties - application-swing/src/main/resources/i18n/application-swing_es_ES.properties - application-swing/src/main/resources/i18n/application-swing_fr_FR.properties Changes: ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java @@ -200,8 +200,10 @@ public class AdminUIHandler { ConfigUI configUI = (ConfigUI) ui.getStepUI(AdminStep.CONFIG); - model.setCentralSourceLabel(t("observe.storage.config.target.storage")); + model.setLocalSourceLabel(t("observe.storage.config.exportSource.storage")); + model.setCentralSourceLabel(t("observe.storage.config.exportTarget.storage")); + configUI.getLocalSourceConfig().setBorder(new TitledBorder(model.getLocalSourceLabel())); configUI.getCentralSourceConfig().setBorder(new TitledBorder(model.getCentralSourceLabel())); } ===================================== application-swing/src/main/resources/i18n/application-swing_en_GB.properties ===================================== --- a/application-swing/src/main/resources/i18n/application-swing_en_GB.properties +++ b/application-swing/src/main/resources/i18n/application-swing_en_GB.properties @@ -1555,6 +1555,8 @@ observe.storage.config.data.mode=Data import mode observe.storage.config.data.storage=Data source cConfiguration observe.storage.config.export.required.read.data=You need to have read/write permissions on remove data source data observe.storage.config.export.required.read.referentiel=You need to have read/write permissions on remove referential source data +observe.storage.config.exportSource.storage=Configuration of data source to export +observe.storage.config.exportTarget.storage=Configuration of target data source observe.storage.config.left.storage=Left data source configuration observe.storage.config.referentiel.mode=Referential import mode observe.storage.config.referentiel.storage=Central data source configuration ===================================== application-swing/src/main/resources/i18n/application-swing_es_ES.properties ===================================== --- a/application-swing/src/main/resources/i18n/application-swing_es_ES.properties +++ b/application-swing/src/main/resources/i18n/application-swing_es_ES.properties @@ -1555,11 +1555,13 @@ observe.storage.config.data.mode=Modo de importación de los datos observe.storage.config.data.storage=Configuración de la base de datos observe.storage.config.export.required.read.data=Debe tener derechos de lectura sobre los datos de la base remota observe.storage.config.export.required.read.referentiel=Debe tener derechos de lectura sobre el referencial de la base remota +observe.storage.config.exportSource.storage=Configuration de la base à exporter +observe.storage.config.exportTarget.storage=Configuración de la base de datos de destino observe.storage.config.left.storage=Configuración de la base de la izquierda observe.storage.config.referentiel.mode=Modo de importación del referencial observe.storage.config.referentiel.storage=Configuración de la base de referencia observe.storage.config.right.storage=Configuration de la base de la derecha -observe.storage.config.source.storage=Configuración de la base para actualizar +observe.storage.config.source.storage=Configuración de la base de la izquierda observe.storage.config.target.storage=Configuración de la base de datos de destino observe.storage.error.badUrl=Error en el formato de la dirección (URL) %s observe.storage.error.dbVersionMismatch=La versión de la base remota (%s) no es compatible con la versión del modelo (%s). ===================================== application-swing/src/main/resources/i18n/application-swing_fr_FR.properties ===================================== --- a/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties +++ b/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties @@ -1555,6 +1555,8 @@ observe.storage.config.data.mode=Mode d'import des données observe.storage.config.data.storage=Configuration de la base de données observe.storage.config.export.required.read.data=Vous devez posséder les droits de lecture sur les données de la base distante observe.storage.config.export.required.read.referentiel=Vous devez posséder les droits de lecture sur le référentiel de la base distante +observe.storage.config.exportSource.storage=Configuration de la base à exporter +observe.storage.config.exportTarget.storage=Configuration de la base destination observe.storage.config.left.storage=Configuration de la base de gauche observe.storage.config.referentiel.mode=Mode d'import du référentiel observe.storage.config.referentiel.storage=Configuration de la base de référence View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/c307bf303de28e06a291592fb36… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/c307bf303de28e06a291592fb36… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-5.x] Problème d'UI/menu contextuel lors du déplacement d'items (routes, activités) (See #768)
by Tony CHEMIT 12 Jun '17

12 Jun '17
Tony CHEMIT pushed to branch develop-5.x at ultreiaio / ird-observe Commits: 1c750803 by Tony CHEMIT at 2017-06-12T17:37:32+02:00 Problème d&#39;UI/menu contextuel lors du déplacement d&#39;items (routes, activités) (See #768) - - - - - 26 changed files: - application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglineUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglinesUIAction.java - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeineUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeinesUIAction.java - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveMultipleDataUIActionSupport.java - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRouteUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRoutesUIAction.java - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveSingleDataUIActionSupport.java - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglineUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglinesUIAction.java - + application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeineUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeinesUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveTripNodeMenuPopulator.java → application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripsUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/ObserveNavigationTreeShowPopupAction.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeActivityRouteActionListener.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeActivityTripActionListener.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeRouteTripActionListener.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeTripProgramActionListener.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/NodeChangeActionListener.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveActivityLonglineNodeMenuPopulator.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveActivitySeineNodeMenuPopulator.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveNodeMenuPopulator.java - − application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveRouteNodeMenuPopulator.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/node/ObserveNode.java Changes: ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx @@ -86,7 +86,7 @@ <JPopupMenu id='scopeDownPopup'/> <JPopupMenu id='navigationPopup'> <JMenuItem id="navigationNoAction"/> - <JMenu id="navigationMoveAction"/> + <JMenuItem id="navigationMoveAction"/> <JMenuItem id="navigationOpenAction"/> <JMenuItem id="navigationCloseAction"/> <JMenuItem id="navigationDeleteAction"/> ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglineUIAction.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglineUIAction.java @@ -0,0 +1,123 @@ +/* + * #%L + * ObServe :: Application Swing + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.ird.observe.application.swing.ui.actions.shared; + +import fr.ird.observe.application.swing.ObserveOpenDataManager; +import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; +import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.application.swing.ui.tree.node.TripLonglineNode; +import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.longline.ActivityLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineDto; +import java.util.Optional; +import javax.swing.JOptionPane; + + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Action pour changer le programme d'une ou plusieurs marée dans la liste. + * + * @author Tony Chemit - dev(a)ultreia.io + * @since 5.0 + */ +public class MoveActivityLonglineUIAction extends MoveSingleDataUIActionSupport { + + private static final long serialVersionUID = 1L; + + public static final String ACTION_NAME = "moveActivityLongline"; + + public MoveActivityLonglineUIAction(ObserveMainUI mainUI) { + super(mainUI, + ACTION_NAME, + n("observe.navigationMenu.move.activityLongline"), + n("observe.navigationMenu.move.activityLongline"), + "move-activities" + ); + } + + @Override + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return chooseNewTripLongline(mainUI, oldParentNode); + } + + @Override + int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId) { + + return servicesProvider.newActivityLonglineService().moveActivityLonglineToTripLongline(dataId, newParentId); + } + + @Override + void closeNode(ObserveOpenDataManager openDataManager, String dataId) { + if (openDataManager.isOpenActivityLongline(dataId)) { + openDataManager.closeActivityLongline(dataId); + } + } + + @Override + ObserveNode getNewParentNode(ObserveTreeHelper treeHelper, ObserveNode grandParentNode, String newParentId) { + ObserveNode tripLonglineNode = treeHelper.getChild(grandParentNode, newParentId); + String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivityLonglineDto.class); + return treeHelper.getChild(tripLonglineNode, activitiesNodeId); + } + + static Optional<String> chooseNewTripLongline(ObserveMainUI ui, ObserveNode oldParentNode) { + + ObserveNode programNode = oldParentNode.getParent(); + String oldTripLonglineId = oldParentNode.getId(); + int tripLonglineNb = programNode.getChildCount(); + + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + DataReferenceDecorator<TripLonglineDto> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(TripLonglineDto.class); + + //on crée un tableau avec une marée en moins car on ne propose pas la marée actuelle + DecoratedNodeEntity[] decoratedTripLonglines = new DecoratedNodeEntity[tripLonglineNb - 1]; + + int j = 0; + for (int i = 0; i < tripLonglineNb; i++) { + + TripLonglineNode tripLonglineNode = (TripLonglineNode) programNode.getChildAt(i); + + String tripLonglineId = tripLonglineNode.getId(); + + if (!oldTripLonglineId.equals(tripLonglineId)) { + decoratedTripLonglines[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(tripLonglineNode, decorator); + } + } + + Object decoratedTripLongline = JOptionPane.showInputDialog(ui, + t("observe.action.choose.tripLongline.message"), + t("observe.action.choose.tripLongline.title"), + JOptionPane.QUESTION_MESSAGE, + null, + decoratedTripLonglines, + null); + return Optional.ofNullable(decoratedTripLongline != null ? ((DecoratedNodeEntity) decoratedTripLongline).getId() : null); + } + +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglinesUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglinesUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivityLonglinesUIAction.java @@ -24,31 +24,17 @@ package fr.ird.observe.application.swing.ui.actions.shared; import fr.ird.observe.application.swing.ObserveOpenDataManager; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; -import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; import fr.ird.observe.application.swing.ui.ObserveMainUI; -import fr.ird.observe.application.swing.ui.content.ContentUI; import fr.ird.observe.application.swing.ui.content.list.impl.longline.ActivityLonglinesUI; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.node.TripLonglineNode; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.services.dto.DataReference; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.services.ObserveServicesProvider; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; -import fr.ird.observe.services.dto.longline.TripLonglineDto; -import fr.ird.observe.services.service.longline.ActivityLonglineService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import java.awt.event.ActionEvent; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; + import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; /** * Action pour changer le programme d'une ou plusieurs marée dans la liste. @@ -56,15 +42,10 @@ import static org.nuiton.i18n.I18n.t; * @author Kevin Morin (Code Lutin) * @since 5.0 */ -public class MoveActivityLonglinesUIAction extends AbstractUIAction { +public class MoveActivityLonglinesUIAction extends MoveMultipleDataUIActionSupport<ActivityLonglinesUI> { private static final long serialVersionUID = 1L; - /** - * Logger. - */ - private static final Log log = LogFactory.getLog(MoveActivityLonglinesUIAction.class); - public static final String ACTION_NAME = "moveActivityLonglines"; public MoveActivityLonglinesUIAction(ObserveMainUI mainUI) { @@ -72,95 +53,23 @@ public class MoveActivityLonglinesUIAction extends AbstractUIAction { ACTION_NAME, n("observe.content.action.move.activities.longline"), n("observe.content.action.move.activities.longline.tip"), - "move-activities" + "move-activities", + ActivityLonglinesUI.class ); } @Override - public void actionPerformed(final ActionEvent e) { - - SwingUtilities.invokeLater(() -> { - JComponent c = (JComponent) e.getSource(); - ContentUI<?> ui = (ContentUI<?>) - c.getClientProperty("ui"); - if (ui == null) { - throw new IllegalStateException( - "could not find client property " + - "ui on component" + c); - } - - if (!(ui instanceof ActivityLonglinesUI)) { - throw new IllegalStateException("Can not come here!"); - } - ActivityLonglinesUI activityLonglinesUI = (ActivityLonglinesUI) ui; - - - // get current triplongline id - ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); - ObserveNode oldActivitiesNode = treeHelper.getSelectedNode(); - ObserveNode oldTripLonglineNode = oldActivitiesNode.getParent(); - - // choose the new tripLongline - String tripLonglineId = chooseNewTripLongline(ui, oldTripLonglineNode); - - if (tripLonglineId != null) { - - if (log.isInfoEnabled()) { - log.info("Will move activities to trip: " + tripLonglineId); - } - // change the tripLongline of the selected activities - List<DataReference<ActivityLonglineDto>> selectedDatas = activityLonglinesUI.getModel().getSelectedDatas(); - List<String> activityIds = selectedDatas.stream() - .map(DataReference.ID_FUNCTION) - .collect(Collectors.toList()); - ActivityLonglineService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newActivityLonglineService(); -// List<Integer> positions = - service.moveActivityLonglinesToTripLongline(activityIds, tripLonglineId); - - // update the tree - updateTree(oldActivitiesNode, tripLonglineId, activityIds); - } - - }); - + List<Integer> moveData(List<String> dataIds, String newParentId, ObserveServicesProvider servicesProvider) { + return servicesProvider.newActivityLonglineService().moveActivityLonglinesToTripLongline(dataIds, newParentId); } - protected String chooseNewTripLongline(ContentUI<?> ui, ObserveNode oldTripLonglineNode) { - ObserveNode programNode = oldTripLonglineNode.getParent(); - String oldTripLonglineId = oldTripLonglineNode.getId(); - int tripLonglineNb = programNode.getChildCount(); - - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - DataReferenceDecorator<TripLonglineDto> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(TripLonglineDto.class); - - //on crée un tableau avec une marée en moins car on ne propose pas la marée actuelle - DecoratedNodeEntity[] decoratedTripLonglines = new DecoratedNodeEntity[tripLonglineNb - 1]; - - int j = 0; - for (int i = 0; i < tripLonglineNb; i++) { - - TripLonglineNode tripLonglineNode = (TripLonglineNode) programNode.getChildAt(i); - - String tripLonglineId = tripLonglineNode.getId(); - - if (!oldTripLonglineId.equals(tripLonglineId)) { - decoratedTripLonglines[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(tripLonglineNode, decorator); - } - } - - Object decoratedTripLongline = JOptionPane.showInputDialog(ui, - t("observe.action.choose.tripLongline.message"), - t("observe.action.choose.tripLongline.title"), - JOptionPane.QUESTION_MESSAGE, - null, - decoratedTripLonglines, - null); - return decoratedTripLongline != null ? ((DecoratedNodeEntity) decoratedTripLongline).getId() : null; + @Override + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return MoveActivityLonglineUIAction.chooseNewTripLongline(getMainUI(), oldParentNode); } - protected void updateTree(ObserveNode oldActivitiesNode, - String tripLonglineId, - List<String> activityIds) { + @Override + void updateUI(ActivityLonglinesUI ui, ObserveNode oldActivitiesNode, String tripLonglineId, List<String> activityIds, List<Integer> positions) { ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); @@ -179,9 +88,7 @@ public class MoveActivityLonglinesUIAction extends AbstractUIAction { .findFirst(); // If so, we close it to avoid ending up with an open activity into a closed trip. - if (openActivity.isPresent()) { - openDataManager.closeActivityLongline(openActivity.get()); - } + openActivity.ifPresent(openDataManager::closeActivityLongline); // Let's reload the sub tree of each activities node. // As the change have already be done in database, we just call the child loaders to regenerate the activities nodes sub trees ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeineUIAction.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeineUIAction.java @@ -0,0 +1,123 @@ +/* + * #%L + * ObServe :: Application Swing + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.ird.observe.application.swing.ui.actions.shared; + +import fr.ird.observe.application.swing.ObserveOpenDataManager; +import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; +import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.application.swing.ui.tree.node.RouteSeineNode; +import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.seine.ActivitySeineDto; +import fr.ird.observe.services.dto.seine.RouteDto; +import java.util.Optional; +import javax.swing.JOptionPane; + + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Action pour changer le programme d'une ou plusieurs marée dans la liste. + * + * @author Tony Chemit - dev(a)ultreia.io + * @since 5.0 + */ +public class MoveActivitySeineUIAction extends MoveSingleDataUIActionSupport { + + private static final long serialVersionUID = 1L; + + public static final String ACTION_NAME = "moveActivitySeine"; + + public MoveActivitySeineUIAction(ObserveMainUI mainUI) { + super(mainUI, + ACTION_NAME, + n("observe.navigationMenu.move.activitySeine"), + n("observe.navigationMenu.move.activitySeine"), + "move-activities" + ); + } + + @Override + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return chooseNewRoute(mainUI, oldParentNode); + } + + @Override + int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId) { + return servicesProvider.newActivitySeineService().moveActivitySeineToRoute(dataId, newParentId); + } + + @Override + void closeNode(ObserveOpenDataManager openDataManager, String dataId) { + if (openDataManager.isOpenActivitySeine(dataId)) { + openDataManager.closeActivitySeine(dataId); + } + } + + @Override + ObserveNode getNewParentNode(ObserveTreeHelper treeHelper, ObserveNode grandParentNode, String newParentId) { + ObserveNode routeNode = treeHelper.getChild(grandParentNode, newParentId); + String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivitySeineDto.class); + return treeHelper.getChild(routeNode, activitiesNodeId); + } + + static Optional<String> chooseNewRoute(ObserveMainUI mainUI, ObserveNode oldParentNode) { + + ObserveNode routesNode = oldParentNode.getParent(); + String oldRouteId = oldParentNode.getId(); + int routeNb = routesNode.getChildCount(); + + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + DataReferenceDecorator<RouteDto> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(RouteDto.class); + + //on crée un tableau avec une route en moins car on ne propose pas la route actuel + DecoratedNodeEntity[] decoratedRoutes = new DecoratedNodeEntity[routeNb - 1]; + + int j = 0; + for (int i = 0; i < routeNb; i++) { + + RouteSeineNode routeNode = (RouteSeineNode) routesNode.getChildAt(i); + + String routeId = routeNode.getId(); + + if (!oldRouteId.equals(routeId)) { + decoratedRoutes[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(routeNode, decorator); + } + } + + Object decoratedRoute = JOptionPane.showInputDialog(mainUI, + t("observe.action.choose.route.message"), + t("observe.action.choose.route.title"), + JOptionPane.QUESTION_MESSAGE, + null, + decoratedRoutes, + null); + + return Optional.ofNullable(decoratedRoute != null ? ((DecoratedNodeEntity) decoratedRoute).getId() : null); + } + +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeinesUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeinesUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveActivitySeinesUIAction.java @@ -24,32 +24,17 @@ package fr.ird.observe.application.swing.ui.actions.shared; import fr.ird.observe.application.swing.ObserveOpenDataManager; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; -import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; import fr.ird.observe.application.swing.ui.ObserveMainUI; -import fr.ird.observe.application.swing.ui.content.ContentUI; import fr.ird.observe.application.swing.ui.content.list.impl.seine.ActivitySeinesUI; -import fr.ird.observe.application.swing.ui.content.list.impl.seine.ActivitySeinesUIModel; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.node.RouteSeineNode; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.services.dto.DataReference; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.services.ObserveServicesProvider; import fr.ird.observe.services.dto.seine.ActivitySeineDto; -import fr.ird.observe.services.dto.seine.RouteDto; -import fr.ird.observe.services.service.seine.ActivitySeineService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import java.awt.event.ActionEvent; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; + import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; /** * Action pour changer le programme d'une ou plusieurs marée dans la liste. @@ -57,15 +42,10 @@ import static org.nuiton.i18n.I18n.t; * @author Kevin Morin (Code Lutin) * @since 5.0 */ -public class MoveActivitySeinesUIAction extends AbstractUIAction { +public class MoveActivitySeinesUIAction extends MoveMultipleDataUIActionSupport<ActivitySeinesUI> { private static final long serialVersionUID = 1L; - /** - * Logger. - */ - private static final Log log = LogFactory.getLog(MoveActivitySeinesUIAction.class); - public static final String ACTION_NAME = "moveActivitySeines"; public MoveActivitySeinesUIAction(ObserveMainUI mainUI) { @@ -73,115 +53,46 @@ public class MoveActivitySeinesUIAction extends AbstractUIAction { ACTION_NAME, n("observe.content.action.move.activities.seine"), n("observe.content.action.move.activities.seine.tip"), - "move-activities" + "move-activities", + ActivitySeinesUI.class ); } @Override - public void actionPerformed(final ActionEvent e) { - - SwingUtilities.invokeLater(() -> { - JComponent c = (JComponent) e.getSource(); - ContentUI<?> ui = (ContentUI<?>) - c.getClientProperty("ui"); - if (ui == null) { - throw new IllegalStateException( - "could not find client property " + - "ui on component" + c); - } - - if (!(ui instanceof ActivitySeinesUI)) { - throw new IllegalStateException("Can not come here!"); - } - - // get current route id - ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); - ObserveNode oldActivitiesNode = treeHelper.getSelectedNode(); - ObserveNode oldRouteNode = oldActivitiesNode.getParent(); - - // choose the new route - String routeId = chooseNewRoute(ui, oldRouteNode); - - if (routeId != null) { - // change the route of the selected activities - List<DataReference<ActivitySeineDto>> selectedDatas = ((ActivitySeinesUIModel) ui.getModel()).getSelectedDatas(); - List<String> activityIds = selectedDatas.stream() - .map(DataReference.ID_FUNCTION) - .collect(Collectors.toList()) ; - ActivitySeineService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newActivitySeineService(); - List<Integer> positions = service.moveActivitySeinesToRoute(activityIds, routeId); - - // update the tree - updateTree(oldActivitiesNode, routeId, activityIds); - } - - }); - + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return MoveActivitySeineUIAction.chooseNewRoute(getMainUI(), oldParentNode); } - protected String chooseNewRoute(ContentUI<?> ui, ObserveNode oldRouteNode) { - ObserveNode routesNode = oldRouteNode.getParent(); - String oldRouteId = oldRouteNode.getId(); - int routeNb = routesNode.getChildCount(); - - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - DataReferenceDecorator<RouteDto> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(RouteDto.class); - - //on crée un tableau avec une route en moins car on ne propose pas la route actuel - DecoratedNodeEntity[] decoratedRoutes = new DecoratedNodeEntity[routeNb - 1]; - - int j = 0; - for (int i = 0; i < routeNb; i++) { - - RouteSeineNode routeNode = (RouteSeineNode) routesNode.getChildAt(i); - - String routeId = routeNode.getId(); - - if (!oldRouteId.equals(routeId)) { - decoratedRoutes[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(routeNode, decorator); - } - } - - Object decoratedRoute = JOptionPane.showInputDialog(ui, - t("observe.action.choose.route.message"), - t("observe.action.choose.route.title"), - JOptionPane.QUESTION_MESSAGE, - null, - decoratedRoutes, - null); - - return decoratedRoute != null ? ((DecoratedNodeEntity) decoratedRoute).getId() : null; + @Override + List<Integer> moveData(List<String> dataIds, String newParentId, ObserveServicesProvider servicesProvider) { + return servicesProvider.newActivitySeineService().moveActivitySeinesToRoute(dataIds, newParentId); } - protected void updateTree(ObserveNode oldActivitiesNode, - String routeId, - List<String> activityIds) { + @Override + void updateUI(ActivitySeinesUI ui, ObserveNode oldParentNode, String newParentId, List<String> dataIds, List<Integer> positions) { ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); - ObserveNode oldRouteNode = oldActivitiesNode.getParent(); + ObserveNode oldRouteNode = oldParentNode.getParent(); ObserveNode routesNode = oldRouteNode.getParent(); - ObserveNode tripNode = routesNode.getParent(); - ObserveNode newRouteNode = treeHelper.getChild(routesNode, routeId); + ObserveNode newRouteNode = treeHelper.getChild(routesNode, newParentId); String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivitySeineDto.class); ObserveNode newActivitiesNode = treeHelper.getChild(newRouteNode, activitiesNodeId); // Let's check if we're moving an open activity - Optional<String> openActivity = activityIds + Optional<String> openActivity = dataIds .stream() .filter(openDataManager::isOpenActivitySeine) .findFirst(); // If so, we close it to avoid ending up with an open activity into a closed route. - if (openActivity.isPresent()) { - openDataManager.closeActivitySeine(openActivity.get()); - } + openActivity.ifPresent(openDataManager::closeActivitySeine); // Let's reload the sub tree of each activities node. // As the change have already be done in database, we just call the child loaders to regenerate the activities nodes sub trees - treeHelper.reloadNodeSubTree(oldActivitiesNode, true); + treeHelper.reloadNodeSubTree(oldParentNode, true); treeHelper.reloadNodeSubTree(newActivitiesNode, true); // Let's put the focus on the activities node which received the activities ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveMultipleDataUIActionSupport.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveMultipleDataUIActionSupport.java @@ -0,0 +1,69 @@ +package fr.ird.observe.application.swing.ui.actions.shared; + +import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.content.ContentUI; +import fr.ird.observe.application.swing.ui.content.list.ContentListUI; +import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.DataReference; +import java.awt.event.ActionEvent; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.swing.JComponent; + +/** + * Created by tchemit on 12/06/17. + * + * @author Tony Chemit - dev(a)tchemit.fr + */ +public abstract class MoveMultipleDataUIActionSupport<U extends ContentListUI<?, ?>> extends AbstractUIAction { + + private final Class<U> uiType; + + MoveMultipleDataUIActionSupport(ObserveMainUI mainUI, String actionId, String label, String shortDescription, String actionIcon, Class<U> uiType) { + super(mainUI, actionId, label, shortDescription, actionIcon); + this.uiType = uiType; + } + + @Override + public final void actionPerformed(ActionEvent e) { + + JComponent c = (JComponent) e.getSource(); + ContentUI<?> ui1 = (ContentUI<?>) c.getClientProperty("ui"); + if (ui1 == null) { + throw new IllegalStateException("could not find client property ui on component" + c); + } + if (!uiType.isAssignableFrom(ui1.getClass())) { + throw new IllegalStateException("Can not come here!"); + } + + @SuppressWarnings("unchecked") U ui = (U) ui1; + + ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); + ObserveNode node = treeHelper.getSelectedNode(); + + ObserveNode oldParentNode = node.getParent().isRoot() ? node : node.getParent(); + + Optional<String> optionalNewParentId = getNewParentId(getMainUI(), oldParentNode); + + if (optionalNewParentId.isPresent()) { + + List<String> dataIds = ui.getModel().getSelectedDatas().stream().map(DataReference.ID_FUNCTION).collect(Collectors.toList()); + + List<Integer> positions = moveData(dataIds, optionalNewParentId.get(), ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider()); + + updateUI(ui, node, optionalNewParentId.get(), dataIds, positions); + } + + } + + abstract Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode); + + abstract List<Integer> moveData(List<String> dataIds, String newParentId, ObserveServicesProvider servicesProvider); + + abstract void updateUI(U ui, ObserveNode oldParentNode, String newParentId, List<String> dataIds, List<Integer> positions); + +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRouteUIAction.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRouteUIAction.java @@ -0,0 +1,121 @@ +/* + * #%L + * ObServe :: Application Swing + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.ird.observe.application.swing.ui.actions.shared; + +import fr.ird.observe.application.swing.ObserveOpenDataManager; +import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; +import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.application.swing.ui.tree.node.TripSeineNode; +import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.seine.RouteDto; +import fr.ird.observe.services.dto.seine.TripSeineDto; +import java.util.Optional; +import javax.swing.JOptionPane; + + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Action pour changer le programme d'une ou plusieurs marée dans la liste. + * + * @author Tony Chemit - dev(a)ultreia.io + * @since 5.0 + */ +public class MoveRouteUIAction extends MoveSingleDataUIActionSupport { + + private static final long serialVersionUID = 1L; + + public static final String ACTION_NAME = "moveRoute"; + + public MoveRouteUIAction(ObserveMainUI mainUI) { + super(mainUI, + ACTION_NAME, + n("observe.navigationMenu.move.route"), + n("observe.navigationMenu.move.route"), + "move-routes" + ); + } + + @Override + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return chooseNewTripSeine(mainUI, oldParentNode); + } + + @Override + int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId) { + return servicesProvider.newRouteService().moveRouteToTripSeine(dataId, newParentId); + } + + @Override + void closeNode(ObserveOpenDataManager openDataManager, String dataId) { + if (openDataManager.isOpenRoute(dataId)) { + openDataManager.closeRoute(dataId); + } + } + + @Override + ObserveNode getNewParentNode(ObserveTreeHelper treeHelper, ObserveNode grandParentNode, String newParentId) { + ObserveNode tripNode = treeHelper.getChild(grandParentNode, newParentId); + String routesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(RouteDto.class); + return treeHelper.getChild(tripNode, routesNodeId); + } + + static Optional<String> chooseNewTripSeine(ObserveMainUI mainUI, ObserveNode oldTripSeineNode) { + ObserveNode programNode = oldTripSeineNode.getParent(); + String oldTripSeineId = oldTripSeineNode.getId(); + int tripSeineNb = programNode.getChildCount(); + + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + DataReferenceDecorator<TripSeineDto> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(TripSeineDto.class); + + //on crée un tableau avec une marée en moins car on ne propose pas la marée actuel + DecoratedNodeEntity[] decoratedTripSeines = new DecoratedNodeEntity[tripSeineNb - 1]; + + int j = 0; + for (int i = 0; i < tripSeineNb; i++) { + + TripSeineNode tripSeineNode = (TripSeineNode) programNode.getChildAt(i); + + String tripSeineId = tripSeineNode.getId(); + + if (!oldTripSeineId.equals(tripSeineId)) { + decoratedTripSeines[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(tripSeineNode, decorator); + } + } + + Object decoratedTripSeine = JOptionPane.showInputDialog(mainUI, + t("observe.action.choose.tripSeine.message"), + t("observe.action.choose.tripSeine.title"), + JOptionPane.QUESTION_MESSAGE, + null, + decoratedTripSeines, + null); + return Optional.ofNullable(decoratedTripSeine != null ? ((DecoratedNodeEntity) decoratedTripSeine).getId() : null); + } + +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRoutesUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRoutesUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveRoutesUIAction.java @@ -24,31 +24,17 @@ package fr.ird.observe.application.swing.ui.actions.shared; import fr.ird.observe.application.swing.ObserveOpenDataManager; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; -import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; import fr.ird.observe.application.swing.ui.ObserveMainUI; -import fr.ird.observe.application.swing.ui.content.ContentUI; import fr.ird.observe.application.swing.ui.content.list.impl.seine.RoutesUI; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.node.TripSeineNode; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.services.dto.DataReference; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.services.ObserveServicesProvider; import fr.ird.observe.services.dto.seine.RouteDto; -import fr.ird.observe.services.dto.seine.TripSeineDto; -import fr.ird.observe.services.service.seine.RouteService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import java.awt.event.ActionEvent; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; + import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; /** * Action pour changer le programme d'une ou plusieurs marée dans la liste. @@ -56,15 +42,10 @@ import static org.nuiton.i18n.I18n.t; * @author Kevin Morin (Code Lutin) * @since 5.0 */ -public class MoveRoutesUIAction extends AbstractUIAction { +public class MoveRoutesUIAction extends MoveMultipleDataUIActionSupport<RoutesUI> { private static final long serialVersionUID = 1L; - /** - * Logger. - */ - private static final Log log = LogFactory.getLog(MoveRoutesUIAction.class); - public static final String ACTION_NAME = "moveRoutes"; public MoveRoutesUIAction(ObserveMainUI mainUI) { @@ -72,88 +53,23 @@ public class MoveRoutesUIAction extends AbstractUIAction { ACTION_NAME, n("observe.content.action.move.routes"), n("observe.content.action.move.routes.tip"), - "move-routes" + "move-routes", + RoutesUI.class ); } @Override - public void actionPerformed(final ActionEvent e) { - - SwingUtilities.invokeLater(() -> { - JComponent c = (JComponent) e.getSource(); - ContentUI<?> ui = (ContentUI<?>) - c.getClientProperty("ui"); - if (ui == null) { - throw new IllegalStateException( - "could not find client property " + - "ui on component" + c); - } - - if (!(ui instanceof RoutesUI)) { - throw new IllegalStateException("Can not come here!"); - } - - RoutesUI theUi = (RoutesUI) ui; - - // get current tripseine id - ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); - ObserveNode oldRoutesNode = treeHelper.getSelectedNode(); - ObserveNode oldTripSeineNode = oldRoutesNode.getParent(); - - // choose the new tripseine - String tripSeineId = chooseNewTripSeine(theUi, oldTripSeineNode); - - if (tripSeineId != null) { - // change the tripseine of the selected routes - List<DataReference<RouteDto>> selectedDatas = theUi.getModel().getSelectedDatas(); - List<String> routeIds = selectedDatas.stream().map(DataReference.ID_FUNCTION).collect(Collectors.toList()); - RouteService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newRouteService(); - List<Integer> positions = service.moveRoutesToTripSeine(routeIds, tripSeineId); - - // update the tree - updateTree(oldRoutesNode, tripSeineId, routeIds); - } - - }); - + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return MoveRouteUIAction.chooseNewTripSeine(getMainUI(), oldParentNode); } - protected String chooseNewTripSeine(ContentUI<?> ui, ObserveNode oldTripSeineNode) { - ObserveNode programNode = oldTripSeineNode.getParent(); - String oldTripSeineId = oldTripSeineNode.getId(); - int tripSeineNb = programNode.getChildCount(); - - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - DataReferenceDecorator<TripSeineDto> decorator = applicationContext.getDecoratorService().getDataReferenceDecorator(TripSeineDto.class); - - //on crée un tableau avec une marée en moins car on ne propose pas la marée actuel - DecoratedNodeEntity[] decoratedTripSeines = new DecoratedNodeEntity[tripSeineNb - 1]; - - int j = 0; - for (int i = 0; i < tripSeineNb; i++) { - - TripSeineNode tripSeineNode = (TripSeineNode) programNode.getChildAt(i); - - String tripSeineId = tripSeineNode.getId(); - - if (!oldTripSeineId.equals(tripSeineId)) { - decoratedTripSeines[j++] = DecoratedNodeEntity.newDecoratedNodeEntity(tripSeineNode, decorator); - } - } - - Object decoratedTripSeine = JOptionPane.showInputDialog(ui, - t("observe.action.choose.tripSeine.message"), - t("observe.action.choose.tripSeine.title"), - JOptionPane.QUESTION_MESSAGE, - null, - decoratedTripSeines, - null); - return decoratedTripSeine != null ? ((DecoratedNodeEntity) decoratedTripSeine).getId() : null; + @Override + List<Integer> moveData(List<String> dataIds, String newParentId, ObserveServicesProvider servicesProvider) { + return ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newRouteService().moveRoutesToTripSeine(dataIds, newParentId); } - protected void updateTree(ObserveNode oldRoutesNode, - String tripSeineId, - List<String> routeIds) { + @Override + void updateUI(RoutesUI ui, ObserveNode oldRoutesNode, String tripSeineId, List<String> routeIds, List<Integer> positions) { ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); @@ -172,9 +88,7 @@ public class MoveRoutesUIAction extends AbstractUIAction { .findFirst(); // If so, we close it to avoid ending up with an open route into a closed trip. - if (openRoute.isPresent()) { - openDataManager.closeRoute(openRoute.get()); - } + openRoute.ifPresent(openDataManager::closeRoute); // Let's reload the sub tree of each routes node. // As the change have already be done in database, we just call the child loaders to regenerate the routes nodes sub trees ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveSingleDataUIActionSupport.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveSingleDataUIActionSupport.java @@ -0,0 +1,71 @@ +package fr.ird.observe.application.swing.ui.actions.shared; + +import fr.ird.observe.application.swing.ObserveOpenDataManager; +import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.services.ObserveServicesProvider; +import java.awt.event.ActionEvent; +import java.util.Optional; + +/** + * Created by tchemit on 12/06/17. + * + * @author Tony Chemit - dev(a)tchemit.fr + */ +public abstract class MoveSingleDataUIActionSupport extends AbstractUIAction { + + MoveSingleDataUIActionSupport(ObserveMainUI mainUI, String actionId, String label, String shortDescription, String actionIcon) { + super(mainUI, actionId, label, shortDescription, actionIcon); + } + + @Override + public final void actionPerformed(ActionEvent e) { + + ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); + ObserveNode node = treeHelper.getSelectedNode(); + ObserveNode oldParentNode = node.getParent().getParent().equals(node.getRoot()) ? node.getParent() : node.getParent().getParent(); + Optional<String> optionalNewParentId = getNewParentId(getMainUI(), oldParentNode); + + optionalNewParentId.ifPresent(newParentId -> apply(oldParentNode, node.getId(), newParentId)); + } + + abstract Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode); + + private void apply(ObserveNode oldParentNode, String dataId, String newParentId) { + + ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); + + ObserveNode node = treeHelper.getSelectedNode(); + ObserveNode grandParentNode = oldParentNode.getParent(); + ObserveNode newParentNode = getNewParentNode(getMainUI().getTreeHelper(), grandParentNode, newParentId); + + closeNode(ObserveSwingApplicationContext.get().getOpenDataManager(), node.getId()); + + int position = moveData(ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider(), ObserveSwingApplicationContext.get().getOpenDataManager(), oldParentNode.getId(), newParentId, dataId); + + treeHelper.selectNode(newParentNode); + + treeHelper.removeNode(node); + + ObserveNode newNode = treeHelper.getChild(newParentNode, dataId); + + if (newNode == null) { + + treeHelper.insertNode(newParentNode, node, position); + newNode = node; + } + + treeHelper.refreshNode(oldParentNode, false); + treeHelper.refreshNode(newParentNode, false); + treeHelper.selectNode(newNode); + + } + + abstract int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId); + + abstract void closeNode(ObserveOpenDataManager openDataManager, String dataId); + + abstract ObserveNode getNewParentNode(ObserveTreeHelper treeHelper, ObserveNode grandParentNode, String newParentId); +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglineUIAction.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglineUIAction.java @@ -0,0 +1,50 @@ +package fr.ird.observe.application.swing.ui.actions.shared; + +/*- + * #%L + * ObServe :: Application Swing + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.application.swing.ObserveOpenDataManager; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.constants.GearType; + +/** + * @author Tony Chemit - dev(a)tchemit.fr + * @since 5.0 + */ +public class MoveTripLonglineUIAction extends MoveTripUIAction { + + private static final long serialVersionUID = 1L; + + public static final String ACTION_NAME = "moveTripLongline"; + + public MoveTripLonglineUIAction(ObserveMainUI mainUI) { + super(mainUI, ACTION_NAME, GearType.longline); + } + + @Override + int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId) { + int position = servicesProvider.newTripLonglineService().moveTripLonglineToProgram(dataId, newParentId); + super.moveData(servicesProvider, openDataManager, oldParentId, newParentId, dataId); + return position; + } +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglinesUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglinesUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripLonglinesUIAction.java @@ -22,18 +22,13 @@ package fr.ird.observe.application.swing.ui.actions.shared; * #L% */ -import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.services.dto.DataReference; -import fr.ird.observe.services.dto.constants.GearType; -import fr.ird.observe.services.dto.longline.TripLonglineDto; -import fr.ird.observe.services.service.longline.TripLonglineService; import fr.ird.observe.application.swing.ui.ObserveMainUI; -import fr.ird.observe.application.swing.ui.content.ContentUI; import fr.ird.observe.application.swing.ui.content.list.impl.longline.TripLonglinesUI; import fr.ird.observe.application.swing.ui.content.list.impl.longline.TripLonglinesUIModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.DataReference; +import fr.ird.observe.services.dto.constants.GearType; +import fr.ird.observe.services.dto.longline.TripLonglineDto; import java.util.ArrayList; import java.util.List; @@ -41,43 +36,24 @@ import java.util.List; * @author Kevin Morin (Code Lutin) * @since 5.0 */ -public class MoveTripLonglinesUIAction extends MoveTripsUIAction<TripLonglineDto> { +public class MoveTripLonglinesUIAction extends MoveTripsUIAction<TripLonglinesUI> { private static final long serialVersionUID = 1L; - /** - * Logger. - */ - private static final Log log = LogFactory.getLog(MoveTripLonglinesUIAction.class); - public static final String ACTION_NAME = "moveTripLonglines"; public MoveTripLonglinesUIAction(ObserveMainUI mainUI) { - super(mainUI, ACTION_NAME); - } - - @Override - protected void checkUIClass(ContentUI<?> ui) throws IllegalStateException { - if (!(ui instanceof TripLonglinesUI)) { - throw new IllegalStateException("Can not come here!"); - } - } - - @Override - protected GearType getGearType(ContentUI<?> ui) { - return GearType.longline; + super(mainUI, ACTION_NAME, GearType.longline, TripLonglinesUI.class); } @Override - protected List<Integer> getPositions(List<String> tripIds, String programId) { - TripLonglineService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newTripLonglineService(); - return service.moveTripLonglinesToProgram(tripIds, programId); + List<Integer> moveData(List<String> dataIds, String newParentId, ObserveServicesProvider servicesProvider) { + return servicesProvider.newTripLonglineService().moveTripLonglinesToProgram(dataIds, newParentId); } @Override - protected void updateModelData(ContentUI<?> ui) { - TripLonglinesUI tripLonglinesUI = (TripLonglinesUI) ui; - TripLonglinesUIModel model = tripLonglinesUI.getModel(); + protected void updateModelData(TripLonglinesUI ui) { + TripLonglinesUIModel model = ui.getModel(); List<DataReference<TripLonglineDto>> data = new ArrayList<>(model.getData()); data.removeAll(model.getSelectedDatas()); model.setData(data); ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeineUIAction.java ===================================== --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeineUIAction.java @@ -0,0 +1,50 @@ +package fr.ird.observe.application.swing.ui.actions.shared; + +/*- + * #%L + * ObServe :: Application Swing + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.application.swing.ObserveOpenDataManager; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.constants.GearType; + +/** + * @author Tony Chemit - dev(a)tchemit.fr + * @since 5.0 + */ +public class MoveTripSeineUIAction extends MoveTripUIAction { + + private static final long serialVersionUID = 1L; + + public static final String ACTION_NAME = "moveTripSeine"; + + public MoveTripSeineUIAction(ObserveMainUI mainUI) { + super(mainUI, ACTION_NAME, GearType.seine); + } + + @Override + int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId) { + int position = servicesProvider.newTripSeineService().moveTripSeineToProgram(dataId, newParentId); + super.moveData(servicesProvider, openDataManager, oldParentId, newParentId, dataId); + return position; + } +} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeinesUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeinesUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripSeinesUIAction.java @@ -23,17 +23,14 @@ package fr.ird.observe.application.swing.ui.actions.shared; */ import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.content.list.impl.seine.TripSeinesUI; +import fr.ird.observe.application.swing.ui.content.list.impl.seine.TripSeinesUIModel; +import fr.ird.observe.services.ObserveServicesProvider; import fr.ird.observe.services.dto.DataReference; import fr.ird.observe.services.dto.constants.GearType; import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.service.seine.TripSeineService; -import fr.ird.observe.application.swing.ui.ObserveMainUI; -import fr.ird.observe.application.swing.ui.content.ContentUI; -import fr.ird.observe.application.swing.ui.content.list.impl.seine.TripSeinesUI; -import fr.ird.observe.application.swing.ui.content.list.impl.seine.TripSeinesUIModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.util.ArrayList; import java.util.List; @@ -41,43 +38,24 @@ import java.util.List; * @author Kevin Morin (Code Lutin) * @since 5.0 */ -public class MoveTripSeinesUIAction extends MoveTripsUIAction<TripSeineDto> { +public class MoveTripSeinesUIAction extends MoveTripsUIAction<TripSeinesUI> { private static final long serialVersionUID = 1L; - /** - * Logger. - */ - private static final Log log = LogFactory.getLog(MoveTripSeinesUIAction.class); - public static final String ACTION_NAME = "moveTripSeines"; public MoveTripSeinesUIAction(ObserveMainUI mainUI) { - super(mainUI, ACTION_NAME); - } - - @Override - protected void checkUIClass(ContentUI<?> ui) throws IllegalStateException { - if (!(ui instanceof TripSeinesUI)) { - throw new IllegalStateException("Can not come here!"); - } - } - - @Override - protected GearType getGearType(ContentUI<?> ui) { - return GearType.seine; + super(mainUI, ACTION_NAME, GearType.seine, TripSeinesUI.class); } @Override - protected List<Integer> getPositions(List<String> tripIds, String programId) { - TripSeineService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newTripSeineService(); - return service.moveTripSeinesToProgram(tripIds, programId); + List<Integer> moveData(List<String> dataIds, String newParentId, ObserveServicesProvider servicesProvider) { + return servicesProvider.newTripSeineService().moveTripSeinesToProgram(dataIds, newParentId); } @Override - protected void updateModelData(ContentUI<?> ui) { - TripSeinesUI tripSeinesUI = (TripSeinesUI) ui; - TripSeinesUIModel model = tripSeinesUI.getModel(); + protected void updateModelData(TripSeinesUI ui) { + TripSeinesUIModel model = ui.getModel(); List<DataReference<TripSeineDto>> data = new ArrayList<>(model.getData()); data.removeAll(model.getSelectedDatas()); model.setData(data); ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveTripNodeMenuPopulator.java → application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveTripNodeMenuPopulator.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripUIAction.java @@ -1,6 +1,4 @@ -package fr.ird.observe.application.swing.ui.tree.menu; - -/*- +/* * #%L * ObServe :: Application Swing * %% @@ -8,7 +6,7 @@ package fr.ird.observe.application.swing.ui.tree.menu; * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -16,64 +14,96 @@ package fr.ird.observe.application.swing.ui.tree.menu; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public + * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ +package fr.ird.observe.application.swing.ui.actions.shared; +import fr.ird.observe.application.swing.ObserveOpenDataManager; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.services.dto.IdHelper; -import fr.ird.observe.services.dto.constants.GearType; -import fr.ird.observe.services.dto.referential.ProgramDto; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.application.swing.decoration.decorators.ReferentialReferenceDecorator; +import fr.ird.observe.application.swing.ui.ObserveMainUI; import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; import fr.ird.observe.application.swing.ui.tree.node.ProgramLonglineNode; import fr.ird.observe.application.swing.ui.tree.node.ProgramSeineNode; -import fr.ird.observe.application.swing.ui.tree.actions.ChangeTripProgramActionListener; -import fr.ird.observe.application.swing.ui.tree.actions.NodeChangeActionListener; import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.application.swing.decoration.decorators.ReferentialReferenceDecorator; - +import fr.ird.observe.services.ObserveServicesProvider; +import fr.ird.observe.services.dto.IdHelper; +import fr.ird.observe.services.dto.constants.GearType; +import fr.ird.observe.services.dto.referential.ProgramDto; import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import javax.swing.JOptionPane; + + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; /** - * @author Kevin Morin (Code Lutin) + * Action pour changer le programme d'une ou plusieurs marée dans la liste. + * + * @author Tony Chemit - dev(a)tchemit.fr * @since 5.0 */ -public class MoveTripNodeMenuPopulator extends MoveNodeMenuPopulator { +public abstract class MoveTripUIAction extends MoveSingleDataUIActionSupport { + + private static final long serialVersionUID = 1L; + + public static final String ACTION_NAME = "moveTrip"; + + private final GearType gearType; + + MoveTripUIAction(ObserveMainUI mainUI, String actionName, GearType gearType) { + super(mainUI, + actionName, + n("observe.navigationMenu.move.trip"), + n("observe.navigationMenu.move.trip"), + "move-trips" + ); + this.gearType = gearType; + } @Override - public NodeChangeActionListener createChangeActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String id, - String parentId) { - return new ChangeTripProgramActionListener(treeHelper, dataSource, id, parentId); + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return chooseNewProgram(mainUI, gearType, oldParentNode.getId()); } @Override - public List<DecoratedNodeEntity> getPossibleParentNodes(ObserveNode tripNode, ObserveTreeHelper treeHelper) { + int moveData(ObserveServicesProvider servicesProvider, ObserveOpenDataManager openDataManager, String oldParentId, String newParentId, String dataId) { - // noeud du programme parent - ObserveNode parentNode = tripNode.getParent(); + // Close old program and open new program + if (openDataManager.isOpen(dataId)) { + openDataManager.closeProgram(oldParentId); + openDataManager.openProgram(newParentId); + } - // programmes du même type que le noeud de marée, sans le parent actuel - List<DecoratedNodeEntity> possibleParents = new ArrayList<>(); + // hum, we do NOT use this value (concrete classes define it) + return 0; + } - // noeud longline ? - GearType gearType = IdHelper.isLonglineId(tripNode.getId()) ? GearType.longline : GearType.seine; + @Override + void closeNode(ObserveOpenDataManager openDataManager, String dataId) { + // Don't do anything : trip should stay open when being transferred + } - // racine - ObserveNode rootNode = treeHelper.getRootNode(); + @Override + ObserveNode getNewParentNode(ObserveTreeHelper treeHelper, ObserveNode grandParentNode, String newParentId) { + return treeHelper.getChild(grandParentNode, newParentId); + } - createPossibleParents(parentNode.getId(), possibleParents, gearType, rootNode); + static Optional<String> chooseNewProgram(ObserveMainUI mainUI, GearType gearType, String oldProgramId) { - return possibleParents; - } + ObserveTreeHelper treeHelper = mainUI.getTreeHelper(); + + // racine + ObserveNode rootNode = treeHelper.getRootNode(); - public static void createPossibleParents(String oldProgramId, List<DecoratedNodeEntity> possibleParents, GearType gearType, ObserveNode rootNode) { + //on crée un tableau avec un programme en moins car on ne propose pas le programme actuel + List<DecoratedNodeEntity> decoratedProgramList = new ArrayList<>(); ReferentialReferenceDecorator<ProgramDto> programDecorator = ObserveSwingApplicationContext.get().getDecoratorService().getReferentialReferenceDecorator(ProgramDto.class); @@ -89,17 +119,30 @@ public class MoveTripNodeMenuPopulator extends MoveNodeMenuPopulator { if (programNode instanceof ProgramSeineNode && GearType.seine == gearType) { ProgramSeineNode node = (ProgramSeineNode) programNode; - possibleParents.add(DecoratedNodeEntity.newDecoratedNodeEntity(node, programDecorator)); + decoratedProgramList.add(DecoratedNodeEntity.newDecoratedNodeEntity(node, programDecorator)); } else if (programNode instanceof ProgramLonglineNode && GearType.longline == gearType) { ProgramLonglineNode node = (ProgramLonglineNode) programNode; - possibleParents.add(DecoratedNodeEntity.newDecoratedNodeEntity(node, programDecorator)); + decoratedProgramList.add(DecoratedNodeEntity.newDecoratedNodeEntity(node, programDecorator)); } } } + + DecoratedNodeEntity[] decoratedPrograms = + decoratedProgramList.toArray(new DecoratedNodeEntity[decoratedProgramList.size()]); + + DecoratedNodeEntity decoratedProgram = (DecoratedNodeEntity) JOptionPane.showInputDialog(mainUI, + t("observe.action.choose.program.message"), + t("observe.action.choose.program.title"), + JOptionPane.QUESTION_MESSAGE, + null, + decoratedPrograms, + null); + + return Optional.ofNullable(decoratedProgram == null ? null : decoratedProgram.getId()); } } ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripsUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripsUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveTripsUIAction.java @@ -23,29 +23,18 @@ package fr.ird.observe.application.swing.ui.actions.shared; import fr.ird.observe.application.swing.ObserveOpenDataManager; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.services.dto.DataDto; -import fr.ird.observe.services.dto.DataReference; -import fr.ird.observe.services.dto.constants.GearType; import fr.ird.observe.application.swing.ui.ObserveMainUI; -import fr.ird.observe.application.swing.ui.content.ContentUI; -import fr.ird.observe.application.swing.ui.content.list.ContentListUIModel; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.application.swing.ui.content.list.ContentListUI; import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.menu.MoveTripNodeMenuPopulator; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; +import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; +import fr.ird.observe.services.dto.constants.GearType; +import java.util.List; +import java.util.Optional; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; /** * Action pour changer le programme d'une ou plusieurs marée dans la liste. @@ -53,118 +42,55 @@ import static org.nuiton.i18n.I18n.t; * @author Kevin Morin (Code Lutin) * @since 5.0 */ -public abstract class MoveTripsUIAction<T extends DataDto> extends AbstractUIAction { +public abstract class MoveTripsUIAction<U extends ContentListUI<?, ?>> extends MoveMultipleDataUIActionSupport<U> { private static final long serialVersionUID = 1L; - /** - * Logger. - */ private static final Log log = LogFactory.getLog(MoveTripsUIAction.class); public static final String ACTION_NAME = "moveTrips"; + private final GearType gearType; + + protected abstract void updateModelData(U ui); - public MoveTripsUIAction(ObserveMainUI mainUI, String actionName) { + MoveTripsUIAction(ObserveMainUI mainUI, String actionName, GearType gearType, Class<U> uiType) { super(mainUI, actionName, n("observe.content.action.move.trips"), n("observe.content.action.move.trips.tip"), - "move-trips" + "move-trips", + uiType ); + this.gearType = gearType; } @Override - public void actionPerformed(final ActionEvent e) { - - SwingUtilities.invokeLater(() -> { - JComponent c = (JComponent) e.getSource(); - ContentUI<?> ui = (ContentUI<?>) - c.getClientProperty("ui"); - if (ui == null) { - throw new IllegalStateException( - "could not find client property " + - "ui on component" + c); - } - - checkUIClass(ui); - - // get current program id - ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); - ObserveNode oldProgramNode = treeHelper.getSelectedNode(); - String oldProgramId = oldProgramNode.getId(); - - // choose the new program - String programId = chooseNewProgram(ui, oldProgramId); - - if (programId != null) { - - // change the program of the selected trips - List<DataReference<T>> selectedDatas = ((ContentListUIModel) ui.getModel()).getSelectedDatas(); - List<String> tripIds = selectedDatas.stream().map(DataReference.ID_FUNCTION).collect(Collectors.toList()); - List<Integer> positions = getPositions(tripIds, programId); - - // update the tree - updateTree(ui, oldProgramNode, oldProgramId, programId, tripIds, positions); - } - - }); - + Optional<String> getNewParentId(ObserveMainUI mainUI, ObserveNode oldParentNode) { + return MoveTripUIAction.chooseNewProgram(getMainUI(), gearType, oldParentNode.getId()); } - protected String chooseNewProgram(ContentUI<?> ui, String oldProgramId) { - - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - - ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); - - GearType geartype = getGearType(ui); - - // racine - ObserveNode rootNode = treeHelper.getRootNode(); - - //on crée un tableau avec un programme en moins car on ne propose pas le programme actuel - List<DecoratedNodeEntity> decoratedProgramList = new ArrayList<>(); - - MoveTripNodeMenuPopulator.createPossibleParents(oldProgramId, decoratedProgramList, geartype, rootNode); - - DecoratedNodeEntity[] decoratedPrograms = - decoratedProgramList.toArray(new DecoratedNodeEntity[decoratedProgramList.size()]); - - DecoratedNodeEntity decoratedProgram = (DecoratedNodeEntity) JOptionPane.showInputDialog(ui, - t("observe.action.choose.program.message"), - t("observe.action.choose.program.title"), - JOptionPane.QUESTION_MESSAGE, - null, - decoratedPrograms, - null); - - return decoratedProgram == null ? null : decoratedProgram.getId(); - } + @Override + void updateUI(U ui, ObserveNode oldParentNode, String newParentId, List<String> dataIds, List<Integer> positions) { - protected void updateTree(ContentUI<?> ui, - ObserveNode oldProgramNode, - String oldProgramId, - String programId, - List<String> tripIds, - List<Integer> positions) { + String oldProgramId = oldParentNode.getId(); ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); ObserveTreeHelper treeHelper = getMainUI().getTreeHelper(); ObserveNode rootNode = treeHelper.getRootNode(); - ObserveNode newProgramNode = treeHelper.getChild(rootNode, programId); + ObserveNode newProgramNode = treeHelper.getChild(rootNode, newParentId); for (int i = 0, s = positions.size(); i < s; i++) { - String tripId = tripIds.get(i); - ObserveNode tripNode = treeHelper.getChild(oldProgramNode, tripId); + String tripId = dataIds.get(i); + ObserveNode tripNode = treeHelper.getChild(oldParentNode, tripId); boolean wasOpen = tripNode.isOpen(); treeHelper.removeNode(tripNode); if (wasOpen) { openDataManager.closeProgram(oldProgramId); - openDataManager.openProgram(programId); + openDataManager.openProgram(newParentId); } ObserveNode newTripNode = treeHelper.getChild(newProgramNode, tripId); @@ -181,17 +107,9 @@ public abstract class MoveTripsUIAction<T extends DataDto> extends AbstractUIAct updateModelData(ui); - treeHelper.reloadNode(oldProgramNode, true); + treeHelper.reloadNode(oldParentNode, true); treeHelper.reloadNode(newProgramNode, true); treeHelper.selectNode(newProgramNode); } - protected abstract void checkUIClass(ContentUI<?> ui) throws IllegalStateException; - - protected abstract GearType getGearType(ContentUI<?> ui); - - protected abstract List<Integer> getPositions(List<String> tripIds, String programId); - - protected abstract void updateModelData(ContentUI<?> ui); - } ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/ObserveNavigationTreeShowPopupAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/ObserveNavigationTreeShowPopupAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/ObserveNavigationTreeShowPopupAction.java @@ -23,24 +23,23 @@ package fr.ird.observe.application.swing.ui.tree; */ import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; import fr.ird.observe.application.swing.ObserveOpenDataManager; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.db.DataContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; +import fr.ird.observe.application.swing.ui.actions.shared.MoveActivityLonglineUIAction; +import fr.ird.observe.application.swing.ui.actions.shared.MoveActivitySeineUIAction; +import fr.ird.observe.application.swing.ui.actions.shared.MoveRouteUIAction; +import fr.ird.observe.application.swing.ui.actions.shared.MoveTripLonglineUIAction; +import fr.ird.observe.application.swing.ui.actions.shared.MoveTripSeineUIAction; import fr.ird.observe.application.swing.ui.content.ContentUI; import fr.ird.observe.application.swing.ui.content.open.ContentOpenableUI; -import fr.ird.observe.application.swing.ui.tree.menu.MoveActivityLonglineNodeMenuPopulator; -import fr.ird.observe.application.swing.ui.tree.menu.MoveActivitySeineNodeMenuPopulator; -import fr.ird.observe.application.swing.ui.tree.menu.MoveNodeMenuPopulator; -import fr.ird.observe.application.swing.ui.tree.menu.MoveRouteNodeMenuPopulator; -import fr.ird.observe.application.swing.ui.tree.menu.MoveTripNodeMenuPopulator; import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import jaxx.runtime.SwingUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -49,16 +48,8 @@ import javax.swing.JTree; import javax.swing.MenuElement; import javax.swing.SwingUtilities; import javax.swing.tree.TreePath; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.List; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Created on 1/8/15. @@ -76,15 +67,6 @@ public class ObserveNavigationTreeShowPopupAction { private static final String ACTIVITY_SEINE_MENU_ITEMS = "activitySeine"; private static final String ACTIVITY_LONGLINE_MENU_ITEMS = "activityLongline"; - static { - n("observe.navigationMenu.move.trip"); - n("observe.navigationMenu.move.route"); - n("observe.navigationMenu.move.activitySeine"); - n("observe.navigationMenu.move.activityLongline"); - } - - private final ObserveTreeHelper treeHelper; - private final JPopupMenu popup; private final JTree tree; @@ -95,11 +77,8 @@ public class ObserveNavigationTreeShowPopupAction { private final JMenuItem moveAction; private final JMenuItem deleteAction; - private final ImmutableMap<String, MoveNodeMenuPopulator> moveNodeDataByNodeType; - public ObserveNavigationTreeShowPopupAction(ObserveTreeHelper treeHelper, JScrollPane pane, JPopupMenu popup) { - this.treeHelper = treeHelper; this.popup = popup; this.tree = treeHelper.getUI(); @@ -135,11 +114,6 @@ public class ObserveNavigationTreeShowPopupAction { this.moveAction = moveComponent; this.deleteAction = deleteActionComponent; - moveNodeDataByNodeType = ImmutableMap.of(TRIP_MENU_ITEMS, new MoveTripNodeMenuPopulator(), - ROUTE_MENU_ITEMS, new MoveRouteNodeMenuPopulator(), - ACTIVITY_SEINE_MENU_ITEMS, new MoveActivitySeineNodeMenuPopulator(), - ACTIVITY_LONGLINE_MENU_ITEMS, new MoveActivityLonglineNodeMenuPopulator()); - KeyAdapter keyAdapter = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -163,7 +137,7 @@ public class ObserveNavigationTreeShowPopupAction { pane.addMouseListener(mouseAdapter); } - protected void autoSelectNodeInTree(MouseEvent e) { + private void autoSelectNodeInTree(MouseEvent e) { boolean rightClick = SwingUtilities.isRightMouseButton(e); @@ -204,7 +178,7 @@ public class ObserveNavigationTreeShowPopupAction { } } - public void openNodeMenu(KeyEvent e) { + private void openNodeMenu(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU && !tree.isSelectionEmpty()) { @@ -226,7 +200,7 @@ public class ObserveNavigationTreeShowPopupAction { } } - protected void showPopup(int row, Point p) { + private void showPopup(int row, Point p) { if (log.isInfoEnabled()) { log.info("Will show popup from row: " + row); @@ -244,7 +218,7 @@ public class ObserveNavigationTreeShowPopupAction { } - protected void beforeOpenPopup(ObserveNode selectedNode) { + private void beforeOpenPopup(ObserveNode selectedNode) { // clean popup popup.removeAll(); @@ -295,64 +269,47 @@ public class ObserveNavigationTreeShowPopupAction { } } - protected void beforeOpenMenu(ObserveNode selectedNode, String nodeType) { + private void beforeOpenMenu(ObserveNode selectedNode, String nodeType) { if (log.isInfoEnabled()) { log.info("Will load popup for " + nodeType + " node."); } - MoveNodeMenuPopulator moveNodeData = moveNodeDataByNodeType.get(nodeType); - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + ContentUI<?> selectedContentUI = applicationContext.getContentUIManager().getSelectedContentUI(); if (selectedNode.isOpen()) { - closeAction.putClientProperty("ui", applicationContext.getContentUIManager().getSelectedContentUI()); + closeAction.putClientProperty("ui", selectedContentUI); popup.add(closeAction); } else { - openAction.putClientProperty("ui", applicationContext.getContentUIManager().getSelectedContentUI()); + openAction.putClientProperty("ui", selectedContentUI); popup.add(openAction); } - moveAction.setText(t("observe.navigationMenu.move." + nodeType)); - moveAction.setToolTipText(t("observe.navigationMenu.move." + nodeType)); - moveAction.setIcon(SwingUtil.getUIManagerActionIcon("move-" + nodeType)); - popup.add(moveAction); - - moveAction.removeAll(); - - // get the available program for the trip - - String id = selectedNode.getId(); - - ObserveSwingDataSource dataSource = treeHelper.getDataProvider().getDataSource(); - - List<DecoratedNodeEntity> possibleParentNodes = moveNodeData.getPossibleParentNodes(selectedNode, treeHelper); - - for (DecoratedNodeEntity possibleParent : possibleParentNodes) { - - String possibleParentId = possibleParent.getId(); - JMenuItem item = new JMenuItem(possibleParent.toString()); - item.setName(possibleParentId); - - - item.addActionListener(moveNodeData.createChangeActionListener(treeHelper, - dataSource, - id, - possibleParentId)); - - moveAction.add(item); + if (selectedNode.isTripSeineNode()) { + moveAction.setAction(new MoveTripSeineUIAction(applicationContext.getMainUI())); + } else if (selectedNode.isTripLonglineNode()) { + moveAction.setAction(new MoveTripLonglineUIAction(applicationContext.getMainUI())); + } else if (selectedNode.isRouteNode()) { + moveAction.setAction(new MoveRouteUIAction(applicationContext.getMainUI())); + } else if (selectedNode.isActivitySeineNode()) { + moveAction.setAction(new MoveActivitySeineUIAction(applicationContext.getMainUI())); + } else if (selectedNode.isActivityLonglineNode()) { + moveAction.setAction(new MoveActivityLonglineUIAction(applicationContext.getMainUI())); } - deleteAction.putClientProperty("ui", applicationContext.getContentUIManager().getSelectedContentUI()); + popup.add(moveAction); + + deleteAction.putClientProperty("ui", selectedContentUI); deleteAction.setEnabled(selectedNode.isOpen()); popup.add(deleteAction); } - protected boolean isRowSelected(int requiredRow) { + private boolean isRowSelected(int requiredRow) { boolean result = false; @@ -372,7 +329,7 @@ public class ObserveNavigationTreeShowPopupAction { } - protected int getLowestSelectedRowCount() { + private int getLowestSelectedRowCount() { Preconditions.checkState(!tree.isSelectionEmpty()); ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeActivityRouteActionListener.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeActivityRouteActionListener.java +++ /dev/null @@ -1,87 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.actions; - -/* - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - - -import fr.ird.observe.application.swing.ObserveOpenDataManager; -import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.services.dto.seine.ActivitySeineDto; -import fr.ird.observe.services.service.seine.ActivitySeineService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Created on 1/9/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 3.11 - */ -public class ChangeActivityRouteActionListener extends NodeChangeActionListener { - - /** Logger. */ - private static final Log log = LogFactory.getLog(ChangeActivityRouteActionListener.class); - - public ChangeActivityRouteActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String activityId, - String routeId) { - super(treeHelper, activityId, routeId); - } - - @Override - protected void closeNode(String activityId) { - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - - if (openDataManager.isOpenActivitySeine(activityId)) { - openDataManager.closeActivitySeine(activityId); - } - } - - @Override - protected ObserveNode getParentNode(ObserveNode node) { - return node.getParent().getParent(); - } - - @Override - protected ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId) { - ObserveNode routeNode = getTreeHelper().getChild(grandParentNode, parentNodeId); - String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivitySeineDto.class); - return getTreeHelper().getChild(routeNode, activitiesNodeId); - } - - @Override - protected int moveNodeToParent(String nodeId, String parentNodeId, String oldParentNodeId) { - int position; - - ActivitySeineService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newActivitySeineService(); - position = service.moveActivitySeineToRoute(nodeId, parentNodeId); - - return position; - } - -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeActivityTripActionListener.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeActivityTripActionListener.java +++ /dev/null @@ -1,89 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.actions; - -/* - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - - -import fr.ird.observe.application.swing.ObserveOpenDataManager; -import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.services.dto.longline.ActivityLonglineDto; -import fr.ird.observe.services.service.longline.ActivityLonglineService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Created on 1/9/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 3.11 - */ -public class ChangeActivityTripActionListener extends NodeChangeActionListener { - - /** Logger. */ - private static final Log log = LogFactory.getLog(ChangeActivityTripActionListener.class); - - public ChangeActivityTripActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String activityId, - String tripLonglineId) { - super(treeHelper, activityId, tripLonglineId); - } - - @Override - protected void closeNode(String activityId) { - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - - if (openDataManager.isOpenActivityLongline(activityId)) { - openDataManager.closeActivityLongline(activityId); - } - } - - @Override - protected ObserveNode getParentNode(ObserveNode node) { - return node.getParent().getParent(); - } - - @Override - protected ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId) { - ObserveNode tripLonglineNode = getTreeHelper().getChild(grandParentNode, parentNodeId); - String activitiesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(ActivityLonglineDto.class); - return getTreeHelper().getChild(tripLonglineNode, activitiesNodeId); - } - - @Override - protected int moveNodeToParent(String nodeId, String parentNodeId, String oldParentNodeId) { - int position; - - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - - ActivityLonglineService service = applicationContext.getMainDataSourceServicesProvider().newActivityLonglineService(); - position = service.moveActivityLonglineToTripLongline(nodeId, parentNodeId); - - return position; - } - -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeRouteTripActionListener.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeRouteTripActionListener.java +++ /dev/null @@ -1,86 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.actions; - -/* - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - - -import fr.ird.observe.application.swing.ObserveOpenDataManager; -import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.application.swing.decoration.ObserveI18nDecoratorHelper; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.services.dto.seine.RouteDto; -import fr.ird.observe.services.service.seine.RouteService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Created on 1/9/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 3.11 - */ -public class ChangeRouteTripActionListener extends NodeChangeActionListener { - - /** Logger. */ - private static final Log log = LogFactory.getLog(ChangeRouteTripActionListener.class); - - public ChangeRouteTripActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String routeId, - String tripId) { - super(treeHelper, routeId, tripId); - } - - @Override - protected void closeNode(String routeId) { - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - - if (openDataManager.isOpenRoute(routeId)) { - openDataManager.closeRoute(routeId); - } - } - - @Override - protected ObserveNode getParentNode(ObserveNode node) { - return node.getParent().getParent(); - } - - @Override - protected ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId) { - ObserveNode tripNode = getTreeHelper().getChild(grandParentNode, parentNodeId); - String routesNodeId = ObserveI18nDecoratorHelper.getTypePluralI18nKey(RouteDto.class); - return getTreeHelper().getChild(tripNode, routesNodeId); - } - - @Override - protected int moveNodeToParent(String nodeId, String parentNodeId, String oldParentNodeId) { - int position; - - RouteService service = ObserveSwingApplicationContext.get().getMainDataSourceServicesProvider().newRouteService(); - position = service.moveRouteToTripSeine(nodeId, parentNodeId); - - return position; - } -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeTripProgramActionListener.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/ChangeTripProgramActionListener.java +++ /dev/null @@ -1,95 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.actions; - -/* - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - - -import fr.ird.observe.application.swing.ObserveOpenDataManager; -import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.services.ObserveServicesProvider; -import fr.ird.observe.services.dto.IdHelper; -import fr.ird.observe.services.service.longline.TripLonglineService; -import fr.ird.observe.services.service.seine.TripSeineService; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Created on 1/9/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 3.11 - */ -public class ChangeTripProgramActionListener extends NodeChangeActionListener { - - /** Logger. */ - private static final Log log = LogFactory.getLog(ChangeTripProgramActionListener.class); - - public ChangeTripProgramActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String tripId, - String programId) { - super(treeHelper, tripId, programId); - } - - @Override - protected void closeNode(String tripId) { - // Don't do anything : trip should stay open when being transferred - } - - @Override - protected ObserveNode getParentNode(ObserveNode node) { - return node.getParent(); - } - - @Override - protected ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId) { - return getTreeHelper().getChild(grandParentNode, parentNodeId); - } - - @Override - protected int moveNodeToParent(String nodeId, String parentNodeId, String oldParentNodeId) { - int position; - - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - ObserveServicesProvider servicesProvider = applicationContext.getMainDataSourceServicesProvider(); - if (IdHelper.isTripLonglineId(nodeId)) { - TripLonglineService service = servicesProvider.newTripLonglineService(); - position = service.moveTripLonglineToProgram(nodeId, parentNodeId); - - } else { - TripSeineService service = servicesProvider.newTripSeineService(); - position = service.moveTripSeineToProgram(nodeId, parentNodeId); - } - - // Close old program and open new program - ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - if (openDataManager.isOpen(nodeId)) { - openDataManager.closeProgram(oldParentNodeId); - openDataManager.openProgram(parentNodeId); - } - - return position; - } -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/NodeChangeActionListener.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/actions/NodeChangeActionListener.java +++ /dev/null @@ -1,102 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.actions; - -/* - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - - -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * Created on 1/9/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 3.11 - */ -public abstract class NodeChangeActionListener implements ActionListener { - - /** Logger. */ - private static final Log log = LogFactory.getLog(NodeChangeActionListener.class); - - private final String nodeId; - - private final String parentNodeId; - - private final ObserveTreeHelper treeHelper; - - public NodeChangeActionListener(ObserveTreeHelper treeHelper, - String nodeId, - String parentNodeId) { - this.nodeId = nodeId; - this.parentNodeId = parentNodeId; - this.treeHelper = treeHelper; - } - - @Override - public void actionPerformed(ActionEvent event) { - - ObserveNode node = treeHelper.getSelectedNode(); - ObserveNode oldParentNode = getParentNode(node); - ObserveNode grandParentNode = oldParentNode.getParent(); - ObserveNode newParentNode = getNewParentNode(grandParentNode, parentNodeId); - - closeNode(node.getId()); - - int position = moveNodeToParent(nodeId, parentNodeId, oldParentNode.getId()); - - treeHelper.selectNode(newParentNode); - - treeHelper.removeNode(node); - - ObserveNode newNode = treeHelper.getChild(newParentNode, nodeId); - - if (newNode == null) { - - // create it - if (log.isInfoEnabled()) { - log.info("Insert node: "); - } - treeHelper.insertNode(newParentNode, node, position); - newNode = node; - } - - treeHelper.selectNode(newNode); - - } - - protected ObserveTreeHelper getTreeHelper() { - return treeHelper; - } - - protected abstract void closeNode(String nodeId); - - protected abstract ObserveNode getParentNode(ObserveNode node); - - protected abstract ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId); - - protected abstract int moveNodeToParent(String nodeId, String parentNodeId, String oldParentNodeId); -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveActivityLonglineNodeMenuPopulator.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveActivityLonglineNodeMenuPopulator.java +++ /dev/null @@ -1,85 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.menu; - -/*- - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.services.dto.IdHelper; -import fr.ird.observe.services.dto.longline.TripLonglineDto; -import fr.ird.observe.application.swing.decoration.DecoratorService; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.node.TripLonglineNode; -import fr.ird.observe.application.swing.ui.tree.actions.ChangeActivityTripActionListener; -import fr.ird.observe.application.swing.ui.tree.actions.NodeChangeActionListener; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * @since 5.0 - */ -public class MoveActivityLonglineNodeMenuPopulator extends MoveNodeMenuPopulator { - - @Override - public NodeChangeActionListener createChangeActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String id, - String parentId) { - return new ChangeActivityTripActionListener(treeHelper, dataSource, id, parentId); - } - - @Override - public List<DecoratedNodeEntity> getPossibleParentNodes(ObserveNode activityLonglineNode, ObserveTreeHelper treeHelper) { - - // noeud de marée parent - ObserveNode parentNode = activityLonglineNode.getParent().getParent(); - - // noeud de route de la marée sans le parent actuel - List<DecoratedNodeEntity> possibleParents = new ArrayList<>(); - - // noeud du programme - ObserveNode programNode = parentNode.getParent(); - - DecoratorService decoratorService = treeHelper.getTreeCellRenderer().getDecoratorService(); - DataReferenceDecorator<TripLonglineDto> tripDecorator = decoratorService.getDataReferenceDecorator(TripLonglineDto.class); - - for (int i = 0, n = programNode.getChildCount(); i < n; i++) { - - TripLonglineNode tripNode = (TripLonglineNode) programNode.getChildAt(i); - String tripId = tripNode.getId(); - - // si le noeud de marée n'est pas le même que le parent actuel - // si le noeud est bien un noeud de marée longline - if (!parentNode.equals(tripNode) && IdHelper.isTripLonglineId(tripId)) { - - possibleParents.add(DecoratedNodeEntity.newDecoratedNodeEntity(tripNode, tripDecorator)); - - } - } - - return possibleParents; - } -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveActivitySeineNodeMenuPopulator.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveActivitySeineNodeMenuPopulator.java +++ /dev/null @@ -1,85 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.menu; - -/*- - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.services.dto.IdHelper; -import fr.ird.observe.services.dto.seine.RouteDto; -import fr.ird.observe.application.swing.decoration.DecoratorService; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.node.RouteSeineNode; -import fr.ird.observe.application.swing.ui.tree.actions.ChangeActivityRouteActionListener; -import fr.ird.observe.application.swing.ui.tree.actions.NodeChangeActionListener; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * @since 5.0 - */ -public class MoveActivitySeineNodeMenuPopulator extends MoveNodeMenuPopulator { - - @Override - public NodeChangeActionListener createChangeActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String id, - String parentId) { - return new ChangeActivityRouteActionListener(treeHelper, dataSource, id, parentId); - } - - @Override - public List<DecoratedNodeEntity> getPossibleParentNodes(ObserveNode activitySeineNode, ObserveTreeHelper treeHelper) { - - // noeud de route parent - ObserveNode parentNode = activitySeineNode.getParent().getParent(); - - // noeud de route de la marée sans le parent actuel - List<DecoratedNodeEntity> possibleParents = new ArrayList<>(); - - // noeud des routes de la marée - ObserveNode routesNode = parentNode.getParent(); - - DecoratorService decoratorService = treeHelper.getTreeCellRenderer().getDecoratorService(); - DataReferenceDecorator<RouteDto> routeDecorator = decoratorService.getDataReferenceDecorator(RouteDto.class); - - for (int i = 0, n = routesNode.getChildCount(); i < n; i++) { - - RouteSeineNode routeNode = (RouteSeineNode) routesNode.getChildAt(i); - String routeId = routeNode.getId(); - - // si le noeud de marée n'est pas le même que le parent actuel - // si le noeud est bien un noeud de marée seine - if (!parentNode.equals(routeNode) && IdHelper.isRouteId(routeId)) { - - possibleParents.add(DecoratedNodeEntity.newDecoratedNodeEntity(routeNode, routeDecorator)); - - } - } - - return possibleParents; - } -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveNodeMenuPopulator.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveNodeMenuPopulator.java +++ /dev/null @@ -1,62 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.menu; - -/*- - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.actions.NodeChangeActionListener; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; - -import java.util.List; - -/** - * Objets pour créer les items du menu déplacer dans le menu contextuel de l'arbre - * - * @author Kevin Morin (Code Lutin) - * @since 5.0 - */ -public abstract class MoveNodeMenuPopulator { - - /** - * Crée une action pour déplacer le noeud quand on sélectionne le menu du nouveau parent - * @param treeHelper - * @param dataSource - * @param id - * @param parentId - * @return - */ - public abstract NodeChangeActionListener createChangeActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String id, - String parentId); - - /** - * Récupère les parents dans lesquels on peut déplacer le noeud sélectionné - * @param node le noeud sélectionné - * @param treeHelper le treehelper - * @return une liste contenant les ids et les libellés des noeuds - */ - public abstract List<DecoratedNodeEntity> getPossibleParentNodes(ObserveNode node, ObserveTreeHelper treeHelper); - -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveRouteNodeMenuPopulator.java deleted ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/menu/MoveRouteNodeMenuPopulator.java +++ /dev/null @@ -1,85 +0,0 @@ -package fr.ird.observe.application.swing.ui.tree.menu; - -/*- - * #%L - * ObServe :: Application Swing - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; -import fr.ird.observe.services.dto.IdHelper; -import fr.ird.observe.services.dto.seine.TripSeineDto; -import fr.ird.observe.application.swing.decoration.DecoratorService; -import fr.ird.observe.application.swing.ui.tree.node.ObserveNode; -import fr.ird.observe.application.swing.ui.tree.ObserveTreeHelper; -import fr.ird.observe.application.swing.ui.tree.node.TripSeineNode; -import fr.ird.observe.application.swing.ui.tree.actions.ChangeRouteTripActionListener; -import fr.ird.observe.application.swing.ui.tree.actions.NodeChangeActionListener; -import fr.ird.observe.application.swing.ui.util.DecoratedNodeEntity; -import fr.ird.observe.application.swing.decoration.decorators.DataReferenceDecorator; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * @since 5.0 - */ -public class MoveRouteNodeMenuPopulator extends MoveNodeMenuPopulator { - - @Override - public NodeChangeActionListener createChangeActionListener(ObserveTreeHelper treeHelper, - ObserveSwingDataSource dataSource, - String id, - String parentId) { - return new ChangeRouteTripActionListener(treeHelper, dataSource, id, parentId); - } - - @Override - public List<DecoratedNodeEntity> getPossibleParentNodes(ObserveNode routeNode, ObserveTreeHelper treeHelper) { - - // noeud de marée parent - ObserveNode parentNode = routeNode.getParent().getParent(); - - // noeud de marée du programme sans le parent actuel - List<DecoratedNodeEntity> possibleParents = new ArrayList<>(); - - // noeud du programme - ObserveNode programNode = parentNode.getParent(); - - DecoratorService decoratorService = treeHelper.getTreeCellRenderer().getDecoratorService(); - DataReferenceDecorator<TripSeineDto> tripDecorator = decoratorService.getDataReferenceDecorator(TripSeineDto.class); - - for (int i = 0, n = programNode.getChildCount(); i < n; i++) { - - TripSeineNode tripNode = (TripSeineNode) programNode.getChildAt(i); - String tripId = tripNode.getId(); - - // si le noeud de marée n'est pas le même que le parent actuel - // si le noeud est bien un noeud de marée seine - if (!parentNode.equals(tripNode) && IdHelper.isTripSeineId(tripId)) { - - possibleParents.add(DecoratedNodeEntity.newDecoratedNodeEntity(tripNode, tripDecorator)); - - } - } - - return possibleParents; - } -} ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/node/ObserveNode.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/node/ObserveNode.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/tree/node/ObserveNode.java @@ -105,6 +105,14 @@ public class ObserveNode extends NavTreeNode<ObserveNode> { || TripLonglineDto.class.isAssignableFrom(internalClass)); } + public boolean isTripSeineNode() { + return isDataNode() && TripSeineDto.class.isAssignableFrom(internalClass); + } + + public boolean isTripLonglineNode() { + return isDataNode() && TripLonglineDto.class.isAssignableFrom(internalClass); + } + public boolean isRouteNode() { return isDataNode() && RouteDto.class.isAssignableFrom(internalClass); } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/1c750803709da1fd7e55717d772… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/1c750803709da1fd7e55717d772… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-5.x] Problème potentiel dans la gestion du fuseau horaire, pour l'affichage des dates…
by Tony CHEMIT 12 Jun '17

12 Jun '17
Tony CHEMIT pushed to branch develop-5.x at ultreiaio / ird-observe Commits: ecc6002a by Tony CHEMIT at 2017-06-12T11:32:09+02:00 Problème potentiel dans la gestion du fuseau horaire, pour l&#39;affichage des dates selon le calendrier grégorien (See #769) - - - - - 1 changed file: - entities/src/main/java/fr/ird/observe/ObserveTopiaConfiguration.java Changes: ===================================== entities/src/main/java/fr/ird/observe/ObserveTopiaConfiguration.java ===================================== --- a/entities/src/main/java/fr/ird/observe/ObserveTopiaConfiguration.java +++ b/entities/src/main/java/fr/ird/observe/ObserveTopiaConfiguration.java @@ -47,6 +47,7 @@ public class ObserveTopiaConfiguration extends BeanTopiaConfiguration { hibernateExtraConfiguration.put("hibernate.hikari.maximumPoolSize", "10"); hibernateExtraConfiguration.put("hibernate.hikari.autoCommit", "false"); hibernateExtraConfiguration.put("hibernate.hikari.registerMbeans", "true"); + hibernateExtraConfiguration.put("hibernate.jdbc.time_zone", "UTC"); // hibernateExtraConfiguration.put(HibernateAvailableSettings.CONNECTION_PROVIDER, "org.hibernate.c3p0.internal.C3P0ConnectionProvider"); // hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_MAX_SIZE, "500"); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/ecc6002a1f44db6082a4421d2b8… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/ecc6002a1f44db6082a4421d2b8… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Sur les opérations (synchro, ...) on ne récupère plus les informations de sécuri…
by Tony CHEMIT 11 Jun '17

11 Jun '17
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 24bd9754 by Tony CHEMIT at 2017-06-11T23:37:44+02:00 Sur les opérations (synchro, ...) on ne récupère plus les informations de sécurité de la base locale (See #781) - - - - - 1 changed file: - application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/config/ConfigModel.java Changes: ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/config/ConfigModel.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/config/ConfigModel.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/config/ConfigModel.java @@ -37,14 +37,14 @@ import fr.ird.observe.services.configuration.ObserveDataSourceInformation; import fr.ird.observe.services.service.BabModelVersionException; import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException; import fr.ird.observe.services.service.DatabaseNotFoundException; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.beans.PropertyChangeListener; import java.io.File; import java.util.EnumSet; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import static fr.ird.observe.application.swing.configuration.constants.DbMode.USE_LOCAL; import static fr.ird.observe.application.swing.configuration.constants.DbMode.USE_REMOTE; @@ -463,7 +463,7 @@ public class ConfigModel extends AdminActionModel { } } - protected void startIncomingSourceModel(AdminUI ui) { + protected void startIncomingSourceModel(AdminUI ui, final ObserveDataSourceInformation previousSourceInfo) { AdminUIModel uiModel = ui.getModel(); @@ -476,7 +476,6 @@ public class ConfigModel extends AdminActionModel { ObserveSwingDataSource previousSource = getPreviousSource(); ObserveDataSourceConfiguration previousSourceConfig = null; - ObserveDataSourceInformation previousSourceInfo = null; EnumSet<DbMode> authorizedModes = uiModel.getIncomingDataSourceMode(); EnumSet<DbMode> modes = EnumSet.noneOf(DbMode.class); @@ -508,7 +507,7 @@ public class ConfigModel extends AdminActionModel { try { previousSourceConfig = previousSource.getConfiguration().clone(); - previousSourceInfo = previousSource.getInformation(); +// previousSourceInfo = previousSource.getInformation(); } catch (CloneNotSupportedException e) { if (log.isErrorEnabled()) { log.error("con not clone previous data configuration", e); @@ -602,15 +601,17 @@ public class ConfigModel extends AdminActionModel { // avant le demarrage du wizard, on ferme toujours la source // en cours d'utilisation + ObserveDataSourceInformation previousSourceInformation = null; if (previousSource != null && previousSource.isOpen()) { + previousSourceInformation = previousSource.getInformation(); if (log.isDebugEnabled()) { log.debug("Close previous source " + previousSource.getLabel()); } doCloseSource(previousSource); } - startIncomingSourceModel(ui); + startIncomingSourceModel(ui, previousSourceInformation); startCentralSourceModel(ui); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/24bd975455e51257d7efc749b69… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/24bd975455e51257d7efc749b69… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Correction script de migration (See #577)
by Tony CHEMIT 11 Jun '17

11 Jun '17
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 48dc3db4 by Tony CHEMIT at 2017-06-11T23:19:58+02:00 Correction script de migration (See #577) - - - - - 1 changed file: - persistence/src/main/resources/db/migration/6.901/01_add_object_operation-H2.sql Changes: ===================================== persistence/src/main/resources/db/migration/6.901/01_add_object_operation-H2.sql ===================================== --- a/persistence/src/main/resources/db/migration/6.901/01_add_object_operation-H2.sql +++ b/persistence/src/main/resources/db/migration/6.901/01_add_object_operation-H2.sql @@ -64,7 +64,5 @@ UPDATE OBSERVE_COMMON.LASTUPDATEDATE SET LASTUPDATEDATE = CURRENT_TIMESTAMP WHE ALTER TABLE observe_seine.floatingObject ALTER COLUMN objectOperation2 RENAME TO objectOperation; -ALTER TABLE observe_seine.floatingObject RENAME objectOperation2 TO objectOperation; - ALTER TABLE observe_seine.floatingObject ADD CONSTRAINT fk_floatingobject_objectOperation FOREIGN KEY (objectOperation) REFERENCES observe_seine.objectOperation(topiaid); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/48dc3db45192227569115a47fe4… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/48dc3db45192227569115a47fe4… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe] Pushed new branch feature/i18n
by Tony CHEMIT 11 Jun '17

11 Jun '17
Tony CHEMIT pushed new branch feature/i18n at ultreiaio / ird-observe --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/tree/feature/i18n You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-5.x] problème caractères accentués, encodage changé ? (See #729)
by Tony CHEMIT 11 Jun '17

11 Jun '17
Tony CHEMIT pushed to branch develop-5.x at ultreiaio / ird-observe Commits: 42fcc279 by Tony CHEMIT at 2017-06-11T22:27:12+02:00 problème caractères accentués, encodage changé ? (See #729) - - - - - 1 changed file: - topia-extension/src/main/java/org/nuiton/topia/service/sql/batch/actions/ReplicateTablesAction.java Changes: ===================================== topia-extension/src/main/java/org/nuiton/topia/service/sql/batch/actions/ReplicateTablesAction.java ===================================== --- a/topia-extension/src/main/java/org/nuiton/topia/service/sql/batch/actions/ReplicateTablesAction.java +++ b/topia-extension/src/main/java/org/nuiton/topia/service/sql/batch/actions/ReplicateTablesAction.java @@ -278,9 +278,10 @@ public class ReplicateTablesAction extends AbstractTablesAction<ReplicateTablesR if (columnValue instanceof String) { String stringValue = (String) columnValue; stringValue = "'" + stringValue.replaceAll("'", "''") + "'"; - if (h2) { - stringValue = "stringencode(" + stringValue + ")"; - } + // Nope this does not work (See # +// if (h2) { +// stringValue = "stringencode(" + stringValue + ")"; +// } statement += ", " + stringValue; continue; } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/42fcc279a71e79c5f17cf0aa053… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/42fcc279a71e79c5f17cf0aa053… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] improve migration script (use common scripts when possible)
by Tony CHEMIT 09 Jun '17

09 Jun '17
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 3ce89258 by Tony CHEMIT at 2017-06-09T17:12:49+02:00 improve migration script (use common scripts when possible) - - - - - 30 changed files: - persistence/src/main/resources/db/migration/5.0/03_add_lastUpdateDate_table-PG.sql - − persistence/src/main/resources/db/migration/5.0/04_remove_unit_field-PG.sql - persistence/src/main/resources/db/migration/5.0/04_remove_unit_field-H2.sql → persistence/src/main/resources/db/migration/5.0/04_remove_unit_field-common.sql - − persistence/src/main/resources/db/migration/5.0/05_remove_gender_field-PG.sql - persistence/src/main/resources/db/migration/5.0/05_remove_gender_field-H2.sql → persistence/src/main/resources/db/migration/5.0/05_remove_gender_field-common.sql - − persistence/src/main/resources/db/migration/5.0/07_drop_not_null_constraint_gearUseFeatures-PG.sql - persistence/src/main/resources/db/migration/5.0/07_drop_not_null_constraint_gearUseFeatures-H2.sql → persistence/src/main/resources/db/migration/5.0/07_drop_not_null_constraint_gearUseFeatures-common.sql - − persistence/src/main/resources/db/migration/5.0/08_drop_not_null_constraint_hauling_identifier-PG.sql - persistence/src/main/resources/db/migration/5.0/08_drop_not_null_constraint_hauling_identifier-H2.sql → persistence/src/main/resources/db/migration/5.0/08_drop_not_null_constraint_hauling_identifier-common.sql - − persistence/src/main/resources/db/migration/5.0/09_add_non_target_length_sex_fk-H2.sql - persistence/src/main/resources/db/migration/5.0/09_add_non_target_length_sex_fk-PG.sql → persistence/src/main/resources/db/migration/5.0/09_add_non_target_length_sex_fk-common.sql - − persistence/src/main/resources/db/migration/6.0/01_evol_8374_delete_sonarUsed-PG.sql - persistence/src/main/resources/db/migration/6.0/01_evol_8374_delete_sonarUsed-H2.sql → persistence/src/main/resources/db/migration/6.0/01_evol_8374_delete_sonarUsed-common.sql - − persistence/src/main/resources/db/migration/6.0/02_evol_7886_catch_add_set_idx-PG.sql - persistence/src/main/resources/db/migration/6.0/02_evol_7886_catch_add_set_idx-H2.sql → persistence/src/main/resources/db/migration/6.0/02_evol_7886_catch_add_set_idx-common.sql - − persistence/src/main/resources/db/migration/6.0/04_evol_6832_branchlineComposition_add_tracelineLength-PG.sql - persistence/src/main/resources/db/migration/6.0/04_evol_6832_branchlineComposition_add_tracelineLength-H2.sql → persistence/src/main/resources/db/migration/6.0/04_evol_6832_branchlineComposition_add_tracelineLength-common.sql - − persistence/src/main/resources/db/migration/6.0/05_evol_6999_nonTargetCatch_add_well-PG.sql - persistence/src/main/resources/db/migration/6.0/05_evol_6999_nonTargetCatch_add_well-H2.sql → persistence/src/main/resources/db/migration/6.0/05_evol_6999_nonTargetCatch_add_well-common.sql - − persistence/src/main/resources/db/migration/6.0/06_evol_8375_setSeine_add_booleans-PG.sql - persistence/src/main/resources/db/migration/6.0/06_evol_8375_setSeine_add_booleans-H2.sql → persistence/src/main/resources/db/migration/6.0/06_evol_8375_setSeine_add_booleans-common.sql - persistence/src/main/resources/db/migration/6.0/08_evol_8390_measure_type-PG.sql - − persistence/src/main/resources/db/migration/6.0/09_evol_7877_targetLength_add_sex-PG.sql - persistence/src/main/resources/db/migration/6.0/09_evol_7877_targetLength_add_sex-H2.sql → persistence/src/main/resources/db/migration/6.0/09_evol_7877_targetLength_add_sex-common.sql - − persistence/src/main/resources/db/migration/6.0/10_evol_8391_species_add_sizeMeasureType-PG.sql - persistence/src/main/resources/db/migration/6.0/10_evol_8391_species_add_sizeMeasureType-H2.sql → persistence/src/main/resources/db/migration/6.0/10_evol_8391_species_add_sizeMeasureType-common.sql - − persistence/src/main/resources/db/migration/6.0/11_evol_8571_length_add_tagNumber-PG.sql - persistence/src/main/resources/db/migration/6.0/11_evol_8571_length_add_tagNumber-H2.sql → persistence/src/main/resources/db/migration/6.0/11_evol_8571_length_add_tagNumber-common.sql - − persistence/src/main/resources/db/migration/6.0/12_evol_8475_vessel_add_fields-PG.sql - persistence/src/main/resources/db/migration/6.0/12_evol_8475_vessel_add_fields-H2.sql → persistence/src/main/resources/db/migration/6.0/12_evol_8475_vessel_add_fields-common.sql The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/3ce892585591077e79220cb2f10… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/3ce892585591077e79220cb2f10… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 2 commits: fix merge from develop-7.x
by Tony CHEMIT 09 Jun '17

09 Jun '17
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 4efa256e by Tony CHEMIT at 2017-06-09T16:58:55+02:00 fix merge from develop-7.x - - - - - 27ddfc10 by Tony CHEMIT at 2017-06-09T17:00:13+02:00 Synchro avancée référentiel/marées, écran inutile (See #773) - - - - - 2 changed files: - application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties - application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java Changes: ===================================== application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties ===================================== --- a/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties +++ b/application-swing-decoration/src/main/resources/i18n/application-swing-decoration_es_ES.properties @@ -151,6 +151,8 @@ observe.type.nonTargetSamples=Muestreos de fauna accesoria observe.type.objectFate=Futuro del objeto observe.type.objectFates=Futuros del objeto observe.type.objectMaterial=Objet flottant Matériel \#TODO +observe.type.objectMaterialHierarchies=Hiérarchies de matériel d'objet flottant \#TODO +observe.type.objectMaterialHierarchy=Hiérarchie de matériel d'objet flottant \#TODO observe.type.objectMaterials=Objet flottant matériaux \#TODO observe.type.objectObservedSpecies=Fauna observada observe.type.objectOperation=Operación sobre el objeto ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIHandler.java @@ -28,22 +28,28 @@ import fr.ird.observe.application.swing.ui.ObserveKeyStrokes; import fr.ird.observe.application.swing.ui.UIHelper; import fr.ird.observe.application.swing.ui.admin.config.ConfigUI; import fr.ird.observe.application.swing.ui.admin.config.SelectDataUI; +import fr.ird.observe.application.swing.ui.admin.consolidate.ConsolidateUI; +import fr.ird.observe.application.swing.ui.admin.export.ExportUI; import fr.ird.observe.application.swing.ui.admin.resume.ShowResumeUI; import fr.ird.observe.application.swing.ui.admin.save.SaveLocalUI; +import fr.ird.observe.application.swing.ui.admin.synchronize.data.DataSynchroUI; +import fr.ird.observe.application.swing.ui.admin.synchronize.referential.legacy.SynchronizeUI; +import fr.ird.observe.application.swing.ui.admin.synchronize.referential.ng.ReferentialSynchroUI; +import fr.ird.observe.application.swing.ui.admin.validate.ValidateUI; +import java.awt.Component; +import java.util.Arrays; +import java.util.Date; +import javax.swing.Icon; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.border.TitledBorder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.wizard.WizardUILancher; import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardExtUtil; import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import javax.swing.Icon; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.border.TitledBorder; -import java.awt.Component; -import java.util.Arrays; -import java.util.Date; import static org.nuiton.i18n.I18n.t; @@ -225,11 +231,74 @@ public class AdminUIHandler implements UIHandler<AdminUI> { } + if (oldStep != null && oldStep.ordinal() < AdminStep.REFERENTIAL_SYNCHRONIZE.ordinal() && newStep == AdminStep.REFERENTIAL_SYNCHRONIZE) { + + if (ui.getModel().getStepState(AdminStep.REFERENTIAL_SYNCHRONIZE) == WizardState.PENDING) { + ReferentialSynchroUI tabUI = (ReferentialSynchroUI) ui.getStepUI(AdminStep.REFERENTIAL_SYNCHRONIZE); + tabUI.getStartAction().doClick(); + } + + } + + if (oldStep != null && oldStep.ordinal() < AdminStep.DATA_SYNCHRONIZE.ordinal() && newStep == AdminStep.DATA_SYNCHRONIZE) { + + if (ui.getModel().getStepState(AdminStep.DATA_SYNCHRONIZE) == WizardState.PENDING) { + DataSynchroUI tabUI = (DataSynchroUI) ui.getStepUI(AdminStep.DATA_SYNCHRONIZE); + tabUI.getStartAction().doClick(); + } + + } + + if (oldStep != null && oldStep.ordinal() < AdminStep.CONSOLIDATE.ordinal() && newStep == AdminStep.CONSOLIDATE) { + + if (ui.getModel().getStepState(AdminStep.CONSOLIDATE) == WizardState.PENDING) { + ConsolidateUI tabUI = (ConsolidateUI) ui.getStepUI(AdminStep.CONSOLIDATE); + tabUI.getStartButton().doClick(); + } + + } + + if (oldStep != null && oldStep.ordinal() < AdminStep.SYNCHRONIZE.ordinal() && newStep == AdminStep.SYNCHRONIZE) { + + if (ui.getModel().getStepState(AdminStep.SYNCHRONIZE) == WizardState.PENDING) { + SynchronizeUI tabUI = (SynchronizeUI) ui.getStepUI(AdminStep.SYNCHRONIZE); + tabUI.getStartAction().doClick(); + } + + } + + if (oldStep != null && oldStep.ordinal() < AdminStep.VALIDATE.ordinal() && newStep == AdminStep.VALIDATE) { + + if (ui.getModel().getStepState(AdminStep.VALIDATE) == WizardState.PENDING) { + ValidateUI tabUI = (ValidateUI) ui.getStepUI(AdminStep.VALIDATE); + tabUI.getStartButton().doClick(); + } + + } + + if (oldStep != null && oldStep.ordinal() < AdminStep.SAVE_LOCAL.ordinal() && newStep == AdminStep.SAVE_LOCAL) { + + if (ui.getModel().getStepState(AdminStep.SAVE_LOCAL) == WizardState.PENDING) { + SaveLocalUI tabUI = (SaveLocalUI) ui.getStepUI(AdminStep.SAVE_LOCAL); + tabUI.getStartAction().doClick(); + } + + } + + if (oldStep != null && oldStep.ordinal() < AdminStep.EXPORT_DATA.ordinal() && newStep == AdminStep.EXPORT_DATA) { + + if (ui.getModel().getStepState(AdminStep.EXPORT_DATA) == WizardState.PENDING) { + ExportUI tabUI = (ExportUI) ui.getStepUI(AdminStep.EXPORT_DATA); + tabUI.getPrepareAction().doClick(); + } + + } + if (c != null && c.getStep() == AdminStep.SAVE_LOCAL) { // on met a jour le descriptif - SaveLocalUI saveUI = (SaveLocalUI) ui.getStepUI(AdminStep.SAVE_LOCAL); - saveUI.getHandler().updateText(); + SaveLocalUI tabUI = (SaveLocalUI) ui.getStepUI(AdminStep.SAVE_LOCAL); + tabUI.getHandler().updateText(); } if (c != null && c.getStep() == AdminStep.SHOW_RESUME) { @@ -259,7 +328,7 @@ public class AdminUIHandler implements UIHandler<AdminUI> { /** * Call back lorsque l'état du modèle a changé. - * + * <p> * Ici, on va rendre accessible (ou pas) les onglets selon l'état du modèle. * * @param newState le nouvel état. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/04e1611642041865902d1fa1c4… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/04e1611642041865902d1fa1c4… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe] Deleted branch master-7.x
by Tony CHEMIT 09 Jun '17

09 Jun '17
Tony CHEMIT deleted branch master-7.x at ultreiaio / ird-observe --- You're receiving this email because of your account on gitlab.com.
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.