branch feature/7622 created (now 84e8818)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git at 84e8818 ajout de l'icone (refs #7622) This branch includes the following new commits: new 5eefa47 ajout des menus pour les routes (refs #7622) new a3b7a04 actions de déplcement des routes et marées (refs #7622) new dfc2880 ajout d'une méthode pour savoir si un noeud est un noeud de route (refs #7622) new c622f51 ajout des nouveaux menus sur les noeuds de route (refs #7622) new c5a6d71 i18n (refs #7622) new d5ae5d9 ajout des méthodes pour déplacer une route (refs #7622) new 84e8818 ajout de l'icone (refs #7622) The 7 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 84e8818322bb7621d28ebb28ceb0dffcb177ce9b Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:50:19 2015 +0100 ajout de l'icone (refs #7622) commit d5ae5d99a408202000a752c543a88fffac324a99 Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:39:20 2015 +0100 ajout des méthodes pour déplacer une route (refs #7622) commit c5a6d718e604965368b95179355d13b46a2c636e Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:39:16 2015 +0100 i18n (refs #7622) commit c622f514b8db26962a99a4e16a8a01c2d0bdb451 Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:36:05 2015 +0100 ajout des nouveaux menus sur les noeuds de route (refs #7622) commit dfc28806db4d7f3eb0ebf731b050ebaa9cac4a0a Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:35:13 2015 +0100 ajout d'une méthode pour savoir si un noeud est un noeud de route (refs #7622) commit a3b7a04b8edc588b784dc2a4621a79aed0693e0e Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:34:41 2015 +0100 actions de déplcement des routes et marées (refs #7622) commit 5eefa4766140764f3fbe6d263720384407da3172 Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:33:53 2015 +0100 ajout des menus pour les routes (refs #7622) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit 5eefa4766140764f3fbe6d263720384407da3172 Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:33:53 2015 +0100 ajout des menus pour les routes (refs #7622) --- .../main/java/fr/ird/observe/ui/ObserveMainUI.css | 42 ++++++++++++++++++---- .../main/java/fr/ird/observe/ui/ObserveMainUI.jaxx | 6 ++++ .../observe-application-swing_en_GB.properties | 4 +++ .../observe-application-swing_es_ES.properties | 4 +++ .../observe-application-swing_fr_FR.properties | 4 +++ 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css index 82ba5bc..1ce09bd 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css @@ -41,18 +41,20 @@ JSplitPane { enabled: {!isBusy()}; } -#navigationMoveTripAction { - text: "observe.navigationMenu.moveTrip"; - toolTipText: "observe.navigationMenu.moveTrip"; - actionIcon: "move-trips"; -} - #navigationNoAction { text: "observe.navigationMenu.noAction"; toolTipText: "observe.navigationMenu.noAction"; enabled: false; } +// trip menu + +#navigationMoveTripAction { + text: "observe.navigationMenu.moveTrip"; + toolTipText: "observe.navigationMenu.moveTrip"; + actionIcon: "move-trips"; +} + #navigationOpenTripAction { text: "observe.navigationMenu.openTripAction"; toolTipText: "observe.navigationMenu.openTripAction"; @@ -73,6 +75,34 @@ JSplitPane { action: {new fr.ird.observe.ui.actions.shared.DeleteDataUIAction(this)}; } +// route menu + +#navigationMoveRouteAction { + text: "observe.navigationMenu.moveRoute"; + toolTipText: "observe.navigationMenu.moveRoute"; + //actionIcon: "move-routes"; +} + +#navigationOpenRouteAction { + text: "observe.navigationMenu.openRouteAction"; + toolTipText: "observe.navigationMenu.openRouteAction"; + enabled: {!dataContext.isOpenRoute()}; + action: {new fr.ird.observe.ui.actions.shared.ReOpenUIAction(this)}; +} + +#navigationCloseRouteAction { + text: "observe.navigationMenu.closeRouteAction"; + toolTipText: "observe.navigationMenu.closeRouteAction"; + enabled: {!dataContext.isOpenActivity()}; + action: {new fr.ird.observe.ui.actions.shared.CloseOpenUIAction(this)}; +} + +#navigationDeleteRouteAction { + text: "observe.navigationMenu.deleteRouteAction"; + toolTipText: "observe.navigationMenu.deleteRouteAction"; + action: {new fr.ird.observe.ui.actions.shared.DeleteDataUIAction(this)}; +} + #menuFile { text: "observe.menu.file"; mnemonic: F; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx index 2c446ef..480b1e3 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx @@ -84,10 +84,16 @@ <JPopupMenu id='scopeDownPopup'/> <JPopupMenu id='navigationPopup'> <JMenuItem id="navigationNoAction"/> + <!-- Trip menu --> <JMenu id="navigationMoveTripAction"/> <JMenuItem id="navigationOpenTripAction"/> <JMenuItem id="navigationCloseTripAction"/> <JMenuItem id="navigationDeleteTripAction"/> + <!-- Route menu --> + <JMenu id="navigationMoveRouteAction"/> + <JMenuItem id="navigationOpenRouteAction"/> + <JMenuItem id="navigationCloseRouteAction"/> + <JMenuItem id="navigationDeleteRouteAction"/> </JPopupMenu> <ObserveSwingApplicationConfig id='config' initializer='getContextValue(ObserveSwingApplicationConfig.class)'/> diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_en_GB.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_en_GB.properties index d97fb75..c07a3b7 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_en_GB.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_en_GB.properties @@ -1554,10 +1554,14 @@ observe.message.validation.start.referentiel= observe.message.validation.use.storage= observe.message.warning.will.be.delete= observe.model.version= +observe.navigationMenu.closeRouteAction= observe.navigationMenu.closeTripAction= +observe.navigationMenu.deleteRouteAction= observe.navigationMenu.deleteTripAction= +observe.navigationMenu.moveRoute= observe.navigationMenu.moveTrip=Change program observe.navigationMenu.noAction=< No action > +observe.navigationMenu.openRouteAction= observe.navigationMenu.openTripAction= observe.nonTargetCatch.message.table.will.delete.nonTargetSample= observe.nonTargetCatch.table.catchWeight= diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_es_ES.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_es_ES.properties index ff0694b..d17ed34 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_es_ES.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_es_ES.properties @@ -1556,10 +1556,14 @@ observe.message.validation.start.referentiel=Validación del referencial de tipo observe.message.validation.use.storage=Se realizará la validación de %1$s observe.message.warning.will.be.delete=%1$s\n\nAtención, la exportación reemplazará la marea existente. observe.model.version= +observe.navigationMenu.closeRouteAction= observe.navigationMenu.closeTripAction= +observe.navigationMenu.deleteRouteAction= observe.navigationMenu.deleteTripAction= +observe.navigationMenu.moveRoute= observe.navigationMenu.moveTrip= observe.navigationMenu.noAction= +observe.navigationMenu.openRouteAction= observe.navigationMenu.openTripAction= observe.nonTargetCatch.message.table.will.delete.nonTargetSample=¡Confirmar la eliminación de los objetos de la copia de seguridad.\!\n\n Las especies siguientes no estarán disponibles en los muestreos\:\n%1$s\nComo consecuencia se suprimiràn los muestreos siguientes \:\n%2$s observe.nonTargetCatch.table.catchWeight=Peso diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties index 0ad8cf2..15af143 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties @@ -1545,10 +1545,14 @@ observe.message.validation.start.referentiel=Validation du référentiel de type observe.message.validation.use.storage=La validation sera effectuée sur %1$s observe.message.warning.will.be.delete=%1$s\n\nAttention, l'export remplacera la marée existante. observe.model.version=Version du modèle de données +observe.navigationMenu.closeRouteAction= observe.navigationMenu.closeTripAction=Clôturer la marée +observe.navigationMenu.deleteRouteAction= observe.navigationMenu.deleteTripAction=Supprimer la marée +observe.navigationMenu.moveRoute= observe.navigationMenu.moveTrip=Réallocation du programme observe.navigationMenu.noAction=< Aucune action définie > +observe.navigationMenu.openRouteAction= observe.navigationMenu.openTripAction=Réouvrir la marée observe.nonTargetCatch.message.table.will.delete.nonTargetSample=En confirmant la sauvegarde des objets vont être supprimés\!\n\nLes espèces suivantes ne seront plus utilisables dans des échantillonages \:\n%1$s\nCela entrainera la suppression des échantillonages des ces espèces observe.nonTargetCatch.table.catchWeight=Poids -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit a3b7a04b8edc588b784dc2a4621a79aed0693e0e Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:34:41 2015 +0100 actions de déplcement des routes et marées (refs #7622) --- .../actions/ChangeRouteTripActionListener.java | 91 ++++++++++++++++ .../actions/ChangeTripProgramActionListener.java | 74 +++++-------- .../ui/tree/actions/NodeChangeActionListener.java | 115 +++++++++++++++++++++ 3 files changed, 232 insertions(+), 48 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeRouteTripActionListener.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeRouteTripActionListener.java new file mode 100644 index 0000000..23bdd99 --- /dev/null +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeRouteTripActionListener.java @@ -0,0 +1,91 @@ +package fr.ird.observe.ui.tree.actions; + +/* + * #%L + * ObServe :: Swing + * %% + * Copyright (C) 2008 - 2015 IRD, Codelutin, Tony Chemit + * %% + * 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.ObserveSwingApplicationContext; +import fr.ird.observe.db.ObserveSwingDataSource; +import fr.ird.observe.services.dto.seine.TripSeineDto; +import fr.ird.observe.services.service.seine.RouteService; +import fr.ird.observe.ui.DecoratorService; +import fr.ird.observe.ui.tree.ObserveNode; +import fr.ird.observe.ui.tree.ObserveTreeHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Created on 1/9/15. + * + * @author Tony Chemit - chemit@codelutin.com + * @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, dataSource, routeId, tripId); + } + + @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 = DecoratorService.getPropertyLabel(ObserveTreeHelper.TREE_NODE_PREFIX, + TripSeineDto.PROPERTY_ROUTE); + ObserveNode routesNode = getTreeHelper().getChild(tripNode, routesNodeId); + return routesNode; + } + + @Override + protected void closeParent(String oldParentId) { + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + applicationContext.getOpenDataManager().closeTripSeine(oldParentId); + } + + @Override + protected int moveNodeToParent(String nodeId, String parentNodeId) { + int position; + + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + + RouteService service = applicationContext.newService(RouteService.class); + position = service.moveRouteToTripSeine(nodeId, parentNodeId); + + return position; + } + + @Override + protected void openParent(String parentNodeId, String grandParentNodeId) { + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + applicationContext.getOpenDataManager().openTripSeine(grandParentNodeId, parentNodeId); + } +} diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeTripProgramActionListener.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeTripProgramActionListener.java index cdf5587..b41f3c4 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeTripProgramActionListener.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/ChangeTripProgramActionListener.java @@ -33,83 +33,61 @@ import fr.ird.observe.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 - chemit@codelutin.com * @since 3.11 */ -public class ChangeTripProgramActionListener implements ActionListener { +public class ChangeTripProgramActionListener extends NodeChangeActionListener { /** Logger. */ private static final Log log = LogFactory.getLog(ChangeTripProgramActionListener.class); - private final String tripId; - - private final String programId; - - private final ObserveTreeHelper treeHelper; - - private final ObserveSwingDataSource dataSource; - public ChangeTripProgramActionListener(ObserveTreeHelper treeHelper, ObserveSwingDataSource dataSource, String tripId, String programId) { - this.tripId = tripId; - this.programId = programId; - this.treeHelper = treeHelper; - this.dataSource = dataSource; + super(treeHelper, dataSource, tripId, programId); } @Override - public void actionPerformed(ActionEvent event) { + protected ObserveNode getParentNode(ObserveNode node) { + return node.getParent(); + } - ObserveNode tripNode = treeHelper.getSelectedNode(); - ObserveNode rootNode = treeHelper.getRootNode(); - ObserveNode newProgramNode = treeHelper.getChild(rootNode, programId); - String oldProgramId = tripNode.getParent().getId(); - ObserveNode oldProgramNode = treeHelper.getChild(rootNode, oldProgramId); + @Override + protected ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId) { + return getTreeHelper().getChild(grandParentNode, parentNodeId); + } + @Override + protected void closeParent(String oldParentId) { ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + applicationContext.getOpenDataManager().closeProgram(oldParentId); + } - applicationContext.getOpenDataManager().closeProgram(oldProgramId); - + @Override + protected int moveNodeToParent(String nodeId, String parentNodeId) { int position; - if (IdDtos.isTripLonglineId(tripId)) { + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + + if (IdDtos.isTripLonglineId(nodeId)) { TripLonglineService service = applicationContext.newService(TripLonglineService.class); - position = service.moveTripLonglineToProgram(tripId, programId); + position = service.moveTripLonglineToProgram(nodeId, parentNodeId); } else { TripSeineService service = applicationContext.newService(TripSeineService.class); - position = service.moveTripSeineToProgram(tripId, programId); + position = service.moveTripSeineToProgram(nodeId, parentNodeId); } - treeHelper.removeNode(tripNode); - - ObserveNode newTripNode = treeHelper.getChild(newProgramNode, tripId); - - if (newTripNode == null) { - - // create it - if (log.isInfoEnabled()) { - log.info("Insert trip node: "); - } - treeHelper.insertNode(newProgramNode, tripNode, position); - newTripNode = tripNode; - } - - applicationContext.getOpenDataManager().openProgram(programId); - - treeHelper.reloadNode(oldProgramNode, true); - treeHelper.reloadNode(newProgramNode, true); -// treeHelper.refreshNode(oldProgramNode, true); -// treeHelper.refreshNode(newProgramNode, true); - treeHelper.selectNode(newTripNode); + return position; + } + @Override + protected void openParent(String parentNodeId, String grandParentNodeId) { + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + applicationContext.getOpenDataManager().openProgram(parentNodeId); } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/NodeChangeActionListener.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/NodeChangeActionListener.java new file mode 100644 index 0000000..ad4320f --- /dev/null +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/actions/NodeChangeActionListener.java @@ -0,0 +1,115 @@ +package fr.ird.observe.ui.tree.actions; + +/* + * #%L + * ObServe :: Swing + * %% + * Copyright (C) 2008 - 2015 IRD, Codelutin, Tony Chemit + * %% + * 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.db.ObserveSwingDataSource; +import fr.ird.observe.ui.tree.ObserveNode; +import fr.ird.observe.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 - chemit@codelutin.com + * @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; + + private final ObserveSwingDataSource dataSource; + + public NodeChangeActionListener(ObserveTreeHelper treeHelper, + ObserveSwingDataSource dataSource, + String nodeId, + String parentNodeId) { + this.nodeId = nodeId; + this.parentNodeId = parentNodeId; + this.treeHelper = treeHelper; + this.dataSource = dataSource; + } + + @Override + public void actionPerformed(ActionEvent event) { + + ObserveNode node = treeHelper.getSelectedNode(); + ObserveNode oldParentNode = getParentNode(node); + String oldParentId = oldParentNode.getId(); + ObserveNode grandParentNode = oldParentNode.getParent(); + String grandParentNodeId = grandParentNode.getId(); + ObserveNode newParentNode = getNewParentNode(grandParentNode, parentNodeId); + + closeParent(oldParentId); + + int position = moveNodeToParent(nodeId, parentNodeId); + + 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; + } + + openParent(parentNodeId, grandParentNodeId); + + treeHelper.reloadNode(grandParentNode, true); +// treeHelper.reloadNode(newParentNode, true); +// treeHelper.refreshNode(oldParentNode, true); +// treeHelper.refreshNode(newParentNode, true); + treeHelper.selectNode(newNode); + + } + + public ObserveTreeHelper getTreeHelper() { + return treeHelper; + } + + protected abstract ObserveNode getParentNode(ObserveNode node); + + protected abstract ObserveNode getNewParentNode(ObserveNode grandParentNode, String parentNodeId); + + protected abstract void closeParent(String oldParentId); + + protected abstract int moveNodeToParent(String nodeId, String parentNodeId); + + protected abstract void openParent(String parentNodeId, String grandParentNodeId); +} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit dfc28806db4d7f3eb0ebf731b050ebaa9cac4a0a Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:35:13 2015 +0100 ajout d'une méthode pour savoir si un noeud est un noeud de route (refs #7622) --- .../src/main/java/fr/ird/observe/ui/tree/ObserveNode.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNode.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNode.java index 990fdee..5bb8f23 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNode.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNode.java @@ -23,6 +23,7 @@ package fr.ird.observe.ui.tree; import fr.ird.observe.services.dto.OpenableDto; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.TripSeineDto; import jaxx.runtime.swing.nav.tree.NavTreeNode; import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; @@ -102,4 +103,9 @@ public class ObserveNode extends NavTreeNode<ObserveNode> { || TripLonglineDto.class.isAssignableFrom(internalClass)); } + public boolean isRouteNode() { + return isDataNode() && + (RouteDto.class.isAssignableFrom(internalClass)); + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit c622f514b8db26962a99a4e16a8a01c2d0bdb451 Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:36:05 2015 +0100 ajout des nouveaux menus sur les noeuds de route (refs #7622) --- .../tree/ObserveNavigationTreeShowPopupAction.java | 263 ++++++++++++++++----- 1 file changed, 210 insertions(+), 53 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNavigationTreeShowPopupAction.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNavigationTreeShowPopupAction.java index c4eb58c..04c80a3 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNavigationTreeShowPopupAction.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveNavigationTreeShowPopupAction.java @@ -22,7 +22,9 @@ package fr.ird.observe.ui.tree; * #L% */ +import com.google.common.base.Function; import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.db.ObserveSwingDataSource; @@ -31,11 +33,17 @@ import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.constants.GearType; import fr.ird.observe.services.dto.referential.ProgramDto; import fr.ird.observe.services.dto.referential.ProgramDtos; +import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.service.ReferentialService; +import fr.ird.observe.services.service.seine.TripSeineService; +import fr.ird.observe.ui.tree.actions.ChangeRouteTripActionListener; import fr.ird.observe.ui.tree.actions.ChangeTripProgramActionListener; +import fr.ird.observe.ui.tree.actions.NodeChangeActionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; +import org.nuiton.decorator.DecoratorUtil; +import org.nuiton.decorator.JXPathDecorator; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; @@ -50,6 +58,7 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.lang.reflect.Constructor; import java.util.LinkedHashSet; import java.util.List; @@ -64,6 +73,9 @@ public class ObserveNavigationTreeShowPopupAction { /** Logger. */ private static final Log log = LogFactory.getLog(ObserveNavigationTreeShowPopupAction.class); + private static final String TRIP_MENU_ITEMS = "trip"; + private static final String ROUTE_MENU_ITEMS = "route"; + private final ObserveTreeHelper treeHelper; private final JScrollPane pane; @@ -72,13 +84,9 @@ public class ObserveNavigationTreeShowPopupAction { private final JTree tree; - private final JMenuItem moveTripPopup; - private final JMenuItem noAction; - private final JMenuItem openTripAction; - private final JMenuItem closeTripAction; - private final JMenuItem deleteTripAction; + private final ImmutableMap<String, NavigationPopupMenuItems> menuItemsByNodeType; public ObserveNavigationTreeShowPopupAction(ObserveTreeHelper treeHelper, JScrollPane pane, JPopupMenu popup) { @@ -87,20 +95,27 @@ public class ObserveNavigationTreeShowPopupAction { this.popup = popup; this.tree = treeHelper.getUI(); - JMenuItem moveTripComponent = null; JMenuItem noActionComponent = null; + // trip menus + JMenuItem moveTripComponent = null; JMenuItem openTripActionComponent = null; JMenuItem closeTripActionComponent = null; JMenuItem deleteTripActionComponent = null; + //route menus + JMenuItem moveRouteComponent = null; + JMenuItem openRouteActionComponent = null; + JMenuItem closeRouteActionComponent = null; + JMenuItem deleteRouteActionComponent = null; for (MenuElement menuElement : popup.getSubElements()) { - if (menuElement.getComponent().getName().equals("navigationMoveTripAction")) { - moveTripComponent = (JMenuItem) menuElement.getComponent(); - } if (menuElement.getComponent().getName().equals("navigationNoAction")) { noActionComponent = (JMenuItem) menuElement.getComponent(); } + // trip menus + if (menuElement.getComponent().getName().equals("navigationMoveTripAction")) { + moveTripComponent = (JMenuItem) menuElement.getComponent(); + } if (menuElement.getComponent().getName().equals("navigationOpenTripAction")) { openTripActionComponent = (JMenuItem) menuElement.getComponent(); } @@ -110,13 +125,69 @@ public class ObserveNavigationTreeShowPopupAction { if (menuElement.getComponent().getName().equals("navigationDeleteTripAction")) { deleteTripActionComponent = (JMenuItem) menuElement.getComponent(); } + // route menus + if (menuElement.getComponent().getName().equals("navigationMoveRouteAction")) { + moveRouteComponent = (JMenuItem) menuElement.getComponent(); + } + if (menuElement.getComponent().getName().equals("navigationOpenRouteAction")) { + openRouteActionComponent = (JMenuItem) menuElement.getComponent(); + } + if (menuElement.getComponent().getName().equals("navigationCloseRouteAction")) { + closeRouteActionComponent = (JMenuItem) menuElement.getComponent(); + } + if (menuElement.getComponent().getName().equals("navigationDeleteRouteAction")) { + deleteRouteActionComponent = (JMenuItem) menuElement.getComponent(); + } } - this.moveTripPopup = moveTripComponent; this.noAction = noActionComponent; - this.openTripAction = openTripActionComponent; - this.closeTripAction = closeTripActionComponent; - this.deleteTripAction = deleteTripActionComponent; + + Function<String, List<ReferenceDto>> getProgramsFunction = new Function<String, List<ReferenceDto>>() { + + @Override + public List<ReferenceDto> apply(String nodeId) { + GearType gearType = IdDtos.isLonglineId(nodeId) ? GearType.longline : GearType.seine; + + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + + LinkedHashSet<ReferenceDto> allPrograms = applicationContext.newService(ReferentialService.class) + .getReferentialReferenceSet(ProgramDto.class) + .getReference(); + + return Lists.newArrayList(ProgramDtos.filterReferencesByGearType(allPrograms, gearType)); + } + }; + NavigationPopupMenuItems tripItems = new NavigationPopupMenuItems(openTripActionComponent, + closeTripActionComponent, + moveTripComponent, + deleteTripActionComponent, + ProgramDto.class, + ChangeTripProgramActionListener.class, + getProgramsFunction); + + Function<String, List<ReferenceDto>> getTripSeinesFunction = new Function<String, List<ReferenceDto>>() { + + @Override + public List<ReferenceDto> apply(String nodeId) { + + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + + LinkedHashSet<ReferenceDto> allTripSeine = applicationContext.newService(TripSeineService.class) + .getAllTripSeine() + .getReference(); + + return Lists.newArrayList(allTripSeine); + } + }; + NavigationPopupMenuItems routeItems = new NavigationPopupMenuItems(openRouteActionComponent, + closeRouteActionComponent, + moveRouteComponent, + deleteRouteActionComponent, + TripSeineDto.class, + ChangeRouteTripActionListener.class, + getTripSeinesFunction); + + menuItemsByNodeType = ImmutableMap.of(TRIP_MENU_ITEMS, tripItems, ROUTE_MENU_ITEMS, routeItems); KeyAdapter keyAdapter = new KeyAdapter() { @Override @@ -229,71 +300,102 @@ public class ObserveNavigationTreeShowPopupAction { if (selectedNode.isTripNode()) { - if (log.isInfoEnabled()) { - log.info("Will load popup for trip node."); - } + beforeOpenMenu(selectedNode, TRIP_MENU_ITEMS); + + } else if (selectedNode.isRouteNode()) { + + beforeOpenMenu(selectedNode, ROUTE_MENU_ITEMS); + + } else { - ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); + popup.add(noAction); + } + } - if (selectedNode.isOpen()) { + protected void beforeOpenMenu(ObserveNode selectedNode, String nodeType) { + if (log.isInfoEnabled()) { + log.info("Will load popup for " + nodeType + " node."); + } - closeTripAction.putClientProperty("ui", applicationContext.getSelectedContentUI()); - popup.add(closeTripAction); + NavigationPopupMenuItems items = menuItemsByNodeType.get(nodeType); + JMenuItem openAction = items.getOpenAction(); + JMenuItem closeAction = items.getCloseAction(); + JMenuItem movePopup = items.getMovePopup(); + JMenuItem deleteAction = items.getDeleteAction(); - popup.add(moveTripPopup); + ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); - moveTripPopup.removeAll(); + if (selectedNode.isOpen()) { - // get the available program for the trip + closeAction.putClientProperty("ui", applicationContext.getSelectedContentUI()); + popup.add(closeAction); - String tripId = selectedNode.getId(); - GearType gearType = IdDtos.isLonglineId(tripId) ? GearType.longline : GearType.seine; + popup.add(movePopup); - ObserveSwingDataSource dataSource = treeHelper.getDataProvider().getDataSource(); + movePopup.removeAll(); - LinkedHashSet<ReferenceDto> allPrograms = applicationContext.newService(ReferentialService.class) - .getReferentialReferenceSet(ProgramDto.class) - .getReference(); - List<ReferenceDto> programs = Lists.newArrayList(ProgramDtos.filterReferencesByGearType(allPrograms, gearType)); + // get the available program for the trip - String openProgramId = applicationContext.getDataContext().getOpenProgramId(); + String id = selectedNode.getId(); - Decorator<ReferenceDto> programDecorator = applicationContext.getDecorator(ReferenceDto.class, - ProgramDto.class.getSimpleName()); - for (ReferenceDto program : programs) { + ObserveSwingDataSource dataSource = treeHelper.getDataProvider().getDataSource(); - String programId = program.getId(); + List<ReferenceDto> parents = items.getGetParentsFunction().apply(id); - if (!programId.equals(openProgramId)) { - JMenuItem item = new JMenuItem(programDecorator.toString(program)); - item.setName(programId); - item.addActionListener(new ChangeTripProgramActionListener(treeHelper, - dataSource, - tripId, - programId)); + Class<?> parentClass = items.getParentClass(); + String[] openIds = applicationContext.getDataContext().getOpenIds(parentClass); + String openParentId = openIds[openIds.length - 1]; - moveTripPopup.add(item); + Decorator<ReferenceDto> decorator = applicationContext.getDecorator(ReferenceDto.class, + parentClass.getSimpleName()); - } + DecoratorUtil.sort((JXPathDecorator<ReferenceDto>) decorator, parents, 0); - } + for (ReferenceDto parent : parents) { - } else { + String parentId = parent.getId(); - openTripAction.putClientProperty("ui", applicationContext.getSelectedContentUI()); - popup.add(openTripAction); + if (!parentId.equals(openParentId)) { + + JMenuItem item = new JMenuItem(decorator.toString(parent)); + item.setName(parentId); + + try { + Constructor<? extends NodeChangeActionListener> actionListenerConstructor = + items.getChangeActionListenerClass().getConstructor(ObserveTreeHelper.class, + ObserveSwingDataSource.class, + String.class, + String.class); + + item.addActionListener(actionListenerConstructor.newInstance(treeHelper, + dataSource, + id, + parentId)); + + movePopup.add(item); + + } catch (ReflectiveOperationException e) { + if (log.isErrorEnabled()) { + log.error("error while creating the item listener", e); + } + } - } - deleteTripAction.putClientProperty("ui", applicationContext.getSelectedContentUI()); - deleteTripAction.setEnabled(selectedNode.isOpen()); - popup.add(deleteTripAction); + } + + } } else { - popup.add(noAction); + openAction.putClientProperty("ui", applicationContext.getSelectedContentUI()); + popup.add(openAction); + } + + deleteAction.putClientProperty("ui", applicationContext.getSelectedContentUI()); + deleteAction.setEnabled(selectedNode.isOpen()); + popup.add(deleteAction); } protected boolean isRowSelected(int requiredRow) { @@ -331,4 +433,59 @@ public class ObserveNavigationTreeShowPopupAction { } + private class NavigationPopupMenuItems { + + private final JMenuItem openAction; + private final JMenuItem closeAction; + private final JMenuItem movePopup; + private final JMenuItem deleteAction; + private final Class<?> parentClass; + private final Class<? extends NodeChangeActionListener> changeActionListenerClass; + private final Function<String, List<ReferenceDto>> getParentsFunction; + + public NavigationPopupMenuItems(JMenuItem openAction, + JMenuItem closeAction, + JMenuItem movePopup, + JMenuItem deleteAction, + Class<?> parentClass, + Class<? extends NodeChangeActionListener> changeActionListenerClass, + Function<String, List<ReferenceDto>> getParentsFunction) { + this.openAction = openAction; + this.closeAction = closeAction; + this.movePopup = movePopup; + this.deleteAction = deleteAction; + this.parentClass = parentClass; + this.changeActionListenerClass = changeActionListenerClass; + this.getParentsFunction = getParentsFunction; + } + + public JMenuItem getCloseAction() { + return closeAction; + } + + public JMenuItem getDeleteAction() { + return deleteAction; + } + + public JMenuItem getMovePopup() { + return movePopup; + } + + public JMenuItem getOpenAction() { + return openAction; + } + + public Class<?> getParentClass() { + return parentClass; + } + + public Class<? extends NodeChangeActionListener> getChangeActionListenerClass() { + return changeActionListenerClass; + } + + public Function<String, List<ReferenceDto>> getGetParentsFunction() { + return getParentsFunction; + } + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit c5a6d718e604965368b95179355d13b46a2c636e Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:39:16 2015 +0100 i18n (refs #7622) --- .../resources/i18n/observe-application-swing_fr_FR.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties index 15af143..0d8490c 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties @@ -1545,14 +1545,14 @@ observe.message.validation.start.referentiel=Validation du référentiel de type observe.message.validation.use.storage=La validation sera effectuée sur %1$s observe.message.warning.will.be.delete=%1$s\n\nAttention, l'export remplacera la marée existante. observe.model.version=Version du modèle de données -observe.navigationMenu.closeRouteAction= +observe.navigationMenu.closeRouteAction=Clôturer la route observe.navigationMenu.closeTripAction=Clôturer la marée -observe.navigationMenu.deleteRouteAction= +observe.navigationMenu.deleteRouteAction=Supprimer la route observe.navigationMenu.deleteTripAction=Supprimer la marée -observe.navigationMenu.moveRoute= +observe.navigationMenu.moveRoute=Changer de marée observe.navigationMenu.moveTrip=Réallocation du programme observe.navigationMenu.noAction=< Aucune action définie > -observe.navigationMenu.openRouteAction= +observe.navigationMenu.openRouteAction=Réouvrir la route observe.navigationMenu.openTripAction=Réouvrir la marée observe.nonTargetCatch.message.table.will.delete.nonTargetSample=En confirmant la sauvegarde des objets vont être supprimés\!\n\nLes espèces suivantes ne seront plus utilisables dans des échantillonages \:\n%1$s\nCela entrainera la suppression des échantillonages des ces espèces observe.nonTargetCatch.table.catchWeight=Poids -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit d5ae5d99a408202000a752c543a88fffac324a99 Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:39:20 2015 +0100 ajout des méthodes pour déplacer une route (refs #7622) --- .../web/controller/v1/seine/RouteServiceController.java | 4 ++++ .../java/fr/ird/observe/services/service/seine/RouteService.java | 3 +++ .../fr/ird/observe/services/service/seine/RouteServiceTopia.java | 8 ++++++++ .../ird/observe/services/service/seine/TripSeineServiceTopia.java | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java index 5a42d30..7b402f9 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java @@ -89,4 +89,8 @@ public class RouteServiceController extends ObserveAuthenticatedServiceControlle return service.delete(tripSeineId, routeId); } + @Override + public int moveRouteToTripSeine(String routeId, String tripSeineId) { + return service.moveRouteToTripSeine(routeId, tripSeineId); + } } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java index 57d5e68..2a321c0 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java @@ -73,4 +73,7 @@ public interface RouteService extends ObserveService { @DeleteRequest boolean delete(String tripSeineId, String routeId); + @Write + @WriteDataPermission + int moveRouteToTripSeine(String routeId, String tripSeineId); } diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java index aa49974..70d71a4 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java @@ -261,4 +261,12 @@ public class RouteServiceTopia extends ObserveServiceTopia implements RouteServi } + @Override + public int moveRouteToTripSeine(String routeId, String tripSeineId) { + Route route = loadEntity(RouteDto.class, Route.class, routeId); + TripSeine tripSeine = loadEntity(TripSeineDto.class, TripSeine.class, tripSeineId); + tripSeine.addRoute(route); + saveEntity(TripSeine.class, tripSeine); + return getRoutePositionInTripSeine(tripSeineId, routeId); + } } diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java index 607b7d5..29624ed 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java @@ -215,6 +215,10 @@ public class TripSeineServiceTopia extends ObserveServiceTopia implements TripSe Program program = loadEntity(ProgramDto.class, Program.class, programId); tripSeine.setProgram(program); saveEntity(TripSeine.class, tripSeine); + + ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext(); + persistenceContext.flush(); + return getTripSeinePositionInProgram(programId, tripSeineId); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7622 in repository observe. See http://git.codelutin.com/observe.git commit 84e8818322bb7621d28ebb28ceb0dffcb177ce9b Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 16:50:19 2015 +0100 ajout de l'icone (refs #7622) --- .../src/main/java/fr/ird/observe/ui/ObserveMainUI.css | 2 +- .../src/main/resources/icons/action-move-routes.png | Bin 0 -> 953 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css index 1ce09bd..f91e3c8 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.css @@ -80,7 +80,7 @@ JSplitPane { #navigationMoveRouteAction { text: "observe.navigationMenu.moveRoute"; toolTipText: "observe.navigationMenu.moveRoute"; - //actionIcon: "move-routes"; + actionIcon: "move-routes"; } #navigationOpenRouteAction { diff --git a/observe-application-swing/src/main/resources/icons/action-move-routes.png b/observe-application-swing/src/main/resources/icons/action-move-routes.png new file mode 100644 index 0000000..d7ee543 Binary files /dev/null and b/observe-application-swing/src/main/resources/icons/action-move-routes.png differ -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm