branch feature/7587 updated (b5758f6 -> 1dcdd98)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7587 in repository observe. See http://git.codelutin.com/observe.git discards b5758f6 calcule de la nouvelle position de la marée (refs #7587) discards 416d0f8 adpatation des la carte + petite rose de vents (refs #7587) discards ac31162 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) discards 8d75432 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) discards 6b98aaf correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) discards 7a12dcf Renommage de ObserveValidator en ObserveSwingValidator discards 1a1febd début de migration de l'ecran (refs #7587) discards ff0f341 début de migration de l'ecran (refs #7587) discards 34d8183 correction du remplissage des données referentielles des combo et listes adds 9d449cb correction du remplissage des données referentielles des combo et listes adds 35287ed correction de l'ouverture de l'écran de marée (refs #7586) adds d4e5353 affichage de l'écran d'édition de marée quand on clique sur nouvelle marée (refs #7586) adds fe0a577 chargement des triplonglines (refs #7586) adds 54f7e07 fix decorator(refs #7586) adds 65595be fix compilation adds 2e27a48 Termine #7586 Rock'n Roll! Merge branch 'feature/7586' into develop new d30781b début de migration de l'ecran (refs #7587) new 3b53dd5 début de migration de l'ecran (refs #7587) new c064c65 Renommage de ObserveValidator en ObserveSwingValidator new 5b96fb0 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) new 4aff5ad correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) new cf7321f correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) new 5877b30 adpatation des la carte + petite rose de vents (refs #7587) new 1dcdd98 calcule de la nouvelle position de la marée (refs #7587) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (b5758f6) \ N -- N -- N refs/heads/feature/7587 (1dcdd98) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 8 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 1dcdd98999735fea3540642e97b77b89a8c81970 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 16:58:55 2015 +0200 calcule de la nouvelle position de la marée (refs #7587) commit 5877b30ad3962342c7ac63d04c077ff66696349a Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 16:14:01 2015 +0200 adpatation des la carte + petite rose de vents (refs #7587) commit cf7321f225db9a07eda65c911af24af97eaeab1d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 15:29:53 2015 +0200 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) commit 4aff5ada12c0fd11df98225ff3f26991cb7a8435 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 14:30:12 2015 +0200 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) commit 5b96fb0ab86d8f010a689134e59d85875c7df468 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 14:26:13 2015 +0200 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) commit c064c6599dc2dc017083085a56e173205bfeff6d Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Oct 6 11:57:41 2015 +0200 Renommage de ObserveValidator en ObserveSwingValidator commit 3b53dd5c6ff1f7f17cc892ae622109baba72a16b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 11:24:49 2015 +0200 début de migration de l'ecran (refs #7587) commit d30781b8df6c5c6801079373b8ea6b3768f12eae Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 5 18:21:33 2015 +0200 début de migration de l'ecran (refs #7587) Summary of changes: .../observe/ObserveSwingApplicationContext.java | 10 +- .../business/db/model/DataSelectionModel.java | 345 +++++++++++---------- .../java/fr/ird/observe/ui/DecoratorService.java | 122 ++++---- .../observe/ui/content/ContentUIInitializer.java | 16 +- .../ird/observe/ui/content/ContentUIManager.java | 16 +- .../list/impl/longline/TripLonglinesUIHandler.java | 10 +- .../content/open/impl/longline/TripLonglineUI.css | 7 +- .../ui/content/open/impl/seine/TripSeineUI.css | 6 +- .../ui/storage/tabs/DataSelectionModel.java | 2 +- .../observe/ui/storage/tabs/RolesTableModel.java | 3 +- .../ui/storage/tabs/StorageTabUIHandler.java | 3 +- .../ui/tree/DataSelectionTreeSelectionModel.java | 14 +- .../loadors/ProgramLonglineNodeChildLoador.java | 22 +- .../observe-application-swing_en_GB.properties | 8 + .../observe-application-swing_es_ES.properties | 8 + .../observe-application-swing_fr_FR.properties | 16 +- .../resources/i18n/observe-swing_fr_FR.properties | 16 +- .../v1/longline/TripLonglineServiceController.java | 5 +- .../service/longline/TripLonglineService.java | 3 +- .../services/dto/referential/PersonDtos.java | 48 +++ .../services/dto/referential/ReferentialDtos.java | 40 +++ .../services/dto/ObserveDtosInitializer.java | 6 +- .../service/longline/TripLonglineServiceTopia.java | 29 +- 23 files changed, 435 insertions(+), 320 deletions(-) create mode 100644 observe-services-model/src/main/java/fr/ird/observe/services/dto/referential/PersonDtos.java -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit d30781b8df6c5c6801079373b8ea6b3768f12eae Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Oct 5 18:21:33 2015 +0200 début de migration de l'ecran (refs #7587) --- .../ird/observe/ui/content/ContentUIHandler.java | 6 +- .../observe/ui/content/ContentUIInitializer.java | 19 +++++- .../ird/observe/ui/content/ObserveContentUI.java | 3 +- .../ui/content/open/ContentOpenableUIHandler.java | 4 +- .../open/impl/seine/TripSeineUIHandler.java | 73 +++------------------- .../content/open/impl/seine/TripSeineUIModel.java | 7 --- .../java/fr/ird/observe/ui/tree/TripSeineNode.java | 2 +- 7 files changed, 32 insertions(+), 82 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java index f771ad5..8a6b083 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java @@ -244,11 +244,11 @@ public abstract class ContentUIHandler<E extends IdDto> { /** * Pour calculer la propriete {@code canWrite} du modèle. * - * @param source la base source de l'ui + * @param dataSsource la base source de l'ui * @return {@code true} si on peut écrire (donc éditer), {@code false} autrement. */ - protected abstract boolean computeCanWrite(ObserveSwingDataSource source); - + protected abstract boolean computeCanWrite(ObserveSwingDataSource dataSsource); + protected final String getSelectedParentId() { String s = null; if (parentType != null) { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java index 97ddd8a..5160d83 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java @@ -66,10 +66,25 @@ import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor; import org.nuiton.jaxx.widgets.select.FilterableDoubleList; import org.nuiton.util.DateUtil; -import javax.swing.*; +import javax.swing.AbstractButton; +import javax.swing.ActionMap; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JScrollBar; +import javax.swing.JSpinner; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.ListCellRenderer; +import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import javax.swing.table.TableCellEditor; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ObserveContentUI.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ObserveContentUI.java index 5a40d9e..9f5586e 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ObserveContentUI.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ObserveContentUI.java @@ -30,7 +30,8 @@ import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.BlockingLayerUI; import jaxx.runtime.validator.swing.SwingValidatorMessageTableModel; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JToolBar; /** * Created on 10/5/14. diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java index 2208490..20ba59c 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java @@ -82,8 +82,6 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU protected abstract boolean doOpenData(); - public abstract boolean doCloseData(); - public final void openDataUI() { boolean ok = false; try { @@ -135,6 +133,8 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU } } + public abstract boolean doCloseData(); + public final void afterCloseData() { ContentOpenableUI<E> ui = getUi(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index a0d0536..c567581 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -26,10 +26,6 @@ import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.services.dto.FormDto; -import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.constants.DataContextType; -import fr.ird.observe.configuration.ObserveSwingApplicationConfig; -import fr.ird.observe.db.ObserveSwingDataSource; import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.dto.seine.TripSeineDtos; import fr.ird.observe.services.service.seine.TripSeineService; @@ -41,7 +37,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.DateUtil; -import javax.swing.*; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.util.Date; @@ -95,15 +92,15 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { @Override protected ContentMode getContentMode(DataContext dataContext) { - String mareeId = getSelectedId(); + String tripSeineId = getSelectedId(); - if (mareeId == null) { + if (tripSeineId == null) { // maree en cours de creation return ContentMode.CREATE; } - if (dataContext.isSelectedOpen(TripSeineDto.class)) { + if (getOpenDataManager().isOpenTripSeine(tripSeineId)) { // maree ouverte return ContentMode.UPDATE; @@ -141,8 +138,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { TripSeineUI ui = getUi(); TripMapUI tripMap = ui.getTripMap(); - //FIXME -// tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), getSelectedId()); + tripMap.getHandler().doOpenMap(getSelectedId()); } }); buildTripMap = false; @@ -192,12 +188,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { } formDto = getTripSeineService().loadToEdit(tripId); - //FIXME -// if (!bean.isRouteEmpty()) { -// -// // on force le trie des routes -// Routes.sort(bean.getRoute()); -// } } getModel().setFormDto(formDto); @@ -210,22 +200,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { finalizeOpenUI(mode, create); } - //FIXME -// @Override -// protected TripSeine onPreCreate(TopiaContext tx, Object parent, TripSeine bean) throws TopiaException { -// -// Program parentBean = (Program) parent; -// Date date = DateUtil.getDay(new Date()); -// bean.setStartDate(date); -// bean.setEndDate(date); -// if (log.isDebugEnabled()) { -// log.debug("start date : " + date); -// log.debug("program : " + parentBean); -// } -// bean.setProgram(parentBean); -// return bean; -// } - @Override public void startEditUI(String... binding) { @@ -276,12 +250,9 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { model.setModified(create); } - //FIXME @Override protected boolean doSave(TripSeineDto bean) throws Exception { - String programId = getDataContext().getSelectedProgramId(); - // on force toujours la date a etre sans heure, minute,... Date startDate = DateUtil.getDay(bean.getStartDate()); if (log.isDebugEnabled()) { @@ -294,8 +265,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { log.debug("endDate = " + endDate); } - bean.setOpen(true); - String beanId = getTripSeineService().save(bean); bean.setId(beanId); @@ -306,23 +275,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { return true; } - //FIXME -// @Override -// protected TripSeine onCreate(TopiaContext tx, Object parent, TripSeine editBean) throws TopiaException { -// TripSeine beanToSave = ObserveDAOHelper.getTripSeineDAO(tx).create(); -// editBean.setTopiaId(beanToSave.getTopiaId()); -// return beanToSave; -// } - - //FIXME -// @Override -// protected TripSeine onUpdate(TopiaContext tx, Object parentBean, TripSeine beanToSave) throws TopiaException { -// -// getLoadBinder().copyExcluding(getBean(), beanToSave, TripSeine.PROPERTY_ROUTE, TripSeine.PROPERTY_GEAR_USE_FEATURES_SEINE); -// -// return beanToSave; -// } - @Override protected boolean doDelete(TripSeineDto bean) throws Exception { @@ -341,20 +293,9 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { return true; } - //FIXME -// @Override -// protected void onDelete(TopiaContext tx, Object parentBean, TripSeine beanToDelete) throws TopiaException { -// -// TopiaDAO<TripSeine> dao = getDataSource().getDAO(tx, TripSeine.class); -// dao.delete(beanToDelete); -// } - @Override protected boolean obtainCanReopen(boolean create) { - - DataContext dataContext = getDataContext(); - return !create && !dataContext.isOpenTrip(); - + return !create && getOpenDataManager().canOpenTripSeine(); } protected TripSeineService getTripSeineService() { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java index aa9fa89..3da50c1 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java @@ -58,16 +58,9 @@ public class TripSeineUIModel extends ContentOpenableUIModel<TripSeineDto> { TripSeineDto.PROPERTY_OCEAN, TripSeineDto.PROPERTY_DEPARTURE_HARBOUR, TripSeineDto.PROPERTY_LANDING_HARBOUR, - //FIXME -// TripSeineDto.PROPERTY_PROGRAM, -// TripSeineDto.PROPERTY_ROUTE, TripSeineDto.PROPERTY_ERS_ID, TripSeineDto.PROPERTY_OPEN); - // on ajoute la recopie de l'association route - //FIXME -// builder.addCollectionStrategy(Binder.CollectionStrategy.duplicate, TripSeineDto.PROPERTY_ROUTE); - return builder; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/TripSeineNode.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/TripSeineNode.java index 787ad27..abe4361 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/TripSeineNode.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/TripSeineNode.java @@ -48,7 +48,7 @@ public class TripSeineNode extends DtoNodeSupport<TripSeineDto> { @Override protected ReferenceDto<TripSeineDto> fetchEntity() { TripSeineService tripSeineService = ObserveSwingApplicationContext.get().newService(TripSeineService.class); - FormDto<TripSeineDto> formDto = tripSeineService.loadToRead(entity.getId()); + FormDto<TripSeineDto> formDto = tripSeineService.loadToRead(getId()); ReferenceDto<TripSeineDto> referenceDto = ReferenceDtos.newReferenceDto(TripSeineDto.class, Lists.newArrayList(TripSeineDto.PROPERTY_ID, -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit 3b53dd5c6ff1f7f17cc892ae622109baba72a16b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 11:24:49 2015 +0200 début de migration de l'ecran (refs #7587) --- .../TripSeineDto-n1-create-error-validation.xml | 243 +++++++++++++++++++++ .../TripSeineDto-n1-create-warning-validation.xml | 54 +++++ .../TripSeineDto-n1-update-error-validation.xml | 206 +++++++++++++++++ .../TripSeineDto-n1-update-warning-validation.xml | 94 ++++++++ 4 files changed, 597 insertions(+) diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-error-validation.xml b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-error-validation.xml new file mode 100644 index 0000000..e32342d --- /dev/null +++ b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-error-validation.xml @@ -0,0 +1,243 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="observer"> + + <!-- pas de observer selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.observer</message> + </field-validator> + + <!-- observer desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ observer.enabled ]]> + </param> + <message>validator.trip.desactivated.observer</message> + </field-validator> + + </field> + + <field name="captain"> + + <!-- captain desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ captain == null || captain.enabled ]]> + </param> + <message>validator.trip.desactivated.captain</message> + </field-validator> + + </field> + + <field name="dataEntryOperator"> + + <!-- dataEntryOperator desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ dataEntryOperator == null || dataEntryOperator.enabled ]]> + </param> + <message>validator.trip.desactivated.dataEntryOperator</message> + </field-validator> + + </field> + + <field name="vessel"> + + <!-- pas de vessel sélectionné --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.vessel</message> + </field-validator> + + <!-- vessel desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ vessel.enabled ]]> + </param> + <message>validator.trip.desactivated.vessel</message> + </field-validator> + + </field> + + <field name="ocean"> + + <!-- pas d'ocean selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.ocean</message> + </field-validator> + + <!-- ocean desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ ocean == null || ocean.enabled ]]> + </param> + <message>validator.trip.desactivated.ocean</message> + </field-validator> + + </field> + + <field name="departureHarbour"> + + <!-- pas de departureHarbour selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.departureHarbour</message> + </field-validator> + + <!-- departureHarbour desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ departureHarbour.enabled ]]> + </param> + <message>validator.trip.desactivated.departureHarbour</message> + </field-validator> + + </field> + + <field name="landingHarbour"> + + <!-- landingHarbour desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ landingHarbour == null || landingHarbour.enabled ]]> + </param> + <message>validator.trip.desactivated.landingHarbour</message> + </field-validator> + + </field> + + <field name="startDate"> + + <!-- pas de date de debut selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.startDate</message> + </field-validator> + + </field> + + <field name="endDate"> + + <!-- pas de date de fin selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.endDate</message> + </field-validator> + + <!-- date de fin avant date de debut --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ endDate == null || endDate.time >= startDate.time ]]> + </param> + <message>validator.trip.endDate.after.startDate</message> + </field-validator> + + </field> + + <field name="formsUrl"> + + <!-- formsUrl url pas valide --> + <field-validator type="url" short-circuit="true"> + <message>validator.trip.invalid.formsUrl</message> + </field-validator> + + </field> + + <field name="reportsUrl"> + + <!-- reportsUrl url pas valide --> + <field-validator type="url" short-circuit="true"> + <message>validator.trip.invalid.reportsUrl</message> + </field-validator> + + </field> + + <field name="comment"> + + <!-- comentaire de moins de 1024 caractères --> + <field-validator type="stringlength"> + <param name="maxLength">1024</param> + <message>validator.trip.comment.tobig</message> + </field-validator> + + <!-- comment requis selon le type de departureHarbour choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ departureHarbour == null || !departureHarbour.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.departureHarbour</message> + </field-validator> + + <!-- comment requis selon le type de landingHarbour choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ landingHarbour == null || !landingHarbour.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.landingHarbour</message> + </field-validator> + + <!-- comment requis selon le type de vessel choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ vessel == null || !vessel.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.vessel</message> + </field-validator> + + <!-- comment requis selon le type de ocean choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ ocean == null || !ocean.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.ocean</message> + </field-validator> + + <!-- comment requis selon le type de dataEntryOperator choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ dataEntryOperator == null || !dataEntryOperator.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.dataEntryOperator</message> + </field-validator> + + <!-- comment requis selon le type de observer choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ observer == null || !observer.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.observer</message> + </field-validator> + + <!-- comment requis selon le type de captain choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ captain == null || !captain.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.captain</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-warning-validation.xml b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-warning-validation.xml new file mode 100644 index 0000000..a39dbb4 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-warning-validation.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="landingHarbour"> + + <!-- pas de landingHarbour selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.landingHarbour</message> + </field-validator> + + </field> + + <field name="captain"> + + <!-- pas de captain selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.captain</message> + </field-validator> + + </field> + + <field name="dataEntryOperator"> + + <!-- pas de dataEntryOperator selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.dataEntryOperator</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-error-validation.xml new file mode 100644 index 0000000..330c0b1 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-error-validation.xml @@ -0,0 +1,206 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="observer"> + + <!-- pas de observer selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.observer</message> + </field-validator> + + </field> + + + <field name="vessel"> + + <!-- pas de vessel sélectionné --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.vessel</message> + </field-validator> + + </field> + + <field name="ocean"> + + <!-- pas d'ocean selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.ocean</message> + </field-validator> + + </field> + + <field name="startDate"> + + <!-- pas de date de debut selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.startDate</message> + </field-validator> + + <!-- coherence startDate > date de toute route --> + <!--<field-validator type="collectionFieldExpression">--> + <!--<param name="mode">ALL</param>--> + <!--<param name="useSensitiveContext">true</param>--> + <!--<param name="collectionFieldName">route</param>--> + <!--<param name="expression"><![CDATA[--> + <!--startDate.time <= current.date.time--> + <!--]]>--> + <!--</param>--> + <!--<message>validator.trip.invalid.startDate##${index}</message>--> + <!--</field-validator>--> + + </field> + + <field name="endDate"> + + <!-- pas de date de fin selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.endDate</message> + </field-validator> + + <!-- date de fin avant date de debut --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ endDate == null || endDate.time >= startDate.time ]]> + </param> + <message>validator.trip.endDate.after.startDate</message> + </field-validator> + + <!-- coherence endDate > date de toute route --> + <!--<field-validator type="collectionFieldExpression">--> + <!--<param name="mode">ALL</param>--> + <!--<param name="useSensitiveContext">true</param>--> + <!--<param name="collectionFieldName">route</param>--> + <!--<param name="expression"><![CDATA[--> + <!--current.date.time <= endDate.time--> + <!--]]>--> + <!--</param>--> + <!--<message>validator.trip.invalid.endDate##${index}</message>--> + <!--</field-validator>--> + + </field> + + <!--<field name="route">--> + + <!--<!– coherence date des routes –>--> + <!--<field-validator type="collectionFieldExpression">--> + <!--<param name="mode">ALL</param>--> + <!--<param name="useSensitiveContext">true</param>--> + <!--<param name="expression"><![CDATA[--> + <!--previous == null || previous.date.time <= current.date.time--> + <!--]]>--> + <!--</param>--> + <!--<message>validator.trip.invalid.date##${index}</message>--> + <!--</field-validator>--> + + <!--</field>--> + + <field name="formsUrl"> + + <!-- formsUrl url pas valide --> + <field-validator type="url" short-circuit="true"> + <message>validator.trip.invalid.formsUrl</message> + </field-validator> + + </field> + + <field name="reportsUrl"> + + <!-- reportsUrl url pas valide --> + <field-validator type="url" short-circuit="true"> + <message>validator.trip.invalid.reportsUrl</message> + </field-validator> + + </field> + + <field name="comment"> + + <!-- comentaire de moins de 1024 caractères --> + <field-validator type="stringlength"> + <param name="maxLength">1024</param> + <message>validator.trip.comment.tobig</message> + </field-validator> + + <!-- comment requis selon le type de departureHarbour choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ departureHarbour == null || !departureHarbour.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.departureHarbour</message> + </field-validator> + + <!-- comment requis selon le type de landingHarbour choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ landingHarbour == null || !landingHarbour.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.landingHarbour</message> + </field-validator> + + <!-- comment requis selon le type de vessel choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ vessel == null || !vessel.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.vessel</message> + </field-validator> + + <!-- comment requis selon le type de ocean choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ ocean == null || !ocean.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.ocean</message> + </field-validator> + + <!-- comment requis selon le type de dataEntryOperator choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ dataEntryOperator == null || !dataEntryOperator.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.dataEntryOperator</message> + </field-validator> + + <!-- comment requis selon le type de observer choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ observer == null || !observer.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.observer</message> + </field-validator> + + <!-- comment requis selon le type de captain choisi --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ captain == null || !captain.needComment || (comment != null && !comment.empty) ]]> + </param> + <message>validator.trip.required.comment.for.captain</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-warning-validation.xml b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-warning-validation.xml new file mode 100644 index 0000000..e60f881 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-warning-validation.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="departureHarbour"> + + <!-- pas de departureHarbour selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.departureHarbour</message> + </field-validator> + + </field> + + <field name="landingHarbour"> + + <!-- pas de landingHarbour selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.landingHarbour</message> + </field-validator> + + </field> + + <field name="ocean"> + + <!-- pas d'ocean selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.required.ocean</message> + </field-validator> + + </field> + + <!--<field name="route">--> + + <!--<!– une route est ouverte (interdit la cloture de la maree) –>--> + <!--<!–<field-validator type="openableEntity">–>--> + <!--<!–<message>validator.tripSeine.unclosed.route##${openValueAsString}</message>–>--> + <!--<!–</field-validator>–>--> + + <!--<!– coherence loch des routes –>--> + <!--<field-validator type="collectionFieldExpression">--> + <!--<param name="mode">ALL</param>--> + <!--<param name="useSensitiveContext">true</param>--> + <!--<!–param name="expressionForFirst"><![CDATA[ current.startLogValue == null || current.startLogValue == 0 ]]></param–>--> + <!--<param name="expression">--> + <!--<![CDATA[previous == null || current.startLogValue == null || previous.endLogValue == null || previous.endLogValue <= current.startLogValue ]]>--> + <!--</param>--> + <!--<message>validator.trip.invalid.loch##${current.startLogValue}##${current.date}##${previous.endLogValue}</message>--> + <!--</field-validator>--> + <!-- --> + <!--</field>--> + + <field name="captain"> + + <!-- pas de captain selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.captain</message> + </field-validator> + + </field> + + <field name="dataEntryOperator"> + + <!-- pas de dataEntryOperator selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.trip.null.dataEntryOperator</message> + </field-validator> + + </field> + +</validators> -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit c064c6599dc2dc017083085a56e173205bfeff6d Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Oct 6 11:57:41 2015 +0200 Renommage de ObserveValidator en ObserveSwingValidator --- observe-application-swing/pom.xml | 2 +- .../observe/ObserveSwingApplicationContext.java | 4 ++-- .../business/ObserveApplicationContext.java | 4 ++-- ...veValidator.java => ObserveSwingValidator.java} | 26 +++++++++++----------- .../business/validation/ValidationContext.java | 2 +- .../observe/ui/content/ContentUIInitializer.java | 8 +++---- .../content/table/impl/seine/NonTargetCatchUI.jaxx | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/observe-application-swing/pom.xml b/observe-application-swing/pom.xml index 783b8f8..2577602 100644 --- a/observe-application-swing/pom.xml +++ b/observe-application-swing/pom.xml @@ -46,7 +46,7 @@ <jaxx.autoImportCss>true</jaxx.autoImportCss> <jaxx.autoRecurseInCss>false</jaxx.autoRecurseInCss> <jaxx.validatorFactoryFQN> - fr.ird.observe.business.validation.ObserveValidator + fr.ird.observe.business.validation.ObserveSwingValidator </jaxx.validatorFactoryFQN> <jaxx.commonCss> ${project.basedir}/src/main/java/fr/ird/observe/ui/ObserveCommon.css diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ObserveSwingApplicationContext.java b/observe-application-swing/src/main/java/fr/ird/observe/ObserveSwingApplicationContext.java index cc513f3..e8290a1 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ObserveSwingApplicationContext.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ObserveSwingApplicationContext.java @@ -25,7 +25,7 @@ import com.google.common.base.Preconditions; import fr.ird.observe.business.BinderService; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.gps.GPSService; -import fr.ird.observe.business.validation.ObserveValidator; +import fr.ird.observe.business.validation.ObserveSwingValidator; import fr.ird.observe.business.validation.ValidationContext; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.db.ObserveSwingDataSource; @@ -337,7 +337,7 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext { VALIDATION_CONTEXT_ENTRY_DEF.getContextValue(this); if (result == null) { result = new ValidationContext(); - ObserveValidator.setValidationContext(result); + ObserveSwingValidator.setValidationContext(result); result.setDataContext(getDataContext()); VALIDATION_CONTEXT_ENTRY_DEF.setContextValue(this, result); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/business/ObserveApplicationContext.java b/observe-application-swing/src/main/java/fr/ird/observe/business/ObserveApplicationContext.java index 846e44a..96e6a86 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/business/ObserveApplicationContext.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/business/ObserveApplicationContext.java @@ -21,11 +21,11 @@ */ package fr.ird.observe.business; +import fr.ird.observe.business.validation.ObserveSwingValidator; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.gps.GPSService; -import fr.ird.observe.business.validation.ObserveValidator; import fr.ird.observe.business.validation.ValidationContext; import fr.ird.observe.db.ObserveSwingDataSource; import fr.ird.observe.services.dto.constants.ReferentialLocale; @@ -194,7 +194,7 @@ public class ObserveApplicationContext extends DefaultApplicationContext { VALIDATION_CONTEXT_ENTRY_DEF.getContextValue(this); if (result == null) { result = new ValidationContext(); - ObserveValidator.setValidationContext(result); + ObserveSwingValidator.setValidationContext(result); result.setDataContext(getDataContext()); VALIDATION_CONTEXT_ENTRY_DEF.setContextValue(this, result); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ObserveValidator.java b/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ObserveSwingValidator.java similarity index 88% rename from observe-application-swing/src/main/java/fr/ird/observe/business/validation/ObserveValidator.java rename to observe-application-swing/src/main/java/fr/ird/observe/business/validation/ObserveSwingValidator.java index 91f5bde..ae36b4c 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ObserveValidator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ObserveSwingValidator.java @@ -44,31 +44,31 @@ import org.nuiton.validator.xwork2.XWork2ValidatorUtil; * @author Tony Chemit - chemit@codelutin.com * @since 1.0 */ -public class ObserveValidator<B> extends SwingValidator<B> { +public class ObserveSwingValidator<B> extends SwingValidator<B> { /** Logger */ - private static final Log log = LogFactory.getLog(ObserveValidator.class); + private static final Log log = LogFactory.getLog(ObserveSwingValidator.class); /** un etat pour initialiser la stack une unique fois la stack */ private static boolean init; private static ValidationContext validationContext; - public static <B> ObserveValidator<B> newValidator(Class<B> type, + public static <B> ObserveSwingValidator<B> newValidator(Class<B> type, String context, NuitonValidatorScope... scopes) { - return new ObserveValidator<B>( + return new ObserveSwingValidator<>( type, context, scopes ); } - public static <B> ObserveValidator<B> newValidator(NuitonValidatorProvider provider, + public static <B> ObserveSwingValidator<B> newValidator(NuitonValidatorProvider provider, Class<B> type, String context, NuitonValidatorScope... scopes) { - return new ObserveValidator<B>( + return new ObserveSwingValidator<>( provider, type, context, @@ -76,17 +76,17 @@ public class ObserveValidator<B> extends SwingValidator<B> { ); } - public ObserveValidator( + public ObserveSwingValidator( Class<B> type, String context, NuitonValidatorScope... scopes) { super(NuitonValidatorFactory.getDefaultProvider(), type, context, scopes); } - public ObserveValidator(NuitonValidatorProvider provider, - Class<B> type, - String context, - NuitonValidatorScope... scopes) { + public ObserveSwingValidator(NuitonValidatorProvider provider, + Class<B> type, + String context, + NuitonValidatorScope... scopes) { super(provider, type, context, scopes); } @@ -168,7 +168,7 @@ public class ObserveValidator<B> extends SwingValidator<B> { } public static void setValidationContext(ValidationContext validationContext) { - ObserveValidator.validationContext = validationContext; + ObserveSwingValidator.validationContext = validationContext; // a chaque fois qu'on change le contexte de validation // il faudra reinitiliser la stack setInit(false); @@ -179,7 +179,7 @@ public class ObserveValidator<B> extends SwingValidator<B> { } private static void setInit(boolean init) { - ObserveValidator.init = init; + ObserveSwingValidator.init = init; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ValidationContext.java b/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ValidationContext.java index 8c5f73d..0efb9b6 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ValidationContext.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/business/validation/ValidationContext.java @@ -150,7 +150,7 @@ public class ValidationContext { log.info("Attach data context " + dataContext); } this.dataContext = dataContext; - ObserveValidator.reloadDataContext(this, false); + ObserveSwingValidator.reloadDataContext(this, false); } //FIXME diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java index 5160d83..116177a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java @@ -26,7 +26,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import fr.ird.observe.ObserveSwingApplicationContext; -import fr.ird.observe.business.validation.ObserveValidator; +import fr.ird.observe.business.validation.ObserveSwingValidator; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.IdDto; import fr.ird.observe.services.dto.ReferenceDto; @@ -273,8 +273,8 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E continue; } - if (o instanceof ObserveValidator<?>) { - init(ui, (ObserveValidator<?>) o); + if (o instanceof ObserveSwingValidator<?>) { + init(ui, (ObserveSwingValidator<?>) o); continue; } @@ -335,7 +335,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E } - protected void init(UI ui, ObserveValidator<?> validator) { + protected void init(UI ui, ObserveSwingValidator<?> validator) { SwingValidatorUtil.listenValidatorContextNameAndRefreshFields( validator, (JAXXValidator) ui diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx index 683235a..1b6c48a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx @@ -40,7 +40,7 @@ fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto fr.ird.observe.ui.content.table.* - fr.ird.observe.business.validation.ObserveValidator + fr.ird.observe.business.validation.ObserveSwingValidator jaxx.runtime.swing.editor.NumberEditor jaxx.runtime.swing.editor.bean.BeanComboBox -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit 5b96fb0ab86d8f010a689134e59d85875c7df468 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 14:26:13 2015 +0200 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) --- .../content/open/impl/seine/TripSeineUIModel.java | 3 +- .../TripSeineDto-n1-create-error-validation.xml | 0 .../TripSeineDto-n1-create-warning-validation.xml | 0 .../TripSeineDto-n1-update-error-validation.xml | 64 ++++++++++----------- .../TripSeineDto-n1-update-warning-validation.xml | 36 ++++++------ .../main/xmi/observe-services-dto-seine.properties | 1 + .../src/main/xmi/observe-services-dto-seine.zargo | Bin 59029 -> 59456 bytes .../services/dto/ObserveDtosInitializer.java | 3 +- 8 files changed, 55 insertions(+), 52 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java index 3da50c1..54b2755 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIModel.java @@ -59,7 +59,8 @@ public class TripSeineUIModel extends ContentOpenableUIModel<TripSeineDto> { TripSeineDto.PROPERTY_DEPARTURE_HARBOUR, TripSeineDto.PROPERTY_LANDING_HARBOUR, TripSeineDto.PROPERTY_ERS_ID, - TripSeineDto.PROPERTY_OPEN); + TripSeineDto.PROPERTY_OPEN, + TripSeineDto.PROPERTY_ROUTE); return builder; diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-create-error-validation.xml similarity index 100% rename from observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-error-validation.xml rename to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-create-error-validation.xml diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-warning-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-create-warning-validation.xml similarity index 100% rename from observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-create-warning-validation.xml rename to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-create-warning-validation.xml diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-update-error-validation.xml similarity index 79% rename from observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-error-validation.xml rename to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-update-error-validation.xml index 330c0b1..7d3ec4e 100644 --- a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-error-validation.xml +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-update-error-validation.xml @@ -62,16 +62,16 @@ </field-validator> <!-- coherence startDate > date de toute route --> - <!--<field-validator type="collectionFieldExpression">--> - <!--<param name="mode">ALL</param>--> - <!--<param name="useSensitiveContext">true</param>--> - <!--<param name="collectionFieldName">route</param>--> - <!--<param name="expression"><![CDATA[--> - <!--startDate.time <= current.date.time--> - <!--]]>--> - <!--</param>--> - <!--<message>validator.trip.invalid.startDate##${index}</message>--> - <!--</field-validator>--> + <field-validator type="collectionFieldExpression"> + <param name="mode">ALL</param> + <param name="useSensitiveContext">true</param> + <param name="collectionFieldName">route</param> + <param name="expression"><![CDATA[ + startDate.time <= current.date.time + ]]> + </param> + <message>validator.trip.invalid.startDate##${index}</message> + </field-validator> </field> @@ -91,33 +91,33 @@ </field-validator> <!-- coherence endDate > date de toute route --> - <!--<field-validator type="collectionFieldExpression">--> - <!--<param name="mode">ALL</param>--> - <!--<param name="useSensitiveContext">true</param>--> - <!--<param name="collectionFieldName">route</param>--> - <!--<param name="expression"><![CDATA[--> - <!--current.date.time <= endDate.time--> - <!--]]>--> - <!--</param>--> - <!--<message>validator.trip.invalid.endDate##${index}</message>--> - <!--</field-validator>--> + <field-validator type="collectionFieldExpression"> + <param name="mode">ALL</param> + <param name="useSensitiveContext">true</param> + <param name="collectionFieldName">route</param> + <param name="expression"><![CDATA[ + current.date.time <= endDate.time + ]]> + </param> + <message>validator.trip.invalid.endDate##${index}</message> + </field-validator> </field> - <!--<field name="route">--> + <field name="route"> - <!--<!– coherence date des routes –>--> - <!--<field-validator type="collectionFieldExpression">--> - <!--<param name="mode">ALL</param>--> - <!--<param name="useSensitiveContext">true</param>--> - <!--<param name="expression"><![CDATA[--> - <!--previous == null || previous.date.time <= current.date.time--> - <!--]]>--> - <!--</param>--> - <!--<message>validator.trip.invalid.date##${index}</message>--> - <!--</field-validator>--> + <!-- coherence date des routes --> + <field-validator type="collectionFieldExpression"> + <param name="mode">ALL</param> + <param name="useSensitiveContext">true</param> + <param name="expression"><![CDATA[ + previous == null || previous.date.time <= current.date.time + ]]> + </param> + <message>validator.trip.invalid.date##${index}</message> + </field-validator> - <!--</field>--> + </field> <field name="formsUrl"> diff --git a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-warning-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-update-warning-validation.xml similarity index 65% rename from observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-warning-validation.xml rename to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-update-warning-validation.xml index e60f881..a4ecd4b 100644 --- a/observe-application-swing/src/main/resources/fr.ird.observe.services.dto.seine/TripSeineDto-n1-update-warning-validation.xml +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TripSeineDto-n1-update-warning-validation.xml @@ -53,25 +53,25 @@ </field> - <!--<field name="route">--> - - <!--<!– une route est ouverte (interdit la cloture de la maree) –>--> - <!--<!–<field-validator type="openableEntity">–>--> - <!--<!–<message>validator.tripSeine.unclosed.route##${openValueAsString}</message>–>--> - <!--<!–</field-validator>–>--> - - <!--<!– coherence loch des routes –>--> - <!--<field-validator type="collectionFieldExpression">--> - <!--<param name="mode">ALL</param>--> - <!--<param name="useSensitiveContext">true</param>--> - <!--<!–param name="expressionForFirst"><![CDATA[ current.startLogValue == null || current.startLogValue == 0 ]]></param–>--> - <!--<param name="expression">--> - <!--<![CDATA[previous == null || current.startLogValue == null || previous.endLogValue == null || previous.endLogValue <= current.startLogValue ]]>--> - <!--</param>--> - <!--<message>validator.trip.invalid.loch##${current.startLogValue}##${current.date}##${previous.endLogValue}</message>--> + <field name="route"> + + <!-- une route est ouverte (interdit la cloture de la maree) --> + <!--<field-validator type="openableEntity">--> + <!--<message>validator.tripSeine.unclosed.route##${openValueAsString}</message>--> <!--</field-validator>--> - <!-- --> - <!--</field>--> + + <!-- coherence loch des routes --> + <field-validator type="collectionFieldExpression"> + <param name="mode">ALL</param> + <param name="useSensitiveContext">true</param> + <!--param name="expressionForFirst"><![CDATA[ current.startLogValue == null || current.startLogValue == 0 ]]></param--> + <param name="expression"> + <![CDATA[previous == null || current.startLogValue == null || previous.endLogValue == null || previous.endLogValue <= current.startLogValue ]]> + </param> + <message>validator.trip.invalid.loch##${current.startLogValue}##${current.date}##${previous.endLogValue}</message> + </field-validator> + + </field> <field name="captain"> diff --git a/observe-services-model/src/main/xmi/observe-services-dto-seine.properties b/observe-services-model/src/main/xmi/observe-services-dto-seine.properties index efba507..4346372 100644 --- a/observe-services-model/src/main/xmi/observe-services-dto-seine.properties +++ b/observe-services-model/src/main/xmi/observe-services-dto-seine.properties @@ -83,3 +83,4 @@ fr.ird.observe.services.dto.seine.TargetSample.attribute.targetLength.stereotype fr.ird.observe.services.dto.seine.NonTargetSample.attribute.nonTargetLength.stereotype=unique fr.ird.observe.services.dto.seine.GearUseFeaturesSeine.attribute.gearUseFeaturesMeasurement.stereotype=unique fr.ird.observe.services.dto.seine.ActivitySeineObservedSystem.attribute.observedSystem.stereotype=unique +fr.ird.observe.services.dto.seine.TripSeine.attribute.route.stereotype=unique,ordered diff --git a/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo b/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo index e714dbb..e08f6db 100644 Binary files a/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo and b/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo differ diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java b/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java index b48db33..e063c72 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java @@ -1597,7 +1597,8 @@ public class ObserveDtosInitializer implements ObserveModelInitializer { TripSeineDto.PROPERTY_OCEAN, TripSeineDto.PROPERTY_DEPARTURE_HARBOUR, TripSeineDto.PROPERTY_LANDING_HARBOUR, - TripSeineDto.PROPERTY_LAST_UPDATE + TripSeineDto.PROPERTY_LAST_UPDATE, + TripSeineDto.PROPERTY_ROUTE ); registerReferenceBinder(TripSeineDto.class, TripSeine.class, -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit 4aff5ada12c0fd11df98225ff3f26991cb7a8435 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 14:30:12 2015 +0200 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) --- .../java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx index f4758a9..4ae57ef 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx @@ -64,8 +64,8 @@ errorTableModel='{getErrorTableModel()}' autoField='true' context='n1-update'> - <!--FIXME--> - <!--<field name='route' component='{actionDown}'/>--> + + <field name='route' component='{actionDown}'/> </BeanValidator> <script><![CDATA[ -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit cf7321f225db9a07eda65c911af24af97eaeab1d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 15:29:53 2015 +0200 correction de la validation + ajout des routes dans le DTO de trip seine (refs #7587) --- .../ui/content/open/ContentOpenableUIHandler.java | 70 +++++----------------- .../open/impl/seine/TripSeineUIHandler.java | 4 -- 2 files changed, 15 insertions(+), 59 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java index 20ba59c..f7ee163 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java @@ -22,10 +22,13 @@ package fr.ird.observe.ui.content.open; import fr.ird.observe.ObserveOpenDataManager; +import fr.ird.observe.ObserveServiceHelper; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.db.ObserveSwingDataSource; import fr.ird.observe.services.dto.IdDto; +import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import fr.ird.observe.ui.tree.ObserveNode; @@ -158,8 +161,7 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU // selectedNode = selectedNode.getParent(); // } // treeHelper.refreshNode(selectedNode, true); - //FIXME -// treeHelper.reloadSelectedNode(bean instanceof Trip, true); + treeHelper.reloadSelectedNode(bean instanceof TripSeineDto || bean instanceof TripLonglineDto, true); updateActions(); } @@ -170,7 +172,6 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU ContentOpenableUI<E> ui = getUi(); - int position = ui.getContextValue(Integer.class, POSITION_OPENABLE); ObserveTreeHelper treeHelper = getTreeHelper(ui); ObserveNode node = treeHelper.getSelectedNode(); @@ -179,13 +180,6 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU E bean = getBean(); - int oldPosition; - if (create) { - oldPosition = parentNode.getChildCount(); - } else { - oldPosition = parentNode.getIndex(node); - } - if (create) { // on passe en mode mise à jour @@ -200,29 +194,15 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU // arrêt de l'édition de l'écran courant stopEditUI(); - if (oldPosition != position) { - - // on doit repositionner le noeud - treeHelper.moveNode(parentNode, node, position); - } + treeHelper.reloadNode(parentNode, true); // on sélectionne le nouveau noeud treeHelper.selectNode(node); } else { - if (oldPosition != position) { - // on doit repositionner le noeud - treeHelper.moveNode(parentNode, node, position); - - // et le selectionner - treeHelper.selectNode(node); - } + treeHelper.reloadNode(parentNode, true); - // on repaint le noeud et ses enfants -// treeHelper.refreshNode(node, true); - treeHelper.reloadSelectedNode(false, true); -// treeHelper.refreshNode(node, false); } } @@ -266,25 +246,6 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU treeHelper.addUnsavedNode(parentNode, getBeanType()); } - //FIXME -// protected final void obtainChildPosition(E bean, -// DataService dataService, -// DataSource dataSource) { -// -// String containerId = getSelectedParentId(); -// -// int position = dataService.getOpenablePosition(dataSource, -// containerId, -// bean.getTopiaId() -// ); -// -// if (log.isDebugEnabled()) { -// log.debug("Position of child : " + position); -// } -// -// getUi().setContextValue(position, POSITION_OPENABLE); -// } - protected final void finalizeOpenUI(ContentMode mode, boolean create) { // utilisation du mode requis @@ -296,16 +257,15 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU if (!create) { - //FIXME -// Trip currentTrip = ObserveServiceHelper.getValidationContext().getCurrentTrip(); -// -// if (currentTrip != null && currentTrip.isHistoricalData()) { -// -// if (log.isInfoEnabled()) { -// log.info(prefix + "Using a historical fish trip " + currentTrip.getTopiaId()); -// } -// historicalData = true; -// } + TripSeineDto currentTripSeine = ObserveServiceHelper.getValidationContext().getCurrentTripSeine(); + + if (currentTripSeine != null && currentTripSeine.isHistoricalData()) { + + if (log.isInfoEnabled()) { + log.info(prefix + "Using a historical fish trip " + currentTripSeine.getId()); + } + historicalData = true; + } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index c567581..bc0949d 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -268,10 +268,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { String beanId = getTripSeineService().save(bean); bean.setId(beanId); - // recuperation de la position de la maree dans le program - //FIXME -// obtainChildPosition(bean, dataService, dataSource); - return true; } -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit 5877b30ad3962342c7ac63d04c077ff66696349a Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 16:14:01 2015 +0200 adpatation des la carte + petite rose de vents (refs #7587) --- .../open/impl/seine/TripSeineUIHandler.java | 5 ++- .../observe/ui/util/tripMap/ObserveMapPane.java | 40 +++++++++++++++------- .../ui/util/tripMap/TripMapContentBuilder.java | 17 ++++----- .../observe/ui/util/tripMap/TripMapUIHandler.java | 23 ++++++------- 4 files changed, 52 insertions(+), 33 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index bc0949d..0926c22 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -26,6 +26,7 @@ import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.TripMapDto; import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.dto.seine.TripSeineDtos; import fr.ird.observe.services.service.seine.TripSeineService; @@ -137,8 +138,10 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { TripSeineUI ui = getUi(); TripMapUI tripMap = ui.getTripMap(); + TripMapDto tripSeineMap = getTripSeineService().getTripSeineMap(getSelectedId()); - tripMap.getHandler().doOpenMap(getSelectedId()); + + tripMap.getHandler().doOpenMap(tripSeineMap); } }); buildTripMap = false; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java index 2eb267e..ea0164c 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java @@ -35,9 +35,11 @@ import org.geotools.swing.event.MapPaneAdapter; import org.geotools.swing.event.MapPaneEvent; import java.awt.Color; +import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Point; +import java.awt.Polygon; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; @@ -144,36 +146,50 @@ public class ObserveMapPane extends JMapPane { } - protected static int AXIS_LENGHT = 30; - protected static int CIRCLE_RADIUS = 20; - protected static int CENTER_MARGIN = 60; + protected static int AXIS_LENGTH = 30; + + protected static int SUB_AXIS_LENGTH = 5; + + protected static int CENTER_MARGIN = 50; + protected static int INTER_AXIS_TEXT = 3; + + protected static double FONT_SIZE = 12; protected void paintCompass(Graphics graphics) { Point center = new Point(getWidth() - CENTER_MARGIN, CENTER_MARGIN); - graphics.drawOval( - center.x - CIRCLE_RADIUS, - center.y - CIRCLE_RADIUS, - CIRCLE_RADIUS * 2, - CIRCLE_RADIUS * 2); + Font font = graphics.getFont(); + Font fontRatio = font.deriveFont((float) (FONT_SIZE)); + graphics.setFont(fontRatio); FontMetrics fm = graphics.getFontMetrics(); for (CardinalPoint cardinalPoint : CardinalPoint.values()) { - Point2D direction = cardinalPoint.getDirection(rotation, AXIS_LENGHT, center); + Point2D direction = cardinalPoint.getDirection(rotation, (int) (AXIS_LENGTH), center); + + Point2D sommet1 = cardinalPoint.getDirection(rotation - Math.PI / 4, (int) (SUB_AXIS_LENGTH), center); + + Point2D sommet2 = cardinalPoint.getDirection(rotation + Math.PI / 4, (int) (SUB_AXIS_LENGTH), center); + + + Polygon polygon = new Polygon(); + polygon.addPoint((int) center.getX(), (int) center.getY()); + polygon.addPoint((int) direction.getX(), (int) direction.getY()); + polygon.addPoint((int) sommet2.getX(), (int) sommet2.getY()); + graphics.fillPolygon(polygon); - graphics.drawLine(center.x, center.y, (int)direction.getX(), (int) direction.getY()); + graphics.drawLine((int) sommet1.getX(), (int) sommet1.getY(), (int) direction.getX(), (int) direction.getY()); Rectangle2D textArea = fm.getStringBounds(cardinalPoint.getLabel(), graphics); // on cherche la ditance entre le centre du text et sa bordure dans le direction donné - double l = cardinalPoint.distanceCenterBorder(rotation, textArea); + double l = cardinalPoint.distanceCenterBorder(rotation, textArea); - Point2D textCenter = cardinalPoint.getDirection(rotation, AXIS_LENGHT + INTER_AXIS_TEXT + l, center); + Point2D textCenter = cardinalPoint.getDirection(rotation, (int) (AXIS_LENGTH + INTER_AXIS_TEXT) + l, center); graphics.drawString( cardinalPoint.getLabel(), diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java index a2f47a0..7b77a75 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java @@ -34,7 +34,8 @@ import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Polygon; import fr.ird.observe.business.ObserveTechnicalException; -import fr.ird.observe.entities.tripMap.*; +import fr.ird.observe.services.dto.TripMapPointDto; +import fr.ird.observe.services.dto.constants.TripMapPointType; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.geotools.data.FileDataStore; @@ -130,7 +131,7 @@ public class TripMapContentBuilder { mapContent.addLayer(layer); } - public void addTripLine(List<TripMapPoint> tripMapPoints) throws FactoryException { + public void addTripLine(List<TripMapPointDto> tripMapPoints) throws FactoryException { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); @@ -148,9 +149,9 @@ public class TripMapContentBuilder { List<Coordinate> coordinatesByDay = null; - TripMapPoint previousPoint = null; + TripMapPointDto previousPoint = null; - for (TripMapPoint point : tripMapPoints) { + for (TripMapPointDto point : tripMapPoints) { if (previousPoint == null) { coordinatesByDay = Lists.newLinkedList(); } else if (!DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) { @@ -221,7 +222,7 @@ public class TripMapContentBuilder { } - public void addLonglineFishingZone(List<TripMapPoint> tripMapPoints) throws FactoryException { + public void addLonglineFishingZone(List<TripMapPointDto> tripMapPoints) throws FactoryException { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); SimpleFeatureTypeBuilder polygonFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); @@ -267,7 +268,7 @@ public class TripMapContentBuilder { mapContent.addLayer(layerLines); } - public void addLonglineLine(List<TripMapPoint> tripMapPoints) throws FactoryException { + public void addLonglineLine(List<TripMapPointDto> tripMapPoints) throws FactoryException { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); @@ -357,7 +358,7 @@ public class TripMapContentBuilder { } - public void addPoints(List<TripMapPoint> tripMapPoints) throws FactoryException { + public void addPoints(List<TripMapPointDto> tripMapPoints) throws FactoryException { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); @@ -377,7 +378,7 @@ public class TripMapContentBuilder { Set<TripMapPointType> pointTypeInLegend = Sets.newHashSet(); - for (TripMapPoint tripMapPoint : tripMapPoints) { + for (TripMapPointDto tripMapPoint : tripMapPoints) { Coordinate coordinate = new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()); TripMapPointType type = tripMapPoint.getType(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index ea3216c..06870bc 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -22,11 +22,13 @@ package fr.ird.observe.ui.util.tripMap; * #L% */ +import com.google.common.collect.Lists; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.ObserveTechnicalException; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; -import fr.ird.observe.entities.tripMap.TripMapPoint; import fr.ird.observe.services.dto.IdDtos; +import fr.ird.observe.services.dto.TripMapDto; +import fr.ird.observe.services.dto.TripMapPointDto; import fr.ird.observe.ui.UIHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -37,8 +39,9 @@ import org.geotools.swing.event.MapPaneEvent; import org.geotools.swing.event.MapPaneListener; import javax.imageio.ImageIO; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import java.awt.CardLayout; +import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -104,9 +107,7 @@ public class TripMapUIHandler { return view.getObserveMapPane(); } - //FIXME -// public void doOpenMap(DataSource dataSource, DataService dataService, String tripId) { - public void doOpenMap(String tripId) { + public void doOpenMap(TripMapDto tripMapDto) { try { ((CardLayout) view.getLayout()).first(view); @@ -119,9 +120,7 @@ public class TripMapUIHandler { mapPane.getMapContent().dispose(); } - //FIXME -// List<TripMapPoint> tripMapPoints = dataService.loadTripMapActivityPoints(dataSource, tripId); - List<TripMapPoint> tripMapPoints = null; + List<TripMapPointDto> tripMapPoints = Lists.newArrayList(tripMapDto.getPoints()); TripMapContentBuilder mapContentBuilder = new TripMapContentBuilder(); @@ -131,11 +130,11 @@ public class TripMapUIHandler { mapContentBuilder.addLayer(layerFile); } - if (IdDtos.isSeineId(tripId)) { + if (IdDtos.isSeineId(tripMapDto.getId())) { mapContentBuilder.addTripLine(tripMapPoints); - } else if (IdDtos.isLonglineId(tripId)) { + } else if (IdDtos.isLonglineId(tripMapDto.getId())) { mapContentBuilder.addLonglineFishingZone(tripMapPoints); mapContentBuilder.addLonglineLine(tripMapPoints); @@ -146,7 +145,7 @@ public class TripMapUIHandler { // set zoom tripArea = new ReferencedEnvelope(); - for (TripMapPoint point : tripMapPoints) { + for (TripMapPointDto point : tripMapPoints) { tripArea.expandToInclude(new DirectPosition2D(point.getLongitude(), point.getLatitude())); } tripArea.expandBy(1.1); -- 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/7587 in repository observe. See http://git.codelutin.com/observe.git commit 1dcdd98999735fea3540642e97b77b89a8c81970 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 6 16:58:55 2015 +0200 calcule de la nouvelle position de la marée (refs #7587) --- .../ui/content/open/ContentOpenableUIHandler.java | 41 ++++++++++++++++++++-- .../impl/longline/ActivityLonglineUIHandler.java | 7 +++- .../open/impl/longline/TripLonglineUIHandler.java | 10 ++++-- .../open/impl/seine/ActivitySeineUIHandler.java | 8 +++++ .../ui/content/open/impl/seine/RouteUIHandler.java | 6 ++++ .../open/impl/seine/TripSeineUIHandler.java | 15 ++++++++ .../services/service/seine/TripSeineService.java | 2 +- 7 files changed, 83 insertions(+), 6 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java index f7ee163..502a648 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/ContentOpenableUIHandler.java @@ -172,6 +172,7 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU ContentOpenableUI<E> ui = getUi(); + int position = ui.getContextValue(Integer.class, POSITION_OPENABLE); ObserveTreeHelper treeHelper = getTreeHelper(ui); ObserveNode node = treeHelper.getSelectedNode(); @@ -180,6 +181,13 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU E bean = getBean(); + int oldPosition; + if (create) { + oldPosition = parentNode.getChildCount(); + } else { + oldPosition = parentNode.getIndex(node); + } + if (create) { // on passe en mode mise à jour @@ -194,15 +202,29 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU // arrêt de l'édition de l'écran courant stopEditUI(); - treeHelper.reloadNode(parentNode, true); + if (oldPosition != position) { + + // on doit repositionner le noeud + treeHelper.moveNode(parentNode, node, position); + } // on sélectionne le nouveau noeud treeHelper.selectNode(node); } else { + if (oldPosition != position) { + + // on doit repositionner le noeud + treeHelper.moveNode(parentNode, node, position); - treeHelper.reloadNode(parentNode, true); + // et le selectionner + treeHelper.selectNode(node); + } + // on repaint le noeud et ses enfants +// treeHelper.refreshNode(node, true); + treeHelper.reloadSelectedNode(false, true); +// treeHelper.refreshNode(node, false); } } @@ -246,6 +268,21 @@ public abstract class ContentOpenableUIHandler<E extends IdDto> extends ContentU treeHelper.addUnsavedNode(parentNode, getBeanType()); } + protected final void obtainChildPosition(E bean){ + + String containerId = getSelectedParentId(); + + int position = getOpenablePosition(containerId, bean); + + if (log.isDebugEnabled()) { + log.debug("Position of child : " + position); + } + + getUi().setContextValue(position, POSITION_OPENABLE); + } + + protected abstract int getOpenablePosition(String parentId, E bean); + protected final void finalizeOpenUI(ContentMode mode, boolean create) { // utilisation du mode requis diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java index d7a31b5..17a30bb 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java @@ -26,7 +26,6 @@ import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; -import fr.ird.observe.db.ObserveSwingDataSource; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDtos; import fr.ird.observe.services.dto.longline.TripLonglineDto; @@ -305,6 +304,12 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity return true; } + @Override + protected int getOpenablePosition(String parentId, ActivityLonglineDto bean) { + // TODO + return 0; + } + //FIXME // @Override // protected ActivityLongline onCreate(TopiaContext tx, Object parent, ActivityLongline editBean) throws TopiaException { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java index 539eaad..420e058 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java @@ -27,7 +27,6 @@ import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.services.dto.FormDto; -import fr.ird.observe.db.ObserveSwingDataSource; import fr.ird.observe.services.dto.longline.TripLonglineDto; import fr.ird.observe.services.dto.longline.TripLonglineDtos; import fr.ird.observe.services.service.longline.TripLonglineService; @@ -39,7 +38,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.DateUtil; -import javax.swing.*; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.util.Date; @@ -303,6 +303,12 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline return true; } + @Override + protected int getOpenablePosition(String parentId, TripLonglineDto bean) { + // TODO + return 0; + } + //FIXME // @Override // protected TripLongline onCreate(TopiaContext tx, Object parent, TripLongline editBean) throws TopiaException { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java index 9fcbf16..42eb319 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java @@ -349,6 +349,14 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei return true; } + + + @Override + protected int getOpenablePosition(String parentId, ActivitySeineDto bean) { + // TODO + return 0; + } + //FIXME // @Override // protected ActivitySeine onCreate(TopiaContext tx, Object parent, ActivitySeine editBean) throws TopiaException { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java index 808791d..1855ff6 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java @@ -255,6 +255,12 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { } @Override + protected int getOpenablePosition(String parentId, RouteDto bean) { + //TODO + return 0; + } + + @Override protected void afterSave(boolean refresh) { super.afterSave(refresh); repaintTripNode(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 0926c22..a82f283 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -21,11 +21,14 @@ */ package fr.ird.observe.ui.content.open.impl.seine; +import com.google.common.collect.Iterables; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.IdDtos; +import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.TripMapDto; import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.dto.seine.TripSeineDtos; @@ -271,9 +274,21 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { String beanId = getTripSeineService().save(bean); bean.setId(beanId); + // recuperation de la position de la maree dans le program + obtainChildPosition(bean); + return true; } + protected int getOpenablePosition(String parentId, TripSeineDto bean) { + + ReferenceSetDto<TripSeineDto> tripSeineByProgram = getTripSeineService().getTripSeineByProgram(parentId); + + int position = Iterables.indexOf(tripSeineByProgram.getReference(), IdDtos.newIdPredicate(bean.getId())); + + return position; + } + @Override protected boolean doDelete(TripSeineDto bean) throws Exception { diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java index 6a01421..8fcb7c5 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java @@ -63,4 +63,4 @@ public interface TripSeineService extends ObserveService { @DeleteRequest void delete(String tripSeineId); -} \ No newline at end of file + } \ No newline at end of file -- 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