This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit af70d9e750b9474fb3d213bc9dc2e07b54616868 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 15 18:11:19 2015 +0200 refs #6970 Ajout d'un message utilisateur si une liste d'espèce n'a pas pu être chargée --- .../ui/content/table/ContentTableUIHandler.java | 23 ++++++++++++++++++++-- .../impl/longline/CatchLonglineUIHandler.java | 4 ++-- .../table/impl/longline/EncounterUIHandler.java | 2 +- .../content/table/impl/longline/TdrUIHandler.java | 2 +- .../impl/seine/ObjectObservedSpeciesUIHandler.java | 2 +- .../impl/seine/ObjectSchoolEstimateUIHandler.java | 4 ++-- .../table/impl/seine/TargetCatchUIHandler.java | 3 ++- .../impl/seine/TargetDiscardCatchUIHandler.java | 2 +- .../resources/i18n/observe-swing_en_GB.properties | 7 +++++++ .../resources/i18n/observe-swing_es_ES.properties | 7 +++++++ .../resources/i18n/observe-swing_fr_FR.properties | 7 +++++++ 11 files changed, 52 insertions(+), 11 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java index 45375f8..1c6c060 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java @@ -29,6 +29,7 @@ import fr.ird.observe.db.DataSource; import fr.ird.observe.db.DataSourceException; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.entities.referentiel.Species2; +import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import fr.ird.observe.ui.content.ObserveContentUI; @@ -54,6 +55,7 @@ import javax.swing.table.DefaultTableCellRenderer; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -260,8 +262,25 @@ public abstract class ContentTableUIHandler<E extends TopiaEntity, D extends Top } - protected void prepareSpeciesList(String speciesListId, JComponent speciesComponent) throws DataSourceException { - Set<String> speciesIds = getDataService().getSpeciesListSpeciesIds(getDataSource(), speciesListId); + public Set<String> loadSpeciesList(String speciesListId, String errorMessage) { + + Set<String> speciesIds; + try { + speciesIds = getDataService().getSpeciesListSpeciesIds(getDataSource(), speciesListId); + } catch (Exception e) { + + UIHelper.displayWarning(t("observe.title.speciesList.not.found"), t(errorMessage)); + speciesIds = Collections.emptySet(); + + } + return speciesIds; + + } + + + protected void prepareSpeciesList(String speciesListId, JComponent speciesComponent, String errorMessage) throws DataSourceException { + Set<String> speciesIds = loadSpeciesList(speciesListId, errorMessage); + speciesComponent.putClientProperty( ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE, Species2.newSpeciesByIdPredicate(speciesIds)); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java index a28ae64..ae4a399 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java @@ -461,12 +461,12 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLongline, C { String speciesListId = config.getSpeciesListLonglineCatchId(); - prepareSpeciesList(speciesListId, getUi().getSpeciesCatch()); + prepareSpeciesList(speciesListId, getUi().getSpeciesCatch(), n("observe.error.speciesList.longline.catch.notFound")); } { String speciesListId = config.getSpeciesListLonglineDepredatorId(); - prepareSpeciesList(speciesListId, getUi().getPredator()); + prepareSpeciesList(speciesListId, getUi().getPredator(), n("observe.error.speciesList.longline.depredator.notFound")); } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java index 1a17a5b..2392b1a 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java @@ -102,7 +102,7 @@ public class EncounterUIHandler extends ContentTableUIHandler<ActivityLongline, // add a listPredicate to get only species from the correct configured speciesList ObserveConfig config = getUi().getContextValue(ObserveConfig.class); String speciesListId = config.getSpeciesListLonglineEncounterId(); - prepareSpeciesList(speciesListId, getUi().getSpecies()); + prepareSpeciesList(speciesListId, getUi().getSpecies() , n("observe.error.speciesList.longline.encounter.notFound")); super.initUI(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java index d3d5c52..f01592f 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java @@ -209,7 +209,7 @@ public class TdrUIHandler extends ContentTableUIHandler<SetLongline, Tdr> { // add a listPredicate to get only species from the correct configured speciesList ObserveConfig config = getUi().getContextValue(ObserveConfig.class); String speciesListId = config.getSpeciesListLonglineCatchId(); - prepareSpeciesList(speciesListId, getUi().getSpecies()); + prepareSpeciesList(speciesListId, getUi().getSpecies(), n("observe.error.speciesList.longline.catch.notFound")); super.initUI(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java index fc2f5c7..9bbbd05 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java @@ -97,7 +97,7 @@ public class ObjectObservedSpeciesUIHandler extends ContentTableUIHandler<Floati // add a listPredicate to get only species from the correct configured speciesList ObserveConfig config = getUi().getContextValue(ObserveConfig.class); String speciesListId = config.getSpeciesListSeineObjectObservedSpeciesId(); - prepareSpeciesList(speciesListId, getUi().getSpecies()); + prepareSpeciesList(speciesListId, getUi().getSpecies(),n("observe.error.speciesList.seine.objectObservedSpecies.notFound")); super.initUI(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java index 14fe2c4..4823b5e 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java @@ -92,8 +92,8 @@ public class ObjectSchoolEstimateUIHandler extends ContentTableUIHandler<Floatin // add a listPredicate to get only species from the correct configured speciesList ObserveConfig config = getUi().getContextValue(ObserveConfig.class); - String speciesListId = config.getSpeciesListSeineObjectObservedSpeciesId(); - prepareSpeciesList(speciesListId, getUi().getSpecies()); + String speciesListId = config.getSpeciesListSeineObjectSchoolEstimateId(); + prepareSpeciesList(speciesListId, getUi().getSpecies(), n("observe.error.speciesList.seine.objectSchoolEstimate.notFound")); super.initUI(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java index f1f8cb8..2068cda 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java @@ -165,7 +165,8 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeine, Target // Keep only weight categories for the species ObserveConfig config = getUi().getContextValue(ObserveConfig.class); String speciesListId = config.getSpeciesListSeineTargetCatchId(); - java.util.Set<String> speciesIds = getDataService().getSpeciesListSpeciesIds(getDataSource(), speciesListId); + + java.util.Set<String> speciesIds = loadSpeciesList(speciesListId, n("observe.error.speciesList.seine.targetCatch.notFound")); categorieList = Species2.filterWeightCategoryBySpeciesIds( categorieList, speciesIds); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java index 55ad3a2..d9a1ae5 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java @@ -221,7 +221,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeine, // filtre sur la liste d'espèce configuree ObserveConfig config = getUi().getContextValue(ObserveConfig.class); String speciesListId = config.getSpeciesListSeineTargetCatchId(); - java.util.Set<String> speciesIds = getDataService().getSpeciesListSpeciesIds(getDataSource(), speciesListId); + java.util.Set<String> speciesIds = loadSpeciesList(speciesListId, n("observe.error.speciesList.seine.targetCatch.notFound")); categorieList = Species2.filterWeightCategoryBySpeciesIds( categorieList, speciesIds); diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index b8481be..dc596f2 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -1008,6 +1008,12 @@ observe.entity.message.updating= observe.error.can.not.create.directory= observe.error.no.activity.6= observe.error.open.first.db= +observe.error.speciesList.longline.catch.notFound= +observe.error.speciesList.longline.depredator.notFound= +observe.error.speciesList.longline.encounter.notFound= +observe.error.speciesList.seine.objectObservedSpecies.notFound= +observe.error.speciesList.seine.objectSchoolEstimate.notFound= +observe.error.speciesList.seine.targetCatch.notFound= observe.error.storage.could.not.backup.unsane.local.db= observe.error.storage.could.not.load.local.db= observe.floatingObject.message.creating=Creating a floating object @@ -1943,6 +1949,7 @@ observe.title.report.tip=Help to generate reports observe.title.save.localDB=Save local storage to a file observe.title.save.remoteDB=Save remote database to a file observe.title.show.usage=Show usages +observe.title.speciesList.not.found= observe.title.storage.info=Storage details observe.title.synchronize=Synchronize observe.title.synchronize.tip=Synchronize objectOperation on local database diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 5798666..31ac796 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -1008,6 +1008,12 @@ observe.entity.message.updating=Se está modificando el objeto actual '%1$s'. observe.error.can.not.create.directory=¡Imposible crear el directorio %1$s\! observe.error.no.activity.6=La actividad con código 6 no se ha encontrado en la base de datos. observe.error.open.first.db=La base está siendo utilizada por otra aplicación.\nPor favor, cierre la aplicación H2 y vuelva a intentarlo. +observe.error.speciesList.longline.catch.notFound= +observe.error.speciesList.longline.depredator.notFound= +observe.error.speciesList.longline.encounter.notFound= +observe.error.speciesList.seine.objectObservedSpecies.notFound= +observe.error.speciesList.seine.objectSchoolEstimate.notFound= +observe.error.speciesList.seine.targetCatch.notFound= observe.error.storage.could.not.backup.unsane.local.db= observe.error.storage.could.not.load.local.db= observe.floatingObject.message.creating=Objeto en proceso de creación. @@ -1943,6 +1949,7 @@ observe.title.report.tip= observe.title.save.localDB= observe.title.save.remoteDB= observe.title.show.usage= +observe.title.speciesList.not.found= observe.title.storage.info= observe.title.synchronize= observe.title.synchronize.tip= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index 92b3836..c6ff15d 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -1008,6 +1008,12 @@ observe.entity.message.updating=L'objet '%1$s' est en cours de modification. observe.error.can.not.create.directory=Création du répertoire %1$s impossible\! observe.error.no.activity.6=L'activité de type 6 n'a pas été trouvée en base. observe.error.open.first.db=La base est en cours d'utilisation par une autre application.\nVeuillez fermer l'application H2 et réessayer. +observe.error.speciesList.longline.catch.notFound=Impossible de charger la liste d'espèces.\nVérifier dans la configuration (Onglet Configuration des listes d'espèces (Palangre) > speciesList.longline.catch) que la liste d'espèces est bien renseignée. +observe.error.speciesList.longline.depredator.notFound=Impossible de charger la liste d'espèces.\nVérifier dans la configuration (Onglet Configuration des listes d'espèces (Palangre) > speciesList.longline.depredator) que la liste d'espèces est bien renseignée. +observe.error.speciesList.longline.encounter.notFound=Impossible de charger la liste d'espèces.\nVérifier dans la configuration (Onglet Configuration des listes d'espèces (Palangre) > speciesList.longline.encounter) que la liste d'espèces est bien renseignée. +observe.error.speciesList.seine.objectObservedSpecies.notFound=Impossible de charger la liste d'espèces.\nVérifier dans la configuration (Onglet Configuration des listes d'espèces (Senne) > speciesList.seine.objectObservedSpecies) que la liste d'espèces est bien renseignée. +observe.error.speciesList.seine.objectSchoolEstimate.notFound=Impossible de charger la liste d'espèces.\nVérifier dans la configuration (Onglet Configuration des listes d'espèces (Senne) > speciesList.seine.objectSchoolEstimate) que la liste d'espèces est bien renseignée. +observe.error.speciesList.seine.targetCatch.notFound=Impossible de charger la liste d'espèces.\nVérifier dans la configuration (Onglet Configuration des listes d'espèces (Senne) > speciesList.seine.targetCatch) que la liste d'espèces est bien renseignée. observe.error.storage.could.not.backup.unsane.local.db=Impossible d'enregistrer une base non endommagée observe.error.storage.could.not.load.local.db=Impossible d'ouvrir la base locale pour la raison suivante \: %s observe.floatingObject.message.creating=L'objet flottant est en cours de création. @@ -1941,6 +1947,7 @@ observe.title.report.tip=Aide à la génération du rapport de fin d'embarquemen observe.title.save.localDB=Sauver la base locale vers une fichier observe.title.save.remoteDB=Sauver la base distante vers un fichier observe.title.show.usage=Listes des utilisations d'un référentiel... +observe.title.speciesList.not.found=Liste d'espèces non trouvée observe.title.storage.info=Information sur la source de données observe.title.synchronize=Synchronisation du référentiel observe.title.synchronize.tip=Opération de synchronisation du référentiel de la base locale -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.