branch feature/7610 updated (849801d -> 56915d0)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7610 in repository observe. See http://git.codelutin.com/observe.git from 849801d ouverture des écrans de référentiel commun (refs #7610) new 085ea34 trad new 6f68958 fix typo new 162bca1 correction du ReferentielListRenderer pour grises les lignes désactivées quand les objets sont des referencedto (refs #7610) new d2e1010 filterReferentialListByStatus dans les combo new ed3328e correction du decorateur de referencedto pour que le tri fonctionne (refs #7610) new 9fdca20 correction du decorateur de referencedto pour le cas où des tokens sont des referencedtos (refs #7610) new 7840e88 déplacement de la clé i18n de referencestatus dans le dto plutôt que dans l'entité (refs #7610) new 56915d0 modification des decorateurs pour aller chercher en profondeur les attributs des referencedto qui sont eux même attributs (exemple de LengthWeightParameterDto : ocean est un attribut de type referencedto, il faut qu'on aille chercher le label) (refs #7610) 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 56915d055a17bdf01f621ae164df6ee7816ab044 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 17:44:21 2015 +0200 modification des decorateurs pour aller chercher en profondeur les attributs des referencedto qui sont eux même attributs (exemple de LengthWeightParameterDto : ocean est un attribut de type referencedto, il faut qu'on aille chercher le label) (refs #7610) commit 7840e880445721b597d8bbc59d15eda4e00d7edd Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 14:45:07 2015 +0200 déplacement de la clé i18n de referencestatus dans le dto plutôt que dans l'entité (refs #7610) commit 9fdca206b727f11fe9286ff9b597249ff236bfab Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 14:06:25 2015 +0200 correction du decorateur de referencedto pour le cas où des tokens sont des referencedtos (refs #7610) commit ed3328e8da4f4e9709464bdbfb4d82232616ad0e Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 11:17:06 2015 +0200 correction du decorateur de referencedto pour que le tri fonctionne (refs #7610) commit d2e10104ff632bf2b8d68a5c46eaeb72df377841 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:44:43 2015 +0200 filterReferentialListByStatus dans les combo commit 162bca10b55b0bd2e941216bd8eb4ea473f91daf Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:43:00 2015 +0200 correction du ReferentielListRenderer pour grises les lignes désactivées quand les objets sont des referencedto (refs #7610) commit 6f6895861ee9b55da464b09e359aa1d2b91ef647 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:32:32 2015 +0200 fix typo commit 085ea340702c5189e697b73ccd977ca4a6680b40 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:20:37 2015 +0200 trad Summary of changes: .../java/fr/ird/observe/ui/DecoratorService.java | 297 +++++++++++---------- .../observe/ui/content/ContentUIInitializer.java | 29 +- .../ui/content/ref/ContentReferenceUIHandler.java | 20 +- .../decorator/LengthWeightParameterDecorator.java | 14 +- .../ui/util/decorator/NonTargetCatchDecorator.java | 9 +- .../util/decorator/NonTargetLengthDecorator.java | 9 +- .../decorator/ObjectObservedSpeciesDecorator.java | 9 +- .../ui/util/decorator/ObserveDecorator.java | 56 +++- .../ui/util/decorator/ReferenceDecorator.java | 36 ++- .../ui/util/decorator/SpeciesDecorator.java | 9 +- .../ui/util/decorator/TripLonglineDecorator.java | 4 +- .../ui/util/decorator/TripSeineDecorator.java | 4 +- .../observe-application-swing_fr_FR.properties | 186 ++++++------- .../entities/constants/ReferenceStatus.java | 22 +- .../services/dto/constants/ReferenceStatus.java | 22 +- 15 files changed, 399 insertions(+), 327 deletions(-) -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit 085ea340702c5189e697b73ccd977ca4a6680b40 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:20:37 2015 +0200 trad --- .../observe-application-swing_fr_FR.properties | 156 ++++++++++----------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties index bd4de97..3353b60 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties @@ -732,19 +732,19 @@ observe.common.activities.list=Liste des activités observe.common.activity=Activité observe.common.activityLongline= observe.common.activitySeine=Activité -observe.common.baitHaulingStatus= +observe.common.baitHaulingStatus=Status de l'appât au virage +observe.common.baitSettingStatus=Status de l'appât au filage +observe.common.baitType=Type d'appât +observe.common.baitsComposition=Composition des appâts observe.common.baitObservation=Gleure -observe.common.baitSettingStatus= -observe.common.baitType= -observe.common.baitsComposition= -observe.common.basket= +observe.common.basket=Basket observe.common.birdsObservation=Oiseaux observe.common.boolean.false=Non observe.common.boolean.null=Indéterminé observe.common.boolean.true=Oui -observe.common.branchline= -observe.common.branchlineLength= -observe.common.branchlinesComposition= +observe.common.branchline=Avançon +observe.common.branchlineLength=Avançon (m) +observe.common.branchlinesComposition=Composition des avançons observe.common.brand=Marque observe.common.brandName=Marque observe.common.broughtOnDeck=Monté sur le pont @@ -752,8 +752,8 @@ observe.common.capacity=Capacité transport (m³) observe.common.capacityLabel=Libellé capacité observe.common.captain=Capitaine observe.common.caracteristics=Caractéristiques -observe.common.catchFateLongline= -observe.common.catchLongline= +observe.common.catchFateLongline=Devenir capture +observe.common.catchLongline=Capture observe.common.catchWeight=Poids estimé (en t) observe.common.catchWeightComputed.computed.tip=Le poids estimé a été calculé (%s) observe.common.catchWeightComputed.observed.tip=Le poids estimé a été observé @@ -781,53 +781,53 @@ observe.common.description=Description observe.common.detailledActivitiesObservation=Activités détaillées observe.common.detectionMode=Mode détection observe.common.directory=Répertoire -observe.common.encounter= -observe.common.encounterType= +observe.common.encounter=Rencontre +observe.common.encounterType=Type de rencontre observe.common.endDate=Fin de validité observe.common.endLogValue=Loch du soir (milles) observe.common.equation=Relation Taille-Poids observe.common.ersId=Id ERS -observe.common.faoCode= +observe.common.faoCode=Code FAO observe.common.file=Fichier observe.common.firstName=Prénom observe.common.flagCountry=Pavillon -observe.common.floatingObject= -observe.common.floatline1Length= -observe.common.floatline2Length= -observe.common.floatlineLengths= -observe.common.floatlinesComposition= +observe.common.floatingObject=Objet flottant +observe.common.floatline1Length=Orin 1 (m) +observe.common.floatline2Length=Orin 2 (m) +observe.common.floatlineLengths=Template +observe.common.floatlinesComposition=Composition des orins observe.common.formsUrl=URL des formulaires -observe.common.fpaZone= +observe.common.fpaZone=Zone FPA observe.common.gaugeLabel=Libellé jauge -observe.common.gear= -observe.common.gearCaracteristic= -observe.common.gearCaracteristicType= +observe.common.gear=Équipement +observe.common.gearCaracteristic=Caractéristique d'un équipement +observe.common.gearCaracteristicType=Type de caractéristique d'équipement observe.common.gearType=Type d'engin -observe.common.gearUseFeaturesLongline= -observe.common.gearUseFeaturesSeine= -observe.common.gender= +observe.common.gearUseFeaturesLongline=Équipement +observe.common.gearUseFeaturesSeine=Équipement +observe.common.gender=Sexe observe.common.generateReport=Générer un rapport de validation observe.common.global.progression.description=Progression globale -observe.common.gps.activity= -observe.common.gps.gpsPoint= -observe.common.gps.gpsPointInterval= -observe.common.gpsPointInterval= -observe.common.harbour= -observe.common.haulingIdentifier= -observe.common.healthness= +observe.common.gps.activity=Activité +observe.common.gps.gpsPoint=Point GPS +observe.common.gps.gpsPointInterval=Intervalle de points +observe.common.gpsPointInterval=Intervalle de points +observe.common.harbour=Port +observe.common.haulingIdentifier=Virage +observe.common.healthness=État de santé observe.common.heureobservation=Heure d'observation -observe.common.homeId= +observe.common.homeId=Identifiant observe.common.homeIdFAOWormsId=Code 3L / FAO / Worms -observe.common.hookPosition= -observe.common.hookSize= -observe.common.hookType= -observe.common.hooksComposition= -observe.common.id= -observe.common.inconnu= +observe.common.hookPosition=Position du hameçon +observe.common.hookSize=Taille +observe.common.hookType=Type d'hameçon +observe.common.hooksComposition=Composition des hameçons +observe.common.id=Identifiant +observe.common.inconnu=inconnu observe.common.iso2Code=code ISO-2 observe.common.iso3Code=Code ISO-3 -observe.common.itemHorizontalPosition= -observe.common.itemVerticalPosition= +observe.common.itemHorizontalPosition=Localisation de l'élément sur la ligne mère +observe.common.itemVerticalPosition=Localisation de l'élément sur l'avançon observe.common.keelCodeFlotte=Code quille /Code flotte observe.common.label1=Libellé anglais observe.common.label2=Libellé français @@ -846,16 +846,16 @@ observe.common.length.inf=Longueur (cm inf.) observe.common.length.observed.tip=La longueur a été observée observe.common.lengthMeasureType=Type de mensuration observe.common.lengthWeightFormula=Relation Poids -observe.common.lengthWeightParameter= +observe.common.lengthWeightParameter=Relation Taille-Poids observe.common.libelles=Libellés -observe.common.lightsticksColor= -observe.common.lightsticksType= -observe.common.lineType= -observe.common.locode= +observe.common.lightsticksColor=Couleur de baton lumineux +observe.common.lightsticksType=Type de baton lumineux +observe.common.lineType=Type de ligne +observe.common.locode=Locode observe.common.longitude=Longitude observe.common.lowerValueUpperValue=Borne min-max observe.common.mammalsObservation=Mammifères -observe.common.maturityStatus= +observe.common.maturityStatus=Maturité observe.common.meanLength=Taille moyenne (en cm) observe.common.meanLengthComputed.computed.tip=La taille moyenne a été calculée (%s) observe.common.meanLengthComputed.observed.tip=La taille moyenne a été observée @@ -869,28 +869,28 @@ observe.common.measureType.lf=LF observe.common.measureType.unknown=Inconnu observe.common.minLengthMax=Taille min-max (en cm) observe.common.minWeightMax=Poids min-max (en Kg) -observe.common.mitigationType= -observe.common.name= +observe.common.mitigationType=Type de mesure d'atténuation +observe.common.name=Nom observe.common.needComment=Nécessite un commentaire observe.common.nextFpaZone=Zone FPA pénétrée observe.common.no.balise=Aucune balise lue -observe.common.nocode= +observe.common.nocode=code absent observe.common.nonCoupSenne=Non coup de senne observe.common.nonTargetCatch=Faune accessoire conservée ou rejetée -observe.common.nonTargetLength= +observe.common.nonTargetLength=Longueur (cm inf.) observe.common.nonTargetObservation=Faune associée observe.common.nonTargetSample=Echantillon faune accessoire observe.common.none=Aucun observe.common.objectFate=Devenir de l'objet observe.common.objectObservedSpecies=Faune observée observe.common.objectOperation=Opération sur l'objet -observe.common.objectSchoolEstimate= +observe.common.objectSchoolEstimate=Estimation banc objet observe.common.objectType=Type d'objet observe.common.objectsObservation=Objet flottants observe.common.observedSystem=Système observé observe.common.observedSystemDistance=Distance système observé (en milles avec 1 décimale) observe.common.observer=Observateur -observe.common.observerLabel= +observe.common.observerLabel=Observateur observe.common.obsolete.entity=Le référentiel %1$s est désactivé. observe.common.ocean=Océan observe.common.ocean/label1=Océan @@ -922,8 +922,8 @@ observe.common.program.observation.value.7=valeur 7 non définie observe.common.program.observation.value.8=valeur 8 non définie observe.common.program.observation.value.9=valeur 9 non définie observe.common.reasonForDiscard=Raison rejet -observe.common.reasonForNoFishing= -observe.common.reasonForNullSet= +observe.common.reasonForNoFishing=Raison de non coup de Senne +observe.common.reasonForNullSet=Cause coup nul observe.common.reportsUrl=URL de rapport observe.common.resume=Résumé de la configuration observe.common.route=Route @@ -934,7 +934,7 @@ observe.common.schoolType=Type de banc observe.common.scientificLabel=Libellé scientifique observe.common.seaSurfaceTemperature=Température surface (°) observe.common.searchMaximum=Vitesse maximale -observe.common.section= +observe.common.section=Section observe.common.select.gps.import.file=Fichier à importer observe.common.select.gps.import.file.tip=Choisir le fichier de trace GPS à importer observe.common.select.gps.maxDelay=Temps maximum (mn) @@ -950,24 +950,24 @@ observe.common.select.validate.mode.tip=Choisir le type de données à valider observe.common.select.validate.scope=Niveau de validation observe.common.select.validate.scope.tip=Choisir le ou les niveaux de validation observe.common.selected.validators=Nombre de validateurs détectés \: %1$s -observe.common.sensorBrand= -observe.common.sensorDataFormat= -observe.common.sensorPosition= -observe.common.sensorType= -observe.common.sensorUsed= -observe.common.setLongline= -observe.common.setSeine= -observe.common.settingIdentifier= -observe.common.settingShape= +observe.common.sensorBrand=Marque de capteur +observe.common.sensorDataFormat=Format de données de capteur +observe.common.sensorPosition=Position de capteur +observe.common.sensorType=Type de capteur +observe.common.sensorUsed=Capteur utilisé +observe.common.setLongline=Opération de pêche +observe.common.setSeine=Calée +observe.common.settingIdentifier=Filage +observe.common.settingShape=Forme au filage observe.common.sex=Sexe -observe.common.sizeMeasure= -observe.common.sizeMeasureType= +observe.common.sizeMeasure=Mesure de taille +observe.common.sizeMeasureType=Type de mesure de taille observe.common.species=Espèce -observe.common.species/scientificLabel= +observe.common.species/scientificLabel=Espèce observe.common.speciesFate=Devenir espèce observe.common.speciesFaune=Espèce de faune observe.common.speciesGroup=Groupe espèce -observe.common.speciesList= +observe.common.speciesList=Liste d'espèces observe.common.speciesStatus=Statut faune observée observe.common.speciesThon=Espèce de thon observe.common.speedRange=Libellé vitesse vent @@ -977,7 +977,7 @@ observe.common.startDateFinValidite=Début - fin de validité observe.common.startLogValue=Loch du matin (milles) observe.common.status=Statut observe.common.step.description=Description de l'étape -observe.common.stomacFullness= +observe.common.stomacFullness=Niveau de remplissage de l'estomac observe.common.storage.not.valid=Source de données non configurée observe.common.supportVesselName=Nom supply observe.common.surroundingActivity=Activité environnante @@ -986,12 +986,12 @@ observe.common.taillePoids.caracteristics=Caractéristiques Taille-Poids observe.common.targetCatch=Capture cible observe.common.targetDiscarded=Rejet de thon observe.common.targetDiscardsObservation=Rejets thon -observe.common.targetLength= +observe.common.targetLength=Taille Thon observe.common.targetSample=Echantillon thon rejeté observe.common.targetSampleCapture=Echantillon thon capturé -observe.common.tdr= -observe.common.tdrRecord= -observe.common.time= +observe.common.tdr=Enregistreur de profondeur +observe.common.tdrRecord=Enregistrement de profondeur +observe.common.time=Heure observe.common.topiaCreateDate=Date de création observe.common.topiaId=Identifiant technique observe.common.topiaVersion=Version @@ -999,8 +999,8 @@ observe.common.totalCount=Nombre estimé observe.common.totalCountComputed.computed.tip=Le nombre estimé a été calculé (%s) observe.common.totalCountComputed.observed.tip=Le nombre estimé a été observé observe.common.totalWeight=Poids -observe.common.tracelineLength= -observe.common.transmittingBuoy= +observe.common.tracelineLength=Partie basse (m) +observe.common.transmittingBuoy=Balise lue observe.common.transmittingBuoyOperation=Opération balise observe.common.transmittingBuoyType=Type de balise observe.common.tripLongline=Marée @@ -1041,8 +1041,8 @@ observe.common.weight.ind=Poids ind. (en Kg) observe.common.weight.observed.tip=Le poids a été observé observe.common.weightCategory=Catégorie de poids observe.common.weightLengthFormula=Relation Taille -observe.common.weightMeasure= -observe.common.weightMeasureType= +observe.common.weightMeasure=Mesure de poids +observe.common.weightMeasureType=Type de mesure de poids observe.common.well=Cuve observe.common.wind=Vent Beaufort observe.common.yearService=Année de mise en service -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit 6f6895861ee9b55da464b09e359aa1d2b91ef647 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:32:32 2015 +0200 fix typo --- .../observe-application-swing_fr_FR.properties | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties index 3353b60..e07c7d4 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties @@ -29,16 +29,16 @@ observe.action.auto.copy.to.clipboard=Copie automatique dans le presse-papier observe.action.auto.copy.to.clipboard.tip=Mettre à jour automatiquement le contenu du presse-papier avec les résultats observe.action.back.to.list=Retour à la liste observe.action.back.to.list.tip=Retour à la liste des données -observe.action.baitHaulingStatus.create.tip=Créer un nouveau status de l'appât au virage -observe.action.baitHaulingStatus.delete.tip=Supprimer le status de l'appât au virage sélectionné -observe.action.baitHaulingStatus.detail.tip=Voir les détails du status de l'appât au virage sélectionné -observe.action.baitHaulingStatus.modify.tip=Modifier le status de l'appât au virage sélectionné -observe.action.baitHaulingStatus.save.tip=Sauver les modifications du status de l'appât au virage -observe.action.baitSettingStatus.create.tip=Créer un nouveau status de l'appât au filage -observe.action.baitSettingStatus.delete.tip=Supprimer le status de l'appât au filage sélectionné -observe.action.baitSettingStatus.detail.tip=Voir les détails du status de l'appât au filage sélectionné -observe.action.baitSettingStatus.modify.tip=Modifier le status de l'appât au filage sélectionné -observe.action.baitSettingStatus.save.tip=Sauver les modifications du status de l'appât au filage +observe.action.baitHaulingStatus.create.tip=Créer un nouveau statut de l'appât au virage +observe.action.baitHaulingStatus.delete.tip=Supprimer le statut de l'appât au virage sélectionné +observe.action.baitHaulingStatus.detail.tip=Voir les détails du statut de l'appât au virage sélectionné +observe.action.baitHaulingStatus.modify.tip=Modifier le statut de l'appât au virage sélectionné +observe.action.baitHaulingStatus.save.tip=Sauver les modifications du statuts de l'appât au virage +observe.action.baitSettingStatus.create.tip=Créer un nouveau statut de l'appât au filage +observe.action.baitSettingStatus.delete.tip=Supprimer le statut de l'appât au filage sélectionné +observe.action.baitSettingStatus.detail.tip=Voir les détails du statut de l'appât au filage sélectionné +observe.action.baitSettingStatus.modify.tip=Modifier le statut de l'appât au filage sélectionné +observe.action.baitSettingStatus.save.tip=Sauver les modifications du statut de l'appât au filage observe.action.baitType.create.tip=Créer un nouveau type d'appât observe.action.baitType.delete.tip=Supprimer le type d'appât sélectionné observe.action.baitType.detail.tip=Voir les détails du type d'appât sélectionné @@ -732,11 +732,11 @@ observe.common.activities.list=Liste des activités observe.common.activity=Activité observe.common.activityLongline= observe.common.activitySeine=Activité -observe.common.baitHaulingStatus=Status de l'appât au virage -observe.common.baitSettingStatus=Status de l'appât au filage +observe.common.baitHaulingStatus=Statut de l'appât au virage +observe.common.baitObservation=Gleure +observe.common.baitSettingStatus=Statut de l'appât au filage observe.common.baitType=Type d'appât observe.common.baitsComposition=Composition des appâts -observe.common.baitObservation=Gleure observe.common.basket=Basket observe.common.birdsObservation=Oiseaux observe.common.boolean.false=Non @@ -2156,8 +2156,8 @@ observe.title.consolidate=Consolider les données observateur observe.title.consolidate.tip=Consolider les données observateur observe.title.content.HookSizes= observe.title.content.HookTypes= -observe.title.content.baitHaulingStatuss=Gestion des status de l'appât au virage -observe.title.content.baitSettingStatuss=Gestion des status de l'appât au filage +observe.title.content.baitHaulingStatuss=Gestion des statuts de l'appât au virage +observe.title.content.baitSettingStatuss=Gestion des statuts de l'appât au filage observe.title.content.baitTypes=Gestion des types d'appât observe.title.content.catchFateLonglines=Gestion des devenirs capture observe.title.content.country=Gestion des pays @@ -2246,8 +2246,8 @@ observe.tree.activityLongline=Activités observe.tree.activityLonglineDto.unsaved=Nouvelle activité observe.tree.activitySeine=Activités observe.tree.activitySeineDto.unsaved=Nouvelle activité -observe.tree.baitHaulingStatus=Status de l'appât au virage -observe.tree.baitSettingStatus=Status de l'appât au filage +observe.tree.baitHaulingStatus=Statut de l'appât au virage +observe.tree.baitSettingStatus=Statut de l'appât au filage observe.tree.baitType=Type d'appât observe.tree.catchFateLongline=Devenir capture observe.tree.catchLongline=Captures @@ -2263,7 +2263,7 @@ observe.tree.gearCaracteristicType=Type de caractéristique d'équipement observe.tree.gearUseFeaturesLongline=Équipements observe.tree.gearUseFeaturesSeine=Équipements observe.tree.harbour=Port -observe.tree.healthness=Status de la capture +observe.tree.healthness=Statuts de la capture observe.tree.hookPosition=Position du hameçon observe.tree.hookSize=Taille d'hameçon observe.tree.hookType=Type d'hameçon -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit 162bca10b55b0bd2e941216bd8eb4ea473f91daf Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:43:00 2015 +0200 correction du ReferentielListRenderer pour grises les lignes désactivées quand les objets sont des referencedto (refs #7610) --- .../observe/ui/content/ContentUIInitializer.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) 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 44d811d..579f276 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 @@ -32,6 +32,7 @@ import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.constants.ReferenceStatus; import fr.ird.observe.services.dto.referential.ReferentialDto; +import fr.ird.observe.services.dto.referential.ReferentialDtos; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.actions.shared.AbstractUIAction; import fr.ird.observe.ui.util.BooleanEditor; @@ -1011,27 +1012,32 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E normalColor = comp.getForeground(); } - String tip = ((JLabel) comp).getText(); + String tip = null; // par defaut, on utilise la couleur normale Color col = normalColor; if (value != null && - value instanceof ReferentialDto) { + (value instanceof ReferentialDto || value instanceof ReferenceDto)) { - ReferentialDto e = (ReferentialDto) value; - ReferenceStatus status = e.getStatus(); + ReferenceStatus status = null; + + if (value instanceof ReferentialDto) { + ReferentialDto e = (ReferentialDto) value; + status = e.getStatus(); + + } else { + ReferenceDto e = (ReferenceDto) value; + if (e.getPropertyNames().contains(ReferentialDto.PROPERTY_STATUS)) { + status = (ReferenceStatus) e.getPropertyValue(ReferentialDto.PROPERTY_STATUS); + } + } if (status == ReferenceStatus.disabled) { // l'entite est desactivee // on la grise pour bien la differencier col = disableColor; - tip = t("observe.common.obsolete.entity", tip); - - } else { - tip = null; + tip = t("observe.common.obsolete.entity", ((JLabel) comp).getText()); } - } else { - tip = null; } comp.setForeground(col); comp.setToolTipText(tip); -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit d2e10104ff632bf2b8d68a5c46eaeb72df377841 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 10:44:43 2015 +0200 filterReferentialListByStatus dans les combo --- .../src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 579f276..e699d43 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 @@ -1079,8 +1079,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E "], size : " + newValue.size()); } //TC-20100208 : on ne veut pas voir les elements du referentiel non actif - //FIXME -// ReferenceEntities.filterReferentielListByStatus(newValue); + ReferentialDtos.filterReferentialListByStatus(newValue); E selectedItem = (E) comboBox.getSelectedItem(); -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit ed3328e8da4f4e9709464bdbfb4d82232616ad0e Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 11:17:06 2015 +0200 correction du decorateur de referencedto pour que le tri fonctionne (refs #7610) --- .../ui/util/decorator/ReferenceDecorator.java | 43 +++++++++++++++------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java index 480a2e8..224e407 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java @@ -1,11 +1,8 @@ package fr.ird.observe.ui.util.decorator; -import com.google.common.collect.ImmutableList; import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.referential.ReferentialDto; - -import java.util.HashMap; -import java.util.Map; +import org.apache.commons.jxpath.JXPathContext; import static org.nuiton.i18n.I18n.t; @@ -19,18 +16,36 @@ public class ReferenceDecorator extends ObserveDecorator<ReferenceDto> implement } @Override - public String toString(Object bean) { - if (bean instanceof ReferenceDto) { - ReferenceDto ref = (ReferenceDto) bean; - Map map = new HashMap<>(); - ImmutableList<String> propertyNames = ref.getPropertyNames(); - for (String propertyName : propertyNames) { - Object value = ((ReferenceDto) bean).getPropertyValue(propertyName); - map.put(propertyName, value); + protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { + + // assume all values are comparable + Comparable<Comparable<?>> value; + + Object contextBean = jxcontext.getContextBean(); + + if (contextBean instanceof ReferenceDto) { + + ReferenceDto referenceBean = (ReferenceDto) contextBean; + + + if (referenceBean.getPropertyNames().contains(token)) { + + value = (Comparable<Comparable<?>>) referenceBean.getPropertyValue(token); + + if (value == null) { + value = (Comparable<Comparable<?>>) getDefaultNullValue(token); + } + + } else { + value = (Comparable<Comparable<?>>) getDefaultUndefinedValue(token); } - bean = map; + + } else { + value = super.getTokenValue(jxcontext, token); } - return super.toString(bean); + + return value; + } @Override -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit 9fdca206b727f11fe9286ff9b597249ff236bfab Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 14:06:25 2015 +0200 correction du decorateur de referencedto pour le cas où des tokens sont des referencedtos (refs #7610) --- .../java/fr/ird/observe/ui/DecoratorService.java | 2 +- .../ui/util/decorator/ReferenceDecorator.java | 31 +++++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java index d63d690..997181a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java @@ -559,7 +559,7 @@ public class DecoratorService extends DecoratorProvider { // LengthWeightParameter decorator registerDecorator(new LengthWeightParameterDecorator(libelle)); registerReferenceDtoDecorator(LengthWeightParameterDto.class, - "${gender}$s##${ocean/" + libelle + "}$s##${species/scientificLabel}$s##" + + "${sex/label}$s##${ocean/label}$s##${species/scientificLabel}$s##" + t("observe.common.lengthWeightFormula") + " ${lengthWeightFormula}$s"); // gps decorators diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java index 224e407..62926af 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java @@ -4,6 +4,8 @@ import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.referential.ReferentialDto; import org.apache.commons.jxpath.JXPathContext; +import java.io.Serializable; + import static org.nuiton.i18n.I18n.t; /** @@ -19,7 +21,7 @@ public class ReferenceDecorator extends ObserveDecorator<ReferenceDto> implement protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { // assume all values are comparable - Comparable<Comparable<?>> value; + Comparable<Comparable<?>> value = null; Object contextBean = jxcontext.getContextBean(); @@ -27,17 +29,32 @@ public class ReferenceDecorator extends ObserveDecorator<ReferenceDto> implement ReferenceDto referenceBean = (ReferenceDto) contextBean; + String[] tokens = token.split("/"); + + for (int i = 0 ; i < tokens.length - 1 ; i++) { + + if (referenceBean.getPropertyNames().contains(tokens[i])) { + + Serializable propertyValue = referenceBean.getPropertyValue(tokens[i]); + + if (propertyValue == null || !(propertyValue instanceof ReferenceDto)) { - if (referenceBean.getPropertyNames().contains(token)) { + return (Comparable<Comparable<?>>) getDefaultUndefinedValue(token); - value = (Comparable<Comparable<?>>) referenceBean.getPropertyValue(token); + } - if (value == null) { - value = (Comparable<Comparable<?>>) getDefaultNullValue(token); + referenceBean = (ReferenceDto) propertyValue; } + } + + String lastToken = tokens[tokens.length - 1]; + if (referenceBean.getPropertyNames().contains(lastToken)) { + value = (Comparable<Comparable<?>>) referenceBean.getPropertyValue(lastToken); + } + - } else { - value = (Comparable<Comparable<?>>) getDefaultUndefinedValue(token); + if (value == null) { + value = (Comparable<Comparable<?>>) getDefaultNullValue(tokens[0]); } } else { -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit 7840e880445721b597d8bbc59d15eda4e00d7edd Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 14:45:07 2015 +0200 déplacement de la clé i18n de referencestatus dans le dto plutôt que dans l'entité (refs #7610) --- .../entities/constants/ReferenceStatus.java | 22 ++-------------------- .../services/dto/constants/ReferenceStatus.java | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/constants/ReferenceStatus.java b/observe-entities/src/main/java/fr/ird/observe/entities/constants/ReferenceStatus.java index b9898e6..37e1683 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/constants/ReferenceStatus.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/constants/ReferenceStatus.java @@ -21,9 +21,6 @@ */ package fr.ird.observe.entities.constants; -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - /** * Une énumération pour caractériser les valeurs des status d'une entité du * référentiel @@ -34,24 +31,9 @@ import static org.nuiton.i18n.I18n.t; public enum ReferenceStatus { /** status desactive */ - disabled(n("observe.common.reference.status.disabled")), + disabled, /** status active */ - enabled(n("observe.common.reference.status.enabled")); - - private String i18nKey; - - ReferenceStatus(String i18nKey) { - this.i18nKey = i18nKey; - } - - public String getI18nKey() { - return i18nKey; - } - - @Override - public String toString() { - return t(i18nKey); - } + enabled } diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/constants/ReferenceStatus.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/constants/ReferenceStatus.java index dbc6eef..166a458 100644 --- a/observe-services-model/src/main/java/fr/ird/observe/services/dto/constants/ReferenceStatus.java +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/constants/ReferenceStatus.java @@ -22,6 +22,9 @@ package fr.ird.observe.services.dto.constants; * #L% */ +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + /** * Une énumération pour caractériser les valeurs des status d'une entité du * référentiel @@ -32,9 +35,24 @@ package fr.ird.observe.services.dto.constants; public enum ReferenceStatus { /** status desactive */ - disabled, + disabled(n("observe.common.reference.status.disabled")), /** status active */ - enabled; + enabled(n("observe.common.reference.status.enabled")); + + private String i18nKey; + + ReferenceStatus(String i18nKey) { + this.i18nKey = i18nKey; + } + + public String getI18nKey() { + return i18nKey; + } + + @Override + public String toString() { + return t(i18nKey); + } } -- 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/7610 in repository observe. See http://git.codelutin.com/observe.git commit 56915d055a17bdf01f621ae164df6ee7816ab044 Author: Kevin Morin <morin@codelutin.com> Date: Thu Oct 15 17:44:21 2015 +0200 modification des decorateurs pour aller chercher en profondeur les attributs des referencedto qui sont eux même attributs (exemple de LengthWeightParameterDto : ocean est un attribut de type referencedto, il faut qu'on aille chercher le label) (refs #7610) --- .../java/fr/ird/observe/ui/DecoratorService.java | 297 +++++++++++---------- .../ui/content/ref/ContentReferenceUIHandler.java | 20 +- .../decorator/LengthWeightParameterDecorator.java | 14 +- .../ui/util/decorator/NonTargetCatchDecorator.java | 9 +- .../util/decorator/NonTargetLengthDecorator.java | 9 +- .../decorator/ObjectObservedSpeciesDecorator.java | 9 +- .../ui/util/decorator/ObserveDecorator.java | 56 +++- .../ui/util/decorator/ReferenceDecorator.java | 26 +- .../ui/util/decorator/SpeciesDecorator.java | 9 +- .../ui/util/decorator/TripLonglineDecorator.java | 4 +- .../ui/util/decorator/TripSeineDecorator.java | 4 +- 11 files changed, 246 insertions(+), 211 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java index 997181a..6e4d744 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java @@ -46,6 +46,7 @@ import fr.ird.observe.services.dto.referential.OceanDto; import fr.ird.observe.services.dto.referential.OrganismDto; import fr.ird.observe.services.dto.referential.PersonDto; import fr.ird.observe.services.dto.referential.ProgramDto; +import fr.ird.observe.services.dto.referential.ReferentialDto; import fr.ird.observe.services.dto.referential.SexDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.SpeciesGroupDto; @@ -96,6 +97,7 @@ import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; import fr.ird.observe.services.dto.referential.seine.WindDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; +import fr.ird.observe.services.dto.seine.GearUseFeaturesMeasurementSeineDto; import fr.ird.observe.services.dto.seine.ObjectSchoolEstimateDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.SchoolEstimateDto; @@ -108,6 +110,7 @@ import fr.ird.observe.ui.util.decorator.LengthWeightParameterDecorator; import fr.ird.observe.ui.util.decorator.NonTargetCatchDecorator; import fr.ird.observe.ui.util.decorator.NonTargetLengthDecorator; import fr.ird.observe.ui.util.decorator.ObjectObservedSpeciesDecorator; +import fr.ird.observe.ui.util.decorator.ObserveDecorator; import fr.ird.observe.ui.util.decorator.ReferenceDecorator; import fr.ird.observe.ui.util.decorator.SpeciesDecorator; import fr.ird.observe.ui.util.decorator.TripLonglineDecorator; @@ -392,6 +395,8 @@ public class DecoratorService extends DecoratorProvider { n("observe.common.branchlineLength"); n("observe.common.tracelineLength"); + n("observe.common.gearUseFeaturesMeasurementSeine"); + } @Override @@ -405,191 +410,211 @@ public class DecoratorService extends DecoratorProvider { Locale locale = referentialLocale.getLocale(); String libelle = referentialLocale.getLibelle(); - registerJXPathDecorator(ProgramDto.class, - t("observe.common.program") + - " ${" + libelle + "}$s"); - registerReferenceDtoDecorator(ProgramDto.class, t("observe.common.program") + " ${label}$s"); - registerJXPathDecorator(RouteDto.class, - "${date}$td/%1$tm/%1$tY"); + registerReferenceDtoDecorator(ProgramDto.class, + t("observe.common.program") + " ${" + libelle + "}$s", + t("observe.common.program") + " ${label}$s"); registerReferenceDtoDecorator(RouteDto.class, "${date}$td/%1$tm/%1$tY"); - registerMultiJXPathDecorator( - ActivitySeineDto.class, - "${time}$tH:%1$tM##${vesselActivitySeine/" + libelle + "}$s", - "##", " - "); - registerReferenceDtoDecorator(ActivitySeineDto.class, "${time}$tH:%1$tM##${vesselActivitySeine}$s"); - registerMultiJXPathDecorator( - ActivityLonglineDto.class, - "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${vesselActivityLongline/" + libelle + "}$s", - "##", " - "); + registerReferenceDtoDecorator(ActivitySeineDto.class, + "${time}$tH:%1$tM##${vesselActivitySeine/label}$s", + "${time}$tH:%1$tM##${vesselActivitySeine}$s", + " - "); registerReferenceDtoDecorator(ActivityLonglineDto.class, - "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${vesselActivityLongline}$s"); - registerMultiJXPathDecorator(PersonDto.class, "${lastName}$s##${firstName}$s", "##", " "); + "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${vesselActivityLongline/label}$s", + "${timeStamp}$td/%1$tm/%1$tY %1$tH:%1$tM##${vesselActivityLongline}$s", + " - "); registerReferenceDtoDecorator(PersonDto.class, "${lastName}$s##${firstName}$s"); - registerDefaultReferenceDtoDecorator(SexDto.class); + registerReferentialReferenceDtoDecorator(SexDto.class, libelle); //FIXME Use startDate - endDate - registerDefaultReferenceDtoDecorator(FpaZoneDto.class); - registerDefaultReferenceDtoDecorator(OceanDto.class); - registerDefaultReferenceDtoDecorator(DetectionModeDto.class); - registerDefaultReferenceDtoDecorator(VesselDto.class); - registerDefaultReferenceDtoDecorator(CountryDto.class); + registerReferentialReferenceDtoDecorator(FpaZoneDto.class, libelle); + registerReferentialReferenceDtoDecorator(OceanDto.class, libelle); + registerReferentialReferenceDtoDecorator(DetectionModeDto.class, libelle); + registerReferentialReferenceDtoDecorator(VesselDto.class, libelle); + registerReferentialReferenceDtoDecorator(CountryDto.class, libelle); registerReferenceDtoDecorator(VesselSizeCategoryDto.class, "${code}$s##${gaugeLabel}$s##${capacityLabel}$s"); - registerDefaultReferenceDtoDecorator(VesselTypeDto.class); - registerDefaultReferenceDtoDecorator(VesselActivitySeineDto.class); - registerDefaultReferenceDtoDecorator(SurroundingActivityDto.class); - registerDefaultReferenceDtoDecorator(ObservedSystemDto.class); + registerReferentialReferenceDtoDecorator(VesselTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(VesselActivitySeineDto.class, libelle); + registerReferentialReferenceDtoDecorator(SurroundingActivityDto.class, libelle); + registerReferentialReferenceDtoDecorator(ObservedSystemDto.class, libelle); registerReferenceDtoDecorator(WindDto.class, "${code}$s##${label}$s##${speedRange}$s"); - registerMultiJXPathDecorator( - FloatingObjectDto.class, - "DCP ${objectType/" + libelle + "}$s", "##", " - "); - registerReferenceDtoDecorator(FloatingObjectDto.class, "DCP ${objectType}$s"); + registerReferenceDtoDecorator(FloatingObjectDto.class, "DCP ${objectType/" + libelle + "}$s", "DCP ${objectType}$s", " - "); //FIXME Remove this - registerJXPathDecorator(SetSeineDto.class, t("observe.common.setSeine")); + registerObserveDecorator(SetSeineDto.class, t("observe.common.setSeine")); //FIXME Remove this - registerJXPathDecorator(SetLonglineDto.class, t("observe.common.setLongline")); - registerDefaultReferenceDtoDecorator(ObjectFateDto.class); - registerDefaultReferenceDtoDecorator(OrganismDto.class); - registerDefaultReferenceDtoDecorator(ObjectTypeDto.class); - registerDefaultReferenceDtoDecorator(ObjectOperationDto.class); - registerDefaultReferenceDtoDecorator(SpeciesStatusDto.class); - registerDefaultReferenceDtoDecorator(TransmittingBuoyTypeDto.class); - registerDefaultReferenceDtoDecorator(TransmittingBuoyOperationDto.class); - registerDefaultReferenceDtoDecorator(ReasonForNullSetDto.class); - registerDefaultReferenceDtoDecorator(ReasonForNoFishingDto.class); - registerDefaultReferenceDtoDecorator(WeightCategoryDto.class); - registerDefaultReferenceDtoDecorator(ReasonForDiscardDto.class); - registerDefaultReferenceDtoDecorator(SpeciesFateDto.class); - registerDefaultReferenceDtoDecorator(SpeciesGroupDto.class); - registerDefaultReferenceDtoDecorator(SpeciesListDto.class); - - registerDefaultReferenceDtoDecorator(BaitHaulingStatusDto.class); - registerDefaultReferenceDtoDecorator(BaitSettingStatusDto.class); - registerDefaultReferenceDtoDecorator(BaitTypeDto.class); - registerDefaultReferenceDtoDecorator(CatchFateLonglineDto.class); - registerDefaultReferenceDtoDecorator(EncounterTypeDto.class); - registerDefaultReferenceDtoDecorator(HealthnessDto.class); - registerDefaultReferenceDtoDecorator(HookPositionDto.class); - registerDefaultReferenceDtoDecorator(HookSizeDto.class); - registerDefaultReferenceDtoDecorator(HookTypeDto.class); - registerDefaultReferenceDtoDecorator(ItemVerticalPositionDto.class); - registerDefaultReferenceDtoDecorator(ItemHorizontalPositionDto.class); - registerDefaultReferenceDtoDecorator(LightsticksColorDto.class); - registerDefaultReferenceDtoDecorator(LightsticksTypeDto.class); - registerDefaultReferenceDtoDecorator(LineTypeDto.class); - registerDefaultReferenceDtoDecorator(MaturityStatusDto.class); - registerDefaultReferenceDtoDecorator(MitigationTypeDto.class); + registerObserveDecorator(SetLonglineDto.class, t("observe.common.setLongline")); + registerReferentialReferenceDtoDecorator(ObjectFateDto.class, libelle); + registerReferentialReferenceDtoDecorator(OrganismDto.class, libelle); + registerReferentialReferenceDtoDecorator(ObjectTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(ObjectOperationDto.class, libelle); + registerReferentialReferenceDtoDecorator(SpeciesStatusDto.class, libelle); + registerReferentialReferenceDtoDecorator(TransmittingBuoyTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(TransmittingBuoyOperationDto.class, libelle); + registerReferentialReferenceDtoDecorator(ReasonForNullSetDto.class, libelle); + registerReferentialReferenceDtoDecorator(ReasonForNoFishingDto.class, libelle); + registerReferentialReferenceDtoDecorator(WeightCategoryDto.class, libelle); + registerReferentialReferenceDtoDecorator(ReasonForDiscardDto.class, libelle); + registerReferentialReferenceDtoDecorator(SpeciesFateDto.class, libelle); + registerReferentialReferenceDtoDecorator(SpeciesGroupDto.class, libelle); + registerReferentialReferenceDtoDecorator(SpeciesListDto.class, libelle); + + registerReferentialReferenceDtoDecorator(BaitHaulingStatusDto.class, libelle); + registerReferentialReferenceDtoDecorator(BaitSettingStatusDto.class, libelle); + registerReferentialReferenceDtoDecorator(BaitTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(CatchFateLonglineDto.class, libelle); + registerReferentialReferenceDtoDecorator(EncounterTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(HealthnessDto.class, libelle); + registerReferentialReferenceDtoDecorator(HookPositionDto.class, libelle); + registerReferentialReferenceDtoDecorator(HookSizeDto.class, libelle); + registerReferentialReferenceDtoDecorator(HookTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(ItemVerticalPositionDto.class, libelle); + registerReferentialReferenceDtoDecorator(ItemHorizontalPositionDto.class, libelle); + registerReferentialReferenceDtoDecorator(LightsticksColorDto.class, libelle); + registerReferentialReferenceDtoDecorator(LightsticksTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(LineTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(MaturityStatusDto.class, libelle); + registerReferentialReferenceDtoDecorator(MitigationTypeDto.class, libelle); registerReferenceDtoDecorator(SensorBrandDto.class, "${code}$s##${brandName}$s"); - registerDefaultReferenceDtoDecorator(SensorDataFormatDto.class); - registerDefaultReferenceDtoDecorator(SensorTypeDto.class); - registerDefaultReferenceDtoDecorator(SettingShapeDto.class); - registerDefaultReferenceDtoDecorator(SizeMeasureTypeDto.class); - registerDefaultReferenceDtoDecorator(StomacFullnessDto.class); - registerDefaultReferenceDtoDecorator(TripTypeDto.class); - registerDefaultReferenceDtoDecorator(VesselActivityLonglineDto.class); - registerDefaultReferenceDtoDecorator(WeightMeasureTypeDto.class); - registerDefaultReferenceDtoDecorator(GearCaracteristicTypeDto.class); - registerDefaultReferenceDtoDecorator(GearCaracteristicDto.class); - registerDefaultReferenceDtoDecorator(GearDto.class); + registerReferentialReferenceDtoDecorator(SensorDataFormatDto.class, libelle); + registerReferentialReferenceDtoDecorator(SensorTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(SettingShapeDto.class, libelle); + registerReferentialReferenceDtoDecorator(SizeMeasureTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(StomacFullnessDto.class, libelle); + registerReferentialReferenceDtoDecorator(TripTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(VesselActivityLonglineDto.class, libelle); + registerReferentialReferenceDtoDecorator(WeightMeasureTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(GearCaracteristicTypeDto.class, libelle); + registerReferentialReferenceDtoDecorator(GearCaracteristicDto.class, libelle); + registerReferentialReferenceDtoDecorator(GearDto.class, libelle); registerReferenceDtoDecorator(HarbourDto.class, "${code}$s##${name}$s##${locode}$s"); - registerMultiJXPathDecorator( - ObjectSchoolEstimateDto.class, - "${species/scientificLabel}$s##${weight}$d", "##", - " - "); - registerMultiJXPathDecorator( - SchoolEstimateDto.class, - "${species/scientificLabel}$s##${weight}$d##${meanWeight}$d", "##", " - "); - registerMultiJXPathDecorator( + registerObserveDecorator(ObjectSchoolEstimateDto.class, "${species/scientificLabel}$s##${weight}$d"); + registerObserveDecorator(SchoolEstimateDto.class, "${species/scientificLabel}$s##${weight}$d##${meanWeight}$d"); + registerObserveDecorator( TargetCatchDto.class, - "${weightCategory/species/scientificLabel}$s##${weightCategory/" + libelle + "}$s##${weight}$f", "##", " - "); - registerMultiJXPathDecorator( + "${weightCategory/species/scientificLabel}$s##${weightCategory/label}$s##${weight}$f"); + registerObserveDecorator( TargetLengthDto.class, - "${species/scientificLabel}$s##${length}$f##${count}$d", "##", " - "); + "${species/scientificLabel}$s##${length}$f##${count}$d"); - registerMultiJXPathDecorator( + registerObserveDecorator( TransmittingBuoyDto.class, - "${transmittingBuoyType/" + libelle + "}$s##${transmittingBuoyOperation/" + libelle + "}$s##${code}$s", "##", - " - "); + "${transmittingBuoyType/label}$s##${transmittingBuoyOperation/label}$s##${code}$s"); String settingIdentifier = l(locale, "observe.common.settingIdentifier"); String haulingIdentifier = l(locale, "observe.common.haulingIdentifier"); - registerMultiJXPathDecorator( + registerObserveDecorator( SectionDto.class, - " ${settingIdentifier}$s (" + settingIdentifier + ")##${haulingIdentifier}$s (" + haulingIdentifier + ")", "##", " - "); + " ${settingIdentifier}$s (" + settingIdentifier + ")##${haulingIdentifier}$s (" + haulingIdentifier + ")"); - registerMultiJXPathDecorator( + registerObserveDecorator( BasketDto.class, - " ${settingIdentifier}$s (" + settingIdentifier + ")##${haulingIdentifier}$s (" + haulingIdentifier + ")", "##", " - "); + " ${settingIdentifier}$s (" + settingIdentifier + ")##${haulingIdentifier}$s (" + haulingIdentifier + ")"); - registerMultiJXPathDecorator( + registerObserveDecorator( BranchlineDto.class, - " ${settingIdentifier}$s (" + settingIdentifier + ")##${haulingIdentifier}$s (" + haulingIdentifier + ")", "##", " - "); + " ${settingIdentifier}$s (" + settingIdentifier + ")##${haulingIdentifier}$s (" + haulingIdentifier + ")"); - registerJXPathDecorator(SectionDto.class, HAULING_IDENTIFIER, "${haulingIdentifier}$s"); - registerJXPathDecorator(BasketDto.class, HAULING_IDENTIFIER, "${haulingIdentifier}$s"); - registerJXPathDecorator(BranchlineDto.class, HAULING_IDENTIFIER, "${haulingIdentifier}$s"); + registerObserveDecorator(HAULING_IDENTIFIER, SectionDto.class, "${haulingIdentifier}$s"); + registerObserveDecorator(HAULING_IDENTIFIER, BasketDto.class, "${haulingIdentifier}$s"); + registerObserveDecorator(HAULING_IDENTIFIER, BranchlineDto.class, "${haulingIdentifier}$s"); // TripSeine decorator - registerDecorator(new TripSeineDecorator(libelle)); - registerReferenceDtoDecorator(TripSeineDto.class, - "${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel}$s##${observer}$s"); - + registerDecorator(new TripSeineDecorator()); + registerDecorator(TripSeineDto.class.getSimpleName(), + new ReferenceDecorator("${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel}$s##${observer}$s")); // TripLongline decorator - registerDecorator(new TripLonglineDecorator(libelle)); - registerReferenceDtoDecorator(TripLonglineDto.class, - "${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel}$s##${observer}$s"); + registerDecorator(new TripLonglineDecorator()); + registerDecorator(TripLonglineDto.class.getSimpleName(), + new ReferenceDecorator("${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel}$s##${observer}$s")); String oldCode = l(locale, "observe.common.oldCode3L"); // Species decorator - registerDecorator(new SpeciesDecorator(libelle, oldCode)); - registerReferenceDtoDecorator(SpeciesDto.class, - "${faoCode}$s##${scientificLabel}$s##" + oldCode + " ${homeId}$s"); + registerDecorator(new SpeciesDecorator( oldCode)); + registerDecorator(SpeciesDto.class.getSimpleName(), + new ReferenceDecorator("${faoCode}$s##${scientificLabel}$s##" + oldCode + " ${homeId}$s")); // ObjectObservedSpecies decorator - registerDecorator(new ObjectObservedSpeciesDecorator(libelle)); + registerDecorator(new ObjectObservedSpeciesDecorator()); // NonTargetCatch decorator - registerDecorator(new NonTargetCatchDecorator(libelle)); + registerDecorator(new NonTargetCatchDecorator()); // NonTargetLength decorator - registerDecorator(new NonTargetLengthDecorator(libelle)); + registerDecorator(new NonTargetLengthDecorator()); // LengthWeightParameter decorator - registerDecorator(new LengthWeightParameterDecorator(libelle)); - registerReferenceDtoDecorator(LengthWeightParameterDto.class, - "${sex/label}$s##${ocean/label}$s##${species/scientificLabel}$s##" + - t("observe.common.lengthWeightFormula") + " ${lengthWeightFormula}$s"); + registerDecorator(new LengthWeightParameterDecorator()); + registerDecorator(LengthWeightParameterDto.class.getSimpleName(), + new ReferenceDecorator("${sex/label}$s##${ocean/label}$s##${species/scientificLabel}$s##" + + t("observe.common.lengthWeightFormula") + " ${lengthWeightFormula}$s")); // gps decorators - registerJXPathDecorator(ActivitySeineDto.class, - "activity-gps", - t("observe.common.gps.activity")); - registerJXPathDecorator(GPSPoint.class, - "gpsPoint-gps", - t("observe.common.gps.gpsPoint")); - registerJXPathDecorator(GPSPointInterval.class, - "gpsPointInterval-gps", - t("observe.common.gps.gpsPointInterval")); - - registerMultiJXPathDecorator(GPSPoint.class, - "${time}$td/%1$tm/%1$tY %1$tH:%1$tM##${latitude}$s##${longitude}$s", - "##", " "); - - registerMultiJXPathDecorator(SectionTemplate.class, "${id}$s##${floatlineLengths}$s", "##", " "); - - registerJXPathDecorator(CatchLonglineDto.class, "${homeId}$s"); - registerJXPathDecorator(TdrDto.class, "${homeId}$s"); + registerObserveDecorator("activity-gps", + ActivitySeineDto.class, + t("observe.common.gps.activity")); + registerObserveDecorator("gpsPoint-gps", + GPSPoint.class, + t("observe.common.gps.gpsPoint")); + registerObserveDecorator(GPSPointInterval.class, + "gpsPointInterval-gps", + t("observe.common.gps.gpsPointInterval")); + + registerObserveDecorator(GPSPoint.class, + "${time}$td/%1$tm/%1$tY %1$tH:%1$tM##${latitude}$s##${longitude}$s", + " "); + + registerObserveDecorator(SectionTemplate.class, "${id}$s##${floatlineLengths}$s", " "); + + registerObserveDecorator(CatchLonglineDto.class, "${homeId}$s"); + registerObserveDecorator(TdrDto.class, "${homeId}$s"); + + //FIXME how to decorate ? + registerObserveDecorator(GearUseFeaturesMeasurementSeineDto.class, "${id}$s"); } - protected <T extends IdDto> void registerDefaultReferenceDtoDecorator(Class<T> referenceType) { - registerReferenceDtoDecorator(referenceType, "${code}$s##${label}$s"); + protected <T extends ReferentialDto> void registerReferentialReferenceDtoDecorator(Class<T> referenceType, + String libelle) { + registerDecorator(referenceType.getSimpleName(), new ReferenceDecorator("${code}$s##${label}$s")); + registerObserveDecorator(referenceType, "${code}$s##${" + libelle + "}$s", " "); } + protected <T extends IdDto> void registerReferenceDtoDecorator(Class<T> referenceType, String expression) { - registerDecorator(referenceType.getSimpleName(), new ReferenceDecorator(expression)); + registerReferenceDtoDecorator(referenceType, expression, expression); + } + + protected <T extends IdDto> void registerReferenceDtoDecorator(Class<T> referenceType, + String expression, + String referenceExpression) { + registerReferenceDtoDecorator(referenceType, expression, referenceExpression, " "); + } + + protected <T extends IdDto> void registerReferenceDtoDecorator(Class<T> referenceType, + String expression, + String referenceExpression, + String separator) { + registerDecorator(referenceType.getSimpleName(), new ReferenceDecorator(referenceExpression)); + registerObserveDecorator(referenceType, expression, separator); + } + + + protected <T> void registerObserveDecorator(Class<T> referenceType, String expression) { + registerDecorator(new ObserveDecorator<>(referenceType, expression)); + } + + protected <T> void registerObserveDecorator(Class<T> referenceType, String expression, String separator) { + registerDecorator(new ObserveDecorator<>(referenceType, expression, separator)); + } + + protected <T> void registerObserveDecorator(String context, Class<T> referenceType, String expression) { + registerDecorator(context, new ObserveDecorator<>(referenceType, expression)); + } + + protected <T> void registerObserveDecorator(String context, Class<T> referenceType, String expression, String separator) { + registerDecorator(context, new ObserveDecorator<>(referenceType, expression, separator)); } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java index 51ffcab..f09d0d9 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java @@ -52,6 +52,7 @@ import jaxx.runtime.swing.CardLayout2Ext; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.swing.editor.bean.BeanListHeader; import jaxx.runtime.validator.swing.SwingValidatorUtil; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; @@ -258,10 +259,10 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content String[] columns = new String[nbColumns]; System.arraycopy(naturalIds, 0, columns, 1, naturalIds.length); - columns[0] = Introspector.decapitalize(beanType.getSimpleName()); + columns[0] = StringUtils.removeEnd(Introspector.decapitalize(beanType.getSimpleName()), "Dto"); DecoratorService dService = getDecoratorService(); - Decorator<E> decorator = dService.getDecoratorByType(beanType); + Decorator<ReferenceDto> decorator = dService.getDecoratorByType(ReferenceDto.class, beanType.getSimpleName()); for (ReferenceDto<E> e : entities.getReference()) { @@ -270,7 +271,10 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content data[0] = decorator.toString(e); for (String property : naturalIds) { - Object o = e.getPropertyValue(property); + Object o = null; + if (e.getPropertyNames().contains(property)) { + o = e.getPropertyValue(property); + } if (ContentReferenceUIModel.DEFAULT_PROPERTIES[0].equals(property) && o == null) { // cas special du code à 0, le loador ne retourne pas // de valeur car c'est la valeur par defaut d'un type @@ -390,11 +394,11 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content content.add(new JLabel(bean.getId())); //FIXME -// content.add(new JLabel(t("observe.common.topiaCreateDate"))); -// content.add(new JLabel(bean.getTopiaCreateDate().toString())); -// -// content.add(new JLabel(t("observe.common.topiaVersion"))); -// content.add(new JLabel(bean.getTopiaVersion() + "")); + content.add(new JLabel(t("observe.common.topiaCreateDate"))); + content.add(new JLabel("test")); + + content.add(new JLabel(t("observe.common.topiaVersion"))); + content.add(new JLabel("test")); SpringUtilities.makeCompactGrid(content, 3, 2, 5, 5, 5, 5); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/LengthWeightParameterDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/LengthWeightParameterDecorator.java index 61916f2..08a5fcf 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/LengthWeightParameterDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/LengthWeightParameterDecorator.java @@ -36,14 +36,11 @@ public class LengthWeightParameterDecorator extends ObserveDecorator<LengthWeigh private static final long serialVersionUID = 1L; - private final String libelle; - - public LengthWeightParameterDecorator(String libelle) throws IllegalArgumentException, NullPointerException { + public LengthWeightParameterDecorator() throws IllegalArgumentException, NullPointerException { super(LengthWeightParameterDto.class, - "${gender}$s##${ocean/" + libelle + "}$s##${species/scientificLabel}$s##" + + "${sex}$s##${ocean/label}$s##${species/scientificLabel}$s##" + t("observe.common.lengthWeightFormula") + " ${lengthWeightFormula}$s" ); - this.libelle = libelle; } @SuppressWarnings({"unchecked"}) @@ -64,14 +61,11 @@ public class LengthWeightParameterDecorator extends ObserveDecorator<LengthWeigh value = super.getTokenValue(jxcontext, token); if (token.equals("species/scientificLabel") && "xx".equals(value)) { - value = super.getTokenValue(jxcontext, - "species/" + - libelle); + value = super.getTokenValue(jxcontext, "species/label"); } if (token.equals("sex")) { value = super.getTokenValue(jxcontext, - "sex/" + - libelle); + "sex/label"); value = t("observe.common.sex") + ' ' + value; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetCatchDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetCatchDecorator.java index f7e9e4b..0fde90a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetCatchDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetCatchDecorator.java @@ -34,13 +34,10 @@ public class NonTargetCatchDecorator extends ObserveDecorator<NonTargetCatchDto> private static final long serialVersionUID = 1L; - private final String libelle; - - public NonTargetCatchDecorator(String libelle) { + public NonTargetCatchDecorator() { super(NonTargetCatchDto.class, - "${species/scientificLabel}$s##${speciesFate/" + libelle + "}$s" + "${species/scientificLabel}$s##${speciesFate/label}$s" ); - this.libelle = libelle; } @Override @@ -49,7 +46,7 @@ public class NonTargetCatchDecorator extends ObserveDecorator<NonTargetCatchDto> Comparable<Comparable<?>> value = super.getTokenValue(jxcontext, token); if (token.equals("species/scientificLabel") && "xx".equals(String.valueOf(value))) { - value = super.getTokenValue(jxcontext, "species/" + libelle); + value = super.getTokenValue(jxcontext, "species/label"); } return value; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetLengthDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetLengthDecorator.java index 77c753d..140b737 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetLengthDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/NonTargetLengthDecorator.java @@ -34,13 +34,10 @@ public class NonTargetLengthDecorator extends ObserveDecorator<NonTargetLengthDt private static final long serialVersionUID = 1L; - private final String libelle; - - public NonTargetLengthDecorator(String libelle) throws IllegalArgumentException, NullPointerException { + public NonTargetLengthDecorator() throws IllegalArgumentException, NullPointerException { super(NonTargetLengthDto.class, "${species/scientificLabel}$s##${length}$f##${gender}$s" ); - this.libelle = libelle; } @SuppressWarnings({"unchecked"}) @@ -51,10 +48,10 @@ public class NonTargetLengthDecorator extends ObserveDecorator<NonTargetLengthDt super.getTokenValue(jxcontext, token); if (token.equals("species/scientificLabel") && "xx".equals(value)) { - value = super.getTokenValue(jxcontext, "species/" + libelle); + value = super.getTokenValue(jxcontext, "species/label"); } if ("sex".equals(token)) { - value = super.getTokenValue(jxcontext, "sex/" + libelle); + value = super.getTokenValue(jxcontext, "sex/label"); } return (Comparable<Comparable<?>>) value; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObjectObservedSpeciesDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObjectObservedSpeciesDecorator.java index cba7594..0122e9f 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObjectObservedSpeciesDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObjectObservedSpeciesDecorator.java @@ -34,20 +34,17 @@ public class ObjectObservedSpeciesDecorator extends ObserveDecorator<ObjectObser private static final long serialVersionUID = 1L; - private final String libelle; - - public ObjectObservedSpeciesDecorator(String libelle) { + public ObjectObservedSpeciesDecorator() { super(ObjectObservedSpeciesDto.class, - "${species/scientificLabel}$s##${speciesStatus/" + libelle + "}$s##${count}$d" + "${species/scientificLabel}$s##${speciesStatus/label}$s##${count}$d" ); - this.libelle = libelle; } @Override protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { Comparable<Comparable<?>> value = super.getTokenValue(jxcontext, token); if (token.equals("species/scientificLabel") && "xx".equals(String.valueOf(value))) { - value = super.getTokenValue(jxcontext, "species/" + libelle); + value = super.getTokenValue(jxcontext, "species/label"); } return value; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObserveDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObserveDecorator.java index 887777f..401495d 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObserveDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ObserveDecorator.java @@ -21,11 +21,15 @@ */ package fr.ird.observe.ui.util.decorator; +import fr.ird.observe.services.dto.ReferenceDto; import org.apache.commons.jxpath.JXPathContext; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.MultiJXPathDecorator; +import java.io.Serializable; + import static org.nuiton.i18n.I18n.t; /** @@ -34,7 +38,8 @@ import static org.nuiton.i18n.I18n.t; * @author Tony Chemit - chemit@codelutin.com * @since 2.4 */ -public abstract class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Cloneable { +public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Cloneable { + private static final long serialVersionUID = 1L; /** Logger. */ @@ -44,11 +49,14 @@ public abstract class ObserveDecorator<E> extends MultiJXPathDecorator<E> implem public static final String DEFAULT_SEPARATOR_REPLACEMENT = " - "; - protected ObserveDecorator(Class<E> internalClass, String expression) { + public ObserveDecorator(Class<E> internalClass, String expression) { super(internalClass, expression, DEFAULT_SEPARATOR, DEFAULT_SEPARATOR_REPLACEMENT); } + public ObserveDecorator(Class<E> internalClass, String expression, String separator) { + super(internalClass, expression, DEFAULT_SEPARATOR, separator); + } @Override public final Object clone() throws CloneNotSupportedException { @@ -60,8 +68,22 @@ public abstract class ObserveDecorator<E> extends MultiJXPathDecorator<E> implem String token) { // assume all values are comparable Comparable<Comparable<?>> value; + try { - value = (Comparable<Comparable<?>>) jxcontext.getValue(token); + + String[] tokens = token.split("/"); + + Object value0 = jxcontext.getValue(tokens[0]); + + if (value0 instanceof ReferenceDto) { + + value = getValueFromReferenceDto(tokens, (ReferenceDto) value0, 1); + + } else { + + value = (Comparable<Comparable<?>>) jxcontext.getValue(token); + } + if (value == null) { value = (Comparable<Comparable<?>>) getDefaultNullValue(token); } @@ -73,6 +95,34 @@ public abstract class ObserveDecorator<E> extends MultiJXPathDecorator<E> implem return value; } + protected Comparable<Comparable<?>> getValueFromReferenceDto(String[] tokens, ReferenceDto referenceBean, int startIndex) { + + for (int i = startIndex, max = tokens.length - 1 ; i < max ; i++) { + + if (referenceBean.getPropertyNames().contains(tokens[i])) { + + Serializable propertyValue = referenceBean.getPropertyValue(tokens[i]); + + if (propertyValue == null || !(propertyValue instanceof ReferenceDto)) { + + return (Comparable<Comparable<?>>) getDefaultUndefinedValue(StringUtils.join(tokens, "/")); + + } + + referenceBean = (ReferenceDto) propertyValue; + } + } + + Comparable<Comparable<?>> value = null; + + String lastToken = tokens[tokens.length - 1]; + if (referenceBean.getPropertyNames().contains(lastToken)) { + value = (Comparable<Comparable<?>>) referenceBean.getPropertyValue(lastToken); + } + + return value; + } + protected Comparable<?> getDefaultUndefinedValue(String token) { if (log.isWarnEnabled()) { log.warn("No defined value for token [" + token + "]"); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java index 62926af..84443a8 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/ReferenceDecorator.java @@ -4,8 +4,6 @@ import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.referential.ReferentialDto; import org.apache.commons.jxpath.JXPathContext; -import java.io.Serializable; - import static org.nuiton.i18n.I18n.t; /** @@ -27,31 +25,9 @@ public class ReferenceDecorator extends ObserveDecorator<ReferenceDto> implement if (contextBean instanceof ReferenceDto) { - ReferenceDto referenceBean = (ReferenceDto) contextBean; - String[] tokens = token.split("/"); - for (int i = 0 ; i < tokens.length - 1 ; i++) { - - if (referenceBean.getPropertyNames().contains(tokens[i])) { - - Serializable propertyValue = referenceBean.getPropertyValue(tokens[i]); - - if (propertyValue == null || !(propertyValue instanceof ReferenceDto)) { - - return (Comparable<Comparable<?>>) getDefaultUndefinedValue(token); - - } - - referenceBean = (ReferenceDto) propertyValue; - } - } - - String lastToken = tokens[tokens.length - 1]; - if (referenceBean.getPropertyNames().contains(lastToken)) { - value = (Comparable<Comparable<?>>) referenceBean.getPropertyValue(lastToken); - } - + value = getValueFromReferenceDto(tokens, (ReferenceDto) contextBean, 0); if (value == null) { value = (Comparable<Comparable<?>>) getDefaultNullValue(tokens[0]); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/SpeciesDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/SpeciesDecorator.java index 373bd1d..deaa492 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/SpeciesDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/SpeciesDecorator.java @@ -36,8 +36,6 @@ public class SpeciesDecorator extends ObserveDecorator<SpeciesDto> { private static final long serialVersionUID = 1L; - private final String libelle; - static { // pour avoir les traduction sur le nom de la propriété @@ -46,16 +44,13 @@ public class SpeciesDecorator extends ObserveDecorator<SpeciesDto> { n("observe.common.species/scientificLabel"); n("observe.common.scientificLabel"); n("observe.common.homeId"); - - } - public SpeciesDecorator(String libelle, String oldCode) { + public SpeciesDecorator(String oldCode) { super(SpeciesDto.class, "${faoCode}$s##${scientificLabel}$s##" + oldCode + " ${homeId}$s" ); - this.libelle = libelle; } @Override @@ -63,7 +58,7 @@ public class SpeciesDecorator extends ObserveDecorator<SpeciesDto> { Comparable<?> value; value = super.getTokenValue(jxcontext, token); if (token.equals(SpeciesDto.PROPERTY_SCIENTIFIC_LABEL) && "xx".equals(value)) { - value = super.getTokenValue(jxcontext, libelle); + value = super.getTokenValue(jxcontext, "label"); } return (Comparable<Comparable<?>>) value; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripLonglineDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripLonglineDecorator.java index 3379b30..8a31565 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripLonglineDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripLonglineDecorator.java @@ -33,9 +33,9 @@ public class TripLonglineDecorator extends ObserveDecorator<TripLonglineDto> { private static final long serialVersionUID = 1L; - public TripLonglineDecorator(String libelle) throws IllegalArgumentException, NullPointerException { + public TripLonglineDecorator() throws IllegalArgumentException, NullPointerException { super(TripLonglineDto.class, - "${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel/" + libelle + "}$s##${observerLabel}$s" + "${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel/label}$s##${observerLabel}$s" ); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripSeineDecorator.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripSeineDecorator.java index 264ee96..5b61153 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripSeineDecorator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/decorator/TripSeineDecorator.java @@ -34,9 +34,9 @@ public class TripSeineDecorator extends ObserveDecorator<TripSeineDto> { private static final long serialVersionUID = 1L; - public TripSeineDecorator(String libelle) throws IllegalArgumentException, NullPointerException { + public TripSeineDecorator() throws IllegalArgumentException, NullPointerException { super(TripSeineDto.class, - "${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel/" + libelle + "}$s##${observerLabel}$s" + "${startDate}$td/%1$tm/%1$tY##${endDate}$td/%2$tm/%2$tY##${vessel/label}$s##${observerLabel}$s" ); } -- 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