[Suiviobsmer-commits] r1065 - in trunk/wao-ui/src/main: java/fr/ifremer/wao/ui/base java/fr/ifremer/wao/ui/components java/fr/ifremer/wao/ui/pages resources/fr/ifremer/wao/ui/components webapp
Author: sletellier Date: 2011-03-16 16:22:44 +0000 (Wed, 16 Mar 2011) New Revision: 1065 Log: [#2636] remaniement pour adapter wao ?\195?\160 ObsDeb Added: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/SamplingPlanModelFactory.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/SamplingFilterComponent.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/SamplingFilterComponent.tml Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/ModelFactory.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java trunk/wao-ui/src/main/webapp/SamplingPlan.tml trunk/wao-ui/src/main/webapp/Synthesis.tml Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/AbstractFilteredPage.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -46,7 +46,6 @@ import org.apache.tapestry5.ioc.services.PropertyAccess; import org.slf4j.Logger; -import java.util.ArrayList; import java.util.List; /** @@ -169,6 +168,7 @@ public ModelFactory getModelFactory() { if (modelFactory == null) { modelFactory = new ModelFactory<SamplingFilter>(propertyAccess, + user, serviceReferential, serviceSampling, serviceBoat, @@ -183,33 +183,22 @@ protected boolean isAvailableDataForFiltersOnly() { return AbstractFilteredPage.this.isAvailableDataForFiltersOnly(); } + + @Override + public void resetFilter() { + AbstractFilteredPage.this.resetFilter(); + } }; } return modelFactory; } public void onSelectedFromAddSampleRowCode() { - if (getSampleRowId() != null) { - - List<SampleRow> rows = getFilter().getSampleRows(); - if (rows == null) { - rows = new ArrayList<SampleRow>(); - getFilter().setSampleRows(rows); - } - SampleRow sampleRow = getSampleRowSelectModel().findObject(getSampleRowId()); - if ( ! rows.contains(sampleRow)) { - rows.add(sampleRow); - } - - edited = true; - } + getModelFactory().addSampleRowCode(); } public void onSelectedFromRemoveSampleRowCode() { - if (getSampleRowId() != null) { - getFilter().getSampleRows().remove(getSampleRowSelectModel().findObject(getSampleRowId())); - edited = true; - } + getModelFactory().removeSampleRowCode(); } /** @@ -228,12 +217,12 @@ } /** - * @see ModelFactory#initSelectFilters(fr.ifremer.wao.bean.ConnectedUser, boolean, boolean, boolean) + * @see ModelFactory#initSelectFilters(boolean, boolean, boolean) */ protected void initSelectFilters(boolean companySelect, boolean observerSelect, boolean programSelect) throws WaoException { - getModelFactory().initSelectFilters(user, companySelect, observerSelect, programSelect); + getModelFactory().initSelectFilters(companySelect, observerSelect, programSelect); } /** @@ -301,6 +290,8 @@ */ protected abstract boolean isAvailableDataForFiltersOnly(); + protected abstract void resetFilter(); + public String[] onProvideCompletionsFromBoatName(String input) throws WaoException { List<String> results = serviceBoat.getBoatNamesStartWith(input); return results.toArray(new String[results.size()]); @@ -357,8 +348,6 @@ getFilter().setTerrestrialDistrict(district); } - private boolean edited; - /** * EVENT :: selected on refreshByCompany submit button. Reset selects for * company selected : programs, facades, sectors, sampleRows and observers. @@ -382,7 +371,7 @@ getModelFactory().resetProgramSelectModel(); getProgramSelectModel(); } - edited = true; + getModelFactory().setEdited(true); } /** @@ -398,7 +387,7 @@ // Reset facades getFilter().setFacadeName(null); onSelectedFromRefreshByFacade(); - getModelFactory().resetFacadeSelect(); + getModelFactory().resetFacadeSelectModel(); } /** @@ -414,7 +403,7 @@ // Reset sectors getFilter().setSectorName(null); onSelectedFromRefreshBySector(); - getModelFactory().resetSectorSelect(); + getModelFactory().resetSectorSelectModel(); } /** @@ -431,8 +420,8 @@ onSelectedFromSearch(); // Reset sampleRows; getFilter().setSampleRow(null); - getModelFactory().resetSampleRowSelect(); - edited = true; + getModelFactory().resetSampleRowSelectModel(); + getModelFactory().setEdited(true); } /** @@ -441,7 +430,7 @@ * @return true if the page filter is in edited state. */ protected boolean isEdited() { - return edited; + return getModelFactory().isEdited(); } /** Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/ModelFactory.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/ModelFactory.java 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/ModelFactory.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -27,7 +27,7 @@ import java.util.List; /** - * @author sletellier + * @author sletellier <letellier at codelutin.com> */ public abstract class ModelFactory <E extends SamplingFilter> { @@ -38,8 +38,10 @@ protected PropertyAccess propertyAccess; - private boolean observerSelect; - private boolean programSelect; + protected boolean observerSelect; + protected boolean programSelect; + protected ConnectedUser user; + protected boolean edited = false; /** * Services @@ -76,15 +78,37 @@ protected String targetSpeciesDCFId; protected String terrestrialDistrictId; - public ModelFactory(PropertyAccess propertyAccess, ServiceReferential serviceReferential, ServiceSampling serviceSampling, ServiceBoat serviceBoat, ServiceUser serviceUser) { + public ModelFactory(PropertyAccess propertyAccess, + ConnectedUser user, + ServiceReferential serviceReferential, + ServiceSampling serviceSampling, + ServiceBoat serviceBoat, + ServiceUser serviceUser) { + + this.user = user; this.propertyAccess = propertyAccess; this.serviceReferential = serviceReferential; this.serviceSampling = serviceSampling; this.serviceBoat = serviceBoat; this.serviceUser = serviceUser; + + // Initialize filter + resetFilter(); } + public ConnectedUser getUser() { + return user; + } + + public boolean isEdited() { + return edited; + } + + public void setEdited(boolean edited) { + this.edited = edited; + } + public boolean isObserverSelect() { return observerSelect; } @@ -141,22 +165,22 @@ this.terrestrialDistrictId = terrestrialDistrictId; } - public void resetCompanySelect() throws WaoException { + public void resetCompanySelectModel() throws WaoException { companySelectModel = null; getCompanySelectModel(); } - public void resetFacadeSelect() throws WaoException { + public void resetFacadeSelectModel() throws WaoException { facadeSelectModel = null; getFacadeSelectModel(); } - public void resetSectorSelect() throws WaoException { + public void resetSectorSelectModel() throws WaoException { sectorSelectModel = null; getSectorSelectModel(); } - public void resetSampleRowSelect() throws WaoException { + public void resetSampleRowSelectModel() throws WaoException { sampleRowSelectModel = null; getSampleRowSelectModel(); } @@ -169,7 +193,18 @@ programSelectModel = null; } + public void initCompagnyFilter() { + // Very very important to do that at beginning + // Evo #2227 : Guest user has no default company filter + if (user.isCoordinatorOrObserver()) { + if (log.isDebugEnabled()) { + log.debug("Company filtered : " + user.getCompany().getName()); + } + getFilter().setCompany(user.getCompany()); + } + } + /** * Initialize all select for filters. By default, only facade, sector and * sampleRow selects will be initialized. @@ -179,8 +214,10 @@ * @param programSelect * @throws WaoException */ - public void initSelectFilters(ConnectedUser user, boolean companySelect, - boolean observerSelect, boolean programSelect) throws WaoException { + public void initSelectFilters( + boolean companySelect, + boolean observerSelect, + boolean programSelect) throws WaoException { this.observerSelect = observerSelect; this.programSelect = programSelect; @@ -193,7 +230,7 @@ } if (user.isAdmin() && companySelect) { - resetCompanySelect(); + resetCompanySelectModel(); if (getFilter().getCompany() != null) { setCompanyId(getFilter().getCompany().getTopiaId()); } @@ -219,14 +256,21 @@ getProgramSelectModel(); } - resetFacadeSelect(); - resetSectorSelect(); - resetSampleRowSelect(); + resetFacadeSelectModel(); + resetSectorSelectModel(); + resetSampleRowSelectModel(); + + initCompagnyFilter(); } public abstract E getFilter(); /** + * Method to initialize filter, is call on constructor + */ + public abstract void resetFilter(); + + /** * Used to show only active company and observers. * * @return true if only active users will be showed, false otherwise @@ -251,7 +295,36 @@ return facadeSelectModel; } + + public void addSampleRowCode() { + if (getSampleRowId() != null) { + + List<SampleRow> rows = getFilter().getSampleRows(); + if (rows == null) { + rows = new ArrayList<SampleRow>(); + getFilter().setSampleRows(rows); + } + SampleRow sampleRow = getSampleRowSelectModel().findObject(getSampleRowId()); + if ( ! rows.contains(sampleRow)) { + rows.add(sampleRow); + } + + edited = true; + } + } + + public void removeSampleRowCode() { + if (getSampleRowId() != null) { + getFilter().getSampleRows().remove(getSampleRowSelectModel().findObject(getSampleRowId())); + edited = true; + } + } + /** + * Models + */ + + /** * Get select model for fishingZone sector. Depends on facadeName and * company set in filter. * Added: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/SamplingPlanModelFactory.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/SamplingPlanModelFactory.java (rev 0) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/base/SamplingPlanModelFactory.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -0,0 +1,70 @@ +package fr.ifremer.wao.ui.base; + +import fr.ifremer.wao.bean.ConnectedUser; +import fr.ifremer.wao.bean.SamplingFilter; +import fr.ifremer.wao.bean.SamplingFilterImpl; +import fr.ifremer.wao.service.ServiceBoat; +import fr.ifremer.wao.service.ServiceReferential; +import fr.ifremer.wao.service.ServiceSampling; +import fr.ifremer.wao.service.ServiceUser; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Persist; +import org.apache.tapestry5.corelib.components.Form; +import org.apache.tapestry5.ioc.services.PropertyAccess; +import org.nuiton.util.PeriodDates; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +/** + * @author sletellier <letellier at codelutin.com> + */ +public class SamplingPlanModelFactory extends ModelFactory<SamplingFilter> { + + @Persist + protected SamplingFilter filter; + + @InjectComponent + private Form filtersForm; + + public SamplingPlanModelFactory(PropertyAccess propertyAccess, + ConnectedUser user, + ServiceReferential serviceReferential, + ServiceSampling serviceSampling, + ServiceBoat serviceBoat, + ServiceUser serviceUser) { + + super(propertyAccess, user, serviceReferential, serviceSampling, serviceBoat, serviceUser); + } + + @Override + public SamplingFilter getFilter() { + return filter; + } + + @Override + protected boolean isAvailableDataForFiltersOnly() { + return false; + } + + @Override + public void resetFilter() { + + filter = new SamplingFilterImpl(); + // Initialize period + PeriodDates period = PeriodDates.createMonthsPeriodFromToday(11); + + GregorianCalendar initialFromDate = new GregorianCalendar(); + // in the firsts months of a new year go from now to 6 months before + // in the rest of the year, just start at the beginning of the current year + if (initialFromDate.get(Calendar.MONTH) < 3) { + initialFromDate.add(Calendar.MONTH, -6); + } else { + initialFromDate.set(Calendar.DAY_OF_YEAR, 1); + } + period.setFromDate(initialFromDate.getTime()); + filter.setPeriod(period); + filter.setObsProgram(user.getProfile().getObsProgram()); + filter.setEstimatedTides(true); + } +} Added: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/SamplingFilterComponent.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/SamplingFilterComponent.java (rev 0) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/components/SamplingFilterComponent.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -0,0 +1,134 @@ +package fr.ifremer.wao.ui.components; + +import fr.ifremer.wao.bean.SamplingFilter; +import fr.ifremer.wao.entity.SampleRow; +import fr.ifremer.wao.ui.base.ModelFactory; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.annotations.Persist; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.corelib.components.Zone; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.nuiton.util.PeriodDates; +import org.slf4j.Logger; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * @author sletellier <letellier at codelutin.com> + */ +public class SamplingFilterComponent { + + @Inject + private Logger log; + + @Parameter(required = true) + private ModelFactory<? extends SamplingFilter> modelFactory; + + @Parameter(required = true) + private String legendMsg; + + @Parameter(required = false) + private Boolean visibleOnStartup; + + @InjectComponent + private Zone filtersZone; + + @Persist + private boolean reset; + + @Persist + private Object owner; + + @Persist + private Boolean filtersVisible; + + /** + * Current SampleRow from loop + */ + @Property + private SampleRow row; + + public String getLegendMsg() { + return legendMsg; + } + + // True by default + public Boolean getVisibleOnStartup() { + if (visibleOnStartup == null) { + visibleOnStartup = true; + } + return visibleOnStartup; + } + + public Boolean getFiltersVisible() { + if (filtersVisible == null) { + filtersVisible = getVisibleOnStartup(); + } + return filtersVisible; + } + + public void setFiltersVisible(Boolean filtersVisible) { + this.filtersVisible = filtersVisible; + } + + public void switchFiltersVisible() { + filtersVisible = !filtersVisible; + } + + public Zone getFiltersZone() { + return filtersZone; + } + + public SamplingFilter getFilter() { + return modelFactory.getFilter(); + } + + public ModelFactory getModelFactory() { + return modelFactory; + } + + public void setModelFactory(ModelFactory<? extends SamplingFilter> modelFactory) { + this.modelFactory = modelFactory; + } + + public DateFormat getDateFormat() { + return new SimpleDateFormat("MM/yyyy"); + } + + /** + * Activate reset filter + */ + void onSelectedFromReset() { + reset = true; + } + + /** + * Do filtering + * + * @return owner (for refresh) if filter is edited + */ + Object onSuccessFromFiltersForm() { + if (getModelFactory().isEdited()) { + return filtersZone.getBody(); + } + if (reset) { + // Don't reset period in filters + PeriodDates period = getFilter().getPeriod(); + + getModelFactory().resetFilter(); + getFilter().setPeriod(period); + } + return owner; + } + + /** + * Register owner to refresh + * + * @param owner page to refresh on submit + */ + public void setOwner(Object owner) { + this.owner = owner; + } +} Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Boats.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -160,7 +160,8 @@ // Initialize filters using AbstractFilteredPage superclass initSelectFilters(false, false, false); // The company of connected user will be contributed to abstractFilteredPage - initCompanyFilter(); + // TODO sletellier remove it ? : up in initSelectFilters +// initCompanyFilter(); companyBoatInfos = null; } @@ -370,6 +371,11 @@ return true; } + @Override + protected void resetFilter() { + this.boatFilter = null; + } + /** * Retrieve sampleRow from business with id from url context. The sampleRowId from context is set by SamplingPlan page. * When the sampleRow is not null, the filters are disabled to optimize searching boats for this row. @@ -790,7 +796,7 @@ // WARNING :: Reset sampleRow select for edition mode, no limit for // showing sampleRows instead of filters getFilter().setNbMonthFinishedFromToday(null); - getModelFactory().resetSampleRowSelect(); + getModelFactory().resetSampleRowSelectModel(); getFilter().setNbMonthFinishedFromToday(-1); } return boatInfosZone.getBody(); Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -132,8 +132,10 @@ if (fullView == null) { fullView = user.isAdmin(); } + // The company of connected user will be contributed to abstractFilteredPage - initCompanyFilter(); + // TODO sletellier remove it ? : up in initSelectFilters +// initCompanyFilter(); } @Log @@ -197,6 +199,11 @@ return false; } + @Override + protected void resetFilter() { + this.contactFilter = null; + } + Object onActionFromShowFilters() { // Initialize filters initSelectFilters(true, true, true); 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 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -30,20 +30,21 @@ import fr.ifremer.wao.bean.FacadeRow; import fr.ifremer.wao.bean.ObsProgram; import fr.ifremer.wao.bean.SamplingFilter; -import fr.ifremer.wao.bean.SamplingFilterImpl; import fr.ifremer.wao.entity.DCF5Code; import fr.ifremer.wao.entity.FishingZone; import fr.ifremer.wao.entity.SampleMonth; import fr.ifremer.wao.entity.SampleRow; +import fr.ifremer.wao.service.ServiceBoat; import fr.ifremer.wao.service.ServiceReferential; import fr.ifremer.wao.service.ServiceSampling; -import fr.ifremer.wao.ui.base.AbstractFilteredPage; +import fr.ifremer.wao.service.ServiceUser; +import fr.ifremer.wao.ui.base.SamplingPlanModelFactory; import fr.ifremer.wao.ui.components.Layout; +import fr.ifremer.wao.ui.components.SamplingFilterComponent; import fr.ifremer.wao.ui.data.ExportStreamResponse; import fr.ifremer.wao.ui.data.RequiresAuthentication; import fr.ifremer.wao.ui.services.WaoManager; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang.BooleanUtils; import org.apache.tapestry5.StreamResponse; import org.apache.tapestry5.annotations.Import; import org.apache.tapestry5.annotations.InjectComponent; @@ -51,10 +52,9 @@ import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.annotations.SessionState; -import org.apache.tapestry5.corelib.components.Form; -import org.apache.tapestry5.corelib.components.Zone; import org.apache.tapestry5.ioc.Messages; import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.ioc.services.PropertyAccess; import org.nuiton.util.PeriodDates; import org.nuiton.util.StringUtil; import org.nuiton.util.StringUtil.ToString; @@ -65,9 +65,7 @@ import java.text.DateFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; -import java.util.Calendar; import java.util.Date; -import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -81,30 +79,45 @@ */ @RequiresAuthentication(allowedPrograms = {ObsProgram.OBSMER, ObsProgram.OBSVENTE}) @Import(stylesheet = "context:css/sampling.css") -public class SamplingPlan extends AbstractFilteredPage { +public class SamplingPlan { @Inject - private Logger logger; + private Logger log; @Inject - private WaoManager manager; + private PropertyAccess propertyAccess; @Inject - private Messages messages; + private ServiceReferential serviceReferential; @Inject private ServiceSampling serviceSampling; @Inject - private ServiceReferential serviceReferential; + private ServiceBoat serviceBoat; + @Inject + private ServiceUser serviceUser; + + @Inject + private WaoManager manager; + + @Inject + private Messages messages; + @InjectComponent + private SamplingFilterComponent filterComponent; + + @InjectComponent private Layout layout; @SessionState @Property private ConnectedUser user; + @Persist + private SamplingPlanModelFactory modelFactory; + private long nbTidesExpectedTime; private long nbTidesRealTime; @@ -113,22 +126,47 @@ private long totalTidesRealTime; + public SamplingPlanModelFactory getModelFactory() { + if (modelFactory == null) { + modelFactory = new SamplingPlanModelFactory(propertyAccess, + user, serviceReferential, serviceSampling, serviceBoat, serviceUser); + } + return modelFactory; + } + + public void setModelFactory(SamplingPlanModelFactory modelFactory) { + this.modelFactory = modelFactory; + } + /** * Page initialization */ void setupRender() { - if (isFiltersVisible()) { - // Initialize filters - initSelectFilters(true, false, true); - } + // Initialize filters + getModelFactory().initSelectFilters(true, false, true); + // Initialize fullView depends on user admin role if (fullView == null) { fullView = user.isAdmin(); } + + // Register this as owner to ollow component to refresh this + // TODO sletellier 20110316 : find a better way ? + filterComponent.setOwner(this); + // The company of connected user will be contributed to abstractFilteredPage - initCompanyFilter(); + // TODO sletellier remove it ? : up in initSelectFilters +// initCompanyFilter(); } - + + public void onSelectedFromAddSampleRowCode() { + getModelFactory().addSampleRowCode(); + } + + public void onSelectedFromRemoveSampleRowCode() { + getModelFactory().removeSampleRowCode(); + } + /**************************** EXPORT **************************************/ StreamResponse onActionFromExportSamplingPlan() { @@ -150,90 +188,33 @@ /**************************** FILTERS *************************************/ - @Persist - private SamplingFilter filter; - - @InjectComponent - private Zone filtersZone; - - @InjectComponent - private Form filtersForm; - - private boolean reset; - - public PeriodDates getPeriod() { - return getFilter().getPeriod(); - } - - @Override - public SamplingFilter getFilter() throws WaoException { - if (filter == null) { - filter = new SamplingFilterImpl(); - // Initialize period - PeriodDates period = PeriodDates.createMonthsPeriodFromToday(11); - - GregorianCalendar initialFromDate = new GregorianCalendar(); - // in the firsts months of a new year go from now to 6 months before - // in the rest of the year, just start at the beginning of the current year - if (initialFromDate.get(Calendar.MONTH) < 3) { - initialFromDate.add(Calendar.MONTH, -6); - } else { - initialFromDate.set(Calendar.DAY_OF_YEAR, 1); - } - period.setFromDate(initialFromDate.getTime()); - filter.setPeriod(period); - filter.setObsProgram(user.getProfile().getObsProgram()); - filter.setEstimatedTides(true); - } - return filter; - } - - @Override - protected boolean isAvailableDataForFiltersOnly() { - return false; - } - - @Persist - private Boolean showFilters; - public boolean isFiltersVisible() { - if (showFilters == null) { - showFilters = false; - } - return BooleanUtils.isTrue(showFilters); + return filterComponent.getFiltersVisible(); } Object onActionFromShowFilters() { - showFilters = ! showFilters; + filterComponent.switchFiltersVisible(); + // Initialize filters - initSelectFilters(true, false, true); + modelFactory.initSelectFilters(true, false, true); if (isFiltersVisible()) { - return filtersZone.getBody(); + return filterComponent.getFiltersZone().getBody(); } else { - return filtersZone; + return filterComponent.getFiltersZone(); } } - void onSelectedFromReset() { - reset = true; + public PeriodDates getPeriod() { + return getFilter().getPeriod(); } - - Object onSuccessFromFiltersForm() { - if (isEdited()) { - return filtersZone.getBody(); - } - if (reset) { - // Don't reset period in filters - PeriodDates period = getFilter().getPeriod(); - filter = null; - getFilter().setPeriod(period); - } - return this; + public SamplingFilter getFilter() { + return getModelFactory().getFilter(); } + /**************************** MAIN ACTIONS ********************************/ @Persist @@ -252,8 +233,8 @@ void onActionFromChangeFilterEstimatedTides() { boolean oldValue = getFilter().getEstimatedTides(); - if (logger.isDebugEnabled()) { - logger.debug("Change estimatedTides in filter to : " + !oldValue); + if (log.isDebugEnabled()) { + log.debug("Change estimatedTides in filter to : " + !oldValue); } getFilter().setEstimatedTides(!oldValue); } @@ -304,8 +285,8 @@ */ public List<SampleRow> getData() throws WaoException { if (data == null) { - if (logger.isDebugEnabled()) { - logger.debug("sampleRows filter sent to service : " + + if (log.isDebugEnabled()) { + log.debug("sampleRows filter sent to service : " + getFilter().getSampleRows()); } @@ -454,8 +435,8 @@ this.row = row; Integer expected = getNbTidesExpected(), real = getNbTidesReal(); - if (logger.isDebugEnabled()) { - logger.debug( String.format("for month %s and row %s : expected = %s, real = %s", + if (log.isDebugEnabled()) { + log.debug( String.format("for month %s and row %s : expected = %s, real = %s", getDateFormat().format(month), row.getCode(), expected, real)); } @@ -470,8 +451,8 @@ totalExpectedForMonths.put(month, totalExpected); totalRealForMonths.put(month, totalReal); - if (logger.isDebugEnabled()) { - logger.debug( String.format("totals for month %s : expected = %s, actual = %s", + if (log.isDebugEnabled()) { + log.debug( String.format("totals for month %s : expected = %s, actual = %s", getDateFormat().format(month), totalExpected, totalReal)); } @@ -480,9 +461,9 @@ } - if (logger.isDebugEnabled()) { + if (log.isDebugEnabled()) { for (Map.Entry<Date, Integer> expected : totalExpectedForMonths.entrySet()) { - logger.debug( String.format("totals for month %s : expected = %s, actual = %s", + log.debug( String.format("totals for month %s : expected = %s, actual = %s", getDateFormat().format(expected.getKey()), expected.getValue(), totalRealForMonths.get(expected.getKey()))); } @@ -497,8 +478,8 @@ setTotalsForMonths(); } Integer total = totalExpectedForMonths.get(month); - if (logger.isDebugEnabled()) { - logger.debug(String.format("total for month %s is %s", getDateFormat().format(month), total)); + if (log.isDebugEnabled()) { + log.debug(String.format("total for month %s is %s", getDateFormat().format(month), total)); } return total; } @@ -664,7 +645,7 @@ try { serviceSampling.deleteSampleRow(row); } catch (WaoBusinessException eee) { - String error = manager.getErrorMessage(eee, messages, logger); + String error = manager.getErrorMessage(eee, messages, log); layout.addError(error); } } 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 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Synthesis.java 2011-03-16 16:22:44 UTC (rev 1065) @@ -42,8 +42,14 @@ import fr.ifremer.wao.entity.Indicator; import fr.ifremer.wao.entity.IndicatorLevel; import fr.ifremer.wao.entity.SampleRow; +import fr.ifremer.wao.service.ServiceBoat; +import fr.ifremer.wao.service.ServiceReferential; +import fr.ifremer.wao.service.ServiceSampling; import fr.ifremer.wao.service.ServiceSynthesis; +import fr.ifremer.wao.service.ServiceUser; import fr.ifremer.wao.ui.base.AbstractFilteredPage; +import fr.ifremer.wao.ui.base.SamplingPlanModelFactory; +import fr.ifremer.wao.ui.components.SamplingFilterComponent; import fr.ifremer.wao.ui.data.ChartUtils; import fr.ifremer.wao.ui.data.ChartUtils.ChartType; import fr.ifremer.wao.ui.data.RequiresAuthentication; @@ -63,6 +69,7 @@ import org.apache.tapestry5.corelib.components.Zone; import org.apache.tapestry5.ioc.Messages; import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.ioc.services.PropertyAccess; import org.jfree.chart.JFreeChart; import org.nuiton.util.PeriodDates; import org.slf4j.Logger; @@ -89,12 +96,27 @@ */ @RequiresAuthentication(allowedRoles = {UserRole.ADMIN, UserRole.COORDINATOR, UserRole.OBSERVER, UserRole.PROFESSIONAL}) @Import(stylesheet = "context:css/synthesis.css") -public class Synthesis extends AbstractFilteredPage { +public class Synthesis { @Environmental private RenderSupport renderSupport; @Inject + private PropertyAccess propertyAccess; + + @Inject + private ServiceReferential serviceReferential; + + @Inject + private ServiceSampling serviceSampling; + + @Inject + private ServiceBoat serviceBoat; + + @Inject + private ServiceUser serviceUser; + + @Inject private WaoManager manager; @Inject @@ -103,6 +125,9 @@ @Inject private Logger log; + @InjectComponent + private SamplingFilterComponent filterComponent; + @SessionState @Property private ConnectedUser user; @@ -125,13 +150,35 @@ @Inject private Messages messages; + @Persist + private SamplingPlanModelFactory modelFactory; + + public SamplingPlanModelFactory getModelFactory() { + if (modelFactory == null) { + modelFactory = new SamplingPlanModelFactory(propertyAccess, + user, serviceReferential, serviceSampling, serviceBoat, serviceUser); + } + return modelFactory; + } + + public void setModelFactory(SamplingPlanModelFactory modelFactory) { + this.modelFactory = modelFactory; + } + void setupRender() { // make filters keep company between submissions - initSelectFilters(true, false, true); + getModelFactory().initSelectFilters(true, false, true); // add a special CSS to make global synthesis page printable without // menu, filters, etc. renderSupport.addStylesheetLink("css/synthesis-print.css", "print"); + + // Register this as owner to ollow component to refresh this + // TODO sletellier 20110316 : find a better way ? + filterComponent.setOwner(this); + + // TODO sletellier : other have this call to initCompanyFilter() here + // you forgot him ? The call is up in initSelectFilters... } public SynthesisId getActiveSynthesis() { @@ -255,20 +302,8 @@ /********************* FILTERS ********************************************/ - @Persist - private SamplingFilter dataSamplingFilter; - - @Override public SamplingFilter getFilter() throws WaoException { - if (dataSamplingFilter == null) { - dataSamplingFilter = new SamplingFilterImpl(); - if (user.isCoordinatorOrObserver()) { - dataSamplingFilter.setCompany(user.getCompany()); - } - dataSamplingFilter.setObsProgram(user.getProfile().getObsProgram()); - dataSamplingFilter.setEstimatedTides(true); - } - return dataSamplingFilter; + return getModelFactory().getFilter(); } public PeriodDates getPeriod() throws WaoException { @@ -282,35 +317,7 @@ return getFilter().getPeriod(); } - @Override - protected boolean isAvailableDataForFiltersOnly() { - return false; - } - - void onSelectedFromReset() { - reset = true; - } - - Object onSuccessFromFiltersForm() { - if (isEdited()) { - return filtersZone.getBody(); - } - if (reset) { - dataSamplingFilter = null; - } - return this; - } - - /** - * Current SampleRow from loop - */ - @Property - private SampleRow row; - /********************* DYNAMICAL GRAPH : DATA SAMPLING ********************/ - - @InjectComponent - private Zone filtersZone; @Persist private ChartType dataSamplingChartType; Added: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/SamplingFilterComponent.tml =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/SamplingFilterComponent.tml (rev 0) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/SamplingFilterComponent.tml 2011-03-16 16:22:44 UTC (rev 1065) @@ -0,0 +1,78 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" + xmlns:p="tapestry:parameter"> + <div t:type="zone" t:id="filtersZone" t:visible="prop:filtersVisible" id="so-sampling-filters"> + <fieldset> + <legend>${legendMsg}</legend> + <div class="so-filters-form"> + <form t:type="form" t:id="filtersForm" t:zone="so-sampling-filters" action="post"> + <t:errors/> + <div class="t-beaneditor"> + <div> + <label for="periodBegin">${message:wao.ui.form.periodFrom}</label> + <input t:type="datefield" class="width70" t:id="periodBegin" t:value="filter.period.fromDate" t:format="MM/yyyy" + t:validate="required"/> + <label for="periodEnd">${message:wao.ui.form.period.to} </label> + <input t:type="datefield" class="width70" t:id="periodEnd" t:value="filter.period.thruDate" t:format="MM/yyyy" + t:validate="required"/> + </div> + <div> + <t:if t:test="modelFactory.user.admin"> + <label for="company">${message:wao.ui.entity.Company} :</label> + <input t:type="select" t:id="company" t:model="modelFactory.companySelectModel" value="modelFactory.companyId"/> + <!--input t:type="submit" class="ico22px refresh" t:id="modelFactory.refreshByCompany" + value="${message:wao.ui.filters.refresh}" + title="${message:wao.ui.filters.refresh}"/--> + </t:if> + <label for="programName">${message:wao.ui.field.SampleRow.programName} :</label> + <select t:type="select" t:id="programName" t:model="modelFactory.programSelectModel" t:value="filter.programName"/> + + </div> + <div> + <label for="facadeName">${message:wao.ui.field.FishingZone.facadeName} :</label> + <select t:type="select" t:id="facadeName" t:model="modelFactory.facadeSelectModel" t:value="filter.facadeName"/> + <!--input t:type="submit" class="ico22px refresh" t:id="modelFactory.refreshByFacade" value="Refresh" + title="${message:wao.ui.filters.refresh}"/--> + <label for="sectorName">${message:wao.ui.field.FishingZone.sectorName} :</label> + <select t:type="select" t:id="sectorName" t:model="modelFactory.sectorSelectModel" t:value="filter.sectorName"/> + <!--input t:type="submit" class="ico22px refresh" t:id="modelFactory.refreshBySector" value="Refresh" + title="${message:wao.ui.filters.refresh}"/--> + <t:if test="modelFactory.user.obsVente"> + <label>${message:wao.ui.field.SampleRow.terrestrialLocation} :</label> + <input t:type="select" t:model="modelFactory.terrestrialDistrictSelectModel" t:value="modelFactory.terrestrialDistrictId"/> + </t:if> + <label for="sampleRowId">${message:wao.ui.field.SampleRow.code} :</label> + <select t:type="select" t:id="sampleRowId" t:model="modelFactory.sampleRowSelectModel" t:value="modelFactory.sampleRowId"/> + <input t:type="submit" class="ico22px add" t:id="addSampleRowCode" value="Add" + title="Ajouter un code de ligne"/> + <input t:type="submit" class="ico22px remove" t:id="removeSampleRowCode" value="Remove" + title="Retirer un code de ligne"/> + <ul> + <li style="display: inline;" t:type="loop" t:source="filter.sampleRows" t:value="row" t:volatile="true"> + ${row.code} + </li> + </ul> + </div> + <div> + <label for="fishingGearDCF">${message:wao.ui.entity.fishingGearDCF} :</label> + <input t:type="select" t:id="fishingGearDCF" t:model="modelFactory.dcfGearSelectModel" value="modelFactory.fishingGearDCFId"/> + <label for="targetSpeciesDCF">${message:wao.ui.entity.targetSpeciesDCF} :</label> + <input t:type="select" t:id="targetSpeciesDCF" t:model="modelFactory.dcfSpeciesSelectModel" + value="modelFactory.targetSpeciesDCFId"/> + <t:if test="modelFactory.user.obsVente"> + <label t:for="samplingStrategy">${message:wao.ui.field.SampleRow.samplingStrategy} :</label> + <input t:type="select" t:id="samplingStrategy" value="filter.samplingStrategy"/> + </t:if> + </div> + <div class="t-beaneditor-row aright"> + <input t:type="submit" class="ico search-32px" t:id="search" value="Search" + title="Rechercher les lignes du plan correspondants aux filtres saisies"/> + <input t:type="submit" class="ico undo" t:id="reset" value="Reset" + title="Remettre les filtres par défaut"/> + </div> + </div> + </form> + </div> + </fieldset> + </div> +</html> \ No newline at end of file Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml =================================================================== --- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2011-03-16 16:22:44 UTC (rev 1065) @@ -77,74 +77,18 @@ </div> </div> <div> - ${format:wao.ui.form.periodFromTo=dateFormat.format(period.fromDate),dateFormat.format(period.thruDate)} - <a t:type="actionlink" t:id="showFilters" t:zone="so-sampling-filters" class="display-form">${message:wao.ui.misc.advancedSearch}</a> + ${format:wao.ui.form.periodFromTo=dateFormat.format(period.fromDate),dateFormat.format(period.thruDate)} + + <a t:type="actionlink" t:id="showFilters" t:zone="so-sampling-filters" class="display-form"> + ${message:wao.ui.misc.advancedSearch} + </a> </div> - <div t:type="zone" t:id="filtersZone" t:visible="prop:filtersVisible" id="so-sampling-filters"> - <fieldset> - <legend>${message:wao.ui.misc.advancedSearch}</legend> - <div class="so-filters-form"> - <form t:type="form" t:id="filtersForm" t:zone="so-sampling-filters" action="post"> - <t:errors /> - <div class="t-beaneditor"> - <div> - <label for="periodBegin">${message:wao.ui.form.periodFrom}</label> - <input t:type="datefield" class="width70" t:id="periodBegin" t:value="period.fromDate" t:format="MM/yyyy" t:validate="required"/> - <label for="periodEnd"> ${message:wao.ui.form.period.to} </label> - <input t:type="datefield" class="width70" t:id="periodEnd" t:value="period.thruDate" t:format="MM/yyyy" t:validate="required" /> - </div> - <div> - <t:if t:test="user.admin"> - <label for="company">${message:wao.ui.entity.Company} :</label> - <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/> - <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="${message:wao.ui.filters.refresh}" - title="${message:wao.ui.filters.refresh}" /> - </t:if> - <label for="programName">${message:wao.ui.field.SampleRow.programName} :</label> - <select t:type="select" t:id="programName" t:model="programSelectModel" t:value="filter.programName" /> - </div> - <div> - <label for="facadeName">${message:wao.ui.field.FishingZone.facadeName} :</label> - <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" t:value="filter.facadeName" /> - <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="Refresh" - title="${message:wao.ui.filters.refresh}"/> - <label for="sectorName">${message:wao.ui.field.FishingZone.sectorName} :</label> - <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" t:value="filter.sectorName" /> - <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh" - title="${message:wao.ui.filters.refresh}"/> - <t:if test="user.obsVente"> - <label>${message:wao.ui.field.SampleRow.terrestrialLocation} :</label> - <input t:type="select" t:model="terrestrialDistrictSelectModel" t:value="terrestrialDistrictId" /> - </t:if> - <label for="sampleRowId">${message:wao.ui.field.SampleRow.code} :</label> - <select t:type="select" t:id="sampleRowId" t:model="sampleRowSelectModel" t:value="sampleRowId" /> - <input t:type="submit" class="ico22px add" t:id="addSampleRowCode" value="Add" title="Ajouter un code de ligne"/> - <input t:type="submit" class="ico22px remove" t:id="removeSampleRowCode" value="Remove" title="Retirer un code de ligne" /> - <ul> - <li style="display: inline;" t:type="loop" t:source="filter.sampleRows" t:value="row" t:volatile="true"> - ${row.code} - </li> - </ul> - </div> - <div> - <label for="fishingGearDCF">${message:wao.ui.entity.fishingGearDCF} :</label> - <input t:type="select" t:id="fishingGearDCF" t:model="dcfGearSelectModel" value="fishingGearDCFId"/> - <label for="targetSpeciesDCF">${message:wao.ui.entity.targetSpeciesDCF} :</label> - <input t:type="select" t:id="targetSpeciesDCF" t:model="dcfSpeciesSelectModel" value="targetSpeciesDCFId"/> - <t:if test="user.obsVente"> - <label t:for="samplingStrategy">${message:wao.ui.field.SampleRow.samplingStrategy} :</label> - <input t:type="select" t:id="samplingStrategy" value="filter.samplingStrategy" /> - </t:if> - </div> - <div class="t-beaneditor-row aright"> - <input t:type="submit" class="ico search-32px" t:id="search" value="Search" title="Rechercher les lignes du plan correspondants aux filtres saisies" /> - <input t:type="submit" class="ico undo" t:id="reset" value="Reset" title="Remettre les filtres par défaut" /> - </div> - </div> - </form> - </div> - </fieldset> - </div> + + <!--FIXME sletellier 20110316 : visible on parameter dont work in this case....--> + <t:samplingFilterComponent t:id="filterComponent" + t:visibleOnStartup="false" + t:modelFactory="modelFactory" + t:legendMsg="${message:wao.ui.misc.advancedSearch}"/> </div> <t:zone t:id="samplingZone"> <table class="t-data-grid"> Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Synthesis.tml 2011-03-15 17:26:14 UTC (rev 1064) +++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2011-03-16 16:22:44 UTC (rev 1065) @@ -31,79 +31,84 @@ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - <fieldset> - <legend>${message:wao.ui.filters.filters}</legend> - <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters"> - <!--<div t:type="zone" t:id="dataSamplingFiltersZone" t:update="show" id="so-datasampling-filters">--> - <form t:type="form" t:id="filtersForm" t:zone="so-datasampling-filters"> - <t:errors /> - <div class="t-beaneditor"> - <div class="filterRow"> - <label for="periodBegin">${message:wao.ui.form.periodFrom} :</label> - <input t:type="datefield" class="width70" t:id="periodBegin" t:value="period.fromDate" t:format="MM/yyyy" t:validate="required"/> - <label for="periodEnd">${message:wao.ui.form.period.to} :</label> - <input t:type="datefield" class="width70" t:id="periodEnd" t:value="period.thruDate" t:format="MM/yyyy" t:validate="required"/> - </div> - <div> - <t:if t:test="user.admin"> - <label t:for="company">${message:wao.ui.entity.Company} :</label> - <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/> - <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="${message:wao.ui.filters.refresh}" - title="${message:wao.ui.filters.refresh}"/> - </t:if> - <label for="programName">${message:wao.ui.field.SampleRow.programName} :</label> - <select t:type="select" t:id="programName" t:model="programSelectModel" value="filter.programName" /> - <input t:type="submit" class="ico22px refresh" t:id="refreshByProgram" value="${message:wao.ui.filters.refresh}" - title="${message:wao.ui.filters.refresh}"/> - </div> - <div class="filterRow" t:type="zone" t:id="sampleRowZone" t:update="show"> - <label for="facadeName">${message:wao.ui.field.FishingZone.facadeName} :</label> - <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" /> - <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="${message:wao.ui.filters.refresh}" - title="${message:wao.ui.filters.refresh}"/> - <label for="sectorName">${message:wao.ui.field.FishingZone.sectorName} :</label> - <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" /> - <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="${message:wao.ui.filters.refresh}" - title="${message:wao.ui.filters.refresh}"/> - <t:if test="user.obsVente"> - <label>${message:wao.ui.field.SampleRow.terrestrialLocation} :</label> - <input t:type="select" t:model="terrestrialDistrictSelectModel" t:value="terrestrialDistrictId" /> - </t:if> - <label for="sampleRowId">${message:wao.ui.field.SampleRow.code} :</label> - <select t:type="select" t:id="sampleRowId" t:model="sampleRowSelectModel" t:value="sampleRowId" /> - <input t:type="submit" class="ico22px add" t:id="addSampleRowCode" value="Add" title="Ajouter un code de ligne"/> - <input t:type="submit" class="ico22px remove" t:id="removeSampleRowCode" value="Remove" title="Retirer un code de ligne" /> - <ul> - <li style="display: inline;" t:type="loop" t:source="filter.sampleRows" t:value="row" t:volatile="true"> - ${row.code} - </li> - </ul> + <!--fieldset> + <legend>${message:wao.ui.filters.filters}</legend> + <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters"> + <! - -<div t:type="zone" t:id="dataSamplingFiltersZone" t:update="show" id="so-datasampling-filters"> - -> + <form t:type="form" t:id="filtersForm" t:zone="so-datasampling-filters"> + <t:errors /> + <div class="t-beaneditor"> + <div class="filterRow"> + <label for="periodBegin">${message:wao.ui.form.periodFrom} :</label> + <input t:type="datefield" class="width70" t:id="periodBegin" t:value="period.fromDate" t:format="MM/yyyy" t:validate="required"/> + <label for="periodEnd">${message:wao.ui.form.period.to} :</label> + <input t:type="datefield" class="width70" t:id="periodEnd" t:value="period.thruDate" t:format="MM/yyyy" t:validate="required"/> + </div> + <div> + <t:if t:test="user.admin"> + <label t:for="company">${message:wao.ui.entity.Company} :</label> + <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/> + <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="${message:wao.ui.filters.refresh}" + title="${message:wao.ui.filters.refresh}"/> + </t:if> + <label for="programName">${message:wao.ui.field.SampleRow.programName} :</label> + <select t:type="select" t:id="programName" t:model="programSelectModel" value="filter.programName" /> + <input t:type="submit" class="ico22px refresh" t:id="refreshByProgram" value="${message:wao.ui.filters.refresh}" + title="${message:wao.ui.filters.refresh}"/> + </div> + <div class="filterRow" t:type="zone" t:id="sampleRowZone" t:update="show"> + <label for="facadeName">${message:wao.ui.field.FishingZone.facadeName} :</label> + <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" /> + <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="${message:wao.ui.filters.refresh}" + title="${message:wao.ui.filters.refresh}"/> + <label for="sectorName">${message:wao.ui.field.FishingZone.sectorName} :</label> + <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" /> + <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="${message:wao.ui.filters.refresh}" + title="${message:wao.ui.filters.refresh}"/> + <t:if test="user.obsVente"> + <label>${message:wao.ui.field.SampleRow.terrestrialLocation} :</label> + <input t:type="select" t:model="terrestrialDistrictSelectModel" t:value="terrestrialDistrictId" /> + </t:if> + <label for="sampleRowId">${message:wao.ui.field.SampleRow.code} :</label> + <select t:type="select" t:id="sampleRowId" t:model="sampleRowSelectModel" t:value="sampleRowId" /> + <input t:type="submit" class="ico22px add" t:id="addSampleRowCode" value="Add" title="Ajouter un code de ligne"/> + <input t:type="submit" class="ico22px remove" t:id="removeSampleRowCode" value="Remove" title="Retirer un code de ligne" /> + <ul> + <li style="display: inline;" t:type="loop" t:source="filter.sampleRows" t:value="row" t:volatile="true"> + ${row.code} + </li> + </ul> - <!--<t:label t:for="program" />: - <input t:type="select" t:id="program" t:model="programSelectModel" value="programId" />--> - </div> - <div> - <label for="fishingGearDCF">${message:wao.ui.entity.fishingGearDCF} :</label> - <input t:type="select" t:id="fishingGearDCF" t:model="dcfGearSelectModel" value="fishingGearDCFId"/> - <label for="targetSpeciesDCF">${message:wao.ui.entity.targetSpeciesDCF} :</label> - <input t:type="select" t:id="targetSpeciesDCF" t:model="dcfSpeciesSelectModel" value="targetSpeciesDCFId"/> - </div> - <div class="filterRow"> - <input t:type="checkbox" t:id="estimatedTides" value="filter.estimatedTides" /> - <label for="estimatedTides" title="${message:wao.ui.form.estimatedTides.description}">${message:wao.ui.form.estimatedTides}</label> - </div> - <div class="t-beaneditor-row aright"> - <input t:type="submit" class="ico search-32px" t:id="search" value="${message:wao.ui.action.filter}" title="${message:wao.ui.action.filter}" /> - <input t:type="submit" class="ico undo" t:id="reset" value="${message:wao.ui.action.resetFields}" title="${message:wao.ui.action.resetFields}" /> - </div> - </div> - </form> - <!--</div>--> - </div> - </fieldset> + <! - -<t:label t:for="program" />: + <input t:type="select" t:id="program" t:model="programSelectModel" value="programId" />- - > + </div> + <div> + <label for="fishingGearDCF">${message:wao.ui.entity.fishingGearDCF} :</label> + <input t:type="select" t:id="fishingGearDCF" t:model="dcfGearSelectModel" value="fishingGearDCFId"/> + <label for="targetSpeciesDCF">${message:wao.ui.entity.targetSpeciesDCF} :</label> + <input t:type="select" t:id="targetSpeciesDCF" t:model="dcfSpeciesSelectModel" value="targetSpeciesDCFId"/> + </div> + <div class="filterRow"> + <input t:type="checkbox" t:id="estimatedTides" value="filter.estimatedTides" /> + <label for="estimatedTides" title="${message:wao.ui.form.estimatedTides.description}">${message:wao.ui.form.estimatedTides}</label> + </div> + <div class="t-beaneditor-row aright"> + <input t:type="submit" class="ico search-32px" t:id="search" value="${message:wao.ui.action.filter}" title="${message:wao.ui.action.filter}" /> + <input t:type="submit" class="ico undo" t:id="reset" value="${message:wao.ui.action.resetFields}" title="${message:wao.ui.action.resetFields}" /> + </div> + </div> + </form> + <! - -</div> - -> + </div> + </fieldset--> - <div class="mtop30" /> + <t:samplingFilterComponent + t:id="filterComponent" + t:modelFactory="modelFactory" + t:legendMsg="${message:wao.ui.filters.filters}"/> + <div class="mtop30"/> + <!-- MENU : delegator --> <div class="clearfix"> <div class="fleft" id="so-synthesis-menu">
participants (1)
-
sletellier@users.labs.libre-entreprise.org