Author: bleny Date: 2011-01-22 18:06:10 +0000 (Sat, 22 Jan 2011) New Revision: 938 Log: fix sampleRowForm (submitContext removed) Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java trunk/wao-ui/src/main/webapp/SampleRowForm.tml Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2011-01-22 17:36:21 UTC (rev 937) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2011-01-22 18:06:10 UTC (rev 938) @@ -529,20 +529,6 @@ } } - @Log - void onSelectedFromDeleteMonth(int index) throws WaoException { - // SampleMonth month = getSampleMonths().remove(index); - List<SampleMonth> sampleMonths = new ArrayList<SampleMonth>(getSampleMonths()); - SampleMonth removedMonth = sampleMonths.get(index); - sampleMonths.remove(removedMonth); - removedMonth.removePropertyChangeListener( - SampleMonth.PROPERTY_EXPECTED_TIDES_VALUE, propertyChange); -// month.removePropertyChangeListener( -// SampleMonth.PROPERTY_EXPECTED_TIDES_VALUE, propertyChange); - this.sampleMonths = sampleMonths; - edited = true; - } - /*************************** SAMPLE ROW ***********************************/ private String sampleRowId; @@ -646,6 +632,17 @@ getTerrestrialLocationSelectModel().findObject(terrestrialLocationId)); } + // remove sampleMonths with "-1" as value, it should be removed + // to mean that no observation should be done this month + List<SampleMonth> sampleMonths = new ArrayList<SampleMonth>(); + for (SampleMonth sampleMonth : getSampleMonths()) { + if (sampleMonth.getExpectedTidesValue() != -1) { + sampleMonths.add(sampleMonth); + } + } + getSampleRow().clearSampleMonth(); + getSampleRow().addAllSampleMonth(sampleMonths); + try { // Only for save or periodChanged (refreshMonth) if (!cancel && !edited) { Modified: trunk/wao-ui/src/main/webapp/SampleRowForm.tml =================================================================== --- trunk/wao-ui/src/main/webapp/SampleRowForm.tml 2011-01-22 17:36:21 UTC (rev 937) +++ trunk/wao-ui/src/main/webapp/SampleRowForm.tml 2011-01-22 18:06:10 UTC (rev 938) @@ -152,17 +152,7 @@ <tr class="firstRow"> <td t:type="loop" class="acenter" volatile="true" t:source="sampleMonths" t:value="sampleMonth" t:index="monthIndex"> <t:output value="sampleMonth.periodDate" format="dateFormat" /> - <t:unless t:test="sampleMonth.realTidesValue"> - <!--input t:type="submitContext" class="ico16px suppr" t:defer="false" t:id="deleteMonth" value="${message:wao.ui.action.delete}" t:context="monthIndex" /--> - <input t:type="submit" class="ico16px suppr" t:defer="false" t:id="deleteMonth" value="${message:wao.ui.action.delete}" t:context="monthIndex" /> - <p:else> - <img src="${asset:context:}/img/suppr-unavailable-16px.png" alt="${message:wao.ui.unavailableOperation}" /> - </p:else> - </t:unless> </td> -<!-- <td t:type="loop" t:source="months" t:value="month" volatile="true"> - <t:output value="month" format="dateFormat" /> - </td>--> </tr> <tr> <td t:type="loop" class="acenter" volatile="true" t:source="sampleMonths" t:value="sampleMonth">