[Suiviobsmer-commits] r685 - in trunk: wao-business/src/main/java/fr/ifremer/wao wao-business/src/main/java/fr/ifremer/wao/bean wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/resources/i18n wao-business/src/main/xmi wao-ui/src/main/java/fr/ifremer/wao/ui/components wao-ui/src/main/java/fr/ifremer/wao/ui/pages wao-ui/src/main/resources/fr/ifremer/wao/ui/components wao-ui/src/main/webapp wao-ui/src/main/webapp/css
Author: bleny Date: 2010-10-18 14:25:45 +0000 (Mon, 18 Oct 2010) New Revision: 685 Log: style for indicators tables, sumup coefficient, migrating SynthesisService to deliver compliance instead of non-compliance, and i18n on enmum (to be done properly later) Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties trunk/wao-business/src/main/xmi/wao.zargo trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/IndicatorLevels.tml trunk/wao-ui/src/main/webapp/Administration.tml trunk/wao-ui/src/main/webapp/Synthesis.tml trunk/wao-ui/src/main/webapp/css/common.css trunk/wao-ui/src/main/webapp/css/synthesis.css Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-10-18 14:25:45 UTC (rev 685) @@ -334,7 +334,7 @@ SynthesisId.IND_COMPLIANCE_BOARDING, SynthesisId.GRAPH_BOARDING, SynthesisId.IND_ALLEGRO_REACTIVITY, - SynthesisId.IND_SAMPLE_RELIABILITY }; + SynthesisId.IND_DATA_RELIABILITY }; double coefficientValue = 1.0; @@ -385,7 +385,7 @@ queries.add(getInsertIndicatorLevelQuery_1_6(topiaIndicatorLevelIdPrefix + topiaIdSuffix++, 4, 10.0, indicatorTopiaId)); queries.add(getInsertIndicatorLevelQuery_1_6(topiaIndicatorLevelIdPrefix + topiaIdSuffix++, 5, 5.0, indicatorTopiaId)); // 5 days - indicatorTopiaId = indicatorsTopiaIds.get(SynthesisId.IND_SAMPLE_RELIABILITY); + indicatorTopiaId = indicatorsTopiaIds.get(SynthesisId.IND_DATA_RELIABILITY); queries.add(getInsertIndicatorLevelQuery_1_6(topiaIndicatorLevelIdPrefix + topiaIdSuffix++, 1, 80.0, indicatorTopiaId)); queries.add(getInsertIndicatorLevelQuery_1_6(topiaIndicatorLevelIdPrefix + topiaIdSuffix++, 2, 85.0, indicatorTopiaId)); queries.add(getInsertIndicatorLevelQuery_1_6(topiaIndicatorLevelIdPrefix + topiaIdSuffix++, 3, 90.0, indicatorTopiaId)); Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java 2010-10-18 14:25:45 UTC (rev 685) @@ -23,6 +23,8 @@ */ package fr.ifremer.wao.bean; +import static org.nuiton.i18n.I18n._; + /** * SynthesisID * @@ -33,36 +35,45 @@ public enum SynthesisId { /** */ - GRAPH_SAMPLING("graph1"), + GRAPH_SAMPLING("graph1", "wao.business.bean.SynthesisId.graph_sampling"), /** */ - GRAPH_BOARDING("graph2"), + GRAPH_BOARDING("graph2", "wao.business.bean.SynthesisId.graph_boarding"), /** */ - IND_NON_COMPLIANCE_BOARDING("ind1"), + IND_NON_COMPLIANCE_BOARDING("ind1", "wao.business.bean.SynthesisId.non_compliance_boarding"), /** */ - IND_CONTACT_STATE("ind2"), + IND_CONTACT_STATE("ind2", "wao.business.bean.SynthesisId.contact_state"), /** */ - IND_ALLEGRO_REACTIVITY("ind3"), + IND_ALLEGRO_REACTIVITY("ind3", "wao.business.bean.SynthesisId.allegro_reactivity"), /** */ - IND_COMPLIANCE_BOARDING("ind4"), + IND_COMPLIANCE_BOARDING("ind4", "wao.business.bean.SynthesisId.compliance_boarding"), /** */ - IND_SAMPLE_RELIABILITY("ind5"); + IND_DATA_RELIABILITY("ind5", "wao.business.bean.SynthesisId.data_reliability"); - private String blockId; + protected String blockId; - SynthesisId(String blockId) { + /** An i18n key to make enumeration printable in logs and UI. */ + protected String label; + + SynthesisId(String blockId, String label) { this.blockId = blockId; + this.label = label; } public String getBlockId() { return blockId; } + /** Get a translated name for the current value. */ + public String getLabel() { + return _(label); + } + public static SynthesisId getSynthesisId(String blockId) { for (SynthesisId synthesisId : SynthesisId.values()) { if (synthesisId.getBlockId().equals(blockId)) { Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-10-18 14:25:45 UTC (rev 685) @@ -260,7 +260,7 @@ return result; } - @Override + public Map<String, Double> executeGetNonComplianceBoardingIndicator( TopiaContext transaction, Company company) throws TopiaException { @@ -354,6 +354,24 @@ } @Override + protected Map<String, Double> executeGetComplianceBoardingIndicator( + TopiaContext transaction, Company company) throws Exception { + // here, we need compliance, so we get non-compliance values + // and we make the operation to switch + + Map<String, Double> nonCompliances = executeGetNonComplianceBoardingIndicator(transaction, company); + Map<String, Double> compliances = new HashMap<String, Double>(); + + // make the switch, fill compliances with data from nonCompliances + for (Map.Entry<String, Double> nonCompliance : nonCompliances.entrySet()) { + Double compliance = 1.0 - nonCompliance.getValue(); + compliances.put(nonCompliance.getKey(), compliance); + } + + return compliances; + } + + @Override public Collection<ContactStateStatistics> executeGetContactStateStatistics( TopiaContext transaction, Company company, PeriodDates period) throws TopiaException { Modified: trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties =================================================================== --- trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-business/src/main/resources/i18n/wao-business-en_GB.properties 2010-10-18 14:25:45 UTC (rev 685) @@ -2,6 +2,13 @@ wao.business.bean.DataReliability.not_reliable=not reliable wao.business.bean.DataReliability.reliable=reliable wao.business.bean.DataReliability.unknown=unknown +wao.business.bean.SynthesisId.allegro_reactivity= +wao.business.bean.SynthesisId.compliance_boarding= +wao.business.bean.SynthesisId.contact_state= +wao.business.bean.SynthesisId.data_reliability= +wao.business.bean.SynthesisId.graph_boarding= +wao.business.bean.SynthesisId.graph_sampling= +wao.business.bean.SynthesisId.non_compliance_boarding= wao.error.boat.canCreateContact= wao.error.boat.getNbBoarding= wao.error.boatInfos.getNbBoardingForCompany= @@ -67,6 +74,7 @@ wao.error.serviceSampling.getSampleRowsOrderedByFishingZone= wao.error.serviceSampling.importSamplingPlanCsv= wao.error.serviceSynthesis.getBoardingBoats= +wao.error.serviceSynthesis.getComplianceBoardingIndicator= wao.error.serviceSynthesis.getContactDataInputDateReactivity= wao.error.serviceSynthesis.getContactPieChartData= wao.error.serviceSynthesis.getContactPieChartDataByBoatDistrict= Modified: trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties =================================================================== --- trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties 2010-10-18 14:25:45 UTC (rev 685) @@ -2,6 +2,13 @@ wao.business.bean.DataReliability.not_reliable=non exploitable wao.business.bean.DataReliability.reliable=exploitable wao.business.bean.DataReliability.unknown=non renseign\u00E9e +wao.business.bean.SynthesisId.allegro_reactivity=D\u00E9lais de transmission des donn\u00E9es +wao.business.bean.SynthesisId.compliance_boarding=Respect du nombre d'observateurs embarqu\u00E9s +wao.business.bean.SynthesisId.contact_state=\u00C9tats des contacts +wao.business.bean.SynthesisId.data_reliability=Qualit\u00E9 de la donn\u00E9e +wao.business.bean.SynthesisId.graph_boarding=Taux d'embarquement sur un m\u00EAme navire conforme aux exigences +wao.business.bean.SynthesisId.graph_sampling=Taux de r\u00E9alisation du plan d'\u00E9chantillonage +wao.business.bean.SynthesisId.non_compliance_boarding=Non-respect du nombre d'observateurs embarqu\u00E9s wao.error.boat.canCreateContact=Impossible de cr\u00E9er un nouveau contact pour la soci\u00E9t\u00E9 %1$s et le navire %2$s (%3$d) wao.error.boat.getNbBoarding=Impossible de r\u00E9cup\u00E9rer le nombre d'embarquements r\u00E9els depuis le %1$s wao.error.boatInfos.getNbBoardingForCompany=Impossible de r\u00E9cup\u00E9rer le nombre d'embarquements r\u00E9els depuis le %1$s pour la soci\u00E9t\u00E9 %2$s @@ -66,6 +73,7 @@ wao.error.serviceSampling.getSampleRowsOrderedByFishingZone=Impossible de r\u00E9cup\u00E9rer la liste des lignes du plan d'\u00E9chantillonnage wao.error.serviceSampling.importSamplingPlanCsv=Erreur \u00E0 la ligne %1$d [CODE \= %2$s] wao.error.serviceSynthesis.getBoardingBoats=Impossible de r\u00E9cup\u00E9rer les donn\u00E9es du graphique concernant les embarquements sur les navires +wao.error.serviceSynthesis.getComplianceBoardingIndicator= wao.error.serviceSynthesis.getContactDataInputDateReactivity=Impossible de r\u00E9cup\u00E9rer l'indicateur de r\u00E9activit\u00E9 sur les dates de saisies dans Allegro wao.error.serviceSynthesis.getContactPieChartData= wao.error.serviceSynthesis.getContactPieChartDataByBoatDistrict= Modified: trunk/wao-business/src/main/xmi/wao.zargo =================================================================== (Binary files differ) Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/IndicatorLevels.java 2010-10-18 14:25:45 UTC (rev 685) @@ -30,6 +30,10 @@ @Parameter(required = false) private IndicatorLevel highlightLevel; + /** if true, add a last line with a text explaining what colors mean. */ + @Parameter(required = false) + private Boolean withLegend; + /* variable used in view */ @Property private IndicatorLevel indicatorLevel; @@ -41,6 +45,13 @@ return indicator; } + public Boolean isWithLegend() { + if (withLegend = null) { + withLegend = false; + } + return withLegend; + } + public boolean highLightCurrentIndicatorLevel() { if (log.isDebugEnabled()) { log.debug("indicatorLevel = " + indicatorLevel); Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-10-18 14:25:45 UTC (rev 685) @@ -614,6 +614,19 @@ /* variable used in view */ private List<Indicator> indicators; + /** Sum of the coefficient of the indicators. */ + private Double totalCoefficient; + + public Double getTotalCoefficient() { + if (totalCoefficient == null) { + totalCoefficient = 0.0; + for (Indicator indicator : getIndicators()) { + totalCoefficient += indicator.getCoefficient(); + } + } + return totalCoefficient; + } + public List<Indicator> getIndicators() { if (indicators == null) { indicators = serviceSynthesis.getGlobalSynthesisParameters(); Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-18 14:25:45 UTC (rev 685) @@ -418,7 +418,7 @@ if (nonComplianceBoarding == null) { Company company = !user.isAdmin() ? user.getCompany() : null; nonComplianceBoarding = - serviceSynthesis.getNonComplianceBoardingIndicator(company); + serviceSynthesis.getComplianceBoardingIndicator(company); // FIXME 20101015 bleny business code, should be moved in business // computing level for indicator @@ -427,9 +427,8 @@ for (Double compliance : nonComplianceBoarding.values()) { total += compliance; } - double indicatorValue = 100.0 - (total / numberOfCompanies); + double indicatorValue = (total / numberOfCompanies); - // XXX 20101015 bleny switching synthesisId while rendering. side-effects ? activeSynthesis = SynthesisId.IND_COMPLIANCE_BOARDING; activeIndicator = getActiveIndicator(); activeIndicatorLevel = activeIndicator.getLevelForValue(indicatorValue); Modified: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/IndicatorLevels.tml =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/IndicatorLevels.tml 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/IndicatorLevels.tml 2010-10-18 14:25:45 UTC (rev 685) @@ -22,19 +22,27 @@ <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - <table class="indicator"> - <caption>Indicateur : ${indicator.synthesisId} (coefficient = ${indicator.coefficient})</caption> + <table class="indicatorLevels"> + <caption></caption> <tbody> <tr> + <th /> + <th colspan="${indicator.indicatorLevel.size()}">Indicateur : ${indicator.synthesisId.label}</th> + <th>coefficient</th> + </tr> + <tr> <th>Niveaux</th> <t:loop t:source="indicator.indicatorLevel" t:value="indicatorLevel"> <t:if test="highLightCurrentIndicatorLevel()"> - <td class="highlight">${indicatorLevel.level}</td> + <td class="highlight selected">${indicatorLevel.level}</td> <p:else> <td>${indicatorLevel.level}</td> </p:else> </t:if> </t:loop> + <td rowspan="2"> + ${indicator.coefficient} + </td> </tr> <tr> <th>Bornes</th> @@ -54,6 +62,11 @@ </td> </t:loop> </tr> + <!-- t:if test="isWithLegend()"> --> + <caption> + En jaune, la position actuelle de la société selon cet indicateur. + </caption> + <!--/t:if--> </tbody> </table> Modified: trunk/wao-ui/src/main/webapp/Administration.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Administration.tml 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/webapp/Administration.tml 2010-10-18 14:25:45 UTC (rev 685) @@ -174,7 +174,7 @@ <t:if t:test="currentUser.admin"> - <h2>Synthèse globale</h2> + <h2>Indicateurs qualités prestataires</h2> <!-- ALL ACTUAL VALUES FOR INDICATORS OF GLOBAL SYNTHESIS --> @@ -182,9 +182,7 @@ <t:indicatorLevels t:indicator="indicator" /> </t:loop> - <!-- FORM TO MODIFY INDICATOR --> - - + Total coefficients : ${totalCoefficient} </t:if> Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-18 14:25:45 UTC (rev 685) @@ -146,7 +146,7 @@ <!-- now render a table with position on global synthesis --> <br /> - <t:indicatorLevels t:indicator="activeIndicator" highlightLevel="activeIndicatorLevel" /> + <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" /> </div> </t:block> <!-- GRAPH2 : BOARDING_BOAT --> @@ -174,7 +174,7 @@ <!-- now render a table with position on global synthesis --> <br /> - <t:indicatorLevels t:indicator="activeIndicator" highlightLevel="activeIndicatorLevel" /> + <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" /> </div> </t:block> <!-- IND1 : NON_COMPLIANCE_BOARDING --> @@ -220,7 +220,7 @@ <!-- now render a table with position on global synthesis --> <br /> - <t:indicatorLevels t:indicator="activeIndicator" highlightLevel="activeIndicatorLevel" /> + <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" /> </div> </t:block> <!-- IND2 : CONTACT_STATE --> @@ -325,7 +325,7 @@ <!-- now render a table with position on global synthesis --> <br /> - <t:indicatorLevels t:indicator="activeIndicator" highlightLevel="activeIndicatorLevel" /> + <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" /> </div> </t:block> </t:layout> Modified: trunk/wao-ui/src/main/webapp/css/common.css =================================================================== --- trunk/wao-ui/src/main/webapp/css/common.css 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/webapp/css/common.css 2010-10-18 14:25:45 UTC (rev 685) @@ -374,7 +374,7 @@ } /* INDICATOR TABLES */ -table.indicator { +table.indicatorLevels { border: solid 1px black; margin-left: auto; margin-right: auto; @@ -382,31 +382,31 @@ border-collapse: collapse; } -table.indicator th, table.indicator td { +table.indicatorLevels th, table.indicatorLevels td { border: solid 1px black; padding: 5px; } -table.indicator th { +table.indicatorLevels th { text-align: left; } -table.indicator td { +table.indicatorLevels td { text-align: center; } -table.indicator td.highlight { +table.indicatorLevels td.highlight { border-width: 3px; } -table.indicator td.penalty { +table.indicatorLevels td.penalty { background-color: #fee; } -table.indicator td.neutral { +table.indicatorLevels td.neutral { background-color: #eee; } -table.indicator td.bonus { +table.indicatorLevels td.bonus { background-color: #efe; } Modified: trunk/wao-ui/src/main/webapp/css/synthesis.css =================================================================== --- trunk/wao-ui/src/main/webapp/css/synthesis.css 2010-10-17 14:53:36 UTC (rev 684) +++ trunk/wao-ui/src/main/webapp/css/synthesis.css 2010-10-18 14:25:45 UTC (rev 685) @@ -160,7 +160,7 @@ width: 50%; } -div#so-contactstate table { +div#so-noncomplianceboarding indicator { width: 90%; } @@ -173,3 +173,7 @@ div#so-allegroreactivity td.warn { color: red; } + +table.indicatorLevels { + width: 90%; +} \ No newline at end of file
participants (1)
-
bleny@users.labs.libre-entreprise.org