Author: bleny Date: 2010-10-18 15:18:54 +0000 (Mon, 18 Oct 2010) New Revision: 687 Log: removing UI consideration in business (synthesisId blockid) Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java trunk/wao-ui/src/main/webapp/Synthesis.tml 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-18 14:30:34 UTC (rev 686) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java 2010-10-18 15:18:54 UTC (rev 687) @@ -35,54 +35,35 @@ public enum SynthesisId { /** */ - GRAPH_SAMPLING("graph1", "wao.business.bean.SynthesisId.graph_sampling"), + GRAPH_SAMPLING("wao.business.bean.SynthesisId.graph_sampling"), /** */ - GRAPH_BOARDING("graph2", "wao.business.bean.SynthesisId.graph_boarding"), + GRAPH_BOARDING("wao.business.bean.SynthesisId.graph_boarding"), /** */ - IND_NON_COMPLIANCE_BOARDING("ind1", "wao.business.bean.SynthesisId.non_compliance_boarding"), + IND_COMPLIANCE_BOARDING("wao.business.bean.SynthesisId.compliance_boarding"), /** */ - IND_CONTACT_STATE("ind2", "wao.business.bean.SynthesisId.contact_state"), + IND_CONTACT_STATE("wao.business.bean.SynthesisId.contact_state"), /** */ - IND_ALLEGRO_REACTIVITY("ind3", "wao.business.bean.SynthesisId.allegro_reactivity"), + IND_ALLEGRO_REACTIVITY("wao.business.bean.SynthesisId.allegro_reactivity"), /** */ - IND_COMPLIANCE_BOARDING("ind4", "wao.business.bean.SynthesisId.compliance_boarding"), + IND_DATA_RELIABILITY("wao.business.bean.SynthesisId.data_reliability"); - /** */ - IND_DATA_RELIABILITY("ind5", "wao.business.bean.SynthesisId.data_reliability"); - - protected String blockId; - /** An i18n key to make enumeration printable in logs and UI. */ protected String label; - SynthesisId(String blockId, String label) { - this.blockId = blockId; + SynthesisId(String label) { 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)) { - return synthesisId; - } - } - return null; - } - public static SynthesisId valueOf(int ordinal) { for (SynthesisId synthesisId : SynthesisId.values()) { if (synthesisId.ordinal() == ordinal) { 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-18 14:30:34 UTC (rev 686) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2010-10-18 15:18:54 UTC (rev 687) @@ -162,7 +162,7 @@ case GRAPH_SAMPLING : initSamplingBlock(); break; case GRAPH_BOARDING : initBoardingBlock(); } - return resources.getBlock(getActiveSynthesis().getBlockId()); + return resources.getBlock("ind" + getActiveSynthesis().ordinal()); } public String getActionSynthesisId() { @@ -401,10 +401,10 @@ /********************* INDICATOR : NON COMPLIANCE BOARDING ****************/ - private Map<String, Double> nonComplianceBoarding; + private Map<String, Double> complianceBoarding; @Property - private Map.Entry<String, Double> nonComplianceBoardingEntry; + private Map.Entry<String, Double> complianceBoardingEntry; /** * Data for nonComplianceBoarding indicator. The key is the company @@ -414,17 +414,17 @@ * @return a Map with companies and there values for nonComplianceBoarding * @throws WaoException */ - public Map<String, Double> getNonComplianceBoarding() throws WaoException { - if (nonComplianceBoarding == null) { + public Map<String, Double> getComplianceBoarding() throws WaoException { + if (complianceBoarding == null) { Company company = !user.isAdmin() ? user.getCompany() : null; - nonComplianceBoarding = + complianceBoarding = serviceSynthesis.getComplianceBoardingIndicator(company); // FIXME 20101015 bleny business code, should be moved in business // computing level for indicator double total = 0.0; - int numberOfCompanies = nonComplianceBoarding.size(); - for (Double compliance : nonComplianceBoarding.values()) { + int numberOfCompanies = complianceBoarding.size(); + for (Double compliance : complianceBoarding.values()) { total += compliance; } double indicatorValue = 100 * (total / numberOfCompanies); @@ -434,7 +434,7 @@ activeIndicatorLevel = activeIndicator.getLevelForValue(indicatorValue); } - return nonComplianceBoarding; + return complianceBoarding; } /** @@ -444,8 +444,8 @@ * @return the value of the indicator * @throws WaoException */ - public Double getNonComplianceBoardingValue() throws WaoException { - return getNonComplianceBoarding().get(user.getCompany().getName()); + public Double getComplianceBoardingValue() throws WaoException { + return getComplianceBoarding().get(user.getCompany().getName()); } /********************* INDICATOR : CONTACT STATE ******************/ Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-18 14:30:34 UTC (rev 686) +++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-18 15:18:54 UTC (rev 687) @@ -47,7 +47,7 @@ </a> </li> <li> - <a t:type="actionlink" t:context="[actionSynthesisId,'IND_NON_COMPLIANCE_BOARDING']" t:zone="so-synthesis-main"> + <a t:type="actionlink" t:context="[actionSynthesisId,'IND_COMPLIANCE_BOARDING']" t:zone="so-synthesis-main"> <img src="${asset:context:}/img/synthesis-ind-non-compliance-boarding.png" alt="Indicateur" title="Indicateur de non respect du nombre d'observateurs embarqués" /> </a> @@ -72,7 +72,7 @@ </div> <!-- GRAPH1 : DATA_SAMPLING --> - <t:block t:id="graph1"> + <t:block t:id="ind0"> <div class="acenter" id="so-datasampling"> <h2>Données des marées (réalisé / planifié)</h2> <fieldset> @@ -150,7 +150,7 @@ </div> </t:block> <!-- GRAPH2 : BOARDING_BOAT --> - <t:block t:id="graph2"> + <t:block t:id="ind1"> <div class="acenter"> <h2>Sollicitations des navires</h2> <br /> @@ -177,8 +177,8 @@ <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" /> </div> </t:block> - <!-- IND1 : NON_COMPLIANCE_BOARDING --> - <t:block t:id="ind1"> + <!-- IND1 : COMPLIANCE_BOARDING --> + <t:block t:id="ind2"> <div class="ind-table acenter" id="so-noncomplianceboarding"> <h2>Non respect du nombre d'observateurs embarqués</h2> <br /> @@ -195,10 +195,10 @@ </tr> </thead> <tbody> - <tr t:type="loop" t:source="nonComplianceBoarding.entrySet()" t:value="nonComplianceBoardingEntry"> - <td class="company">${nonComplianceBoardingEntry.key}</td> + <tr t:type="loop" t:source="complianceBoarding.entrySet()" t:value="complianceBoardingEntry"> + <td class="company">${complianceBoardingEntry.key}</td> <td class="number"> - <t:output t:value="nonComplianceBoardingEntry.value" t:format="percentFormat"/> + <t:output t:value="complianceBoardingEntry.value" t:format="percentFormat"/> </td> </tr> </tbody> @@ -210,8 +210,8 @@ </p> <div class="indicator"> <p class="number"> - <span t:type="output" t:value="nonComplianceBoardingValue" t:format="percentFormat"> - ${nonComplianceBoardingValue} + <span t:type="output" t:value="complianceBoardingValue" t:format="percentFormat"> + ${complianceBoardingValue} </span> </p> </div> @@ -224,7 +224,7 @@ </div> </t:block> <!-- IND2 : CONTACT_STATE --> - <t:block t:id="ind2"> + <t:block t:id="ind3"> <div class="ind-table acenter" id="so-contactstate"> <h2>Etats des contacts</h2> <br /> @@ -278,7 +278,7 @@ </div> </t:block> <!-- IND3 : ALLEGRO_REACTIVITY --> - <t:block t:id="ind3"> + <t:block t:id="ind4"> <div class="ind-table acenter" id="so-allegroreactivity"> <h2>Réactivité de la saisie dans Allegro par rapport à la date de fin de la marée</h2> <br />