[Suiviobsmer-commits] r439 - 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/entity wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/xmi wao-business/src/test/resources wao-ui/src/main/java/fr/ifremer/wao/ui/components wao-ui/src/main/java/fr/ifremer/wao/ui/data wao-ui/src/main/java/fr/ifremer/wao/ui/pages wao-ui/src/main/resources wao-ui/src/main/resources/fr/ifremer/wao/ui/components wao-ui/
Author: fdesbois Date: 2010-04-12 14:02:38 +0000 (Mon, 12 Apr 2010) New Revision: 439 Log: - Ano #2245 : Problem on sampleRow creation (NPE on listener for new months) - Improve samplingPlan loading (calcul move to SampleRowImpl + done only once when sampleRows are loading from db) - Replace concatenation by StringBuilder in BusinessUtils for Tooltips - Clean log4j for prod Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java trunk/wao-business/src/main/xmi/wao.zargo trunk/wao-business/src/test/resources/log4j.properties trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/Layout.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/BusinessUtils.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml trunk/wao-ui/src/main/resources/log4j.properties trunk/wao-ui/src/main/webapp/SamplingPlan.tml trunk/wao-ui/src/main/webapp/css/sampling.css Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java 2010-04-12 14:02:38 UTC (rev 439) @@ -24,11 +24,11 @@ import fr.ifremer.wao.io.ImportHelper; import fr.ifremer.wao.service.ServiceUser; +import java.io.PrintStream; import java.nio.charset.Charset; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.Locale; -import java.util.logging.Level; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.mail.EmailException; @@ -128,16 +128,24 @@ conf.setConfigFileName(DEFAULT_FILENAME); conf.parse(new String[]{}); - conf.printConfig(); - loadMigrationConfiguration(conf); loadConfiguration(conf); + + printConfiguration(); } catch (ArgumentsParserException eee) { treateError(eee, n_("wao.error.context.parse"), DEFAULT_FILENAME); } } + protected void printConfiguration() { + //StringWriter writer = new StringWriter(); +// PrintWriter printWriter = new PrintWriter(new StringWriter()); +// PrintStream stream = new PrintStream(); + configuration.printConfig(); +// stream. + } + protected void loadMigrationConfiguration(ApplicationConfig conf) { // migration configuration String callBackName = null; Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/FacadeRowImpl.java 2010-04-12 14:02:38 UTC (rev 439) @@ -26,6 +26,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.nuiton.util.PeriodDates; /** * FacadeRowImpl @@ -64,6 +65,9 @@ rows = new ArrayList<SampleRow>(); sectorMap.put(sectors, rows); } + // Prepare data by month : calculate tides (real/expected) and remove + // unused months for period + row.prepareDataByMonth(period); // Add the row to the list rows.add(row); } Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2010-04-12 14:02:38 UTC (rev 439) @@ -29,13 +29,18 @@ import fr.ifremer.wao.WaoProperty; import fr.ifremer.wao.bean.UserRole; import java.io.Serializable; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.mail.EmailException; import org.nuiton.i18n.I18n; import org.nuiton.topia.TopiaContext; @@ -61,33 +66,95 @@ private static final long serialVersionUID = 1L; + protected Integer totalTidesReal; + + protected Integer totalTidesExpected; + + protected Map<String, SampleMonth> sampleMonthMap; + + protected DateFormat monthFormat = new SimpleDateFormat("MM/yyyy"); + /** - * Get a SampleMonth from a date. The month and year of the date must correspond to the SampleMonth to get. + * Get a SampleMonth from a date. The month and year of the date must + * correspond to the SampleMonth to get. * @param date a Date - * @return the SampleMonth if it exists in the SampleMonth list or null otherwise + * @return the SampleMonth if it exists in the SampleMonth list or null + * otherwise */ @Override public SampleMonth getSampleMonth(Date date) { if (getSampleMonth() == null) { return null; } -// Calendar ref = new GregorianCalendar(); -// ref.setTime(date); - //log.info("Ref : " + date); - for (SampleMonth curr : getSampleMonth()) { - //log.info("Curr month : " + curr.getPeriodDate() + " : " + curr.getPeriodMonth() + " / " + curr.getPeriodYear()); -// if (ref.get(Calendar.MONTH) == (curr.getPeriodMonth()-1) && ref.get(Calendar.YEAR) == curr.getPeriodYear()) { +//// Calendar ref = new GregorianCalendar(); +//// ref.setTime(date); +// //log.info("Ref : " + date); +// for (SampleMonth curr : getSampleMonth()) { +// //log.info("Curr month : " + curr.getPeriodDate() + " : " + curr.getPeriodMonth() + " / " + curr.getPeriodYear()); +//// if (ref.get(Calendar.MONTH) == (curr.getPeriodMonth()-1) && ref.get(Calendar.YEAR) == curr.getPeriodYear()) { +//// return curr; +//// } +// Date min = DateUtils.setFirstDayOfMonth(curr.getPeriodDate()); +// Date max = DateUtils.setLastDayOfMonth(curr.getPeriodDate()); +// if (DateUtils.between(date, min, max)) { // return curr; // } - Date min = DateUtils.setFirstDayOfMonth(curr.getPeriodDate()); - Date max = DateUtils.setLastDayOfMonth(curr.getPeriodDate()); - if (DateUtils.between(date, min, max)) { - return curr; +// } + if (sampleMonthMap != null) { + // Direct access if map is defined from prepareDataByMonth + String dateFormatted = monthFormat.format(date); + return sampleMonthMap.get(dateFormatted); + } else { + for (SampleMonth curr : getSampleMonth()) { + Date min = DateUtils.setFirstDayOfMonth(curr.getPeriodDate()); + Date max = DateUtils.setLastDayOfMonth(curr.getPeriodDate()); + if (DateUtils.between(date, min, max)) { + return curr; + } } } return null; } + @Override + public void prepareDataByMonth(PeriodDates period) { + // Do not call this method outside a TopiaContext, will not work + // because of lazy initialization over sampleMonth. Also this + // calcul need to be done when data for sampleRows is loading. + long start = System.currentTimeMillis(); + totalTidesExpected = 0; + totalTidesReal = 0; + Iterator<SampleMonth> it = getSampleMonth().iterator(); + sampleMonthMap = new HashMap<String, SampleMonth>(); + while (it.hasNext()) { + SampleMonth curr = it.next(); + if (period == null || period.between(curr.getPeriodDate())) { + totalTidesExpected += curr.getExpectedTidesValue(); + totalTidesReal += curr.getRealTidesValue(); + String date = monthFormat.format(curr.getPeriodDate()); + sampleMonthMap.put(date, curr); + } else { + // Month not used for period + it.remove(); + } + } + if (log.isTraceEnabled()) { + long stop = System.currentTimeMillis(); + log.trace("prepareDataByMonth Time : " + + DurationFormatUtils.formatDurationHMS(stop - start)); + } + } + + @Override + public Integer getTotalTidesReal() { + return totalTidesReal; + } + + @Override + public Integer getTotalTidesExpected() { + return totalTidesExpected; + } + /** * Return the first fishingZone of the list linked with the SampleRow. * @return a FishingZone or null if there is no fishingZone linked with the SampleRow Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-04-12 14:02:38 UTC (rev 439) @@ -287,6 +287,7 @@ SamplingFilter filter, Company company) throws TopiaException { FacadeRow result = new FacadeRowImpl(); + result.setPeriod(filter.getPeriod()); SampleRowDAO dao = WaoDAOHelper.getSampleRowDAO(transaction); @@ -312,7 +313,7 @@ } // Load data - query.addLoad(SampleRow.SAMPLE_MONTH); +// query.addLoad(SampleRow.SAMPLE_MONTH); List<SampleRow> results = dao.findAllByQuery(query); for (SampleRow row : results) { Modified: trunk/wao-business/src/main/xmi/wao.zargo =================================================================== (Binary files differ) Modified: trunk/wao-business/src/test/resources/log4j.properties =================================================================== --- trunk/wao-business/src/test/resources/log4j.properties 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-business/src/test/resources/log4j.properties 2010-04-12 14:02:38 UTC (rev 439) @@ -8,6 +8,6 @@ log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d [%p] %c{2} %m%n -log4j.logger.fr.ifremer.wao=DEBUG +log4j.logger.fr.ifremer.wao=INFO log4j.logger.org.nuiton.util=INFO log4j.logger.org.nuiton.util.beans.BinderProvider=ERROR Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/Layout.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/Layout.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/Layout.java 2010-04-12 14:02:38 UTC (rev 439) @@ -29,6 +29,7 @@ import fr.ifremer.wao.service.ServiceUser; import fr.ifremer.wao.ui.base.WaoPage; import fr.ifremer.wao.ui.pages.Index; +import fr.ifremer.wao.ui.services.WaoManager; import org.apache.commons.lang.StringUtils; import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.PersistenceConstants; @@ -56,6 +57,9 @@ */ public class Layout { + @Inject + private WaoManager manager; + @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) private String pageTitle; @@ -121,6 +125,10 @@ return true; } + public boolean isDevEnvironment() { + return manager.isDevEnvironment(); + } + /** * Test if the current user in session is a valid user. * Test topia id existence because WaoUser can be empty when session is lost Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/BusinessUtils.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/BusinessUtils.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/BusinessUtils.java 2010-04-12 14:02:38 UTC (rev 439) @@ -21,8 +21,6 @@ package fr.ifremer.wao.ui.data; -import fr.ifremer.wao.WaoBusinessException; -import fr.ifremer.wao.WaoException; import fr.ifremer.wao.bean.ContactState; import fr.ifremer.wao.bean.SamplingFilter; import fr.ifremer.wao.entity.Boat; @@ -34,8 +32,6 @@ import java.text.SimpleDateFormat; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.StringUtils; -import org.apache.tapestry5.ioc.Messages; -import org.slf4j.Logger; /** * DataUtils @@ -52,81 +48,94 @@ public static String getTooltipSampleRow(SampleRow row) { - String result = ""; + StringBuilder result = new StringBuilder(); DateFormat dateFormat = new SimpleDateFormat("MM/yyyy"); Profession profession = row.getProfession(); - result += "<strong>Métier : </strong>" + profession.getCodeDCF5(); + result.append("<strong>Métier : </strong>"). + append(profession.getCodeDCF5()); if (!StringUtils.isEmpty(profession.getMeshSize())) { - result+= " " + profession.getMeshSize(); + result.append(' ').append(profession.getMeshSize()); } if (!StringUtils.isEmpty(profession.getSize())) { - result+= " " + profession.getSize(); + result.append(' ').append(profession.getSize()); } if (!StringUtils.isEmpty(profession.getOther())) { - result+= " " + profession.getOther(); + result.append(' ').append(profession.getOther()); } - result += " - " + profession.getLibelle(); + result.append(" - ").append(profession.getLibelle()); if (!StringUtils.isEmpty(profession.getSpecies())) { - result += "<br /><strong>Espèces cibles : </strong>" + profession.getSpecies(); + result.append("<br /><strong>Espèces cibles : </strong>"). + append(profession.getSpecies()); } - result += "<br /><strong>Programme : </strong>" + row.getProgramName(); - result += "<br /><strong>Période : </strong> du " + dateFormat.format(row.getPeriodBegin()) + - " au " + dateFormat.format(row.getPeriodEnd()); + result.append("<br /><strong>Programme : </strong>"). + append(row.getProgramName()). + append("<br /><strong>Période : </strong> du "). + append(dateFormat.format(row.getPeriodBegin())).append(" au "). + append(dateFormat.format(row.getPeriodEnd())); for (FishingZone zone : row.getFishingZone()) { - result += "<br /><strong>Zone de pêche : </strong>" + zone.getCode(); + result.append("<br /><strong>Zone de pêche : </strong>"). + append(zone.getCode()); } - return result; + return result.toString(); } public static String getTooltipBoat(Boat boat) { - String result = ""; - result += "<strong>" + boat.getImmatriculation() + "</strong>"; - result += "<br /><strong>Quartier : </strong>" + boat.getDistrictCode(); - result += "<br /><strong>Longueur : </strong>" + boat.getBoatLength() + " m"; - result += "<br /><strong>Année de construction : </strong>" + boat.getBuildYear(); - return result; + StringBuilder result = new StringBuilder("<strong>"). + append(boat.getImmatriculation()).append("</strong>"). + append("<br /><strong>Quartier : </strong>"). + append(boat.getDistrictCode()). + append("<br /><strong>Longueur : </strong>"). + append(boat.getBoatLength()).append(" m"). + append("<br /><strong>Année de construction : </strong>"). + append(boat.getBuildYear()); + return result.toString(); } public static String getDataSamplingTitle(SamplingFilter filter) { - String result = "Données des marées"; - boolean filtered = false; + StringBuilder result = new StringBuilder("Données des marées"); + String separator = " : "; if (filter.getCompany() != null) { - //result += !filtered ? " : " : ", "; - result += " :\nSociété " + filter.getCompany().getName(); - filtered = true; + //result.append(!filtered ? " : " : ", "; + result.append(separator). + append("\nSociété ").append(filter.getCompany().getName()); + separator = ", "; } if (StringUtils.isNotEmpty(filter.getProgramName())) { - result += !filtered ? " : " : ", "; - result += "\nProgramme " + filter.getProgramName(); - filtered = true; + result.append(separator). + append("\nProgramme ").append(filter.getProgramName()); + separator = ", "; } if (filter.getSampleRow() != null) { Profession profession = filter.getSampleRow().getProfession(); - result += !filtered ? " : " : ", "; - result += "\nMétier " + profession.getCode(); - result += StringUtils.isNotEmpty(profession.getLibelle()) ? " - " + profession.getLibelle() : ""; - result += StringUtils.isNotEmpty(profession.getSpecies()) ? "\nEspèces (" + profession.getSpecies() + ")" : ""; - result += "\nZones de pêche ("; + result.append(separator). + append("\nMétier ").append(profession.getCode()); + if (StringUtils.isNotEmpty(profession.getLibelle())) { + result.append(" - ").append(profession.getLibelle()); + } + if (StringUtils.isNotEmpty(profession.getSpecies())) { + result.append("\nEspèces ("). + append(profession.getSpecies()).append(")"); + } + result.append("\nZones de pêche ("); for (FishingZone zone : filter.getSampleRow().getFishingZone()) { - result += zone.getDistrictCode() + " "; + result.append(zone.getDistrictCode()).append(' '); } - result += ")"; - filtered = true; + result.append(")"); + separator = ", "; } else { if (filter.getFacadeName() != null) { - result += !filtered ? " : " : ", "; - result += "\nFaçade " + filter.getFacadeName(); - filtered = true; + result.append(separator). + append("\nFaçade ").append(filter.getFacadeName()); + separator = ", "; } if (filter.getSectorName() != null) { - result += !filtered ? " : " : ", "; - result += "\nZone " + filter.getSectorName(); - //filtered = true; + result.append(separator). + append("\nZone ").append(filter.getSectorName()); } } - return result; + return result.toString(); } public static String getContactStyle(Contact contact, boolean admin) { 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 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2010-04-12 14:02:38 UTC (rev 439) @@ -388,7 +388,10 @@ // If an other period is set } else if (periodChanged) { if (curr == null) { - curr = serviceSampling.getNewSampleMonth(currMonth, getSampleRow()); + curr = serviceSampling.getNewSampleMonth(currMonth, + getSampleRow()); + curr.addPropertyChangeListener( + SampleMonth.EXPECTED_TIDES_VALUE, propertyChange); } sampleMonths.add(curr); } @@ -462,7 +465,9 @@ @Log void onSelectedFromDeleteMonth(int index) throws WaoException { - getSampleMonths().remove(index); + SampleMonth month = getSampleMonths().remove(index); + month.removePropertyChangeListener( + SampleMonth.EXPECTED_TIDES_VALUE, propertyChange); edited = true; } @@ -503,7 +508,6 @@ if (sampleRow == null) { if (!StringUtils.isEmpty(sampleRowId)) { sampleRow = serviceSampling.getSampleRow(sampleRowId); - propertyChange = new WaoPropertyChangeListener(); for (SampleMonth month : sampleRow.getSampleMonth()) { month.addPropertyChangeListener( SampleMonth.EXPECTED_TIDES_VALUE, propertyChange); @@ -511,6 +515,7 @@ } else { sampleRow = serviceSampling.getNewSampleRow(); } + propertyChange = new WaoPropertyChangeListener(); } return sampleRow; } Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2010-04-12 14:02:38 UTC (rev 439) @@ -46,6 +46,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.tapestry5.StreamResponse; import org.apache.tapestry5.annotations.IncludeStylesheet; import org.apache.tapestry5.annotations.InjectComponent; @@ -58,6 +59,8 @@ import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.upload.services.UploadedFile; import org.nuiton.util.PeriodDates; +import org.nuiton.util.StringUtil; +import org.nuiton.util.StringUtil.ToString; import org.slf4j.Logger; /** @@ -100,17 +103,28 @@ @Property private WaoUser user; + private long nbTidesExpectedTime; + + private long nbTidesRealTime; + + private long totalTidesExpectedTime; + + private long totalTidesRealTime; + /** * Page initialization */ void setupRender() { + if (log.isDebugEnabled()) { + log.debug("Data is null ? : " + (data == null)); + } if (isFiltersVisible()) { // Initialize filters initSelectFilters(true, false, true); } - // Initialize fullView to true for admin user - if (fullView == null && user.isAdmin()) { - fullView = true; + // Initialize fullView depends on user admin role + if (fullView == null) { + fullView = user.isAdmin(); } } @@ -223,9 +237,16 @@ void onSelectedFromReset() { reset = true; } + +// void onSuccessFromPeriodForm() { +// // Reset data +// data = null; +// } Object onSuccessFromFiltersForm() { if (isEdited()) { + // Reset data +// data = null; return filtersZone.getBody(); } if (reset) { @@ -260,6 +281,7 @@ /** * Main data for samplingPlan : List of SampleRow ordered by FishingZone. */ +// @Persist private List<SampleRow> data; private List<Date> months; @@ -332,27 +354,41 @@ } public Integer getNbTidesExpected() { + Integer result = null; SampleMonth sampleMonth = row.getSampleMonth(month); if (sampleMonth != null) { - return sampleMonth.getExpectedTidesValue(); + result = sampleMonth.getExpectedTidesValue(); } - return null; + return result; } + private static final ToString<FishingZone> FISHING_ZONE_TO_STRING_DISTRICT = + new ToString<FishingZone>() { + + @Override + public String toString(FishingZone o) { + return o.getDistrictCode(); + } + }; + public String getFishingZones() { - String result = ""; - for (FishingZone zone : row.getFishingZone()) { - result += zone.getDistrictCode() + ", "; - } - return result.substring(0, result.length()-2); + return StringUtil.join(row.getFishingZone(), + FISHING_ZONE_TO_STRING_DISTRICT, ", ", false); +// String result = ""; +// for (FishingZone zone : row.getFishingZone()) { +// result += zone.getDistrictCode() + ", "; +// } +// return result.substring(0, result.length()-2); + } public Integer getNbTidesReal() { + Integer result = null; SampleMonth sampleMonth = row.getSampleMonth(month); if (sampleMonth != null) { - return sampleMonth.getRealTidesValue(); + result = sampleMonth.getRealTidesValue(); } - return null; + return result; } public boolean hasNbTidesReal() { @@ -361,32 +397,38 @@ return validMonth && getNbTidesReal() != null; } - public int getTotalTidesExpected() { - int total = 0; - for (Date currentMonth : getMonths()) { - SampleMonth sampleMonth = row.getSampleMonth(currentMonth); - if (sampleMonth != null) { - total += sampleMonth.getExpectedTidesValue(); - } - } - return total; - } +// public int getTotalTidesExpected() { +// long start = System.currentTimeMillis(); +// int total = 0; +// for (Date currentMonth : getMonths()) { +// SampleMonth sampleMonth = row.getSampleMonth(currentMonth); +// if (sampleMonth != null) { +// total += sampleMonth.getExpectedTidesValue(); +// } +// } +// long stop = System.currentTimeMillis(); +// totalTidesExpectedTime += (stop - start); +// return total; +// } +// +// public int getTotalTidesReal() { +// long start = System.currentTimeMillis(); +// int total = 0; +// for (Date currentMonth : getMonths()) { +// SampleMonth sampleMonth = row.getSampleMonth(currentMonth); +// if (sampleMonth != null) { +// total += sampleMonth.getRealTidesValue(); +// } +// } +// long stop = System.currentTimeMillis(); +// totalTidesRealTime += (stop - start); +// return total; +// } - public int getTotalTidesReal() { - int total = 0; - for (Date currentMonth : getMonths()) { - SampleMonth sampleMonth = row.getSampleMonth(currentMonth); - if (sampleMonth != null) { - total += sampleMonth.getRealTidesValue(); - } - } - return total; - } - public String getTotalPercentage() { double result = 0; - if (getTotalTidesExpected() > 0) { - result = (double)getTotalTidesReal() / (double)getTotalTidesExpected(); + if (row.getTotalTidesExpected() > 0) { + result = (double)row.getTotalTidesReal() / (double)row.getTotalTidesExpected(); } return NumberFormat.getPercentInstance().format(result); } Modified: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml 2010-04-12 14:02:38 UTC (rev 439) @@ -9,17 +9,19 @@ </head> <t:if t:test="currentUserExists"> <body> - <!-- Script for Google Analytics --> - <script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + <t:unless t:test="devEnvironment"> + <!-- Script for Google Analytics --> + <script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + </script> + <script type="text/javascript"> + try { + var pageTracker = _gat._getTracker("UA-12982015-1"); + pageTracker._trackPageview(); + } catch(err) {} </script> - <script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("UA-12982015-1"); - pageTracker._trackPageview(); - } catch(err) {} - </script> + </t:unless> <div id="so-session" class="clearfix"> <div class="fleft"> <a t:type="pagelink" t:page="index" title="Page d'accueil"> Modified: trunk/wao-ui/src/main/resources/log4j.properties =================================================================== --- trunk/wao-ui/src/main/resources/log4j.properties 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/resources/log4j.properties 2010-04-12 14:02:38 UTC (rev 439) @@ -11,17 +11,8 @@ # wao.log.home must be defined when starting server # ex : -Dwao.log.home=/home/user/.local/wao log4j.appender.globalfile.File=${wao.log.home}/wao.log -log4j.appender.globalfile.MaxFileSize=500KB +log4j.appender.globalfile.MaxFileSize=2MB log4j.appender.globalfile.Append=true -log4j.appender.globalfile.MaxBackupIndex=10 -log4j.appender.globalfile.Threshold=TRACE +log4j.appender.globalfile.Threshold=INFO log4j.appender.globalfile.layout=org.apache.log4j.PatternLayout log4j.appender.globalfile.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n - -# For Tapestry -log4j.logger.org.apache.tapestry5.services.TapestryModule.ComponentClassResolver=INFO -log4j.logger.org.apache.tapestry5.TapestryFilter=INFO - -log4j.logger.fr.ifremer.wao=DEBUG -log4j.logger.org.nuiton.util=INFO -log4j.logger.org.nuiton.topia=INFO Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml =================================================================== --- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-04-12 14:02:38 UTC (rev 439) @@ -204,7 +204,7 @@ </t:loop> <td class="width50 acenter bright"> <span t:type="ck/Tooltip" title="Infos" t:value="Total sur la période du ${dateFormat.format(period.fromDate)} au ${dateFormat.format(period.thruDate)}" t:effect="appear"> - ${totalTidesExpected} <em>(${totalTidesReal})</em><br /><strong>${totalPercentage}</strong> + ${row.totalTidesExpected} <em>(${row.totalTidesReal})</em><br /><strong>${totalPercentage}</strong> </span> </td> <td class="width60 acenter"><t:output t:value="row.averageTideTime" t:format="numberFormat" /></td> Modified: trunk/wao-ui/src/main/webapp/css/sampling.css =================================================================== --- trunk/wao-ui/src/main/webapp/css/sampling.css 2010-04-08 17:14:30 UTC (rev 438) +++ trunk/wao-ui/src/main/webapp/css/sampling.css 2010-04-12 14:02:38 UTC (rev 439) @@ -38,6 +38,10 @@ margin-bottom: 10px; } +div#so-sampling-filters { + width: 60%; +} + div#so-sampling-filters div.t-beaneditor div { margin-top: 5px; }
participants (1)
-
fdesbois@users.labs.libre-entreprise.org